提交 9d6cbaec 编写于 作者: 葛亚芳 提交者: Gitee

Merge branch 'OpenHarmony-3.1-Release' of gitee.com:openharmony/docs into OpenHarmony-3.1-Release

# Distributed Data Service Development<a name="EN-US_TOPIC_0000001183227606"></a> # Distributed Data Service Development
## When to Use<a name="section29812823611"></a> ## When to Use
The DDS implements synchronization of application data across user devices. When data is added, deleted, or modified for an application on a device, the same application on another device can obtain the data changes. The DDS applies to the distributed gallery, messages, contacts, and file manager. The Distributed Data Service (DDS) implements synchronization of application data across user devices. When data is added, deleted, or modified for an application on a device, the same application on another device can obtain the updated data. The DDS applies to the distributed gallery, messages, Contacts, and file manager.
## Available APIs<a name="section10795222103613"></a>
The following table describes the APIs provided by the OpenHarmony DDS module. ## Available APIs
The table below describes the APIs provided by the OpenHarmony DDS module.
**Table 1** APIs provided by the DDS **Table 1** APIs provided by the DDS
<a name="table1479715411814"></a> | Category | API | Description |
<table><thead align="left"><tr id="row117981654681"><th class="cellrowborder" valign="top" width="13.171317131713172%" id="mcps1.2.4.1.1"><p id="p207989543820"><a name="p207989543820"></a><a name="p207989543820"></a>Function</p> | -------------------------- | ------------------------------------------------------------ | ----------------------------------------------- |
</th> | Creating a distributed database | createKVManager(config:&nbsp;KVManagerConfig,&nbsp;callback:&nbsp;AsyncCallback&lt;KVManager&gt;):&nbsp;void<br>createKVManager(config:&nbsp;KVManagerConfig):&nbsp;Promise&lt;KVManager> | Creates a **KVManager** object for database management.|
<th class="cellrowborder" valign="top" width="53.525352535253525%" id="mcps1.2.4.1.2"><p id="p1379845420813"><a name="p1379845420813"></a><a name="p1379845420813"></a>API</p> | Obtaining a distributed KV store | getKVStore&lt;T&nbsp;extends&nbsp;KVStore&gt;(storeId:&nbsp;string,&nbsp;options:&nbsp;Options,&nbsp;callback:&nbsp;AsyncCallback&lt;T&gt;):&nbsp;void<br>getKVStore&lt;T&nbsp;extends&nbsp;KVStore&gt;(storeId:&nbsp;string,&nbsp;options:&nbsp;Options):&nbsp;Promise&lt;T&gt; | Obtains the KV store with the specified **Options** and **storeId**.|
</th> | Managing data in a distributed KV store| put(key:&nbsp;string,&nbsp;value:&nbsp;Uint8Array&nbsp;\|&nbsp;string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;boolean,&nbsp;callback:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void<br>put(key:&nbsp;string,&nbsp;value:&nbsp;Uint8Array&nbsp;\|&nbsp;string&nbsp;\|&nbsp;number&nbsp;\|&nbsp;boolean):&nbsp;Promise&lt;void> | Inserts or updates data. |
<th class="cellrowborder" valign="top" width="33.3033303330333%" id="mcps1.2.4.1.3"><p id="p10798145412810"><a name="p10798145412810"></a><a name="p10798145412810"></a>Description</p> | Managing data in a distributed KV store| delete(key:&nbsp;string,&nbsp;callback:&nbsp;AsyncCallback&lt;void&gt;):&nbsp;void<br>delete(key:&nbsp;string):&nbsp;Promise&lt;void> | Deletes data. |
</th> | Managing data in a distributed KV store| get(key:&nbsp;string,&nbsp;callback:&nbsp;AsyncCallback&lt;Uint8Array&nbsp;\|&nbsp;string&nbsp;\|&nbsp;boolean&nbsp;\|&nbsp;number&gt;):&nbsp;void<br>get(key:&nbsp;string):&nbsp;Promise&lt;Uint8Array&nbsp;\|&nbsp;string&nbsp;\|&nbsp;boolean&nbsp;\|&nbsp;number> | Queries data. |
</tr> | Subscribing to changes in the distributed data | on(event:&nbsp;'dataChange',&nbsp;type:&nbsp;SubscribeType,&nbsp;observer:&nbsp;Callback&lt;ChangeNotification&gt;):&nbsp;void<br>on(event:&nbsp;'syncComplete',&nbsp;syncCallback:&nbsp;Callback&lt;Array&lt;[string,&nbsp;number]&gt;&gt;):&nbsp;void | Subscribes to data changes in the KV store. |
</thead> | Synchronizing data across devices | sync(deviceIdList:&nbsp;string[],&nbsp;mode:&nbsp;SyncMode,&nbsp;allowedDelayMs?:&nbsp;number):&nbsp;void | Triggers database synchronization in manual mode. |
<tbody><tr id="row14541456191517"><td class="cellrowborder" rowspan="2" valign="top" width="13.171317131713172%" headers="mcps1.2.4.1.1 "><p id="p65410566158"><a name="p65410566158"></a><a name="p65410566158"></a>Creating a distributed database</p>
</td>
<td class="cellrowborder" valign="top" width="53.525352535253525%" headers="mcps1.2.4.1.2 "><p id="p1941744894319"><a name="p1941744894319"></a><a name="p1941744894319"></a>createKVManager(config: KVManagerConfig, callback: AsyncCallback&lt;KVManager&gt;): void</p>
<p id="p1096444965211"><a name="p1096444965211"></a><a name="p1096444965211"></a>createKVManager(config: KVManagerConfig): Promise&lt;KVManager&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="33.3033303330333%" headers="mcps1.2.4.1.3 "><p id="p101014641817"><a name="p101014641817"></a><a name="p101014641817"></a>Creates a <strong id="b1522993164717"><a name="b1522993164717"></a><a name="b1522993164717"></a>KVManager</strong> object for database management.</p>
</td>
</tr>
<tr id="row154114568151"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p696417105816"><a name="p696417105816"></a><a name="p696417105816"></a>getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options, callback: AsyncCallback&lt;T&gt;): void</p>
<p id="p249610364411"><a name="p249610364411"></a><a name="p249610364411"></a>getKVStore&lt;T extends KVStore&gt;(storeId: string, options: Options): Promise&lt;T&gt;</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p1939220263198"><a name="p1939220263198"></a><a name="p1939220263198"></a>Obtains the KV store with specified <strong id="b1047044512494"><a name="b1047044512494"></a><a name="b1047044512494"></a>Options</strong> and <strong id="b76466490494"><a name="b76466490494"></a><a name="b76466490494"></a>storeId</strong>.</p>
</td>
</tr>
<tr id="row157982545817"><td class="cellrowborder" rowspan="3" valign="top" width="13.171317131713172%" headers="mcps1.2.4.1.1 "><p id="p37985541683"><a name="p37985541683"></a><a name="p37985541683"></a>Managing data in a distributed database</p>
</td>
<td class="cellrowborder" valign="top" width="53.525352535253525%" headers="mcps1.2.4.1.2 "><p id="p131294221332"><a name="p131294221332"></a><a name="p131294221332"></a>put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncCallback&lt;void&gt;): void</p>
<p id="p5426816843"><a name="p5426816843"></a><a name="p5426816843"></a>put(key: string, value: Uint8Array | string | number | boolean): Promise&lt;void&gt;</p>
</td>
<td class="cellrowborder" valign="top" width="33.3033303330333%" headers="mcps1.2.4.1.3 "><p id="p176461135185113"><a name="p176461135185113"></a><a name="p176461135185113"></a>Inserts and updates data.</p>
</td>
</tr>
<tr id="row97981541589"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p1081643813515"><a name="p1081643813515"></a><a name="p1081643813515"></a>delete(key: string, callback: AsyncCallback&lt;void&gt;): void</p>
<p id="p18154322061"><a name="p18154322061"></a><a name="p18154322061"></a>delete(key: string): Promise&lt;void&gt;</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p199836513815"><a name="p199836513815"></a><a name="p199836513815"></a>Deletes data.</p>
</td>
</tr>
<tr id="row67981354182"><td class="cellrowborder" valign="top" headers="mcps1.2.4.1.1 "><p id="p570352011813"><a name="p570352011813"></a><a name="p570352011813"></a>get(key: string, callback: AsyncCallback&lt;Uint8Array | string | boolean | number&gt;): void</p>
<p id="p68241257189"><a name="p68241257189"></a><a name="p68241257189"></a>get(key: string): Promise&lt;Uint8Array | string | boolean | number&gt;</p>
</td>
<td class="cellrowborder" valign="top" headers="mcps1.2.4.1.2 "><p id="p66421735105117"><a name="p66421735105117"></a><a name="p66421735105117"></a>Queries data.</p>
</td>
</tr>
<tr id="row79301383912"><td class="cellrowborder" valign="top" width="13.171317131713172%" headers="mcps1.2.4.1.1 "><p id="p9931153113918"><a name="p9931153113918"></a><a name="p9931153113918"></a>Subscribing to changes in the distributed data</p>
</td>
<td class="cellrowborder" valign="top" width="53.525352535253525%" headers="mcps1.2.4.1.2 "><p id="p1650011101175"><a name="p1650011101175"></a><a name="p1650011101175"></a>on(event: 'dataChange', type: SubscribeType, observer: Callback&lt;ChangeNotification&gt;): void</p>
<p id="p76436491878"><a name="p76436491878"></a><a name="p76436491878"></a>on(event: 'syncComplete', syncCallback: Callback&lt;Array&lt;[string, number]&gt;&gt;): void</p>
</td>
<td class="cellrowborder" valign="top" width="33.3033303330333%" headers="mcps1.2.4.1.3 "><p id="p1793120318397"><a name="p1793120318397"></a><a name="p1793120318397"></a>Subscribes to data changes in the database.</p>
</td>
</tr>
<tr id="row6194318125312"><td class="cellrowborder" valign="top" width="13.171317131713172%" headers="mcps1.2.4.1.1 "><p id="p61941518135320"><a name="p61941518135320"></a><a name="p61941518135320"></a>Synchronizing distributed data</p>
</td>
<td class="cellrowborder" valign="top" width="53.525352535253525%" headers="mcps1.2.4.1.2 "><p id="p149121836097"><a name="p149121836097"></a><a name="p149121836097"></a>sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void</p>
</td>
<td class="cellrowborder" valign="top" width="33.3033303330333%" headers="mcps1.2.4.1.3 "><p id="p1319561811538"><a name="p1319561811538"></a><a name="p1319561811538"></a>Triggers database synchronization in manual mode.</p>
</td>
</tr>
</tbody>
</table>
## How to Develop<a name="section1252143014159"></a>
The following uses a single KV store as an example to describe the development procedure.
1. Import the distributed database module. ## How to Develop
The following uses a single KV store as an example to describe the development procedure.
1. Import the distributed data module.
```js ```js
import distributedData from '@ohos.data.distributedData'; import distributedData from '@ohos.data.distributedData';
``` ```
2. Create a **KvManager** instance based on the specified **KvManagerConfig** object. 2. Create a **KvManager** instance based on the specified **KvManagerConfig** object.
1. Create a **KvManagerConfig** object based on the application context. 1. Create a **KvManagerConfig** object based on the application context.
2. Create a **KvManager** instance. 2. Create a **KvManager** instance.
The sample code is as follows: The sample code is as follows:
```js ```js
let kvManager; let kvManager;
try { try {
...@@ -112,12 +62,10 @@ The following uses a single KV store as an example to describe the development p ...@@ -112,12 +62,10 @@ The following uses a single KV store as an example to describe the development p
``` ```
3. Create and obtain a single KV store. 3. Create and obtain a single KV store.
1. Declare the ID of the single KV store to create. 1. Declare the ID of the single KV store to create.
2. Create a single KV store. You are advised to disable automatic synchronization \(**autoSync:false**\) and call **sync** if a synchronization is required. 2. Create a single KV store. You are advised to disable automatic synchronization (**autoSync:false**) and call **sync** if a synchronization is required.
The sample code is as follows: The sample code is as follows:
```js ```js
let kvStore; let kvStore;
try { try {
...@@ -127,7 +75,7 @@ The following uses a single KV store as an example to describe the development p ...@@ -127,7 +75,7 @@ The following uses a single KV store as an example to describe the development p
backup : false, backup : false,
autoSync : false, autoSync : false,
kvStoreType : distributedData.KVStoreType.SINGLE_VERSION, kvStoreType : distributedData.KVStoreType.SINGLE_VERSION,
securityLevel : distributedData.SecurityLevel.S2, securityLevel : distributedData.SecurityLevel.S0,
}; };
kvManager.getKVStore('storeId', options, function (err, store) { kvManager.getKVStore('storeId', options, function (err, store) {
if (err) { if (err) {
...@@ -142,13 +90,11 @@ The following uses a single KV store as an example to describe the development p ...@@ -142,13 +90,11 @@ The following uses a single KV store as an example to describe the development p
} }
``` ```
>![](../public_sys-resources/icon-note.gif) **NOTE:** > ![icon-note.gif](../public_sys-resources/icon-note.gif) **NOTE**<br/>
>For data synchronization between networked devices, you are advised to open the distributed database during application startup to obtain the database handle. With this database handle \(**kvStore** in this example\), you can perform operations, such as inserting data into the database, without creating the database repeatedly during the lifecycle of the handle. > For data synchronization between networked devices, you are advised to open the distributed KV store during application startup to obtain the database handle. With this database handle (**kvStore** in this example), you can perform operations, such as inserting data into the KV store, without creating the KV store repeatedly during the lifecycle of the handle.
4. Subscribe to changes in the distributed data.
4. Subscribe to changes in the distributed data.<br/>
The following is the sample code for subscribing to the data changes of a single KV store: The following is the sample code for subscribing to the data changes of a single KV store:
```js ```js
kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) { kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) {
console.log("dataChange callback call data: " + JSON.stringify(data)); console.log("dataChange callback call data: " + JSON.stringify(data));
...@@ -156,7 +102,6 @@ The following uses a single KV store as an example to describe the development p ...@@ -156,7 +102,6 @@ The following uses a single KV store as an example to describe the development p
``` ```
5. Write data to the single KV store. 5. Write data to the single KV store.
1. Construct the key and value to be written into the single KV store. 1. Construct the key and value to be written into the single KV store.
2. Write key-value pairs into the single KV store. 2. Write key-value pairs into the single KV store.
...@@ -179,12 +124,10 @@ The following uses a single KV store as an example to describe the development p ...@@ -179,12 +124,10 @@ The following uses a single KV store as an example to describe the development p
``` ```
6. Query data in the single KV store. 6. Query data in the single KV store.
1. Construct the key to be queried from the single KV store. 1. Construct the key to be queried from the single KV store.
2. Query data from the single KV store. 2. Query data from the single KV store.
The following is the sample code for querying data of the string type from the single KV store: The following is the sample code for querying data of the string type from the single KV store:
```js ```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
...@@ -204,32 +147,35 @@ The following uses a single KV store as an example to describe the development p ...@@ -204,32 +147,35 @@ The following uses a single KV store as an example to describe the development p
} }
``` ```
7. Synchronize data to other devices. 7. Synchronize data to other devices.<br/>
Select the devices in the same network and the synchronization mode to synchronize data. Select the devices in the same network and the synchronization mode to synchronize data.
The following is the sample code for data synchronization in a single KV store. **deviceIds** can be obtained by deviceManager by calling **getTrustedDeviceListSync\(\)**, and **1000** indicates that the maximum delay time is 1000 ms. The following is the sample code for data synchronization in a single KV store. **deviceIds** can be obtained by deviceManager by calling **getTrustedDeviceListSync()**, and **1000** indicates that the maximum delay time is 1000 ms.
```js ```js
import deviceManager from '@ohos.distributedHardware.deviceManager'; import deviceManager from '@ohos.distributedHardware.deviceManager';
let devManager; let devManager;
// create deviceManager // Create deviceManager.
deviceManager.createDeviceManager("bundleName", (err, value) => { deviceManager.createDeviceManager("bundleName", (err, value) => {
if (!err) { if (!err) {
devManager = value; devManager = value;
}
});
// get deviceIds // get deviceIds
let deviceIds = []; let deviceIds = [];
if (devManager != null) { if (devManager != null) {
var deviceList = devManager.getTrustedDeviceListSync(); var devices = devManager.getTrustedDeviceListSync();
for (var i = 0; i < deviceList.length; i++) { for (var i = 0; i < devices.length; i++) {
deviceIds[i] = deviceList[i].deviceId; deviceIds[i] = devices[i].deviceId;
} }
} }
try{
kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000); kvStore.sync(deviceIds, distributedData.SyncMode.PUSH_ONLY, 1000);
}catch (e) {
console.log("An unexpected error occurred. Error:" + e);
}
}
});
``` ```
## Samples
The following samples are provided to help you better understand the distributed data development:
- [`KvStore`: distributed database (eTS) (API8)](https://gitee.com/openharmony/app_samples/tree/master/data/Kvstore)
- [Distributed Database](https://gitee.com/openharmony/codelabs/tree/master/Data/JsDistributedData)
...@@ -94,6 +94,7 @@ ...@@ -94,6 +94,7 @@
- File Management - File Management
- [@ohos.document](js-apis-document.md)
- [@ohos.environment](js-apis-environment.md) - [@ohos.environment](js-apis-environment.md)
- [@ohos.fileio](js-apis-fileio.md) - [@ohos.fileio](js-apis-fileio.md)
- [@ohos.fileManager](js-apis-filemanager.md) - [@ohos.fileManager](js-apis-filemanager.md)
......
...@@ -917,8 +917,8 @@ Enumerates operation types of the Data ability. ...@@ -917,8 +917,8 @@ Enumerates operation types of the Data ability.
| Name | Readable/Writable| Type | Mandatory| Description | | Name | Readable/Writable| Type | Mandatory| Description |
| -------------------------------- | -------- | -------------------- | ---- | ------------------------------------------------------------ | | -------------------------------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | Read-only | string | No | ID of the device that runs the ability. | | deviceId | Read-only | string | No | ID of the device that runs the ability. |
| bundleName | Read-only | string | No | Bundle name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| | bundleName | Read-only | string | No | Bundle name of the ability to start.|
| abilityName | Read-only | string | No | Name of the ability to start. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can directly match the specified ability.| | abilityName | Read-only | string | No | Name of the ability to start. If both **package** and **AbilityName** are specified in this field in a **Want** object, the **Want** object can directly match the specified ability.|
| uri | Read-only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| | uri | Read-only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | Read-only | string | No | MIME type, for example, text/plain or image/*. | | type | Read-only | string | No | MIME type, for example, text/plain or image/*. |
| flags | Read-only | number | No | How the **Want** object will be handled. By default, a number is passed. For details, see [flags](#flags).| | flags | Read-only | number | No | How the **Want** object will be handled. By default, a number is passed. For details, see [flags](#flags).|
......
...@@ -503,9 +503,7 @@ Asynchronously creates a directory. This method uses a callback to return the re ...@@ -503,9 +503,7 @@ Asynchronously creates a directory. This method uses a callback to return the re
- Example - Example
```js ```js
fileio.mkdir(path, function(err) { fileio.mkdir(path, function(err) {
if (!err) { console.info("mkdir successfully");
// Do something.
}
}); });
``` ```
...@@ -639,7 +637,8 @@ Asynchronously reads data from a file. This method uses a promise to return the ...@@ -639,7 +637,8 @@ Asynchronously reads data from a file. This method uses a promise to return the
let fd = fileio.openSync(path, 0o2); let fd = fileio.openSync(path, 0o2);
let buf = new ArrayBuffer(4096); let buf = new ArrayBuffer(4096);
fileio.read(fd, buf).then(function(readout){ fileio.read(fd, buf).then(function(readout){
console.info("read file data successfully:"+ JSON.stringify(readout)); console.info("read file data successfully");
console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer)));
}).catch(function(error){ }).catch(function(error){
console.info("read file data failed with error:"+ error); console.info("read file data failed with error:"+ error);
}); });
...@@ -671,8 +670,9 @@ Asynchronously reads data from a file. This method uses a callback to return the ...@@ -671,8 +670,9 @@ Asynchronously reads data from a file. This method uses a callback to return the
let fd = fileio.openSync(path, 0o2); let fd = fileio.openSync(path, 0o2);
let buf = new ArrayBuffer(4096); let buf = new ArrayBuffer(4096);
fileio.read(fd, buf, function (err, readOut) { fileio.read(fd, buf, function (err, readOut) {
if (!err) { if (readOut) {
console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer))) console.info("read file data successfully");
console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer)));
} }
}); });
``` ```
...@@ -756,6 +756,7 @@ Asynchronously deletes a directory. This method uses a callback to return the re ...@@ -756,6 +756,7 @@ Asynchronously deletes a directory. This method uses a callback to return the re
```js ```js
fileio.rmdir(path, function(err){ fileio.rmdir(path, function(err){
// Do something. // Do something.
console.info("rmdir successfully");
}); });
``` ```
...@@ -824,9 +825,7 @@ Asynchronously deletes a file. This method uses a callback to return the result. ...@@ -824,9 +825,7 @@ Asynchronously deletes a file. This method uses a callback to return the result.
- Example - Example
```js ```js
fileio.unlink(path, function(err) { fileio.unlink(path, function(err) {
if (!err) { console.info("remove file successfully");
// Do something.
}
}); });
``` ```
...@@ -879,7 +878,7 @@ Asynchronously writes data into a file. This method uses a promise to return the ...@@ -879,7 +878,7 @@ Asynchronously writes data into a file. This method uses a promise to return the
```js ```js
let fd = fileio.openSync(fpath, 0o100 | 0o2, 0o666); let fd = fileio.openSync(fpath, 0o100 | 0o2, 0o666);
fileio.write(fd, "hello, world").then(function(number){ fileio.write(fd, "hello, world").then(function(number){
console.info("write data to file successfully:"+ number); console.info("write data to file successfully and size is:"+ number);
}).catch(function(err){ }).catch(function(err){
console.info("write data to file failed with error:"+ err); console.info("write data to file failed with error:"+ err);
}); });
...@@ -911,8 +910,8 @@ Asynchronously writes data into a file. This method uses a callback to return th ...@@ -911,8 +910,8 @@ Asynchronously writes data into a file. This method uses a callback to return th
```js ```js
let fd = fileio.openSync(path, 0o100 | 0o2, 0o666); let fd = fileio.openSync(path, 0o100 | 0o2, 0o666);
fileio.write(fd, "hello, world", function (err, bytesWritten) { fileio.write(fd, "hello, world", function (err, bytesWritten) {
if (!err) { if (bytesWritten) {
console.log(bytesWritten) console.info("write data to file successfully and size is:"+ bytesWritten);
} }
}); });
``` ```
...@@ -962,7 +961,7 @@ Asynchronously calculates the hash value of a file. This method uses a promise t ...@@ -962,7 +961,7 @@ Asynchronously calculates the hash value of a file. This method uses a promise t
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | ------ | ---- | ---------------------------------------- | | --------- | ------ | ---- | ---------------------------------------- |
| path | string | Yes | Absolute path of the target file. | | path | string | Yes | Absolute path of the target file. |
| algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.| | algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**. **sha256** is recommended for security purposes.|
- Return value - Return value
| Type | Description | | Type | Description |
...@@ -991,14 +990,14 @@ Asynchronously calculates the hash value of a file. This method uses a callback ...@@ -991,14 +990,14 @@ Asynchronously calculates the hash value of a file. This method uses a callback
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | --------------------------- | ---- | ---------------------------------------- | | --------- | --------------------------- | ---- | ---------------------------------------- |
| path | string | Yes | Absolute path of the target file. | | path | string | Yes | Absolute path of the target file. |
| algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**.**sha256** is recommended for security purposes.| | algorithm | string | Yes | Algorithm used to calculate the hash value. The value can be **md5**, **sha1**, or **sha256**. **sha256** is recommended for security purposes.|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the hash value. The hash value is a hexadecimal string consisting of digits and uppercase letters.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the hash value. The hash value is a hexadecimal string consisting of digits and uppercase letters.|
- Example - Example
```js ```js
fileio.hash(fpath, "sha256", function(err, hashStr) { fileio.hash(fpath, "sha256", function(err, hashStr) {
if (!err) { if (hashStr) {
console.log(hashStr) console.info("calculate file hash successfully:"+ hashStr);
} }
}); });
``` ```
...@@ -1091,7 +1090,7 @@ Asynchronously obtains file status information based on the file descriptor. Thi ...@@ -1091,7 +1090,7 @@ Asynchronously obtains file status information based on the file descriptor. Thi
- Return value - Return value
| Type | Description | | Type | Description |
| -------- | -------- | | ---------------------------- | ---------- |
| Promise&lt;[Stat](#stat)&gt; | Promise used to return the file status information obtained.| | Promise&lt;[Stat](#stat)&gt; | Promise used to return the file status information obtained.|
- Example - Example
...@@ -1221,7 +1220,7 @@ Synchronously truncates a file based on the file descriptor. ...@@ -1221,7 +1220,7 @@ Synchronously truncates a file based on the file descriptor.
- Example - Example
```js ```js
fileio.ftruncate(fd, len); fileio.ftruncateSync(fd, len);
``` ```
...@@ -1293,7 +1292,7 @@ Synchronously truncates a file based on the file path. ...@@ -1293,7 +1292,7 @@ Synchronously truncates a file based on the file path.
- Example - Example
```js ```js
fileio.ftruncate(path, len); fileio.truncateSync(path, len);
``` ```
...@@ -1486,7 +1485,8 @@ Asynchronously reads data from a file. This method uses a promise to return the ...@@ -1486,7 +1485,8 @@ Asynchronously reads data from a file. This method uses a promise to return the
- Example - Example
```js ```js
fileio.read(new ArrayBuffer(4096)).then(function(readout){ fileio.read(new ArrayBuffer(4096)).then(function(readout){
console.info("File data read successfully:"+ String.fromCharCode.apply(null, new Uint8Array(readout.buffer))); console.info("read file data successfully");
console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer)));
}).catch(function(err){ }).catch(function(err){
console.info("Failed to read file data. Error:"+ err); console.info("Failed to read file data. Error:"+ err);
}); });
...@@ -1516,8 +1516,9 @@ Asynchronously reads data from a file. This method uses a callback to return the ...@@ -1516,8 +1516,9 @@ Asynchronously reads data from a file. This method uses a callback to return the
```js ```js
let buf = new ArrayBuffer(4096); let buf = new ArrayBuffer(4096);
fileio.read(buf, function (err, readOut) { fileio.read(buf, function (err, readOut) {
if (!err) { if (readOut) {
console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer))) console.info("read file data successfully");
console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer)));
} }
}); });
``` ```
...@@ -2407,14 +2408,14 @@ Provides detailed file information. Before calling a method of the **Stat** clas ...@@ -2407,14 +2408,14 @@ Provides detailed file information. Before calling a method of the **Stat** clas
isBlockDevice(): boolean isBlockDevice(): boolean
Checks whether the current directory entry is a block special file. A block special file supports access by block only, and it is cached when accessed. Checks whether this file is a block special file. A block special file supports access by block only, and it is cached when accessed.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type | Description | | Type | Description |
| ------- | ---------------- | | ------- | ---------------- |
| boolean | Whether the directory entry is a block special file.| | boolean | Whether the file is a block special file.|
- Example - Example
```js ```js
...@@ -2426,14 +2427,14 @@ Checks whether the current directory entry is a block special file. A block spec ...@@ -2426,14 +2427,14 @@ Checks whether the current directory entry is a block special file. A block spec
isCharacterDevice(): boolean isCharacterDevice(): boolean
Checks whether the current directory entry is a character special file. A character special file supports random access, and it is not cached when accessed. Checks whether this file is a character special file. A character special file supports random access, and it is not cached when accessed.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type | Description | | Type | Description |
| ------- | ----------------- | | ------- | ----------------- |
| boolean | Whether the directory entry is a character special file.| | boolean | Whether the file is a character special file.|
- Example - Example
```js ```js
...@@ -2445,14 +2446,14 @@ Checks whether the current directory entry is a character special file. A charac ...@@ -2445,14 +2446,14 @@ Checks whether the current directory entry is a character special file. A charac
isDirectory(): boolean isDirectory(): boolean
Checks whether a directory entry is a directory. Checks whether this file is a directory.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type | Description | | Type | Description |
| ------- | ------------- | | ------- | ------------- |
| boolean | Whether the directory entry is a directory.| | boolean | Whether the file is a directory.|
- Example - Example
```js ```js
...@@ -2464,14 +2465,14 @@ Checks whether a directory entry is a directory. ...@@ -2464,14 +2465,14 @@ Checks whether a directory entry is a directory.
isFIFO(): boolean isFIFO(): boolean
Checks whether the current directory entry is a named pipe (or FIFO). Named pipes are used for inter-process communication. Checks whether this file is a named pipe (or FIFO). Named pipes are used for inter-process communication.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type | Description | | Type | Description |
| ------- | --------------------- | | ------- | --------------------- |
| boolean | Whether the directory entry is a FIFO.| | boolean | Whether the file is an FIFO.|
- Example - Example
```js ```js
...@@ -2483,14 +2484,14 @@ Checks whether the current directory entry is a named pipe (or FIFO). Named pipe ...@@ -2483,14 +2484,14 @@ Checks whether the current directory entry is a named pipe (or FIFO). Named pipe
isFile(): boolean isFile(): boolean
Checks whether a directory entry is a regular file. Checks whether this file is a regular file.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type | Description | | Type | Description |
| ------- | --------------- | | ------- | --------------- |
| boolean | Whether the directory entry is a regular file.| | boolean | Whether the file is a regular file.|
- Example - Example
```js ```js
...@@ -2502,14 +2503,14 @@ Checks whether a directory entry is a regular file. ...@@ -2502,14 +2503,14 @@ Checks whether a directory entry is a regular file.
isSocket(): boolean isSocket(): boolean
Checks whether a directory entry is a socket. Checks whether this file is a socket.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type | Description | | Type | Description |
| ------- | -------------- | | ------- | -------------- |
| boolean | Whether the directory entry is a socket.| | boolean | Whether the file is a socket.|
- Example - Example
```js ```js
...@@ -2521,14 +2522,14 @@ Checks whether a directory entry is a socket. ...@@ -2521,14 +2522,14 @@ Checks whether a directory entry is a socket.
isSymbolicLink(): boolean isSymbolicLink(): boolean
Checks whether a directory entry is a symbolic link. Checks whether this file is a symbolic link.
**System capability**: SystemCapability.FileManagement.File.FileIO **System capability**: SystemCapability.FileManagement.File.FileIO
- Return value - Return value
| Type | Description | | Type | Description |
| ------- | --------------- | | ------- | --------------- |
| boolean | Whether the directory entry is a symbolic link.| | boolean | Whether the file is a symbolic link.|
- Example - Example
```js ```js
...@@ -2731,7 +2732,7 @@ Asynchronously writes data into the stream. This method uses a promise to return ...@@ -2731,7 +2732,7 @@ Asynchronously writes data into the stream. This method uses a promise to return
```js ```js
let ss= fileio.createStreamSync(fpath, "r+"); let ss= fileio.createStreamSync(fpath, "r+");
ss.write("hello, world",{offset: 1,length: 5,position: 5,encoding :'utf-8'}).then(function (number){ ss.write("hello, world",{offset: 1,length: 5,position: 5,encoding :'utf-8'}).then(function (number){
console.info("write successfully:"+ number); console.info("write successfully and size is:"+ number);
}).catch(function(err){ }).catch(function(err){
console.info("write failed with error:"+ err); console.info("write failed with error:"+ err);
}); });
...@@ -2762,9 +2763,9 @@ Asynchronously writes data into the stream. This method uses a callback to retur ...@@ -2762,9 +2763,9 @@ Asynchronously writes data into the stream. This method uses a callback to retur
```js ```js
let ss= fileio.createStreamSync(fpath, "r+"); let ss= fileio.createStreamSync(fpath, "r+");
ss.write("hello, world", {offset: 1, length: 5, position: 5, encoding :'utf-8'}, function (err, bytesWritten) { ss.write("hello, world", {offset: 1, length: 5, position: 5, encoding :'utf-8'}, function (err, bytesWritten) {
if (!err) { if (bytesWritten) {
// do something // do something
console.log(bytesWritten); console.info("write successfully and size is:"+ bytesWritten);
} }
}); });
``` ```
...@@ -2829,6 +2830,7 @@ Asynchronously reads data from the stream. This method uses a promise to return ...@@ -2829,6 +2830,7 @@ Asynchronously reads data from the stream. This method uses a promise to return
let ss = fileio.createStreamSync(fpath, "r+"); let ss = fileio.createStreamSync(fpath, "r+");
ss.read(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5}).then(function (readout){ ss.read(new ArrayBuffer(4096), {offset: 1, length: 5, position: 5}).then(function (readout){
console.info("read data successfully"); console.info("read data successfully");
console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer)));
}).catch(function(err){ }).catch(function(err){
console.info("read data failed with error:"+ err); console.info("read data failed with error:"+ err);
}); });
...@@ -2858,8 +2860,9 @@ Asynchronously reads data from the stream. This method uses a callback to return ...@@ -2858,8 +2860,9 @@ Asynchronously reads data from the stream. This method uses a callback to return
```js ```js
let ss = fileio.createStreamSync(fpath, "r+"); let ss = fileio.createStreamSync(fpath, "r+");
ss.read(new ArrayBuffer(4096),{offset: 1, length: 5, position: 5},function (err, readOut) { ss.read(new ArrayBuffer(4096),{offset: 1, length: 5, position: 5},function (err, readOut) {
if (!err) { if (readOut) {
// do something console.info("read data successfully");
console.log(String.fromCharCode.apply(null, new Uint8Array(readOut.buffer)));
} }
}); });
``` ```
...@@ -2917,7 +2920,7 @@ Asynchronously reads the next directory entry. This method uses a promise to ret ...@@ -2917,7 +2920,7 @@ Asynchronously reads the next directory entry. This method uses a promise to ret
```js ```js
let dir = fileio.opendirSync(path); let dir = fileio.opendirSync(path);
dir.read().then(function (dirent){ dir.read().then(function (dirent){
console.info("read successfully:"+ dirent.name); console.log("read successfully:"+JSON.stringify(dirent));
}).catch(function(err){ }).catch(function(err){
console.info("read failed with error:"+ err); console.info("read failed with error:"+ err);
}); });
...@@ -2941,9 +2944,9 @@ Asynchronously reads the next directory entry. This method uses a callback to re ...@@ -2941,9 +2944,9 @@ Asynchronously reads the next directory entry. This method uses a callback to re
```js ```js
let dir = fileio.opendirSync(path); let dir = fileio.opendirSync(path);
dir.read(function (err, dirent) { dir.read(function (err, dirent) {
if (!err) { if (dirent) {
// do something // do something
console.log(dirent.name) console.log("read successfully:"+JSON.stringify(dirent));
} }
}); });
``` ```
......
# statfs # statfs
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE:**<br/> > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -44,9 +44,9 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ...@@ -44,9 +44,9 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
- Example - Example
```js ```js
let path = "/data"; let path = "/dev";
statfs.getFreeBytes(path).then(function (number){ statfs.getFreeBytes(path).then(function (number){
console.info("getFreeBytes successfully:"+ number); console.info("getFreeBytes promise successfully:"+ number);
}).catch(function(err){ }).catch(function(err){
console.info("getFreeBytes failed with error:"+ err); console.info("getFreeBytes failed with error:"+ err);
}); });
...@@ -71,7 +71,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo ...@@ -71,7 +71,7 @@ Obtains the number of free bytes of the specified file system in asynchronous mo
```js ```js
statfs.getFreeBytes(path, function(err, number){ statfs.getFreeBytes(path, function(err, number){
//do something console.info("getFreeBytes callback successfully:"+ number);
}); });
``` ```
...@@ -98,9 +98,9 @@ Obtains the total number of bytes of the specified file system in asynchronous m ...@@ -98,9 +98,9 @@ Obtains the total number of bytes of the specified file system in asynchronous m
- Example - Example
```js ```js
let path = "/data"; let path = "/dev";
statfs.getTotalBytes(path).then(function (number){ statfs.getTotalBytes(path).then(function (number){
console.info("getTotalBytes successfully:"+ number); console.info("getTotalBytes promise successfully:"+ number);
}).catch(function(err){ }).catch(function(err){
console.info("getTotalBytes failed with error:"+ err); console.info("getTotalBytes failed with error:"+ err);
}); });
...@@ -125,6 +125,6 @@ Obtains the total number of bytes of the specified file system in asynchronous m ...@@ -125,6 +125,6 @@ Obtains the total number of bytes of the specified file system in asynchronous m
```js ```js
statfs.getTotalBytes(path, function(err, number){ statfs.getTotalBytes(path, function(err, number){
//do something console.info("getTotalBytes callback successfully:"+ number);
}); });
``` ```
...@@ -490,7 +490,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -490,7 +490,7 @@ This is a system API and cannot be called by third-party applications.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar.| | type | string | Yes | Listening type.<br>Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar.|
| callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | Yes | Callback used to return the listened information. | | callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | Yes | Callback used to return the information. |
- Example - Example
...@@ -516,7 +516,7 @@ This is a system API and cannot be called by third-party applications. ...@@ -516,7 +516,7 @@ This is a system API and cannot be called by third-party applications.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar.| | type | string | Yes | Listening type.<br>Set it to **systemBarTintChange**, which indicates listening for properties changes of the status bar and navigation bar.|
| callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | No | Callback used to return the listened information. | | callback | Callback&lt;[SystemBarTintState](#systembartintstate)&gt; | No | Callback used to return the information. |
- Example - Example
...@@ -934,7 +934,7 @@ Obtains the area where this window cannot be displayed, for example, the system ...@@ -934,7 +934,7 @@ Obtains the area where this window cannot be displayed, for example, the system
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area.**TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch.| | type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. |
| callback | AsyncCallback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the area. | | callback | AsyncCallback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the area. |
- Example - Example
...@@ -962,7 +962,7 @@ Obtains the area where this window cannot be displayed, for example, the system ...@@ -962,7 +962,7 @@ Obtains the area where this window cannot be displayed, for example, the system
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------------------- | ---- | ------------------------------------------------------------ | | ------ | ------------------------------- | ---- | ------------------------------------------------------------ |
| type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area.**TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch.| | type | [AvoidAreaType](#avoidareatype) | Yes | Type of the area. **TYPE_SYSTEM** indicates the default area of the system. **TYPE_CUTOUT** indicates the notch. |
- Return value - Return value
...@@ -1251,7 +1251,7 @@ Loads content to this window. This API uses an asynchronous callback to return t ...@@ -1251,7 +1251,7 @@ Loads content to this window. This API uses an asynchronous callback to return t
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | -------------------- | | -------- | ------------------------- | ---- | -------------------- |
| path | string | Yes | Path of the page to which the content will be loaded.| | path | string | Yes | Path of the page from which the content will be loaded. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the execution result. |
- Example - Example
...@@ -1278,7 +1278,7 @@ Loads content to this window. This API uses a promise to return the result. ...@@ -1278,7 +1278,7 @@ Loads content to this window. This API uses a promise to return the result.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------- | | ------ | ------ | ---- | -------------------- |
| path | string | Yes | Path of the page to which the content will be loaded.| | path | string | Yes | Path of the page from which the content will be loaded. |
- Return value - Return value
...@@ -1361,7 +1361,7 @@ Enables listening for window size changes. ...@@ -1361,7 +1361,7 @@ Enables listening for window size changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowSizeChange**, which indicates listening for window size changes.| | type | string | Yes | Listening type.<br>Set it to **windowSizeChange**, which indicates listening for window size changes.|
| callback | Callback&lt;[Size](#size)&gt; | Yes | Callback used to return the listened information. | | callback | Callback&lt;[Size](#size)&gt; | Yes | Callback used to return the information. |
- Example - Example
...@@ -1385,7 +1385,7 @@ Disables listening for window size changes. ...@@ -1385,7 +1385,7 @@ Disables listening for window size changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **windowSizeChange<sup>7+</sup>**, which indicates listening for window size changes.| | type | string | Yes | Listening type.<br>Set it to **windowSizeChange<sup>7+</sup>**, which indicates listening for window size changes.|
| callback | Callback&lt;[Size](#size)&gt; | No | Callback used to return the listened information. | | callback | Callback&lt;[Size](#size)&gt; | No | Callback used to return the information. |
- Example - Example
...@@ -1407,7 +1407,7 @@ Enables listening for changes to the area where the window cannot be displayed. ...@@ -1407,7 +1407,7 @@ Enables listening for changes to the area where the window cannot be displayed.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed.| | type | string | Yes | Listening type.<br>Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed.|
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the listened information. | | callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the information. |
- Example - Example
...@@ -1431,7 +1431,7 @@ Disables listening for changes to the area where the window cannot be displayed. ...@@ -1431,7 +1431,7 @@ Disables listening for changes to the area where the window cannot be displayed.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed.| | type | string | Yes | Listening type.<br>Set it to **systemAvoidAreaChange**, which indicates listening for changes to the area where the window cannot be displayed.|
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | No | Callback used to return the listened information. | | callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | No | Callback used to return the information. |
- Example - Example
...@@ -1455,7 +1455,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a ...@@ -1455,7 +1455,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes.| | type | string | Yes | Listening type.<br>Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes.|
| callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the listened information. | | callback | Callback&lt;[AvoidArea](#avoidarea)&gt; | Yes | Callback used to return the information. |
- Example - Example
...@@ -1481,7 +1481,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a ...@@ -1481,7 +1481,7 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. It will be a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Listening type.<br>Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes.| | type | string | Yes | Listening type.<br>Set it to **keyboardHeightChange**, which indicates listening for keyboard height changes.|
| callback | Callback&lt;number&gt; | No | Callback used to return the listened information. | | callback | Callback&lt;number&gt; | No | Callback used to return the information. |
- Example - Example
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
- [Burning](quickstart-ide-lite-steps-hi3861-burn.md) - [Burning](quickstart-ide-lite-steps-hi3861-burn.md)
- [Networking](quickstart-ide-lite-steps-hi3861-netconfig.md) - [Networking](quickstart-ide-lite-steps-hi3861-netconfig.md)
- [Debugging and Verification](quickstart-ide-lite-steps-hi3861-debug.md) - [Debugging and Verification](quickstart-ide-lite-steps-hi3861-debug.md)
- [Running](quickstart-ide-lite-steps-hi3816-running.md) - [Running](quickstart-ide-lite-steps-hi3861-running.md)
- Hi3516 Development Board - Hi3516 Development Board
- [Writing a Hello World Program](quickstart-ide-lite-steps-hi3516-application-framework.md) - [Writing a Hello World Program](quickstart-ide-lite-steps-hi3516-application-framework.md)
- [Building](quickstart-ide-lite-steps-hi3516-building.md) - [Building](quickstart-ide-lite-steps-hi3516-building.md)
......
...@@ -148,7 +148,7 @@ To remotely access the Ubuntu environment through Windows and enjoy the benefits ...@@ -148,7 +148,7 @@ To remotely access the Ubuntu environment through Windows and enjoy the benefits
### Installing Remote SSH ### Installing Remote SSH
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us-cn_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace. 1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
![en-us_image_0000001193920448](figures/en-us_image_0000001193920448.png) ![en-us_image_0000001193920448](figures/en-us_image_0000001193920448.png)
......
...@@ -12,4 +12,4 @@ ...@@ -12,4 +12,4 @@
- **[Debugging and Verification](quickstart-ide-lite-steps-hi3861-debug.md)** - **[Debugging and Verification](quickstart-ide-lite-steps-hi3861-debug.md)**
- **[Running](quickstart-ide-lite-steps-hi3816-running.md)** - **[Running](quickstart-ide-lite-steps-hi3861-running.md)**
...@@ -148,7 +148,7 @@ To remotely access the Ubuntu environment through Windows and enjoy the benefits ...@@ -148,7 +148,7 @@ To remotely access the Ubuntu environment through Windows and enjoy the benefits
### Installing Remote SSH ### Installing Remote SSH
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us-cn_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace. 1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
![en-us_image_0000001193920448](figures/en-us_image_0000001193920448.png) ![en-us_image_0000001193920448](figures/en-us_image_0000001193920448.png)
......
# Setting Up Ubuntu Development Environment<a name="EN-US_TOPIC_0000001174350605"></a>
Operating system: 64-bit version of Ubuntu 16.04 or later.
Perform the following steps to set up the development environment:
1. Obtain source code.
2. Install necessary libraries and tools.
3. Install Python3.
4. Install LLVM \(required only for OpenHarmony\_v1.x\).
5. Install hb.
>![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>- Docker is provided for the Ubuntu build environment, which encapsulates related build tools. If you use Docker to prepare the build environment, you do not need to perform the following steps in this section. For details, see [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315).
>- By default, basic software, such as Samba and Vim, is installed in the system. Adaptation on the software is required to support file sharing between the Linux server and the Windows workstation.
>- For details about the compilation and building subsystem of OpenHarmony, see [Compilation and Building Overview](../subsystems/subsys-build-mini-lite.md).
## Obtaining Source Code and Tools<a name="section1897711811517"></a>
The following table describes the tools and source code required for setting up the general environment for a Linux server and how to obtain these tools and the source code.
**Table 1** Source code and development tools and their obtaining methods
<a name="table6299192712513"></a>
<table><thead align="left"><tr id="row122993276512"><th class="cellrowborder" valign="top" width="25.779999999999998%" id="mcps1.2.4.1.1"><p id="p1829914271858"><a name="p1829914271858"></a><a name="p1829914271858"></a>Item</p>
</th>
<th class="cellrowborder" valign="top" width="30.819999999999997%" id="mcps1.2.4.1.2"><p id="p429918274517"><a name="p429918274517"></a><a name="p429918274517"></a>Description</p>
</th>
<th class="cellrowborder" valign="top" width="43.4%" id="mcps1.2.4.1.3"><p id="p12997271757"><a name="p12997271757"></a><a name="p12997271757"></a>How to Obtain</p>
</th>
</tr>
</thead>
<tbody><tr id="row45863354112"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p3587173513117"><a name="p3587173513117"></a><a name="p3587173513117"></a>Source code</p>
</td>
<td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p258713581118"><a name="p258713581118"></a><a name="p258713581118"></a>Develops functions.</p>
</td>
<td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p16587835171114"><a name="p16587835171114"></a><a name="p16587835171114"></a>See <a href="../get-code/sourcecode-acquire.md">Source Code Acquisition</a>.</p>
</td>
</tr>
<tr id="row020505735919"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p1220513576596"><a name="p1220513576596"></a><a name="p1220513576596"></a>Necessary libraries and tools</p>
</td>
<td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p2206157145919"><a name="p2206157145919"></a><a name="p2206157145919"></a>Used for compilation (such as packaging and image creation).</p>
</td>
<td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p920675719597"><a name="p920675719597"></a><a name="p920675719597"></a>Internet</p>
</td>
</tr>
<tr id="row430016273514"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p330015271158"><a name="p330015271158"></a><a name="p330015271158"></a>Python3.7+</p>
</td>
<td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p43003270510"><a name="p43003270510"></a><a name="p43003270510"></a>Executes script compilation.</p>
</td>
<td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p34760459518"><a name="p34760459518"></a><a name="p34760459518"></a>Internet</p>
</td>
</tr>
<tr id="row7531362055"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p1467122152710"><a name="p1467122152710"></a><a name="p1467122152710"></a>LLVM (required only for OpenHarmony_v1.x)</p>
</td>
<td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p1739432372718"><a name="p1739432372718"></a><a name="p1739432372718"></a>Functions as the compiler toolchain.</p>
</td>
<td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p59711534202610"><a name="p59711534202610"></a><a name="p59711534202610"></a>Internet</p>
</td>
</tr>
<tr id="row1644079184919"><td class="cellrowborder" valign="top" width="25.779999999999998%" headers="mcps1.2.4.1.1 "><p id="p744115914493"><a name="p744115914493"></a><a name="p744115914493"></a>hb</p>
</td>
<td class="cellrowborder" valign="top" width="30.819999999999997%" headers="mcps1.2.4.1.2 "><p id="p1244114913492"><a name="p1244114913492"></a><a name="p1244114913492"></a>Compiles the <span id="text344823833918"><a name="text344823833918"></a><a name="text344823833918"></a>OpenHarmony</span> source code.</p>
</td>
<td class="cellrowborder" valign="top" width="43.4%" headers="mcps1.2.4.1.3 "><p id="p1463918124619"><a name="p1463918124619"></a><a name="p1463918124619"></a>Internet</p>
</td>
</tr>
</tbody>
</table>
>![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install compilation tools like **gn** and **ninja**.
>- \(Recommended\) If you obtain the source code via the mirror site or code repository, install compilation tools such as **gn**, **ninja**, and LLVM. When installing these tools, ensure that their environment variable paths are unique.
## Obtaining Source Code<a name="section1545225464016"></a>
You need to acquire [source code](../get-code/sourcecode-acquire.md), download it on a Linux server, and decompress it.
## Installing Necessary Libraries and Tools<a name="section108201740181219"></a>
Run the following command to install the libraries and tools required for compilation:
```
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev e2fsprogs pkg-config flex bison perl bc openssl libssl-dev libelf-dev libc6-dev-amd64 binutils binutils-dev libdwarf-dev u-boot-tools mtd-utils gcc-arm-linux-gnueabi cpio device-tree-compiler
```
## Installing Python3<a name="section1238412211211"></a>
1. Start a Linux server.
2. Run the following command to check the Python version:
```
python3 --version
```
If Python version is earlier than 3.7, reinstall Python. Do as follows to install Python, for example, Python 3.8.
1. Check the Ubuntu version.
```
cat /etc/issue
```
2. Install Python based on the Ubuntu version.
- If the Ubuntu version is 18 or later, run the following command:
```
sudo apt-get install python3.8
```
- If the Ubuntu version is 16, perform the following steps:
a. Install dependency packages.
```
sudo apt update && sudo apt install software-properties-common
```
b. Add the source of deadsnakes PPA and press **Enter**.
```
sudo add-apt-repository ppa:deadsnakes/ppa
```
c. Install Python 3.8.
```
sudo apt upgrade && sudo apt install python3.8
```
3. Set the soft link of **python** and **python3** to **python3.8**.
```
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1
```
4. Install and upgrade the Python package management tool \(pip3\) using either of the following methods:
- **Command line:**
```
sudo apt-get install python3-setuptools python3-pip -y
sudo pip3 install --upgrade pip
```
- **Installation package:**
```
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python get-pip.py
```
## Installing LLVM \(Required only for OpenHarmony\_v1.x\)<a name="section12202192215415"></a>
>![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>When downloading source code under the OpenHarmony\_v1.x branches or tags, perform the operation procedure described in this section to install LLVM 9.0.0.
>When downloading source code under the Master and OpenHarmony\_v2.x branches or tags, skip this section. The hb automatically downloads the latest version of LLVM.
1. Start a Linux server.
2. [Download LLVM](https://repo.huaweicloud.com/harmonyos/compiler/clang/9.0.0-36191/linux/llvm-linux-9.0.0-36191.tar).
3. Decompress the LLVM installation package to **\~/llvm**.
```
tar -zxvf llvm.tar -C ~/
```
4. Set an environment variable.
```
vim ~/.bashrc
```
Copy the following command to the last line of the **.bashrc** file, save the file, and exit.
```
export PATH=~/llvm/bin:$PATH
```
5. Validate the environment variable.
```
source ~/.bashrc
```
## Installing hb<a name="section15794154618411"></a>
### Prerequisites<a name="section1083283711515"></a>
Python 3.7.4 or later has been installed. For details, see [Installing Python3](#section1238412211211).
### Installation Procedure<a name="section11518484814"></a>
1. Install **hb**.
```
python3 -m pip install --user ohos-build
```
2. Set an environment variable.
```
vim ~/.bashrc
```
Copy the following command to the last line of the **.bashrc** file, save the file, and exit.
```
export PATH=~/.local/bin:$PATH
```
Update the environment variable.
```
source ~/.bashrc
```
3. Run the **hb -h** command. If the following information is displayed, the installation is successful:
```
usage: hb
OHOS build system
positional arguments:
{build,set,env,clean}
build Build source code
set OHOS build settings
env Show OHOS build env
clean Clean output
optional arguments:
-h, --help Show this help message and exit
```
### Uninstalling hb<a name="section3512551574"></a>
```
python3 -m pip uninstall ohos-build
```
>![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>If you encounter any problem during the installation, resort to the [FAQs](quickstart-lite-env-setup-faqs.md).
# Overview<a name="EN-US_TOPIC_0000001128470854"></a>
Use the DevEco Device Tool for development, build, burning, and debugging of OpenHarmony.
The DevEco Device Tool is currently available on Windows and Ubuntu. This document takes the Windows version as an example.
For details about how to use the Ubuntu version, see the [HUAWEI DevEco Device Tool User Guide](https://device.harmonyos.com/en/docs/ide/user-guides/service_introduction-0000001050166905).
The Windows version supports build for the Hi3861 development board only. For other development boards, you should use the Ubuntu version and switch to the Ubuntu platform. The following describes how to set up the development environment and build environment for mini and small OpenHarmony.
# Setting Up Windows Development Environment<a name="EN-US_TOPIC_0000001216018805"></a>
System requirements:
- OS: 64-bit Windows 10
- User name: cannot contain Chinese characters
## Installing DevEco Device Tool<a name="en-us_topic_0000001058091994_section10761564496"></a>
DevEco Device Tool is installed in Visual Studio Code as a plug-in and depends on Python, Node.js, and HPM for running.
DevEco Device Tool supports integrated installation. The DevEco Device Tool setup wizard checks whether the adaptation versions of Visual Studio Code, Python, Node.js and HPM tools have been installed. If any of the tools is not installed, you'll be prompted to select the tool to be automatically installed.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>Before installing DevEco Device Tool, make sure the user name of the host does not contain Chinese characters. Otherwise, the **DevEco Home** page will be stuck loading and the DevEco Device Tool cannot work.
1. Log in to the [HarmonyOS Device website](https://device.harmonyos.com/cn/ide#download_beta) with your HUAWEI ID and download DevEco Device Tool V3.0 Beta1 or a later version. If you do not have a HUAWEI ID, [register](https://developer.huawei.com/consumer/en/doc/start/registration-and-verification-0000001053628148) one first.
2. Decompress the DevEco Device Tool package, double-click the installer, and then click **Next**.
3. Set the installation path of DevEco Device Tool and click **Next**.
4. When prompted, select the tools to be automatically installed and click **Next**.
![](figures/snap28.png)
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>When the setup wizard detects that a compatible Python version has been installed, it prompts you to select the installed Python version or download the recommended Python version.
5. In the dialog box shown below, click **Next** to download and install the tools.
![](figures/snap8.png)
6. In the displayed Python setup wizard, select **Add Python 3.8 to PATH** and click **Install Now**. After the installation is complete, click **Close**.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you have selected the compatible Python version installed on your device, the Python setup wizard will not be displayed. In this case, you skip this step.
>If DevEco Device Tool 2.1 Release is installed, the Python version must be 3.8.x. If DevEco Device Tool V3.0 Beta1 or a later version is installed, the Python version must be 3.8.x or 3.9.x.
![](figures/snap34.png)
7. In the Visual Studio Code setup wizard, install Visual Studio Code as prompted. During the installation, select **Add to PATH \(requires shell restart\)**.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you are using the correct version of Visual Studio Code, the Visual Studio Code setup wizard will not be displayed. In this case, you skip this step.
![](figures/snap33.png)
8. In the Node.js setup wizard, retain the default settings and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you are using the correct version of Node.js, the Node.js setup wizard will not be displayed. In this case, you skip this step.
9. Wait for the DevEco Device Tool setup wizard to automatically install the HPM and DevEco Device Tool. After the installation is complete, click **Finish** to close the setup wizard.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you are using the correct version of HPM, the setup wizard does not download or install HPM.
10. Start Visual Studio Code. The C/C++ and CodeLLDB plug-ins on which DevEco Device Tool depends will be automatically installed. After the installation is complete, click ![](figures/button.png) on the left of Visual Studio Code to check whether C/C++, CodeLLDB, and DevEco Device Tool are included in the **INSTALLED** list.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846).
![](figures/deveco-device-tool-install-sucessful.png)
...@@ -180,7 +180,7 @@ To remotely access the Ubuntu environment through Windows to perform operations ...@@ -180,7 +180,7 @@ To remotely access the Ubuntu environment through Windows to perform operations
### Installing Remote SSH ### Installing Remote SSH
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us-cn_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace. 1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
![en-us_image_0000001193920448](figures/en-us_image_0000001193920448.png) ![en-us_image_0000001193920448](figures/en-us_image_0000001193920448.png)
...@@ -326,7 +326,7 @@ Perform the following steps in Ubuntu: ...@@ -326,7 +326,7 @@ Perform the following steps in Ubuntu:
### Install hb. ### Install hb.
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> To install a proxy, see [Configuring a Proxy](../quick-start/quickstart-lite-reference.md#configuring-a-proxy). > To install a proxy, see [Configuring the Proxy](../quick-start/quickstart-lite-reference.md#section6204129143010).
1. Run the following command to install hb and update it to the latest version: 1. Run the following command to install hb and update it to the latest version:
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
- [Burning](quickstart-ide-lite-steps-hi3861-burn.md) - [Burning](quickstart-ide-lite-steps-hi3861-burn.md)
- [Networking](quickstart-ide-lite-steps-hi3861-netconfig.md) - [Networking](quickstart-ide-lite-steps-hi3861-netconfig.md)
- [Debugging and Verification](quickstart-ide-lite-steps-hi3861-debug.md) - [Debugging and Verification](quickstart-ide-lite-steps-hi3861-debug.md)
- [Running](quickstart-ide-lite-steps-hi3816-running.md) - [Running](quickstart-ide-lite-steps-hi3861-running.md)
- Hi3516 Development Board - Hi3516 Development Board
- [Writing a Hello World Program](quickstart-ide-lite-steps-hi3516-application-framework.md) - [Writing a Hello World Program](quickstart-ide-lite-steps-hi3516-application-framework.md)
- [Building](quickstart-ide-lite-steps-hi3516-building.md) - [Building](quickstart-ide-lite-steps-hi3516-building.md)
......
# Hi3518 Development Board<a name="EN-US_TOPIC_0000001174270693"></a>
## Introduction<a name="section14815247616"></a>
Hi3518E V300 is a next-generation system on chip \(SoC\) designed for the industry-dedicated smart HD IP camera. It introduces a next-generation image signal processor \(ISP\), the H.265 video compression encoder, and the advanced low-power process and architecture design, leading the industry in terms of low bit rate, high image quality, and low power consumption.
**Figure 1** Hi3518E V300 front view<a name="fig73059502010"></a>
![](figures/hi3518e-v300-front-view.png "hi3518e-v300-front-view")
**Figure 2** Hi3518E V300 rear view<a name="fig14828141713116"></a>
![](figures/hi3518e-v300-rear-view.png "hi3518e-v300-rear-view")
## Development Board Specifications<a name="section765112478446"></a>
**Table 1** Specifications of the Hi3518 development board
<a name="t88739bdd7be845fab34087af8ab692f7"></a>
<table><thead align="left"><tr id="r7d87cdc7a09d445c824000228ae4a3b0"><th class="cellrowborder" valign="top" width="28.749999999999996%" id="mcps1.2.3.1.1"><p id="a8ea7b45c00a54e7abd826c3b2bc934dc"><a name="a8ea7b45c00a54e7abd826c3b2bc934dc"></a><a name="a8ea7b45c00a54e7abd826c3b2bc934dc"></a><strong id="b18619196194114"><a name="b18619196194114"></a><a name="b18619196194114"></a>Type</strong></p>
</th>
<th class="cellrowborder" valign="top" width="71.25%" id="mcps1.2.3.1.2"><p id="aac42bd02e83846b187c02d3e976c0b09"><a name="aac42bd02e83846b187c02d3e976c0b09"></a><a name="aac42bd02e83846b187c02d3e976c0b09"></a><strong id="b591334418397"><a name="b591334418397"></a><a name="b591334418397"></a>Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="r9c0a0b643fd7495ab799c1eab9fbe1ec"><td class="cellrowborder" valign="top" width="28.749999999999996%" headers="mcps1.2.3.1.1 "><p id="a1a129c845a45444f9d0b7dcc3aabf4c3"><a name="a1a129c845a45444f9d0b7dcc3aabf4c3"></a><a name="a1a129c845a45444f9d0b7dcc3aabf4c3"></a>Processor core</p>
</td>
<td class="cellrowborder" valign="top" width="71.25%" headers="mcps1.2.3.1.2 "><a name="ul12459548104218"></a><a name="ul12459548104218"></a><ul id="ul12459548104218"><li>Hi3518E V300</li></ul>
</td>
</tr>
<tr id="row1527851224210"><td class="cellrowborder" valign="top" width="28.749999999999996%" headers="mcps1.2.3.1.1 "><p id="p1327911123424"><a name="p1327911123424"></a><a name="p1327911123424"></a>Imaging device</p>
</td>
<td class="cellrowborder" valign="top" width="71.25%" headers="mcps1.2.3.1.2 "><a name="ul49841342134210"></a><a name="ul49841342134210"></a><ul id="ul49841342134210"><li>1/2.9 F23</li></ul>
</td>
</tr>
<tr id="r79097125b7f64c189f67ac280cdacae9"><td class="cellrowborder" valign="top" width="28.749999999999996%" headers="mcps1.2.3.1.1 "><p id="a2bf783139e304d0f9bfeefc56a55dc66"><a name="a2bf783139e304d0f9bfeefc56a55dc66"></a><a name="a2bf783139e304d0f9bfeefc56a55dc66"></a>External interfaces</p>
</td>
<td class="cellrowborder" valign="top" width="71.25%" headers="mcps1.2.3.1.2 "><a name="u6a04d9aa22f6410f91bbcdaf902d0e5f"></a><a name="u6a04d9aa22f6410f91bbcdaf902d0e5f"></a><ul id="u6a04d9aa22f6410f91bbcdaf902d0e5f"><li>External microphone</li><li>External 8 Ω/1.5 W speaker</li></ul>
</td>
</tr>
<tr id="r785d104d71f6426aa9aab25d14a7581b"><td class="cellrowborder" valign="top" width="28.749999999999996%" headers="mcps1.2.3.1.1 "><p id="a59fb5f9ca2004dd2abeb636b2d4c04fa"><a name="a59fb5f9ca2004dd2abeb636b2d4c04fa"></a><a name="a59fb5f9ca2004dd2abeb636b2d4c04fa"></a>External memory interface</p>
</td>
<td class="cellrowborder" valign="top" width="71.25%" headers="mcps1.2.3.1.2 "><a name="u8f323b7322a14e109e2937b9660af0c4"></a><a name="u8f323b7322a14e109e2937b9660af0c4"></a><ul id="u8f323b7322a14e109e2937b9660af0c4"><li>TF card<p id="p167481654192716"><a name="p167481654192716"></a><a name="p167481654192716"></a>A maximum file size of 128 GB is allowed (FAT32 format).</p>
</li></ul>
</td>
</tr>
<tr id="rae3f8ef812894db3951e01b4a1b85438"><td class="cellrowborder" valign="top" width="28.749999999999996%" headers="mcps1.2.3.1.1 "><p id="a81cd5d5655a44c4cbfc0a35b9f65450a"><a name="a81cd5d5655a44c4cbfc0a35b9f65450a"></a><a name="a81cd5d5655a44c4cbfc0a35b9f65450a"></a>WLAN protocol</p>
</td>
<td class="cellrowborder" valign="top" width="71.25%" headers="mcps1.2.3.1.2 "><a name="ul1311935314215"></a><a name="ul1311935314215"></a><ul id="ul1311935314215"><li>802.11 b/g/n</li></ul>
</td>
</tr>
</tbody>
</table>
# Introduction<a name="EN-US_TOPIC_0000001181550103"></a>
- **[Hi3861 Development Board](quickstart-lite-introduction-hi3861.md)**
- **[Hi3516 Development Board](quickstart-lite-introduction-hi3516.md)**
- **[Hi3518 Development Board](quickstart-lite-introduction-hi3518.md)**
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
> For details about other modular compilation operations, see [Building a Standard System](../subsystems/subsys-build-standard-large.md). > For details about other modular compilation operations, see [Building a Standard System](../subsystems/subsys-build-standard-large.md).
## Configuring the Proxy ## Configuring the Proxy<a name="section6204129143010"></a>
### Setting Up the Python Proxy ### Setting Up the Python Proxy
......
# Obtaining Source Code<a name="EN-US_TOPIC_0000001177086414"></a>
## Prerequisites<a name="section21887149017"></a>
1. Register your account with Gitee.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
```
4. Run the following commands to install the **repo** tool:
```
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
chmod a+x /usr/local/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
```
## How to Obtain<a name="section349724435812"></a>
>![](../public_sys-resources/icon-note.gif) **NOTE**<br/>
>Download the master code if you want to get quick access to the latest features for your development. Download the release code, which is more stable, if you want to develop commercial functionalities.
- **Obtaining OpenHarmony master code**
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
```
repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
Method 2: Use the **repo** tool to download the source code over HTTPS.
```
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
- **Obtaining OpenHarmony release code**
For details about how to obtain the source code of an OpenHarmony release, see the [Release-Notes](../get-code/../../release-notes/Readme.md).
# FAQs<a name="EN-US_TOPIC_0000001128470856"></a>
## "Error: Opening COMxx: Access denied" Is Displayed After a Serial Port Is Selected for Burning<a name="section627268185113"></a>
- **Symptom**
**Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port.
![](figures/failed-to-open-the-serial-port.png)
- **Possible Causes**
The serial port has been used.
- Solution
The serial port may be in use. Perform the following steps to troubleshoot:
1. Search for the serial port from the drop-down list in the **TERMINAL** panel.
![](figures/terminal-list.png)
2. Click the dustbin for the terminal using the serial port to disable the terminal.
## What should I do when Windows-based PC failed to be connected to the board?<a name="section195391036568"></a>
- **Symptom**
The file image cannot be obtained after clicking **Burn** and selecting a serial port.
**Figure 1** Failed to obtain the image file due to unavailable connection<a name="fig135261439195819"></a>
![](figures/failed-to-obtain-the-image-file-due-to-unavailable-connection.png "failed-to-obtain-the-image-file-due-to-unavailable-connection")
- **Possible Causes**
The board is disconnected from the Windows-based PC.
Windows Firewall does not allow Visual Studio Code to access the network.
- **Solutions**
1. Check whether the network cable is properly connected.
2. Click **Windows Firewall**.
![](figures/hi3516-network-and-firewall-setting.png)
3. Click **Firewall & network protection**, and on the displayed page, click **Allow applications to communicate through Windows Firewall**.
![](figures/hi3516-firewall-and-network-protection.png)
4. Select the Visual Studio Code application.
![](figures/hi3516-selecting-the-visual-studio-code-application.png)
5. Select the **Private** and **Public** network access rights for the Visual Studio Code application.
![](figures/hi3516-allowing-the-visual-studio-code-application-to-access-the-network.png)
## What should I do when the image failed to be burnt?<a name="section571164016565"></a>
- **Symptom**
The burning status is not displayed after clicking **Burn** and selecting a serial port.
- **Possible Causes**
The IDE is not restarted after the DevEco plug-in is installed.
- **Solutions**
Restart the IDE.
## What should I do when the message indicating Python cannot be found is displayed during compilation and building?<a name="section1039835245619"></a>
- **Symptom**
![](figures/symptom-for-not-finding-python.png)
- **Possible Cause 1**: Python is not installed.
- **Solutions**
[Install Python](../quick-start/quickstart-lite-env-setup-linux.md).
- **Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory.
![](figures/reason-for-not-finding-python.png)
- **Solutions**
Run the following commands:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
Example:
![](figures/solution.png)
## What should I do when no command output is displayed?<a name="section14871149155911"></a>
- **Symptom**
The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when you press **Enter**.
- **Possible Cause 1**
The serial port is connected incorrectly.
- **Solutions**
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 the serial ports are different, perform step 1 in the **Running an Image** section to change the serial port number.
- **Possible Cause 2**
The U-Boot of the board is damaged.
- **Solutions**
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 two boards can be obtained from the following paths, respectively.
>Hi3516D V300: **device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin**
>Hi3518E V300: **device\\hisilicon\\hispark\_aries\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3518ev300.bin**
2. Burn the U-Boot file by following the procedures for burning a U-Boot file over USB.
Select the U-Boot files of corresponding development boards for burning by referring to [Programming Flash Memory on the Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681)/[Programming Flash Memory on the Hi3518](https://device.harmonyos.com/en/docs/ide/user-guides/hi3518_upload-0000001057313128)
3. Log in to the serial port after the burning is complete.
**Figure 2** Serial port displayed after the U-Boot is burnt<a name="en-us_topic_0000001053466255_fig155914681910"></a>
![](figures/serial-port-displayed-after-the-u-boot-is-burnt.png "serial-port-displayed-after-the-u-boot-is-burnt")
# FAQs<a name="EN-US_TOPIC_0000001128311064"></a>
## "Error: Opening COMxx: Access denied" Is Displayed After a Serial Port Is Selected for Burning<a name="section1498892119619"></a>
- **Symptom**
**Error: Opening COMxx: Access denied** is displayed after clicking **Burn** and selecting a serial port.
![](figures/failed-to-open-the-serial-port.png)
- **Possible Causes**
The serial port has been used.
- Solution
The serial port may be in use. Perform the following steps to troubleshoot:
1. Search for the serial port from the drop-down list in the **TERMINAL** panel.
![](figures/terminal-list.png)
2. Click the dustbin for the terminal using the serial port to disable the terminal.
## What should I do when Windows-based PC failed to be connected to the board?<a name="section8512971816"></a>
- **Symptom**
The file image cannot be obtained after clicking **Burn** and selecting a serial port.
**Figure 1** Failed to obtain the image file due to unavailable connection<a name="en-us_topic_0000001053466255_fig5218920223"></a>
![](figures/failed-to-obtain-the-image-file-due-to-unavailable-connection-0.png "failed-to-obtain-the-image-file-due-to-unavailable-connection-0")
- **Possible Causes**
The board is disconnected from the Windows-based PC.
Windows Firewall does not allow Visual Studio Code to access the network.
- **Solutions**
1. Check whether the network cable is properly connected.
2. Click **Windows Firewall**.
![](figures/hi3518-network-and-firewall-setting.png)
3. Click **Firewall & network protection**, and on the displayed page, click **Allow applications to communicate through Windows Firewall**.
![](figures/hi3518-firewall-and-network-protection.png)
4. Select the Visual Studio Code application.
![](figures/hi3518-selecting-the-visual-studio-code-application.png)
5. Select the **Private** and **Public** network access rights for the Visual Studio Code application.
![](figures/hi3518-allowing-the-visual-studio-code-application-to-access-the-network.png)
## What should I do when the image failed to be burnt?<a name="section1767804111198"></a>
- **Symptom**
The burning status is not displayed after clicking **Burn** and selecting a serial port.
- **Possible Causes**
The IDE is not restarted after the DevEco plug-in is installed.
- **Solutions**
Restart the IDE.
## What should I do when the message indicating Python cannot be found is displayed during compilation and building?<a name="en-us_topic_0000001053466255_section1039835245619"></a>
- **Symptom**
![](figures/hi3518-error-for-not-finding-python.png)
- **Possible Cause 1**
Python is not installed.
- **Solutions**
[Install Python](../quick-start/quickstart-lite-env-setup-linux.md).
- **Possible Cause 2**: The soft link that points to the Python does not exist in the usr/bin directory.
![](figures/hi3518-reason-no-python-soft-link.png)
- **Solutions**
Run the following commands:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
Example:
![](figures/hi3518-solution-set-python-soft-link.png)
## What should I do when no command output is displayed?<a name="en-us_topic_0000001053466255_section14871149155911"></a>
- **Symptom**
The serial port shows that the connection has been established. After the board is restarted, nothing is displayed when you press **Enter**.
- **Possible Cause 1**
The serial port is connected incorrectly.
- **Solutions**
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 the serial ports are different, perform step 1 in the **Running an Image** section to change the serial port number.
- **Possible Cause 2**
The U-Boot of the board is damaged.
- **Solutions**
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 two boards can be obtained from the following paths, respectively.
>Hi3516D V300: **device\\hisilicon\\hispark\_taurus\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3516dv300.bin**
>Hi3518E V300: **device\\hisilicon\\hispark\_aries\\sdk\_liteos\\uboot\\out\\boot\\u-boot-hi3518ev300.bin**
2. Burn the U-Boot file by following the procedures for burning a U-Boot file over USB.
Select the U-Boot files of corresponding development boards for burning by referring to [Programming Flash Memory on the Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681)/[Programming Flash Memory on the Hi3518](https://device.harmonyos.com/en/docs/ide/user-guides/hi3518_upload-0000001057313128)
3. Log in to the serial port after the burning is complete.
![](figures/login-serial-port.png)
# Running a Hello OHOS Program<a name="EN-US_TOPIC_0000001174350607"></a>
This section describes how to create, compile, burn, and run the first program, and finally print **Hello OHOS!** on the develop board.
## Creating a Program<a name="section1550972416485"></a>
1. Create a directory and the program source code.
Create the **applications/sample/camera/apps/src/helloworld.c** directory and file whose code is shown in the following example. You can customize the content to be printed. For example, you can change **OHOS** to **World**. You can use either C or C++ to develop a program.
```
#include <stdio.h>
int main(int argc, char **argv)
{
printf("\n************************************************\n");
printf("\n\t\tHello OHOS!\n");
printf("\n************************************************\n\n");
return 0;
}
```
2. Create a build file.
Create the **applications/sample/camera/apps/BUILD.gn** file. The file content is as follows:
```
import("//build/lite/config/component/lite_component.gni")
lite_component("hello-OHOS") {
features = [ ":helloworld" ]
}
executable("helloworld") {
output_name = "helloworld"
sources = [ "src/helloworld.c" ]
include_dirs = []
defines = []
cflags_c = []
ldflags = []
}
```
3. Add a component.
Add the configuration of the **hello\_world\_app** component to the **build/lite/components/applications.json** file. The sample code below shows some configurations defined in the **applications.json** file, and the code between **"\#\#start\#\#"** and **"\#\#end\#\#"** is the new configuration \(Delete the rows where **"\#\#start\#\#"** and **"\#\#end\#\#"** are located after the configurations are added.\)
```
{
"components": [
{
"component": "camera_sample_communication",
"description": "Communication related samples.",
"optional": "true",
"dirs": [
"applications/sample/camera/communication"
],
"targets": [
"//applications/sample/camera/communication:sample"
],
"rom": "",
"ram": "",
"output": [],
"adapted_kernel": [ "liteos_a" ],
"features": [],
"deps": {
"components": [],
"third_party": []
}
},
##start##
{
"component": "hello_world_app",
"description": "Communication related samples.",
"optional": "true",
"dirs": [
"applications/sample/camera/apps"
],
"targets": [
"//applications/sample/camera/apps:hello-OHOS"
],
"rom": "",
"ram": "",
"output": [],
"adapted_kernel": [ "liteos_a" ],
"features": [],
"deps": {
"components": [],
"third_party": []
}
},
##end##
{
"component": "camera_sample_app",
"description": "Camera related samples.",
"optional": "true",
"dirs": [
"applications/sample/camera/launcher",
"applications/sample/camera/cameraApp",
"applications/sample/camera/setting",
"applications/sample/camera/gallery",
"applications/sample/camera/media"
],
```
4. Modify the board configuration file.
Add the **hello\_world\_app** component to the **vendor/hisilicon/hispark\_aries/config.json** file. The sample code below shows the configurations of the **applications** subsystem, and the code between **\#\#start\#\#** and **\#\#end\#\#** is the new configuration \(Delete the rows where **\#\#start\#\#** and **\#\#end\#\#** are located after the configurations are added.\)
```
{
"subsystem": "applications",
"components": [
##start##
{ "component": "hello_world_app", "features":[] },
##end##
{ "component": "camera_sample_app", "features":[] }
]
},
```
## Building<a name="section234175193114"></a>
If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315). If the Linux environment is installed using a software package, go to the root directory of the source code and run the following commands for source code compilation:
```
hb set (Set the building path.)
. (Select the current path.)
Select ipcamera_hispark_aries@hisilicon and press Enter.
hb build -f (Start building.)
```
The result files are generated in the **out/hispark\_aries/ipcamera\_hispark\_aries** directory.
**Figure 1** Hi3518 settings<a name="fig12982192583111"></a>
![](figures/hi3518-settings.png "hi3518-settings")
>![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>The U-Boot file of the Hi3518E V300 development board can be obtained from the following path: device/hisilicon/hispark\_aries/sdk\_liteos/uboot/out/boot/u-boot-hi3518ev300.bin
## Burning<a name="section7609155824819"></a>
Burning is the process of downloading compiled program files to a chipset development board to provide a basis for subsequent debugging. With the one-click burning function of DevEco Device Tool, you can burn development boards quickly and efficiently.
You can burn the Hi3518E V300 development board through the USB port or serial port.
- **Windows system: Supports burning through the USB port or serial port**
- **Linux system: Supports burning through the serial port \(Linux+Windows dual system: Supports burning through the serial port or USB port\)**
Except for environment setup, the operations of burning are the same for Windows and Linux.
The following uses the USB port burning as an example.
1. Connect the PC and the target development board through the serial port and USB port. For details, see [Introduction to the Hi3518 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3518-0000001105201138).
2. <a name="en-us_topic_0000001057313128_li46411811196"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695).
![](figures/hi3518-record-the-serial-port-number.png)
3. Open DevEco Device Tool, choose **QUICK ACCESS** \> **DevEco Home** \> **Projects**, and then click **Settings**.
![](figures/hi3518-deveco-device-tool-setting.png)
4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the file to be burnt is obtained by copying, you must manually change the path of the file to be burnt: Click the tab of the file to be burnt, select **Partition\_bin** from the **New Option** drop-down list box in **Partition Settings**, and set the path of the file to be burnt in **Partition\_bin**.
5. On the **hi3518ev300** tab page, set the burning options.
- **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001057313128_li46411811196).
- **upload\_protocol**: Select the burning protocol **hiburn-usb**.
- **upload\_partitions**: Select the files to be burnt. By default, the **fastboot**, **kernel**, **rootfs**, and **userfs** files are burnt at the same time.
![](figures/upload-options.png)
6. When you finish modifying, click **Save** in the upper right corner.
7. Open the project file, go to ![](figures/hi3518-deveco-device-tool-logo.png) \> **PROJECT TASKS** \> **hi3518ev300\_fastboot** \> **Erase** to erase U-Boot.
![](figures/erase-u-boot.png)
8. When the following message is displayed, power off the development board and then power it on.
![](figures/hi3518-restart-the-development-board.png)
9. If the following message is displayed, it indicates that U-Boot is erased successfully.
![](figures/u-boot-erased-successfully.png)
10. Go to **hi3518ev300** \> **Upload** to start burning.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If this is the first time you burn the Hi3516D V300 or Hi3518E V300 board, the message "not find the Devices" may be displayed. In this case, follow the steps in [Installing the USB Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/usb_driver-0000001058690393) and start burning again.
![](figures/hi3518-upload.png)
11. If the following message is displayed, it indicates that the burning is successful.
![](figures/hi3518-burning-succeeded.png)
12. When the burning is successful, perform the operations in Running an Image to start the system.
## Running an Image<a name="section17612105814480"></a>
After burning is completed, you need to configure the bootloader to run the OpenHarmony system.
1. In the Hi3518E V300 task, click **Configure bootloader \(Boot OS\)** to configure the bootloader.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>The bootloader configuration in DevEco Device Tool has been adapted to Hi3518E V300. Therefore, no manual modification is needed.
![](figures/hi3518-bootloader.png)
2. When the message shown below is displayed, restart the development board. If **SUCCESS** is displayed, it indicates that the configuration is successful.
![](figures/hi3518-reset-success.png)
3. Click **Monitor** on the taskbar to start the serial port tool.
![](figures/hi3518-monitor.png)
4. Follow the onscreen instructions until **OHOS \#** is displayed, indicating that the system is started successfully.
![](figures/hi3518-reboot-success.png)
## Follow-up Learning<a name="section9712145420182"></a>
Congratulations! You have finished all steps! You are advised to go on learning how to develop [Cameras with a Screen](../guide/device-iotcamera.md).
# Setting Up the Environment<a name="EN-US_TOPIC_0000001128470862"></a>
## Environment Requirements<a name="section1724111409282"></a>
### Hardware<a name="section487353718276"></a>
- Hi3518E V300 IoT camera development board
- USB-to-serial cable and network cable \(The Windows workstation is connected to the Hi3518E V300 development board through the USB-to-serial cable and network cable.\)
The following figure shows the hardware connections.
**Figure 1** Hi3518 hardware connections<a name="fig145521530134016"></a>
![](figures/hi3518-hardware-connections.png "hi3518-hardware-connections")
### Software<a name="section17315193935817"></a>
>![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>This section describes how to use an installation package to set up the compilation and development environment. If you are going to use Docker to set up the environment, skip this section and [Installing Linux Build Tools](#section8831868501).
The following table describes the tools required for setting up the general environment for a Linux server of the Hi3518 development board and how to obtain these tools.
**Table 1** Development tools and obtaining methods
<a name="table15485545145811"></a>
<table><thead align="left"><tr id="row1748610451588"><th class="cellrowborder" valign="top" width="23.332333233323332%" id="mcps1.2.4.1.1"><p id="p13486154545816"><a name="p13486154545816"></a><a name="p13486154545816"></a>Development Tool</p>
</th>
<th class="cellrowborder" valign="top" width="14.65146514651465%" id="mcps1.2.4.1.2"><p id="p44867452589"><a name="p44867452589"></a><a name="p44867452589"></a>Description</p>
</th>
<th class="cellrowborder" valign="top" width="62.016201620162015%" id="mcps1.2.4.1.3"><p id="p1748619458583"><a name="p1748619458583"></a><a name="p1748619458583"></a>How to Obtain</p>
</th>
</tr>
</thead>
<tbody><tr id="row18630134151917"><td class="cellrowborder" valign="top" width="23.332333233323332%" headers="mcps1.2.4.1.1 "><p id="p1563113417199"><a name="p1563113417199"></a><a name="p1563113417199"></a>bash</p>
</td>
<td class="cellrowborder" valign="top" width="14.65146514651465%" headers="mcps1.2.4.1.2 "><p id="p463193418190"><a name="p463193418190"></a><a name="p463193418190"></a>Processes CLI commands.</p>
</td>
<td class="cellrowborder" valign="top" width="62.016201620162015%" headers="mcps1.2.4.1.3 "><p id="p1063118344191"><a name="p1063118344191"></a><a name="p1063118344191"></a>System configuration</p>
</td>
</tr>
<tr id="row7598468212"><td class="cellrowborder" valign="top" width="23.332333233323332%" headers="mcps1.2.4.1.1 "><p id="p659815642111"><a name="p659815642111"></a><a name="p659815642111"></a>Basic software package for compilation and building (required only for Ubuntu 20+)</p>
</td>
<td class="cellrowborder" valign="top" width="14.65146514651465%" headers="mcps1.2.4.1.2 "><p id="p137174662119"><a name="p137174662119"></a><a name="p137174662119"></a>Provides a basic software package for compilation and building.</p>
</td>
<td class="cellrowborder" valign="top" width="62.016201620162015%" headers="mcps1.2.4.1.3 "><p id="p125983652118"><a name="p125983652118"></a><a name="p125983652118"></a>Internet</p>
</td>
</tr>
<tr id="row08231641105420"><td class="cellrowborder" valign="top" width="23.332333233323332%" headers="mcps1.2.4.1.1 "><p id="p1682494111548"><a name="p1682494111548"></a><a name="p1682494111548"></a>dosfstools, mtools, and mtd-utils</p>
</td>
<td class="cellrowborder" valign="top" width="14.65146514651465%" headers="mcps1.2.4.1.2 "><p id="p1362445934918"><a name="p1362445934918"></a><a name="p1362445934918"></a>Pack files.</p>
</td>
<td class="cellrowborder" valign="top" width="62.016201620162015%" headers="mcps1.2.4.1.3 "><p id="p1262475944916"><a name="p1262475944916"></a><a name="p1262475944916"></a>apt-get install</p>
</td>
</tr>
</tbody>
</table>
## Installing Linux Build Tools<a name="section8831868501"></a>
>![](../public_sys-resources/icon-notice.gif) **NOTICE:**
>- If you acquire the source code using an HPM component or HPM CLI tool, you do not need to install **hc-gen**.
>- \(Recommended\) If you obtain the source code via the mirror site or code repository, install **hc-gen**. When installing the compilation tool, ensure that its environment variable path is unique.
### Changing Linux Shell to Bash<a name="section434110241084"></a>
Check whether bash is used as the shell.
```
ls -l /bin/sh
```
If **/bin/sh -\> bash** is not displayed, do as follows to change shell to bash.
**Method 1:** Run the following command on the device and then click **No**.
```
sudo dpkg-reconfigure dash
```
**Method 2:** Run the first command to delete **sh** and then run the second command to create a new soft link.
```
sudo rm -rf /bin/sh
sudo ln -s /bin/bash /bin/sh
```
### Installing Basic Software Used for Compilation and Building \(Required Only for Ubuntu 20+\)<a name="section25911132141020"></a>
Install the software.
```
sudo apt-get install build-essential gcc g++ make zlib* libffi-dev
```
### Installing File Packing Tools<a name="section390214473129"></a>
1. Start a Linux server.
2. Install dosfstools, mtools, and mtd-utils.
```
sudo apt-get install dosfstools mtools mtd-utils
```
# Hi3518<a name="EN-US_TOPIC_0000001128311052"></a>
- **[Setting Up the Environment](quickstart-lite-steps-hi3518-setting.md)**
- **[Running a Hello OHOS Program](quickstart-lite-steps-hi3518-running.md)**
- **[FAQs](quickstart-lite-steps-hi3518-faqs.md)**
# Setting Up WLAN Connection<a name="EN-US_TOPIC_0000001174350611"></a>
This example shows how to connect the WLAN module to the gateway using attention \(AT\) commands.
## Building Source Code<a name="section191121332125319"></a>
This section describes how to perform the WLAN module building on a Linux server.
If the Linux environment is installed using Docker, perform the building by referring to [Using Docker to Prepare the Build Environment](../get-code/gettools-acquire.md#section107932281315). If the Linux environment is installed using a software package, perform the following steps:
1. Open the HUAWEI DevEco Device Tool and choose **View** \> **Terminal**.
**Figure 1** Starting the IDE terminal tool<a name="fig755583241511"></a>
![](figures/starting-the-ide-terminal-tool.png "starting-the-ide-terminal-tool")
On the **TERMINAL** panel, run the ssh command, for example, **ssh** **_user_@_ipaddr_**, to connect to the Linux server.
**Figure 2** TERMINAL panel<a name="fig14407256101510"></a>
![](figures/terminal-panel.png "terminal-panel")
2. Go to the root directory of the code, run the **hb set** and **.** commands on the **TERMINAL** panel, and select the **wifiiot\_hispark\_pegasus** version.
**Figure 3** Selecting the target build version<a name="fig191035701814"></a>
![](figures/selecting-the-target-build-version.png "selecting-the-target-build-version")
3. Run the **hb build** command to start building.
**Figure 4** Running commands on the TERMINAL panel<a name="fig10635942111916"></a>
![](figures/running-commands-on-the-terminal-panel.png "running-commands-on-the-terminal-panel")
4. Check whether the building is successful. If yes, **wifiiot\_hispark\_pegasus build success** will be displayed, as shown in the following figure.
**Figure 5** Successful building<a name="fig195291328182015"></a>
![](figures/successful-building.png "successful-building")
5. Check whether the following files are generated in the **./out/wifiiot/** directory.
```
ls -l out/hispark_pegasus/wifiiot_hispark_pegasus/
```
**Figure 6** Directory for storing the generated files<a name="fig112257131214"></a>
![](figures/directory-for-storing-the-generated-files.png "directory-for-storing-the-generated-files")
## Burning Images<a name="section3288165814218"></a>
Burning is the process of downloading compiled program files to a chipset development board to provide a basis for subsequent debugging. With the one-click burning function of DevEco Device Tool, you can burn development boards quickly and efficiently.
**You can burn to the Hi3861 V100 development board through the serial port using the burn-serial or hiburn-serial protocol. The hiburn-serial protocol is applicable to both Windows and Linux systems, while the burn-serial is applicable to Linux only.**
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>The burn-serial protocol is used for compatibility with the projects of historical versions. It does not differ from hiburn-serial in operations.
The operations for burning in Windows and Linux are the same. The only difference lies in the environment setup for DevEco Device Tool.
1. Connect the PC and the target development board through the USB port. For details, see [Introduction to the Hi3861 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3861-0000001105041324).
2. <a name="en-us_topic_0000001056563976_li848662117291"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3861 Series Development Board](https://device.harmonyos.com/en/docs/ide/user-guides/hi3861-drivers-0000001058153433).
![](figures/hi3861-record-the-serial-port-number.png)
3. Open DevEco Device Tool, choose **QUICK ACCESS** \> **DevEco Home** \> **Projects**, and then click **Settings**.
![](figures/hi3861-deveco-device-tool-setting.png)
4. On the **Partition Configuration** tab page, modify the settings. In general cases, you can leave the fields at their default settings.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the file to be burnt is obtained by copying, you must manually change the path of the file to be burnt: Click the tab of the file to be burnt, select **Partition\_bin** from the **New Option** drop-down list box in **Partition Settings**, and set the path of the file to be burnt in **Partition\_bin**.
5. On the **hi3861** tab page, set the burning options.
- **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001056563976_li848662117291).
- **upload\_protocol**: Select the burning protocol. For Windows, set this parameter to **burn-serial** or **hiburn-serial**. For Linux, set this parameter to **hiburn-serial**.
- **upload\_partitions**: Select the files to be burnt. **hi3861\_app** is selected by default.
![](figures/options.png)
6. When you finish modifying, click **Save** in the upper right corner.
7. Open the project file. In the DevEco Device Tool window, go to **PROJECT TASKS** \> **hi3861** \> **Upload** to start burning.
![](figures/hi3861-upload.png)
8. When the following information is displayed, press the RST button on the development board to restart it.
![](figures/hi3861-restart-the-development-board.png)
9. If the following message is displayed, it indicates that the burning is successful.
![](figures/hi3861-burning-succeeded.png)
## Connecting WLAN Module to the Internet.<a name="section194671619167"></a>
After completing version building and burning, do as follows to connect the WLAN module to the Internet using AT commands.
1. Click the icon of **DevEco: Serial Monitor** at the bottom of DevEco Studio to keep the connection between the Windows workstation and the WLAN module.
**Figure 7** Opening the DevEco serial port<a name="fig464411253297"></a>
![](figures/opening-the-deveco-serial-port.png "opening-the-deveco-serial-port")
2. Reset the WLAN module. The message **ready to OS start** is displayed on the **TERMINAL** panel, indicating that the WLAN module is started successfully.
**Figure 8** Successful resetting of the WLAN module <a name="fig3327108143016"></a>
![](figures/successful-resetting-of-the-wlan-module.png "successful-resetting-of-the-wlan-module")
3. Run the following AT commands in sequence via the DevEco serial port terminal to start the STA mode, connect to the specified AP, and enable Dynamic Host Configuration Protocol \(DHCP\).
```
AT+STARTSTA # Start the STA mode.
AT+SCAN # Scan for available APs.
AT+SCANRESULT # Display the scanning result.
AT+CONN="SSID",,2,"PASSWORD" # Connect to the specified AP. (SSID and PASSWORD represent the name and password of the hotspot to be connected, respectively.)
AT+STASTAT # View the connection result.
AT+DHCP=wlan0,1 # Request the IP address of wlan0 from the AP using DHCP.
```
4. Check whether the WLAN module is properly connected to the gateway, as shown in the following figure.
```
AT+IFCFG # View the IP address assigned to an interface of the module.
AT+PING=X.X.X.X # Check the connectivity between the module and the gateway. Replace X.X.X.X with the actual gateway address.
```
**Figure 9** Successful networking of the WLAN module<a name="fig7672858203010"></a>
![](figures/successful-networking-of-the-wlan-module.png "successful-networking-of-the-wlan-module")
# FAQs<a name="EN-US_TOPIC_0000001128311054"></a>
## What should I do when the message **configure: error: no acceptable C compiler found in $PATH** is displayed during Python 3 installation?<a name="section1221016541119"></a>
- **Symptom**
The following error occurs during Python 3 installation:
```
configure: error: no acceptable C compiler found in $PATH. See 'config.log' for more details
```
- **Possible Causes**
**GCC** is not installed.
- **Solutions**
1. Run the **apt-get install gcc** command to install **GCC** online.
2. After the installation, reinstall Python 3.
## What should I do when the message **-bash: make: command not found** is displayed during Python 3 installation?<a name="section1913477181213"></a>
- **Symptom**
The following error occurs during Python 3 installation:
```
-bash: make: command not found
```
- **Possible Causes**
**Make** is not installed.
- **Solutions**
1. Run the **apt-get install make** command to install **Make** online.
2. After the installation, reinstall Python 3.
## What should I do when the message **zlib not available** is displayed during Python 3 installation?<a name="section108211415131210"></a>
- **Symptom**
The following error occurs during Python 3 installation:
```
zipimport.ZipImportError: can't decompress data; zlib not available
```
- **Possible Causes**
**zlib** is not installed.
- **Solutions**
Solution 1: Run the **apt-get install zlib** command to install **zlib** online.
Solution 2: If the software source does not contain **zlib**, download the source code from [http://www.zlib.net/](http://www.zlib.net/).
![](figures/download-zlib.png)
Then run the following commands to install **zlib** offline:
```
# tar xvf zlib-1.2.11.tar.gz
# cd zlib-1.2.11
# ./configure
# make && make install
```
After the installation, reinstall Python 3.
## What should I do when the message **No module named '\_ctypes'** is displayed during Python 3 installation?<a name="section2062268124"></a>
- **Symptom**
The following error occurs during Python 3 installation:
```
ModuleNotFoundError: No module named '_ctypes'
```
- **Possible Causes**
**libffi** and **libffi-devel** are not installed.
- **Solutions**
1. Run the **apt-get install libffi\* -y** command to install **libffi** and **libffi-devel** online.
2. After the installation, reinstall Python 3.
## What should I do when the message **No module named 'Crypto'** is displayed during compilation and building?<a name="section982315398121"></a>
- **Symptom**
The following error occurs during compilation and building:
```
ModuleNotFoundError: No module named 'Crypto'
```
- **Possible Causes**
**Crypto** is not installed.
- **Solutions**
Solution 1: Run the **pip3 install Crypto** command to install **Crypto** online.
Solution 2: Install **Crypto** offline.
- Download the source code from [https://pypi.org/project/pycrypto/\#files](https://pypi.org/project/pycrypto/#files).
![](figures/download-the-source-code.png)
- Save the source code package to the Linux server, decompress the package, and run the **python3 setup.py install** command to install **Crypto**.
- Rebuild an environment.
## What should I do when the message **No module named 'ecdsa'** is displayed during compilation and building?<a name="section102035451216"></a>
- **Symptom**
The following error occurs during compilation and building:
```
ModuleNotFoundError: No module named 'ecdsa'
```
- **Possible Causes**
**ecdsa** is not installed.
- **Solutions**
Solution 1: Run the **pip3 install ecdsa** command to install **ecdsa** online.
Solution 2: Install **ecdsa** offline.
- Download the installation package from [https://pypi.org/project/ecdsa/\#files](https://pypi.org/project/ecdsa/#files).
![](figures/download-ecdsa.png)
- Save the installation package to the Linux server and run the **pip3 install ecdsa-0.15-py2.py3-none-any.whl** command to install **ecdsa**.
- Rebuild an environment.
## What should I do when the message **Could not find a version that satisfies the requirement six\>=1.9.0** is displayed during compilation and building?<a name="section4498158162320"></a>
- **Symptom**
The following error occurs during compilation and building:
```
Could not find a version that satisfies the requirement six>=1.9.0
```
- **Possible Causes**
**six** is not installed.
- **Solutions**
Solution 1: Run the **pip3 install six** command to install **six** online.
Solution 2: Install **six** offline.
- Download the installation package from [https://pypi.org/project/six/\#files](https://pypi.org/project/six/#files).
![](figures/download-six.png)
- Save the source code to the Linux server and run the **pip3 install six-1.14.0-py2.py3-none-any.whl** command to install **six**.
- Rebuild an environment.
## What should I do when the message **cannot find -lgcc** is displayed during compilation and building?<a name="section11181036112615"></a>
- **Symptom**
The following error occurs during compilation and building:
```
riscv32-unknown-elf-ld: cannot find -lgcc
```
- **Possible Causes**
The PATH is incorrectly written by **gcc\_riscv32**. There is an extra slash \(/\).
```
~/gcc_riscv32/bin/:/data/toolchain/
```
- **Solutions**
Modify the PATH by deleting the slash \(/\).
```
~/gcc_riscv32/bin:/data/toolchain/
```
## What should I do when the message indicating Python cannot be found is displayed during compilation and building?<a name="section1571810194619"></a>
- **Symptom**
The following error occurs during compilation and building:
```
-bash: /usr/bin/python: No such file or directory
```
- **Possible Cause 1:** Python is not installed.
- **Solutions**
[Install Python](../quick-start/quickstart-lite-env-setup-linux.md).
- **Possible Cause 2:** The soft link that points to the Python does not exist in the **usr/bin** directory.
![](figures/reason-no-python-soft-link.png)
- **Solutions**
Run the following commands to add a soft link:
```
# cd /usr/bin/
# which python3
# ln -s /usr/local/bin/python3 python
# python --version
```
Example:
![](figures/solution-add-soft-link.png)
## What should I do when the message indicating Python3 cannot be found is displayed during compilation and building?<a name="section108385316482"></a>
- **Symptom**
![](figures/11.png)
- **Possible Causes**
Python 3 is not installed.
- **Solutions**
[Install Python](../quick-start/quickstart-lite-env-setup-linux.md).
## What should I do when an error with **lsb\_release** occurs during **kconfiglib** installation?<a name="section691681635814"></a>
- **Symptom**
The following error occurs during **kconfiglib** installation:
```
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.
```
- **Possible Causes**
The Python version matched with the **lsb\_release** module is different from the current Python version.
- **Solutions**
Run the **find / -name lsb\_release** command, for example, **sudo rm -rf /usr/bin/lsb\_release** to locate and delete **lsb\_release**.
# Running a Hello World Program<a name="EN-US_TOPIC_0000001128311062"></a>
This example shows how to compile a simple service and print **Hello World** to help you preliminarily understand how to run OpenHarmony on Hi3861.
## Modifying Source Code<a name="section79601457101015"></a>
The source code needs to be modified when fixing bugs or compiling a new service. The following describes how to modify the source code when compiling a new service, for example, **my\_first\_app**.
1. Determine the directory structure.
Before compiling a service, you must create a directory \(or a directory structure\) in **./applications/sample/wifi-iot/app** to store source code files.
For example, add the **my\_first\_app** service to the **app** directory, where **hello\_world.c** is the service code and **BUILD.gn** is the compilation script. The directory structure is shown as follows:
```
.
└── applications
└── sample
└── wifi-iot
└── app
│── my_first_app
│ │── hello_world.c
│ └── BUILD.gn
└── BUILD.gn
```
2. Compile the service code.
Create the **hello\_world.c** file in **./applications/sample/wifi-iot/app/my\_first\_app**. Then, create the service entry function **HelloWorld** in **hello\_world.c** and implement service logic. Use the SYS\_RUN\(\) of the OpenHarmony **bootstrap** module to start services. \(**SYS\_RUN** is defined in the **ohos\_init.h** file.\)
```
#include <stdio.h>
#include "ohos_init.h"
#include "ohos_types.h"
void HelloWorld(void)
{
printf("[DEMO] Hello world.\n");
}
SYS_RUN(HelloWorld);
```
3. Compile the **BUILD.gn** file for building services into a static library.
Create the **BUILD.gn** file in **./applications/sample/wifi-iot/app/my\_first\_app** and fill in three parts \(target, source file, and header file path\) of the **BUILD.gn** file.
```
static_library("myapp") {
sources = [
"hello_world.c"
]
include_dirs = [
"//utils/native/lite/include"
]
}
```
- Specify the compilation result named libmyapp.a in **static\_library**. You can fill in this part based on your need.
- Specify the .c file on which a file depends and its path in **sources**. The path that contains **//** represents an absolute path \(the code root path\), otherwise it is a relative path.
- Specify the path of .h file on which **sources** depends in **include\_dirs**.
4. Compile the **BUILD.gn** file and specify the feature modules to be built.
Configure the **./applications/sample/wifi-iot/app/BUILD.gn** file and add an index to the **features** field to enable the target to be involved in compilation. Specify the path and target of a service module in **features**. The following uses **my\_first\_app** as an example and the **features** is configured as follows:
```
import("//build/lite/config/component/lite_component.gni")
lite_component("app") {
features = [
"my_first_app:myapp",
]
}
```
- **my\_first\_app** is a relative path that points to **./applications/sample/wifi-iot/app/my\_first\_app/BUILD.gn**.
- **myapp** represents the **static\_library\("myapp"\)** in **./applications/sample/wifi-iot/app/my\_first\_app/BUILD.gn**.
## Debugging and Verification<a name="section1621064881419"></a>
Currently, there are two debugging and verification methods: using printf to print logs and using ASM files to locate **panic** problems. You can select one of them based on your need.
As the service shown is simple, use the printf method. The following describes the two debugging methods.
### printf<a name="section5204547123316"></a>
Add the **printf** function to the code, which helps print data to the serial port. You can add log printing in key service paths or service exception locations, as shown in the following figure.
```
void HelloWorld(void)
{
printf("[DEMO] Hello world.\n");
}
```
### Locating Exceptions Using the ASM File<a name="section15919111423416"></a>
When the system exits abnormally, the call stack information about the abnormal exit is displayed on the serial port. The following is an example: You can locate the exception by parsing the exception stack information.
```
=======KERNEL PANIC=======
**********************Call Stack*********************
Call Stack 0 -- 4860d8 addr:f784c
Call Stack 1 -- 47b2b2 addr:f788c
Call Stack 2 -- 3e562c addr:f789c
Call Stack 3 -- 4101de addr:f78ac
Call Stack 4 -- 3e5f32 addr:f78cc
Call Stack 5 -- 3f78c0 addr:f78ec
Call Stack 6 -- 3f5e24 addr:f78fc
********************Call Stack end*******************
```
To parse the call stack information, the **Hi3861\_wifiiot\_app.asm** file is required. This file records the symbol addresses of the functions in the code in the flash memory and the disassembly information. The ASM file is built and output together with the version software package and is stored in the **./out/wifiiot/** directory.
1. \(Optional\) Save the call stack information to a TXT file for later editing.
2. Open the ASM file, search for the function address in each call stack, and list the corresponding function. Generally, you only need to find the functions matching the first several stacks to locate exceptions.
```
Call Stack 0 -- 4860d8 addr:f784c -- WadRecvCB
Call Stack 1 -- 47b2b2 addr:f788c -- wal_sdp_process_rx_data
Call Stack 2 -- 3e562c addr:f789c
Call Stack 3 -- 4101de addr:f78ac
Call Stack 4 -- 3e5f32 addr:f78cc
Call Stack 5 -- 3f78c0 addr:f78ec
Call Stack 6 -- 3f5e24 addr:f78fc
```
3. Based on the above call stack information, it can be determined that an exception occurs in the **WadRecvCB** function.
![](figures/wadrecvcb-function.png)
4. Check and modify the code.
## Viewing Execution Result<a name="section18115713118"></a>
After the sample code is compiled, burnt, run, and debugged, the following information is displayed on the serial port interface:
```
ready to OS start
FileSystem mount ok.
wifi init success!
[DEMO] Hello world.
```
## Follow-up Learning<a name="section9712145420182"></a>
Congratulations! You have finished all steps! You are advised to go on learning how to develop [WLAN-connected products](../guide/device-wlan.md).
# Burning Images<a name="EN-US_TOPIC_0000001153557088"></a>
Burning of a regular system requires DevEco Device Tool v2.2 Beta1 or later.
Hi3516D V300 supports burning of the standard system through the USB port, network port, or serial port, where:
- **Windows system: Supports burning through the USB port, serial port, or network port**
- **Linux system: Supports burning through the network port or serial port**
Except for environment setup, the operations of burning are the same for Windows and Linux.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>Currently, the Hi3516D V300 development board supports programming flash memory of the standard system through the USB port, network port, or serial port. This document uses the network port as an example. For details about programming flash memory over other ports, see [Programming Flash Memory on Hi3516D V300](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_upload-0000001052148681).
## Prerequisites<a name="section18547185418328"></a>
In DevEco Device Tool, select **Import Project** to open the folder where the target file is located. Set **MCU** to **Hi3516DV300** under **HiSilicon\_Arm\_Linux** and **Framework** to **Ohos-sources** or **Hpm**.
![](figures/hisilicon-arm-linux.png)
## Programming Flash Memory Through the Network Port<a name="section1965361953312"></a>
The Hi3516DV300 supports burning through the network port in Windows or Linux.
1. Connect the PC and the target development board through the serial port, network port, and power port. For details, see [Introduction to the Hi3516 Development Board](https://device.harmonyos.com/en/docs/start/introduce/oem_minitinier_des_3516-0000001152041033).
2. <a name="en-us_topic_0000001056443961_li1050616379507"></a>Open Device Manager, then check and record the serial port number corresponding to the development board.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the serial port number is not displayed correctly, follow the steps described in [Installing the Serial Port Driver on the Hi3516 or Hi3518 Series Development Boards](https://device.harmonyos.com/en/docs/ide/user-guides/hi3516_hi3518-drivers-0000001050743695).
![](figures/hi3516-record-the-serial-port-number.png)
3. Open DevEco Device Tool, choose **QUICK ACCESS** \> **DevEco Home** \> **Projects**, and then click **Settings**.
![](figures/hi3516-deveco-device-tool-setting.png)
4. On the **hi3516dv300** tab page, configure the burning options.
- **upload\_port**: Select the serial port number obtained in step [2](#en-us_topic_0000001056443961_li1050616379507).
- **upload\_protocol**: Select the burning protocol **hiburn-net**.
- **upload\_partitions**: Select the files to be burnt. By default, **fastboot**, **boot**, **updater**, **misc**, **system**, **vendor**, and **userdata** are burnt at the same time.
![](figures/upload-options-2.png)
5. <a name="en-us_topic_0000001056443961_li85106114532"></a>Check and set the IP address of the network adapter connected to the development board. For details, see [Setting the IP Address of the Network Port for Burning to Hi3516](https://device.harmonyos.com/en/docs/ide/user-guides/set_ipaddress-0000001141825075).
6. Set the IP address of the network port for burning:
- **upload\_net\_server\_ip**: Select the IP address set in step [5](#en-us_topic_0000001056443961_li85106114532), such as 192.168.1.2.
- **upload\_net\_client\_mask**: Set the subnet mask of the development board, such as 255.255.255.0. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 255.255.255.0.
- **upload\_net\_client\_gw**: Set the gateway of the development board, such as 192.168.1.1. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 192.168.1.1.
- **upload\_net\_client\_ip**: Set the IP address of the development board, such as 192.168.1.3. Once the **upload\_net\_server\_ip** field is set, this field will be automatically populated. Example: 192.168.1.3.
![](figures/ip-address-information-3.png)
7. When you finish modifying, click **Save** in the upper right corner.
8. Open the project file and go to ![](figures/2021-01-27_170334.png) \> **PROJECT TASKS** \> **hi3516dv300** \> **Upload** to start burning.
![](figures/en-us_image_0000001215342695.png)
9. When the following message is displayed, power off the development board and then power it on.
![](figures/hi3516-restart-the-development-board.png)
10. If the following message is displayed, it indicates that the burning is successful.
![](figures/hi3516-burning-succeeded-net.png)
11. When the burning is successful, perform the operations in [Running an Image](https://device.harmonyos.com/en/docs/start/introduce/quickstart-standard-running-0000001142160948) to start the system.
# Setting Up a Ubuntu Development Environment in Docker Mode<a name="EN-US_TOPIC_0000001119805112"></a>
The standard OpenHarmony system provides a Docker environment which encapsulates build tools.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>- Before using Docker, install it by following instructions in [Install Docker Engine on Ubuntu](https://docs.docker.com/engine/install/ubuntu/).
>- You can also use the [installation package](quickstart-standard-package-environment.md) to set up the Ubuntu development environment.
## Obtaining Standard-System Source Code<a name="section8761819202511"></a>
### Prerequisites<a name="section102871547153314"></a>
1. Register your account with Gitee.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
```
4. Run the following commands to install the **repo** tool:
```
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
chmod a+x /usr/local/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
```
### Procedure<a name="section429012478331"></a>
Two methods are provided for you to obtain the OpenHarmony master code. You are advised to create a new folder and run the related commands in this folder to download the source code. This folder will then be the root directory of the source code.
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
```
repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
Method 2: Use the **repo** tool to download the source code over HTTPS.
```
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
## Running prebuilts<a name="section0495320152619"></a>
Go to the root directory of the source code and run the following script to install the compiler and binary tool:
```
bash build/prebuilts_download.sh
```
By default, the downloaded prebuilts binary file is stored in **OpenHarmony\_2.0\_canary\_prebuilts** \(which is in the same directory as **OpenHarmony**\).
## Obtaining the Docker Environment<a name="section181431248132513"></a>
1. Obtain the Docker image.
```
docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
2. Go to the root directory of source code and run the following command to access the Docker build environment:
```
docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
## Building Source Code<a name="section92391739152318"></a>
1. Run the following script to start building for standard-system devices \(reference memory ≥ 128 MB\).
```
./build.sh --product-name {product_name} --ccache
```
**product\_name** indicates the platform supported by the current distribution, for example, Hi3516DV300 and rk3568.
Files generated during building are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
2. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md).
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>You can exit Docker by simply running the **exit** command.
...@@ -171,7 +171,7 @@ To remotely access the Ubuntu environment through Windows to perform operations ...@@ -171,7 +171,7 @@ To remotely access the Ubuntu environment through Windows to perform operations
### Installing Remote SSH ### Installing Remote SSH
1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us-cn_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace. 1. Open Visual Studio Code in Windows, click ![en-us_image_0000001239080359](figures/en-us_image_0000001239080359.png), and search for **remote-ssh** in the Extension Marketplace.
![en-us_image_0000001193920448](figures/en-us_image_0000001193920448.png) ![en-us_image_0000001193920448](figures/en-us_image_0000001193920448.png)
...@@ -311,7 +311,7 @@ hb is a compilation tool of OpenHarmony. To install hb in Ubuntu, perform the fo ...@@ -311,7 +311,7 @@ hb is a compilation tool of OpenHarmony. To install hb in Ubuntu, perform the fo
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> To install a proxy, see [Configuring a Proxy](../quick-start/quickstart-standard-reference.md#configuring-a-proxy). > To install a proxy, see [Configuring the Proxy](../quick-start/quickstart-standard-reference.md#section6204129143012).
1. Run the following command to install hb and update it to the latest version: 1. Run the following command to install hb and update it to the latest version:
......
# Setting Up a Ubuntu Development Environment Using the Installation Package<a name="EN-US_TOPIC_0000001119804790"></a>
## Installing Dependent Tools<a name="section18431165519244"></a>
The installation command is as follows:
```
sudo apt-get update && sudo apt-get install binutils git git-lfs gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z1-dev ccache libgl1-mesa-dev libxml2-utils xsltproc unzip m4 bc gnutls-bin python3.8 python3-pip ruby
```
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>The preceding command is applicable to Ubuntu 18.04. For other Ubuntu versions, modify the preceding installation command based on the installation package name. Python 3.7 or later is required. Python 3.8 is used as an example.
## Obtaining Standard-System Source Code<a name="section113751052102517"></a>
### Prerequisites<a name="section102871547153314"></a>
1. Register your account with Gitee.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
```
4. Run the following commands to install the **repo** tool:
```
curl -s https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
chmod a+x /usr/local/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
```
### Procedure<a name="section429012478331"></a>
Two methods are provided for you to obtain the OpenHarmony master code. You are advised to create a new folder and run the related commands in this folder to download the source code. This folder will then be the root directory of the source code.
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
```
repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
Method 2: Use the **repo** tool to download the source code over HTTPS.
```
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
## Running prebuilts<a name="section0495320152619"></a>
Go to the root directory of the source code and run the following script to install the compiler and binary tool:
```
bash build/prebuilts_download.sh
```
By default, the downloaded prebuilts binary file is stored in **OpenHarmony\_2.0\_canary\_prebuilts** \(which is in the same directory as **OpenHarmony**\).
## Building Source Code<a name="section1664835963517"></a>
Perform the following operations in the Linux environment:
1. Go to the root directory of the source code and run the following command to build the distribution.
```
./build.sh --product-name {product_name}
```
**product\_name** indicates the product supported by the current distribution, for example, **Hi3516DV300**.
2. Check the build result. After the build is complete, the following information is displayed in the log:
```
build system image successful.
=====build Hi3516DV300 successful.
```
Files generated during the build are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>For details about module-specific build operations, see [Building Guidelines](../subsystems/subsys-build-standard-large.md).
3. Burn the image. For details, see [Burning Images](quickstart-standard-burn.md).
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
``` ```
### Setting Up the npm Proxy ### Setting Up the npm Proxy<a name="section6204129143012"></a>
1. Create a proxy configuration file. 1. Create a proxy configuration file.
......
# Obtaining Source Code<a name="EN-US_TOPIC_0000001188523654"></a>
### Prerequisites<a name="section1787412417496"></a>
1. Register your account with Gitee.
2. Register an SSH public key for access to Gitee.
3. Install the [git client](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git) and [git-lfs](https://gitee.com/vcs-all-in-one/git-lfs?_from=gitee_search#downloading), and configure basic user information.
```
git config --global user.name "yourname"
git config --global user.email "your-email-address"
git config --global credential.helper store
```
4. Run the following commands to install the **repo** tool:
```
curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 -o /usr/local/bin/repo # If you do not have the access permission to this directory, download the tool to any other accessible directory and configure the directory to the environment variable.
chmod a+x /usr/local/bin/repo
pip3 install -i https://repo.huaweicloud.com/repository/pypi/simple requests
```
### How to Obtain<a name="section1715918316415"></a>
>![](../public_sys-resources/icon-note.gif) **NOTE**<br/>
>Download the master code if you want to get quick access to the latest features for your development. Download the release code, which is more stable, if you want to develop commercial functionalities.
- **Obtaining OpenHarmony master code**
Method 1 \(recommended\): Use the **repo** tool to download the source code over SSH. \(You must have registered an SSH public key for access to Gitee.\)
```
repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
Method 2: Use the **repo** tool to download the source code over HTTPS.
```
repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
- **Obtaining OpenHarmony release code**
For details about how to obtain the source code of an OpenHarmony release, see the [Release-Notes](../get-code/../../release-notes/Readme.md).
# Setting Up a Windows Development Environment<a name="EN-US_TOPIC_0000001216019037"></a>
System requirements:
- OS: 64-bit Windows 10
- User name: cannot contain Chinese characters
## Installing DevEco Device Tool<a name="en-us_topic_0000001058091994_section10761564496"></a>
DevEco Device Tool is installed in Visual Studio Code as a plug-in and depends on Python, Node.js, and HPM for running.
DevEco Device Tool supports integrated installation. The DevEco Device Tool setup wizard checks whether the adaptation versions of Visual Studio Code, Python, Node.js and HPM tools have been installed. If any of the tools is not installed, you'll be prompted to select the tool to be automatically installed.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>Before installing DevEco Device Tool, make sure the user name of the host does not contain Chinese characters. Otherwise, the **DevEco Home** page will be stuck loading and the DevEco Device Tool cannot work.
1. Log in to the [HarmonyOS Device website](https://device.harmonyos.com/cn/ide#download_beta) with your HUAWEI ID and download DevEco Device Tool V3.0 Beta1 or a later version. If you do not have a HUAWEI ID, [register](https://developer.huawei.com/consumer/en/doc/start/registration-and-verification-0000001053628148) one first.
2. Decompress the DevEco Device Tool package, double-click the installer, and then click **Next**.
3. Set the installation path of DevEco Device Tool and click **Next**.
4. When prompted, select the tools to be automatically installed and click **Next**.
![](figures/snap28.png)
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>When the setup wizard detects that a compatible Python version has been installed, it prompts you to select the installed Python version or download the recommended Python version.
5. In the dialog box shown below, click **Next** to download and install the tools.
![](figures/snap8.png)
6. In the displayed Python setup wizard, select **Add Python 3.8 to PATH** and click **Install Now**. After the installation is complete, click **Close**.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you have selected the compatible Python version installed on your device, the Python setup wizard will not be displayed. In this case, you skip this step.
>If DevEco Device Tool 2.1 Release is installed, the Python version must be 3.8.x. If DevEco Device Tool V3.0 Beta1 or a later version is installed, the Python version must be 3.8.x or 3.9.x.
![](figures/snap34.png)
7. In the Visual Studio Code setup wizard, install Visual Studio Code as prompted. During the installation, select **Add to PATH \(requires shell restart\)**.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you are using the correct version of Visual Studio Code, the Visual Studio Code setup wizard will not be displayed. In this case, you skip this step.
![](figures/snap33.png)
8. In the Node.js setup wizard, retain the default settings and click **Next** until **Finish** is displayed. During the installation, Node.js will automatically set the system Path environment variable to the installation directory of **node.exe**.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you are using the correct version of Node.js, the Node.js setup wizard will not be displayed. In this case, you skip this step.
9. Wait for the DevEco Device Tool setup wizard to automatically install the HPM and DevEco Device Tool. After the installation is complete, click **Finish** to close the setup wizard.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If you are using the correct version of HPM, the setup wizard does not download or install HPM.
10. Start Visual Studio Code. The C/C++ and CodeLLDB plug-ins on which DevEco Device Tool depends will be automatically installed. After the installation is complete, click ![](figures/button.png) on the left of Visual Studio Code to check whether C/C++, CodeLLDB, and DevEco Device Tool are included in the **INSTALLED** list.
>![](../public_sys-resources/icon-note.gif) **NOTE:**
>If the C/C++ and CodeLLDB plug-ins fail to be installed, DevEco Device Tool cannot run properly. To solve the issue, see [Installing the C/C++ and CodeLLDB Plug-ins Offline](https://device.harmonyos.com/en/docs/ide/user-guides/offline_plugin_install-0000001074376846).
![](figures/deveco-device-tool-install-sucessful.png)
...@@ -83,5 +83,5 @@ The following table lists the innerkits APIs provided by the signature verificat ...@@ -83,5 +83,5 @@ The following table lists the innerkits APIs provided by the signature verificat
### OpenHarmony Self-signed Application<a name="section167151429133312"></a> ### OpenHarmony Self-signed Application<a name="section167151429133312"></a>
To develop an OpenHarmony self-signed application, follow instructions provided in the guide of [_Configuring the OpenHarmony App Signature_](https://gitee.com/openharmony/docs/blob/master/en/application-dev/quick-start/configuring-openharmony-app-signature.md) : For details about how to develop an OpenHarmony self-signed application, see [Having Your App Automatically Signed](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-auto-configuring-signature-information-0000001271659465).
...@@ -34,16 +34,15 @@ PageAbility生命周期流转如下图所示: ...@@ -34,16 +34,15 @@ PageAbility生命周期流转如下图所示:
PageAbility提供命周期回调,开发者可以在`app.js/app.ets`中重写生命周期相关回调函数 。目前`app.js`环境中仅支持onCreate和onDestroy回调,`app.ets`环境支持全量生命周期回调。 PageAbility提供命周期回调,开发者可以在`app.js/app.ets`中重写生命周期相关回调函数 。目前`app.js`环境中仅支持onCreate和onDestroy回调,`app.ets`环境支持全量生命周期回调。
### 启动模式 ### 启动模式
ability支持单实例、多实例和指定实例3种启动模式。 ability支持单实例和多实例两种启动模式。
在config.json中通过launchType配置项,可以配置具体的启动模式,其中: 在config.json中通过launchType配置项,可以配置具体的启动模式,其中:
| 启动模式 | 描述 |说明 | | 启动模式 | 描述 |说明 |
| ----------- | ------- |---------------- | | ----------- | ------- |---------------- |
| standard | 多实例 | 每次startAbility都会启动一个新的实例 | | standard | 多实例 | 每次startAbility都会启动一个新的实例 |
| singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 | | singleton | 单实例 | 系统中只存在唯一一个实例,startAbility时,如果已存在,则复用系统中的唯一一个实例 |
| specified | 指定实例 | 运行时由ability内部业务决定是否创建多实例 |
缺省情况下是standard模式。 缺省情况下是singleton模式。
## 开发指导 ## 开发指导
### featureAbility接口说明 ### featureAbility接口说明
......
...@@ -578,6 +578,8 @@ ...@@ -578,6 +578,8 @@
- 资源调度 - 资源调度
- [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md) - [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md)
- [@ohos.workScheduler (延迟任务调度)](reference/apis/js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](reference/apis/js-apis-WorkSchedulerExtensionAbility.md)
- 定制管理 - 定制管理
- [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md) - [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md)
......
...@@ -64,6 +64,8 @@ ...@@ -64,6 +64,8 @@
- 资源调度 - 资源调度
- [@ohos.backgroundTaskManager (后台任务管理)](js-apis-backgroundTaskManager.md) - [@ohos.backgroundTaskManager (后台任务管理)](js-apis-backgroundTaskManager.md)
- [@ohos.workScheduler (延迟任务调度)](js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](js-apis-WorkSchedulerExtensionAbility.md)
- 定制管理 - 定制管理
- [@ohos.configPolicy (配置策略)](js-apis-config-policy.md) - [@ohos.configPolicy (配置策略)](js-apis-config-policy.md)
...@@ -90,6 +92,7 @@ ...@@ -90,6 +92,7 @@
- [@ohos.fileManager (公共文件访问与管理)](js-apis-filemanager.md) - [@ohos.fileManager (公共文件访问与管理)](js-apis-filemanager.md)
- [@ohos.statfs (statfs)](js-apis-statfs.md) - [@ohos.statfs (statfs)](js-apis-statfs.md)
- [@ohos.storageStatistics (应用空间统计)](js-apis-storage-statistics.md) - [@ohos.storageStatistics (应用空间统计)](js-apis-storage-statistics.md)
- [@ohos.volumeManager (卷管理)](js-apis-volumemanager.md)
- 电话服务 - 电话服务
- [@ohos.contact (联系人)](js-apis-contact.md) - [@ohos.contact (联系人)](js-apis-contact.md)
......
# 延迟任务调度回调
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 9开始支持。API 9当前为Canary版本,仅供试用,不保证接口可稳定调用。
## 导入模块
```
import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'
```
## WorkSchedulerExtensionAbility.onWorkStart
onWorkStart(work: workScheduler.WorkInfo): void
延迟任务调度开始回调。
**系统能力:** SystemCapability.ResourceSchedule.WorkScheduler
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ---- | --------------------- | ---- | -------------- |
| work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | 是 | 指示要添加到执行队列的工作。 |
**示例:**
```
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStart(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStart' + JSON.stringify(workInfo));
}
}
```
## WorkSchedulerExtensionAbility.onWorkStop
onWorkStop(work: workScheduler.WorkInfo): void
延迟任务调度结束回调。
**系统能力:** SystemCapability.ResourceSchedule.WorkScheduler
**参数**
| 参数名 | 类型 | 必填 | 说明 |
| ---- | --------------------- | ---- | -------------- |
| work | [workScheduler.WorkInfo](js-apis-workScheduler.md#workinfo) | 是 | 指示要添加到执行队列的工作。 |
**示例:**
```
export default class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility {
onWorkStop(workInfo) {
console.log('MyWorkSchedulerExtensionAbility onWorkStop' + JSON.stringify(workInfo));
}
}
```
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> >
> - 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> - 本模块接口为系统接口,三方应用不支持调用。 > - API 9当前为Canary版本,仅供试用,不保证接口可稳定调用。
## 导入模块 ## 导入模块
...@@ -68,6 +68,7 @@ getTotalSizeOfVolume(volumeUuid: string, callback:AsyncCallback&lt;number&gt;):v ...@@ -68,6 +68,7 @@ getTotalSizeOfVolume(volumeUuid: string, callback:AsyncCallback&lt;number&gt;):v
``` ```
## storagestatistics.getFreeSizeOfVolume ## storagestatistics.getFreeSizeOfVolume
getFreeSizeOfVolume(volumeUuid: string): Promise&lt;number&gt; getFreeSizeOfVolume(volumeUuid: string): Promise&lt;number&gt;
...@@ -124,3 +125,71 @@ getFreeSizeOfVolume(volumeUuid: string, callback:AsyncCallback&lt;number&gt;):vo ...@@ -124,3 +125,71 @@ getFreeSizeOfVolume(volumeUuid: string, callback:AsyncCallback&lt;number&gt;):vo
console.info("getFreeSizeOfVolume successfully:"+ number); console.info("getFreeSizeOfVolume successfully:"+ number);
}); });
``` ```
## storagestatistics.getBundleStats<sup>9+</sup>
getBundleStats(packageName: string): Promise&lt;BundleStats&gt;
异步获取应用存储数据,以promise方式返回。
**系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | -------- |
| packageName | string | 是 | 应用包名 |
- 返回值
| 类型 | 说明 |
| ------------------------------------------ | -------------------------- |
| Promise&lt;[Bundlestats](#bundlestats)&gt; | 返回指定卷上的应用存储状态 |
- 示例
```js
let packageName = "";
storagestatistics.getBundleStats(packageName).then(function(BundleStats){
console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats));
}).catch(function(err){
console.info("getBundleStats failed with error:"+ err);
});
```
## storagestatistics.getBundleStats<sup>9+</sup>
getBundleStats(packageName: string, callback: AsyncCallback&lt;BundleStats&gt;): void
异步获取应用存储数据,以callback方式返回。
**系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------ |
| packageName | string | 是 | 应用包名 |
| callback | callback:AsyncCallback&lt;[Bundlestats](#bundlestats)&gt; | 是 | 获取指定卷上的应用存储状态之后的回调 |
- 示例
```js
let packageName = "";
storagestatistics.getBundleStats(packageName, function(error, BundleStats){
// do something
console.info("getBundleStats successfully:"+ JSON.stringify(BundleStats));
});
```
## BundleStats<sup>9+</sup>
**系统能力**:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics。
### 属性
| 名称 | 类型 | 说明 |
| --------- | ------ | -------------- |
| appSize<sup>9+</sup> | number | app数据大小 |
| cacheSize<sup>9+</sup> | number | 缓存数据大小 |
| dataSize<sup>9+</sup> | number | 应用总数据大小 |
\ No newline at end of file
# 卷管理
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
>
> - 本模块首批接口从API version 9开始支持。
> - API 9当前为Canary版本,仅供试用,不保证接口可稳定调用。
## 导入模块
```js
import volumemanager from "@ohos.volumeManager";
```
## volumemanager.getAllVolumes
getAllVolumes(): Promise&lt;Array&lt;Volume&gt;&gt;
异步获取当前所有可获得的卷信息,以promise方式返回。
**系统能力**:SystemCapability.FileManagement.StorageService.Volume
- 返回值
| 类型 | 说明 |
| ---------------------------------- | -------------------------- |
| Promise&lt;[Volume](#volume)[]&gt; | 返回当前所有可获得的卷信息 |
- 示例
```js
volumemanager.getAllVolumes().then(function(volumes){
// do something
});
```
## volumemanager.getAllVolumes
getAllVolumes(callback: AsyncCallback&lt;Array&lt;Volume&gt;&gt;): void
异步获取当前所有可获得的卷信息,以callback方式返回。
**系统能力**:SystemCapability.FileManagement.StorageService.Volume
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | ------------------------------------ |
| callback | callback:AsyncCallback&lt;[Volume](#volume)[]&gt; | 是 | 获取当前所有可获得的卷信息之后的回调 |
- 示例
```js
let uuid = "";
volumemanager.getAllVolumes(uuid, function(error, volumes){
// do something
});
```
## volumemanager.mount
mount(volumeId: string): Promise&lt;boolean&gt;
异步挂载指定卷,以promise方式返回。
**系统能力**:SystemCapability.FileManagement.StorageService.Volume
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---- |
| volumeId | string | 是 | 卷id |
- 返回值
| 类型 | 说明 |
| ---------------------- | ---------- |
| Promise&lt;boolean&gt; | 挂载指定卷 |
- 示例
```js
let volumeId = "";
volumemanager.mount(volumeId).then(function(flag){
// do something
});
```
## volumemanager.mount
mount(volumeId: string, callback:AsyncCallback&lt;boolean&gt;):void
异步获取指定卷的可用空间大小,以callback方式返回。
**系统能力**:SystemCapability.FileManagement.StorageService.Volume
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | 是 | 卷id |
| callback | callback:AsyncCallback&lt;boolean&gt; | 是 | 挂载指定卷之后的回调 |
- 示例
```js
let volumeId = "";
volumemanager.mount(volumeId, function(error, flag){
// do something
});
```
## volumemanager.unmount
unmount(volumeId: string): Promise&lt;boolean&gt;
异步卸载指定卷,以promise方式返回。
**系统能力**:SystemCapability.FileManagement.StorageService.Volume
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------ | ---- | ---- |
| volumeId | string | 是 | 卷id |
- 返回值
| 类型 | 说明 |
| ---------------------- | ---------- |
| Promise&lt;boolean&gt; | 卸载指定卷 |
- 示例
```js
let volumeId = "";
volumemanager.unmount(volumeId).then(function(flag){
// do something
});
```
## volumemanager.unmount
unmount(volumeId: string, callback:AsyncCallback&lt;boolean&gt;):void
异步卸载指定卷,以callback方式返回。
**系统能力**:SystemCapability.FileManagement.StorageService.Volume
- 参数
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------- | ---- | -------------------- |
| volumeId | string | 是 | 卷id |
| callback | callback:AsyncCallback&lt;boolean&gt; | 是 | 卸载指定卷之后的回调 |
- 示例
```js
let volumeId = "";
volumemanager.unmount(volumeId, function(error, flag){
// do something
});
```
## Volume
**系统能力**:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.Volume。
### 属性
| 名称 | 类型 | 说明 |
| ----------- | ------- | -------------------- |
| id | number | 卷id |
| uuid | string | 卷uuid |
| description | string | 卷相关描述 |
| removable | boolean | 是否为可移动存储设备 |
| state | int | 当前卷状态 |
| path | string | 卷的挂载地址 |
\ No newline at end of file
...@@ -88,7 +88,7 @@ caretPosition(value: number): void ...@@ -88,7 +88,7 @@ caretPosition(value: number): void
``` ```
@Entry @Entry
@Component @Component
struct TextAreaExample2 { struct TextAreaExample1 {
@State text: string = '' @State text: string = ''
build() { build() {
Column() { Column() {
...@@ -123,7 +123,7 @@ struct TextAreaExample2 { ...@@ -123,7 +123,7 @@ struct TextAreaExample2 {
``` ```
@Entry @Entry
@Component @Component
struct TextAreaTest { struct TextAreaExample2 {
controller: TextAreaController = new TextAreaController() controller: TextAreaController = new TextAreaController()
build() { build() {
Column() { Column() {
......
...@@ -100,7 +100,7 @@ caretPosition(value:&nbsp;number): void ...@@ -100,7 +100,7 @@ caretPosition(value:&nbsp;number): void
``` ```
@Entry @Entry
@Component @Component
struct TextAreaExample2 { struct TextInputExample1 {
@State text: string = '' @State text: string = ''
build() { build() {
...@@ -134,7 +134,7 @@ struct TextAreaExample2 { ...@@ -134,7 +134,7 @@ struct TextAreaExample2 {
``` ```
@Entry @Entry
@Component @Component
struct TextInputTest { struct TextInputExample2 {
@State text: string = '' @State text: string = ''
controller: TextInputController = new TextInputController() controller: TextInputController = new TextInputController()
build() { build() {
......
...@@ -27,8 +27,8 @@ TabContent() ...@@ -27,8 +27,8 @@ TabContent()
不支持触摸热区设置。 不支持触摸热区设置。
| 名称 | 参数类型 | 默认值 | 描述 | | 名称 | 参数类型 | 默认值 | 描述 |
| -------- | -------- | -------- | -------- | | ------ | ---------------------------------------- | ---- | ---------------------------------------- |
| tabBar | string&nbsp;\|&nbsp;{<br/>icon?:&nbsp;string,<br/>text?:&nbsp;string<br/>}<br/>\|&nbsp;[CustomBuilder](../../ui/ts-types.md#custombuilder类型8+)<sup>8+</sup> | - | 设置TabBar上显示内容。<br/>CustomBuilder:&nbsp;构造器,内部可以传入组件(API8版本以上适用)。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;如果icon采用svg格式图源,则要求svg图源删除其自有宽高属性值。如采用带有自有宽高属性的svg图源,icon大小则是svg本身内置的宽高属性值大小。 | | tabBar | string&nbsp;\|&nbsp;{<br/>icon?:&nbsp;string,<br/>text?:&nbsp;string<br/>}<br/>\|&nbsp;[CustomBuilder](../../ui/ts-types.md)<sup>8+</sup> | - | 设置TabBar上显示内容。<br/>CustomBuilder:&nbsp;构造器,内部可以传入组件(API8版本以上适用)。<br/>>&nbsp;![icon-note.gif](public_sys-resources/icon-note.gif)&nbsp;**说明:**<br/>>&nbsp;如果icon采用svg格式图源,则要求svg图源删除其自有宽高属性值。如采用带有自有宽高属性的svg图源,icon大小则是svg本身内置的宽高属性值大小。 |
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> - TabContent组件不支持设置通用宽度属性,其宽度默认撑满Tabs父组件。 > - TabContent组件不支持设置通用宽度属性,其宽度默认撑满Tabs父组件。
......
# Grid # 栅格布局
栅格布局容器根节点,使用grid-row与grid-col进行栅格布局。具体请参考[Grid-container](../reference/arkui-js/js-components-grid-container.md) 栅格布局容器根节点,使用grid-row与grid-col进行栅格布局。具体请参考[Grid-container](../reference/arkui-js/js-components-grid-container.md)
......
...@@ -433,7 +433,7 @@ ...@@ -433,7 +433,7 @@
``` ```
@Component @Component
struct ContentTable { struct ContentTable {
@Builder IngredientItem(title:string, colorValue: string, name: string, value: string) { @Builder IngredientItem(title:string, name: string, value: string) {
Flex() { Flex() {
Text(title) Text(title)
.fontSize(17.4) .fontSize(17.4)
...@@ -531,6 +531,6 @@ ...@@ -531,6 +531,6 @@
针对创建简单视图,有以下示例工程可供参考: 针对创建简单视图,有以下示例工程可供参考:
- [eTSBuildCommonView](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/eTSBuildCommonView) - [eTSBuildCommonView](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/BuildCommonView)
本示例为构建了简单页面展示食物番茄的图片和营养信息,主要为了展示简单页面的Stack布局和Flex布局。 本示例为构建了简单页面展示食物番茄的图片和营养信息,主要为了展示简单页面的Stack布局和Flex布局。
...@@ -12,25 +12,25 @@ ...@@ -12,25 +12,25 @@
## 栅格系统 ## 栅格系统
栅格系统有Columns、Margins、Gutters三个概念。 栅格系统有Column、Margin、Gutter三个概念。
![zh-cn_image_0000001217236574](figures/zh-cn_image_0000001217236574.png) ![zh-cn_image_0000001217236574](figures/zh-cn_image_0000001217236574.png)
1. Gutters 1. Gutter:
用来控制元素与元素之间距离关系。可以根据设备的不同尺寸,定义不同的gutter值,作为栅格布局的统一规范。为了保证较好的视觉效果,通常gutter的取值不会大于margin的取值。 用来控制元素与元素之间距离关系。可以根据设备的不同尺寸,定义不同的gutter值,作为栅格布局的统一规范。为了保证较好的视觉效果,通常gutter的取值不会大于margin的取值。
2. Margins 2. Margin:
离栅格容器边缘的距离。可以根据设备的不同尺寸,定义不同的margin值,作为栅格布局的统一规范。 离栅格容器边缘的距离。可以根据设备的不同尺寸,定义不同的margin值,作为栅格布局的统一规范。
3. Columns: 3. Column:
栅格布局的主要定位工具。根据设备的不同尺寸,把栅格容器分割成不同的列数,在保证margin和gutter符合规范的情况下,根据总Column的个数计算每个Column列的宽度。 栅格布局的主要定位工具。根据设备的不同尺寸,把栅格容器分割成不同的列数,在保证margin和gutter符合规范的情况下,根据总Column的个数计算每个Column列的宽度。
### 系统栅格断点 ### 系统栅格断点
系统根据不同水平宽度设备对应Columns的数量关系,形成了一套断点规则定义。 系统根据不同水平宽度设备对应Column的数量关系,形成了一套断点规则定义。
系统以设备的水平宽度的屏幕密度像素值作为断点依据,根据当前设备水平宽度所在的断点范围,定义了设备的宽度类型。系统的栅格断点范围、设备宽度类型及其描述,以及对应的默认总列数(columns),边距(gutter),间隔(gutter)定义如下: 系统以设备的水平宽度的屏幕密度像素值作为断点依据,根据当前设备水平宽度所在的断点范围,定义了设备的宽度类型。系统的栅格断点范围、设备宽度类型及其描述,以及对应的默认总列数(column),边距(margin),间隔(gutter)定义如下:
| 设备水平宽度断点范围 | 设备宽度类型 | 描述 | columns | gutter | margin | | 设备水平宽度断点范围 | 设备宽度类型 | 描述 | columns | gutter | margin |
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
通过接口`GridContainer(options?: { columns?: number | 'auto', sizeType?: SizeType, gutter?: Length, margin?: Length})`创建栅格容器,栅格容器内的所有子组件可以使用栅格布局。 通过接口`GridContainer(options?: { columns?: number | 'auto', sizeType?: SizeType, gutter?: Length, margin?: Length})`创建栅格容器,栅格容器内的所有子组件可以使用栅格布局。
- 可以通过参数定义栅格布局的总列数(columns),间隔(gutter),两侧边距(margin)。例如栅格容器总共分为6列,列列间隔为10vp, 两侧边距为20vp: - 可以通过参数定义栅格布局的总列数(columns),间隔(gutter),两侧边距(margin)。例如栅格容器总共分为6列,列列间隔为10vp, 两侧边距为20vp:
``` ```
GridContainer({ columns: 6, gutter: 10, margin: 20 }) {} GridContainer({ columns: 6, gutter: 10, margin: 20 }) {}
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
GridContainer() {} GridContainer() {}
``` ```
上述例子中,默认在在小宽度类型设备(SizeType.SM)上,栅格容器被分为4列,列于列的间隔为24vp, 两侧边距是24vp。在中等宽度类型设备(SizeType.MD)上,栅格容器被分为8列,列于列的间隔为24vp,两侧边距是32vp。 上述例子中,默认在小宽度类型设备(SizeType.SM)上,栅格容器被分为4列,列与列的间隔为24vp, 两侧边距是24vp。在中等宽度类型设备(SizeType.MD)上,栅格容器被分为8列,列与列的间隔为24vp,两侧边距是32vp。
- 也可以通过参数sizeType指定此栅格容器内的组件使用此设备宽度类型的栅格设置,如: - 也可以通过参数sizeType指定此栅格容器内的组件使用此设备宽度类型的栅格设置,如:
......
...@@ -15,11 +15,11 @@ ...@@ -15,11 +15,11 @@
首先导入媒体查询模块,例如: 首先导入媒体查询模块,例如:
``` ```
import mediaquery from '@ohos.mediaquery' import mediaquery from '@ohos.mediaquery'
``` ```
然后通过matchMediaSync接口设置媒体查询条件,并保存返回的条件监听句柄,例如: 然后通过matchMediaSync接口设置媒体查询条件,并保存返回的条件监听句柄,例如:
``` ```
listener = mediaquery.matchMediaSync('(orientation: landscape)') listener = mediaquery.matchMediaSync('(orientation: landscape)')
``` ```
最后通过上面保存的条件监听句柄listener去注册回调函数,在回调函数里更改页面布局或者实现业务逻辑,当匹配到媒体查询条件时会触发此回调函数,例如: 最后通过上面保存的条件监听句柄listener去注册回调函数,在回调函数里更改页面布局或者实现业务逻辑,当匹配到媒体查询条件时会触发此回调函数,例如:
``` ```
...@@ -39,13 +39,13 @@ listener.on('change', onPortrait) ...@@ -39,13 +39,13 @@ listener.on('change', onPortrait)
``` ```
例如: 例如:
screen and (round-screen: true) // 当设备屏幕是圆形时条件成立 `screen and (round-screen: true)`当设备屏幕是圆形时条件成立
(max-height: 800) // 当高度小于800时条件成立 `(max-height: 800)`当高度小于800时条件成立
(height &lt;= 800) // 当高度小于800时条件成立 `(height &lt;= 800) `当高度小于800时条件成立
screen and (device-type: tv) or (resolution &lt; 2) // 包含多个媒体特征的多条件复杂语句查询 `screen and (device-type: tv) or (resolution &lt; 2)`包含多个媒体特征的多条件复杂语句查询
### 媒体类型(media-type) ### 媒体类型(media-type)
......
...@@ -267,6 +267,6 @@ ...@@ -267,6 +267,6 @@
针对页面布局与连接,有以下示例工程可供参考: 针对页面布局与连接,有以下示例工程可供参考:
- [eTSDefiningPageLayoutAndConnection](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/eTSDefiningPageLayoutAndConnection) - [eTSDefiningPageLayoutAndConnection](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/DefiningPageLayoutAndConnection)
本示例构建了食物分类列表页面和食物详情页,向开发者展示了List布局、Grid布局以及页面路由的基本用法。 本示例构建了食物分类列表页面和食物详情页,向开发者展示了List布局、Grid布局以及页面路由的基本用法。
...@@ -578,6 +578,8 @@ ...@@ -578,6 +578,8 @@
- 资源调度 - 资源调度
- [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md) - [@ohos.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-backgroundTaskManager.md)
- [@ohos.workScheduler (延迟任务调度)](reference/apis/js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility (延迟任务调度回调)](reference/apis/js-apis-WorkSchedulerExtensionAbility.md)
- 定制管理 - 定制管理
- [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md) - [@ohos.configPolicy (配置策略)](reference/apis/js-apis-config-policy.md)
......
...@@ -7,12 +7,12 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存 ...@@ -7,12 +7,12 @@ OpenHarmony轻量和小型系统适用于内存较小的IOT设备(参考内存
考虑到开发者的开发习惯,OpenHarmony为开发者提供了以下两种入门指导: 考虑到开发者的开发习惯,OpenHarmony为开发者提供了以下两种入门指导:
- IDE方式:完全采用IDE(Deveco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。 - IDE方式:完全采用IDE(DevEco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。
- 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。
OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。
本文采用Deveco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[轻量和小型系统快速入门(安装包方式)](../quick-start/quickstart-lite-package-directory.md) 本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[轻量和小型系统快速入门(安装包方式)](../quick-start/quickstart-lite-package-directory.md)
## 开发环境 ## 开发环境
......
...@@ -7,12 +7,12 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文, ...@@ -7,12 +7,12 @@ OpenHarmony标准系统适用于参考内存≥128MiB的设备。通过本文,
考虑到开发者的开发习惯,OpenHarmony为开发者提供了以下两种入门指导: 考虑到开发者的开发习惯,OpenHarmony为开发者提供了以下两种入门指导:
- IDE方式:完全采用IDE(Deveco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。 - IDE方式:完全采用IDE(DevEco Device Tool)进行一站式开发,编译依赖工具的安装及编译、烧录、运行都通过IDE进行操作。
- 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。 - 安装包方式:通过命令行进行编译依赖工具的下载安装,编译操作也通过命令实现。烧录、运行等操作使用IDE。
OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。 OpenHarmony还为开发者提供了[Docker环境](../get-code/gettools-acquire.md),在很大程度上简化了编译前的环境配置,习惯使用安装包方式的开发者也可以选择Docker环境进行编译 。
本文采用Deveco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[标准系统快速入门(安装包方式)](../quick-start/quickstart-standard-package-directory.md) 本文采用DevEco Device Tool进行一站式开发介绍,习惯使用命令行的开发者可参考[标准系统快速入门(安装包方式)](../quick-start/quickstart-standard-package-directory.md)
## 开发环境 ## 开发环境
......
...@@ -125,15 +125,13 @@ ...@@ -125,15 +125,13 @@
1. 获取引导文件U-boot。 1. 获取引导文件U-boot。
> ![icon-notice.gif](public_sys-resources/icon-notice.gif) **须知:** > ![icon-notice.gif](public_sys-resources/icon-notice.gif) **须知:**
> 单板的U-boot文件请在开源包中获取:
> >
> Hi3516DV300:device\hisilicon\hispark_taurus\sdk_liteos\uboot\out\boot\u-boot-hi3516dv300.bin > 单板的U-boot文件请在开源包中获取:device\hisilicon\hispark_taurus\sdk_liteos\uboot\out\boot\u-boot-hi3516dv300.bin
>
> Hi3518EV300:device\hisilicon\hispark_aries\sdk_liteos\uboot\out\boot\u-boot-hi3518ev300.bin
2. 根据USB烧写步骤烧写U-boot文件。 2. 根据USB烧写步骤烧写U-boot文件。
按照[Hi3516系列USB烧写步骤](https://device.harmonyos.com/cn/docs/documentation/guide/ide-hi3516-upload-0000001052148681)/[Hi3518系列USB烧写步骤](https://device.harmonyos.com/cn/docs/documentation/guide/ide-hi3518-upload-0000001057313128#section93591711580)中描述的烧写方法,选择对应单板的U-boot文件进行烧写。 按照[Hi3516系列USB烧写步骤](https://device.harmonyos.com/cn/docs/documentation/guide/ide-hi3516-upload-0000001052148681)中描述的烧写方法,选择对应单板的U-boot文件进行烧写。
3. 烧写完成后,登录串口如下图所示。 3. 烧写完成后,登录串口如下图所示。
......
...@@ -21,7 +21,7 @@ build ...@@ -21,7 +21,7 @@ build
└── subsystem_config.json └── subsystem_config.json
productdefine/common productdefine/common
└── products └── products
└── Hi3568DV300.json └── Hi3516DV300.json
``` ```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册