diff --git a/en/application-dev/internationalization/i18n-guidelines.md b/en/application-dev/internationalization/i18n-guidelines.md
index e78bdb6437b26b8a30ee23f9fdec380087297b33..bdef7a0aab63267dbfb7d0a782d97031d198bf55 100644
--- a/en/application-dev/internationalization/i18n-guidelines.md
+++ b/en/application-dev/internationalization/i18n-guidelines.md
@@ -610,8 +610,10 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to
Call **transform** to obtain the transliterated string.
```js
- let transliterator = I18n.Transliterator.getInstance("Any-Latn"); // Any-Latn means to convert any text to Latn text.
- let transformText = transliterator.transform ("Hello"); // transformText = "nǐ hǎo"
+ let transliterator = I18n.Transliterator.getInstance("Any-Latin"); // Any-Latin means to convert any text to Latin text.
+ let transformText = transliterator.transform ("你好"); // transformText = "nǐ hǎo"
+ let transliterator2 = I18n.Transliterator.getInstance("Latin-ASCII"); // Latin-ASCII means to convert Latin text to ASCII text.
+ let transformText = transliterator2.transform(transformText); // transformText = "ni hao"
```
## Obtaining the Character Type
@@ -730,3 +732,4 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to
```js
let order = I18n.I18NUtil.getDateOrder("zh-CN"); // order = "y-L-d" indicates that the sequence of year, month, and day in Chinese is year-month-day.
```
+
\ No newline at end of file
diff --git a/en/application-dev/reference/apis/js-apis-i18n.md b/en/application-dev/reference/apis/js-apis-i18n.md
index 2a85da3460cf4dff87a3076686a8b31ae136f65a..ab2a04c6ec9894e6391ff8c8299dd3ccad6e265b 100644
--- a/en/application-dev/reference/apis/js-apis-i18n.md
+++ b/en/application-dev/reference/apis/js-apis-i18n.md
@@ -1757,8 +1757,8 @@ Obtains a list of IDs supported by the **Transliterator** object.
**Example**
```ts
- // ids = ["ASCII-Latin", "Accents-Any", "Amharic-Latin/BGN", ...], 671 IDs supported in total
- // Each ID consists of two parts separated by a hyphen (-). The format is source-destination.
+ // A total of 671 IDs are supported. One ID is comprised of two parts separated by a hyphen (-) in the format of source-destination. For example, in **ids = ["Han-Latin","Latin-ASCII", "Amharic-Latin/BGN","Accents-Any", ...]**, **Han-Latin** indicates conversion from Chinese to Latin, and **Amharic-Latin** indicates conversion from Amharic to Latin.
+ // For more information, see ISO-15924.
let ids = I18n.Transliterator.getAvailableIDs();
```
diff --git a/en/application-dev/reference/apis/js-apis-runninglock.md b/en/application-dev/reference/apis/js-apis-runninglock.md
index 4d72733c02f607fd17f29f2c4402f059bfee981f..d53fd52b16a98f466029772a0a06458897521ed6 100644
--- a/en/application-dev/reference/apis/js-apis-runninglock.md
+++ b/en/application-dev/reference/apis/js-apis-runninglock.md
@@ -16,7 +16,7 @@ import runningLock from '@ohos.runningLock';
isSupported(type: RunningLockType): boolean;
-Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
+Checks whether the specified type of **RunningLock** is supported.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
@@ -26,7 +26,7 @@ Checks whether the specified type of **RunningLock** is supported. This API uses
| ------ | ----------------------------------- | ---- | -------------------- |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.|
-**Return Value**
+**Return value**
| Type | Description |
| ------- | --------------------------------------- |
@@ -69,14 +69,6 @@ Creates a **RunningLock** object.
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created. |
| callback | AsyncCallback<[RunningLock](#runninglock)> | Yes | Callback used to return the result. If a lock is successfully created, **err** is **undefined** and **data** is the created **RunningLock**. Otherwise, **err** is an error object.|
-**Error codes**
-
-For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
-
-| ID | Error Message |
-|---------|----------|
-| 4900101 | If connecting to the service failed. |
-
**Example**
```js
@@ -106,20 +98,12 @@ Creates a **RunningLock** object.
| name | string | Yes | Name of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.|
-**Return Value**
+**Return value**
| Type | Description |
| ------------------------------------------ | ------------------------------------ |
| Promise<[RunningLock](#runninglock)> | Promise used to return the result.|
-**Error codes**
-
-For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
-
-| ID | Error Message |
-|---------|----------|
-| 4900101 | If connecting to the service failed. |
-
**Example**
```js
@@ -138,7 +122,7 @@ isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boo
> **NOTE**
This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
-Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses an asynchronous callback to return the result.
+Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
@@ -167,7 +151,7 @@ isRunningLockTypeSupported(type: RunningLockType): Promise<boolean>
> **NOTE**
This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
-Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
+Checks whether the specified type of **RunningLock** is supported. This API uses a promise to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
@@ -177,7 +161,7 @@ Checks whether the specified type of **RunningLock** is supported. This API uses
| ------ | ----------------------------------- | ---- | -------------------- |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.|
-**Return Value**
+**Return value**
| Type | Description |
| ---------------------- | ---------------------------------------------------- |
@@ -246,7 +230,7 @@ Creates a **RunningLock** object.
| name | string | Yes | Name of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.|
-**Return Value**
+**Return value**
| Type | Description |
| ------------------------------------------ | ------------------------------------ |
@@ -354,7 +338,7 @@ Checks the hold status of the **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
-**Return Value**
+**Return value**
| Type | Description |
| ------- | ------------------------------------------------------------ |
@@ -452,7 +436,7 @@ Checks the hold status of the **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
-**Return Value**
+**Return value**
| Type | Description |
| ------- | ------------------------------------------------------------ |
| boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.|
@@ -476,7 +460,7 @@ Enumerates the types of **RunningLock** objects.
**System capability:** SystemCapability.PowerManager.PowerManager.Core
-| Name | Value | Description |
-| --------------------------------- | ---- | ------------------------------------------------------------ |
-| BACKGROUND(deprecated) | 1 | A lock that prevents the system from hibernating when the screen is off.
**NOTE**
This parameter is supported since API version 7 and deprecated since API version 10.|
-| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen. |
+| Name | Value | Description |
+| ------------------------ | ---- | -------------------------------------- |
+| BACKGROUND | 1 | A lock that prevents the system from hibernating when the screen is off. |
+| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen.|
diff --git a/en/application-dev/reference/apis/js-apis-usb-deprecated.md b/en/application-dev/reference/apis/js-apis-usb-deprecated.md
index fd71b32b8b92c54538d371c0809b8e17e0ed9c02..d8cc7c877591694c793ace8bd93a677f9ac9e4a1 100644
--- a/en/application-dev/reference/apis/js-apis-usb-deprecated.md
+++ b/en/application-dev/reference/apis/js-apis-usb-deprecated.md
@@ -1,11 +1,12 @@
-# @ohos.usb (USB Management)
+# @ohos.usb (USB)
The **usb** module provides USB device management functions, including USB device list query, bulk data transfer, control transfer, and permission control.
-> **NOTE**
+> **NOTE**
>
> 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 APIs provided by this module are no longer maintained since API version 9. You are advised to use [`@ohos.usbManager`](js-apis-usbManager.md) instead.
+>
+> The APIs provided by this module are no longer maintained since API version 9. You are advised to use [`@ohos.usbManager`](js-apis-usbManager.md).
## Modules to Import
@@ -25,13 +26,13 @@ Obtains the USB device list.
| Type | Description |
| ---------------------------------------------------- | ------- |
-| Array<Readonly<[USBDevice](#usbdevice)>> | Device information list.|
+| Array<Readonly<[USBDevice](#usbdevice)>> | USB device list.|
**Example**
```js
let devicesList = usb.getDevices();
-console.log(`devicesList = ${JSON.stringify(devicesList)}`);
+console.log(`devicesList = ${devicesList}`);
// devicesList is a list of USB devices.
// A simple example of devicesList is provided as follows:
[
@@ -110,7 +111,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
```js
let devicepipe= usb.connectDevice(device);
-console.log(`devicepipe = ${JSON.stringify(devicepipe)}`);
+console.log(`devicepipe = ${devicepipe}`);
```
## usb.hasRight
@@ -131,21 +132,21 @@ Checks whether the application has the permission to access the device.
| Type| Description|
| -------- | -------- |
-| boolean | The value **true** indicates that the application has the permission to access the device, and the value **false** indicates the opposite.|
+| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
**Example**
```js
-let devicesName="1-1";
+let devicesName= "1-1";
let bool = usb.hasRight(devicesName);
-console.log(bool);
+console.log(`${bool}`);
```
## usb.requestRight
requestRight(deviceName: string): Promise<boolean>
-Requests the temporary permission for the application to access the USB device. This API uses a promise to return the result.
+Requests the temporary permission for the application to access a USB device. This API uses a promise to return the result.
**System capability**: SystemCapability.USB.USBManager
@@ -159,14 +160,14 @@ Requests the temporary permission for the application to access the USB device.
| Type| Description|
| -------- | -------- |
-| Promise<boolean> | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted, and the value **false** indicates the opposite.|
+| Promise<boolean> | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted; and the value **false** indicates the opposite.|
**Example**
```js
-let devicesName="1-1";
+let devicesName= "1-1";
usb.requestRight(devicesName).then((ret) => {
- console.log(`requestRight = ${JSON.stringify(ret)}`);
+ console.log(`requestRight = ${ret}`);
});
```
@@ -192,7 +193,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description|
| -------- | -------- |
-| number | The value **0** indicates that the USB interface is successfully claimed, and an error code indicates the opposite.|
+| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
**Example**
@@ -222,7 +223,7 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
| Type| Description|
| -------- | -------- |
-| number | The value **0** indicates that the USB interface is successfully released, and an error code indicates the opposite.|
+| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
**Example**
@@ -252,7 +253,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description|
| -------- | -------- |
-| number | The value **0** indicates that the USB configuration is successfully set, and an error code indicates the opposite.|
+| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
**Example**
@@ -282,7 +283,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description|
| -------- | -------- |
-| number | The value **0** indicates that the USB interface is successfully set, and an error code indicates the opposite.|
+| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
**Example**
@@ -311,7 +312,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description|
| -------- | -------- |
-| Uint8Array | The return value is the raw USB descriptor if the operation is successful, or **undefined** if the operation has failed.|
+| Uint8Array | Returns the raw USB descriptor if the operation is successful; returns **undefined** otherwise.|
**Example**
@@ -339,7 +340,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type | Description |
| ------ | -------------------- |
-| number | The return value is the file descriptor of the USB device if the operation is successful, or **-1** if the operation has failed.|
+| number | Returns the file descriptor of the USB device if the operation is successful; returns **-1** otherwise.|
**Example**
@@ -374,9 +375,17 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**Example**
```js
-usb.controlTransfer(devicepipe, USBControlParams).then((ret) => {
- console.log(`controlTransfer = ${JSON.stringify(ret)}`);
-})
+let param = {
+ request: 0,
+ reqType: 0,
+ target:0,
+ value: 0,
+ index: 0,
+ data: null
+};
+usb.controlTransfer(devicepipe, param).then((ret) => {
+ console.log(`controlTransfer = ${ret}`);
+});
```
## usb.bulkTransfer
@@ -411,7 +420,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
// Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device.
// Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer.
usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => {
- console.log(`bulkTransfer = ${JSON.stringify(ret)}`);
+ console.log(`bulkTransfer = ${ret}`);
});
```
@@ -435,7 +444,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
| Type| Description|
| -------- | -------- |
-| number | The value **0** indicates that the USB device pipe is closed successfully, and an error code indicates the opposite.|
+| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
**Example**
@@ -498,7 +507,7 @@ Converts the USB function list in the numeric mask format to a string in Device
**Example**
```js
-let funcs = ACM | ECM;
+let funcs = usb.FunctionType.ACM | usb.FunctionType.ECM;
let ret = usb.usbFunctionsToString(funcs);
```
@@ -527,8 +536,12 @@ Sets the current USB function list in Device mode.
**Example**
```js
-let funcs = HDC;
-let ret = usb.setCurrentFunctions(funcs);
+let funcs = usb.FunctionType.HDC;
+usb.setCurrentFunctions(funcs).then(() => {
+ console.info('usb setCurrentFunctions successfully.');
+}).catch(err => {
+ console.error('usb setCurrentFunctions failed: ' + err.code + ' message: ' + err.message);
+});
```
## usb.getCurrentFunctions9+
@@ -630,7 +643,12 @@ Sets the role types supported by a specified port, which can be **powerRole** (f
**Example**
```js
-let ret = usb.getSupportedModes(0);
+let portId = 1;
+usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => {
+ console.info('usb setPortRoles successfully.');
+}).catch(err => {
+ console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message);
+});
```
## USBEndpoint
@@ -639,16 +657,16 @@ Represents the USB endpoint from which data is sent or received. You can obtain
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ----------- |
-| address | number | Yes | Endpoint address. |
-| attributes | number | Yes | Endpoint attributes. |
-| interval | number | Yes | Endpoint interval. |
-| maxPacketSize | number | Yes | Maximum size of data packets on the endpoint. |
-| direction | [USBRequestDirection](#usbrequestdirection) | Yes | Endpoint direction. |
-| number | number | Yes | Endpoint number. |
-| type | number | Yes | Endpoint type. |
-| interfaceId | number | Yes | Unique ID of the interface to which the endpoint belongs.|
+| Name | Type | Mandatory | Description |
+| ------------- | ------------------------------------------- | ------------- |------------ |
+| address | number | Yes |Endpoint address. |
+| attributes | number | Yes |Endpoint attributes. |
+| interval | number | Yes |Endpoint interval. |
+| maxPacketSize | number | Yes |Maximum size of data packets on the endpoint. |
+| direction | [USBRequestDirection](#usbrequestdirection) | Yes |Endpoint direction. |
+| number | number | Yes |Endpoint number. |
+| type | number | Yes |Endpoint type. |
+| interfaceId | number | Yes |Unique ID of the interface to which the endpoint belongs.|
## USBInterface
@@ -656,15 +674,15 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ----------- |
-| id | number | Yes | Unique ID of the USB interface. |
-| protocol | number | Yes | Interface protocol. |
-| clazz | number | Yes | Device type. |
-| subClass | number | Yes | Device subclass. |
-| alternateSetting | number | Yes | Settings for alternating between descriptors of the same USB interface.|
-| name | string | Yes | Interface name. |
-| endpoints | Array<[USBEndpoint](#usbendpoint)> | Yes | Endpoints that belong to the USB interface. |
+| Name | Type | Mandatory |Description |
+| ---------------- | ---------------------------------------- | ------------- |--------------------- |
+| id | number | Yes |Unique ID of the USB interface. |
+| protocol | number | Yes |Interface protocol. |
+| clazz | number | Yes |Device type. |
+| subClass | number | Yes |Device subclass. |
+| alternateSetting | number | Yes |Settings for alternating between descriptors of the same USB interface.|
+| name | string | Yes |Interface name. |
+| endpoints | Array<[USBEndpoint](#usbendpoint)> | Yes |Endpoints that belong to the USB interface. |
## USBConfig
@@ -672,15 +690,15 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ----------- |
-| id | number | Yes | Unique ID of the USB configuration. |
-| attributes | number | Yes | Configuration attributes. |
-| maxPower | number | Yes | Maximum power consumption, in mA. |
-| name | string | Yes | Configuration name, which can be left empty. |
-| isRemoteWakeup | boolean | Yes | Support for remote wakeup.|
-| isSelfPowered | boolean | Yes | Support for independent power supplies.|
-| interfaces | Array <[USBInterface](#usbinterface)> | Yes | Supported interface attributes. |
+| Name | Type | Mandatory |Description |
+| -------------- | ------------------------------------------------ | --------------- |----------- |
+| id | number | Yes |Unique ID of the USB configuration. |
+| attributes | number | Yes |Configuration attributes. |
+| maxPower | number | Yes |Maximum power consumption, in mA. |
+| name | string | Yes |Configuration name, which can be left empty. |
+| isRemoteWakeup | boolean | Yes |Support for remote wakeup.|
+| isSelfPowered | boolean | Yes |Support for independent power supplies.|
+| interfaces | Array <[USBInterface](#usbinterface)> | Yes |Supported interface attributes. |
## USBDevice
@@ -688,21 +706,21 @@ Represents the USB device information.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ----------- |
-| busNum | number | Yes | Bus address. |
-| devAddress | number | Yes | Device address. |
-| serial | string | Yes | Sequence number. |
-| name | string | Yes | Device name. |
-| manufacturerName | string | Yes | Device manufacturer. |
-| productName | string | Yes | Product name. |
-| version | string | Yes | Version number. |
-| vendorId | number | Yes | Vendor ID. |
-| productId | number | Yes | Product ID. |
-| clazz | number | Yes | Device class. |
-| subClass | number | Yes | Device subclass. |
-| protocol | number | Yes | Device protocol code. |
-| configs | Array<[USBConfig](#usbconfig)> | Yes | Device configuration descriptor information.|
+| Name | Type | Mandatory |Description |
+| ---------------- | ------------------------------------ | ---------- |---------- |
+| busNum | number | Yes |Bus address. |
+| devAddress | number | Yes |Device address. |
+| serial | string | Yes |Sequence number. |
+| name | string | Yes |Device name. |
+| manufacturerName | string | Yes |Device manufacturer. |
+| productName | string | Yes |Product name. |
+| version | string | Yes |Version. |
+| vendorId | number | Yes |Vendor ID. |
+| productId | number | Yes |Product ID. |
+| clazz | number | Yes |Device class. |
+| subClass | number | Yes |Device subclass. |
+| protocol | number | Yes |Device protocol code. |
+| configs | Array<[USBConfig](#usbconfig)> | Yes |Device configuration descriptor information.|
## USBDevicePipe
@@ -710,10 +728,10 @@ Represents a USB device pipe, which is used to determine a USB device.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ----------- |
-| busNum | number | Yes | Bus address.|
-| devAddress | number | Yes | Device address.|
+| Name | Type | Mandatory |Description |
+| ---------- | ------ | ----- |----- |
+| busNum | number | Yes |Bus address.|
+| devAddress | number | Yes |Device address.|
## USBControlParams
@@ -721,14 +739,14 @@ Represents control transfer parameters.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ----------- |
-| request | number | Yes | Request type. |
-| target | [USBRequestTargetType](#usbrequesttargettype) | Yes | Request target type. |
-| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes | Control request type. |
-| value | number | Yes | Request parameter value. |
-| index | number | Yes | Index of the request parameter value.|
-| data | Uint8Array | Yes | Buffer for writing or reading data. |
+| Name | Type | Mandatory|Description |
+| ------- | ----------------------------------------------- | ---------------- |---------------- |
+| request | number | Yes |Request type. |
+| target | [USBRequestTargetType](#usbrequesttargettype) | Yes |Request target type. |
+| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes |Control request type. |
+| value | number | Yes |Request parameter value. |
+| index | number | Yes |Index of the request parameter value.|
+| data | Uint8Array | Yes |Buffer for writing or reading data. |
## USBPort9+
@@ -738,11 +756,11 @@ Represents a USB port.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ----------- |
-| id | number | Yes | Unique identifier of a USB port. |
-| supportedModes | [PortModeType](#portmodetype9) | Yes | Numeric mask combination for the supported mode list.|
-| status | [USBPortStatus](#usbportstatus9) | Yes | USB port role. |
+| Name | Type | Mandatory|Description |
+| -------------- | -------------------------------- | -------------- |----------------------------------- |
+| id | number | Yes |Unique identifier of a USB port. |
+| supportedModes | [PortModeType](#portmodetype9) | Yes |Numeric mask combination for the supported mode list.|
+| status | [USBPortStatus](#usbportstatus9) | Yes |USB port role. |
## USBPortStatus9+
@@ -752,11 +770,11 @@ Enumerates USB port roles.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Mandatory | Description |
-| -------- | ------- | --------- | ----------- |
-| currentMode | number | Yes | Current USB mode. |
-| currentPowerRole | number | Yes | Current power role. |
-| currentDataRole | number | Yes | Current data role. |
+| Name | Type| Mandatory|Description |
+| ---------------- | -------- | ----------- |---------------------- |
+| currentMode | number | Yes |Current USB mode. |
+| currentPowerRole | number | Yes |Current power role. |
+| currentDataRole | number | Yes |Current data role.|
## USBRequestTargetType
diff --git a/en/application-dev/reference/apis/js-apis-usbManager.md b/en/application-dev/reference/apis/js-apis-usbManager.md
index 95096ca9027425b1701b196d86ad429d73fd200a..9b11948bd5eabe29dfb69a70112b42d20dbc81ec 100644
--- a/en/application-dev/reference/apis/js-apis-usbManager.md
+++ b/en/application-dev/reference/apis/js-apis-usbManager.md
@@ -280,7 +280,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
let device = devicesList[0];
@@ -320,7 +319,6 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
let device = devicesList[0];
@@ -361,7 +359,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
let device = devicesList[0];
@@ -401,7 +398,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
let device = devicesList[0];
@@ -441,7 +437,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
usb.requestRight(devicesList[0].name);
@@ -477,7 +472,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
usb.requestRight(devicesList[0].name);
@@ -524,14 +518,13 @@ let param = {
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
usb.requestRight(devicesList[0].name);
let devicepipe = usb.connectDevice(devicesList[0]);
usb.controlTransfer(devicepipe, param).then((ret) => {
console.log(`controlTransfer = ${ret}`);
-})
+});
```
## usb.bulkTransfer
@@ -568,7 +561,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
let device = devicesList[0];
@@ -612,7 +604,6 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
- return;
}
usb.requestRight(devicesList[0].name);
diff --git a/en/device-dev/get-code/figures/customizing-bundles.png b/en/device-dev/get-code/figures/customizing-components.png
similarity index 100%
rename from en/device-dev/get-code/figures/customizing-bundles.png
rename to en/device-dev/get-code/figures/customizing-components.png
diff --git a/en/device-dev/get-code/sourcecode-acquire.md b/en/device-dev/get-code/sourcecode-acquire.md
index 61b63e1f9f5824530c630fa641cba0d1f75ba85d..a1389e07a8e3aff85bce2d2f14d0dd7bbe94d5e5 100644
--- a/en/device-dev/get-code/sourcecode-acquire.md
+++ b/en/device-dev/get-code/sourcecode-acquire.md
@@ -1,48 +1,59 @@
-# Obtaining Source Code
+# Obtaining Source Code
-## About OpenHarmony
-OpenHarmony is an open-source project launched by the OpenAtom Foundation. The purpose of this project is to build an open, distributed operating system \(OS\) framework for smart IoT devices in the full-scenario, full-connectivity, and full-intelligence era.
+## About OpenHarmony
-The open-source code repositories are available at [https://openharmony.gitee.com](https://openharmony.gitee.com).
+OpenHarmony is an open source project launched by the OpenAtom Foundation. The purpose of this project is to build an open, distributed operating system (OS) framework for smart IoT devices in the full-scenario, full-connectivity, and full-intelligence era.
-## Overview of Source Code Acquisition
-The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-about.md), which can be obtained in any of the following ways:
-- **Method 1**: Acquire the source code from the Gitee code repository. You can use the **repo** or **git** tool to download the latest code from the code repository.
-- **Method 2**: Acquire the source code from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home). Visit [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), search for your desired open-source distribution, and download the bundle list \(or customize bundles and download the bundle list\). Then use the **hpm-cli** tool to download and install the bundles and compilation toolchain on your local PC.
-- **Method 3**: Download the compressed file of a distribution from a mirror site. This method provides a fast download speed, so you can also use this method for obtaining the source code of an earlier version.
-- **Method 4**: Acquire the source code from the GitHub image repository. You can use the **repo** or **git** tool to download the latest code from the code repository.
+The open source code repositories are available at [https://openharmony.gitee.com](https://openharmony.gitee.com).
-## Method 1: Acquiring Source Code from the Gitee Code Repository
-### When to Use
+## Overview of Source Code Acquisition
-- You want to establish a baseline based on stable OpenHarmony releases and distribute the baseline to your customers.
+This document describes how to acquire OpenHarmony source code and provides its directory structure. The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-about.md), which can be obtained in any of the following ways:
-- You have interconnected your software with OpenHarmony and need official certification from OpenHarmony.
+- **Method 1**: Acquire the source code from the Gitee code repository. You can use the **repo** or **git** tool to download the latest code from the code repository.
-- You want to contribute code to the OpenHarmony community after obtaining official OpenHarmony certification for chips, modules, and applications.
+- **Method 2**: Acquire the source code from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home). Visit [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), search for your desired open source distribution, and download the component list (or customize components and download the component list). Then use the **hpm-cli** tool to download and install the components and compilation toolchain on your local PC.
-- You need to rectify OpenHarmony issues.
+- **Method 3**: Download the compressed file of a distribution from a mirror site. This method provides a fast download speed, so you can also use this method for obtaining the source code of an earlier version.
-- You want to learn OpenHarmony source code.
+- **Method 4**: Acquire the source code from the GitHub image repository. You can use the **repo** or **git** tool to download the latest code from the code repository.
-### Prerequisites
+## Method 1: Acquiring Source Code from the Gitee Code Repository
-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.
- ```shell
- git config --global user.name "yourname"
- git config --global user.email "your-email-address"
- git config --global credential.helper store
- ```
+### When to Use
-4. Run the following commands to install the **repo** tool:
+- You want to establish a baseline based on stable OpenHarmony releases and distribute the baseline to your customers.
+
+- You have interconnected your software with OpenHarmony and need official certification from OpenHarmony.
+
+- You want to contribute code to the OpenHarmony community after obtaining official OpenHarmony certification for chips, modules, and applications.
+
+- You need to rectify OpenHarmony issues.
+
+- You want to learn OpenHarmony source code.
+
+
+### Prerequisites
+
+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.
+
+ ```shell
+ git config --global user.name "yourname"
+ git config --global user.email "your-email-address"
+ git config --global credential.helper store
+ ```
+
+4. Install the **repo** tool:
In this example, **~/bin** is used as an example installation directory. You can change the directory as needed.
@@ -62,115 +73,122 @@ The OpenHarmony source code is open to you as [HPM parts](../hpm-part/hpm-part-a
```
-### How to Use
+### How to Use
->![](../public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE**
>
->Download the release code, which is more stable, if you want to develop commercial functionalities. 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. Download the master code if you want to get quick access to the latest features for your development.
-- **Obtaining OpenHarmony release code**
+- **Obtaining OpenHarmony release code**
- For details about how to obtain the source code of an OpenHarmony release, see the [Release Notes](../../release-notes/Readme.md).
+ For details about how to obtain the source code of an OpenHarmony release, see the [Release Notes](../../release-notes/Readme.md).
-- **Obtaining OpenHarmony master code**
+- **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.)
+
+ ```shell
+ repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
+ repo sync -c
+ repo forall -c 'git lfs pull'
+ ```
- 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.\)
+ Method 2: Use the **repo** tool to download the source code over HTTPS.
- ```shell
- repo init -u git@gitee.com:openharmony/manifest.git -b master --no-repo-verify
- repo sync -c
- repo forall -c 'git lfs pull'
- ```
+
+ ```shell
+ repo init -u https://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.
- ```shell
- repo init -u https://gitee.com/openharmony/manifest.git -b master --no-repo-verify
- repo sync -c
- repo forall -c 'git lfs pull'
- ```
+## Method 2: Acquiring Source Code from DevEco Marketplace
-## Method 2: Acquiring Source Code from DevEco Marketplace
+### When to Use
-### When to Use
+If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open source distribution from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), or customize a distribution by adding or deleting components of an open source distribution. Then use the **hpm-cli** tool to download and install the components and compilation toolchain on your local PC.
-If OpenHarmony is new to you, sample solutions are helpful to your development. You can obtain an open-source distribution from [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), or customize a distribution by adding or deleting bundles of an open-source distribution. Then use the **hpm-cli** tool to download and install the bundles and compilation toolchain on your local PC.
-### Prerequisites
+### Prerequisites
You must install **Node.js** and HPM on your local PC. The installation procedure is as follows:
-1. Install **Node.js**.
-
- Download **Node.js** from its official website and install it on your local PC.
+1. Install **Node.js**.
- The [Node.js](https://nodejs.org/) version must be 12.x \(including npm 6.14.4\) or later. An LTS version is recommended.
+ Download **Node.js** from its official website, and install it on your local PC.
-2. Install the **hpm-cli** tool using **npm** delivered with **Node.js**.
+ The [Node.js](https://nodejs.org/) version must be 12.x (including npm 6.14.4) or later. An LTS version is recommended.
- Open the CMD window and run the following command:
+2. Install the **hpm-cli** tool using **npm** delivered with **Node.js**.
- ```shell
- npm install -g @ohos/hpm-cli
- ```
+ Open the CMD window, and run the following command:
+
+ ```shell
+ npm install -g @ohos/hpm-cli
+ ```
-3. Run the following command to check whether the installation is successful. If the HPM version is displayed, the installation is successful.
+3. Run the following command to check whether the installation is successful. If the HPM version is displayed, the installation is successful.
+
+ ```shell
+ hpm -V or hpm --version
+ ```
- ```shell
- hpm -V or hpm --version
- ```
+4. Upgrade the HPM version as needed.
+
+ ```shell
+ npm update -g @ohos/hpm-cli
+ ```
-4. Run the following command to upgrade the HPM version:
- ```shell
- npm update -g @ohos/hpm-cli
- ```
+### How to Use
+1. Search for distributions.
+ 1. Access [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), and click **Device**. Then go to the **Open Source Distribution** page.
+ 2. Enter a keyword, for example, **camera**, in the search box. All matched distributions are displayed.
+ 3. Specify filter criteria, such as the OS, board, and kernel, to further filter the distributions.
+ 4. Find your desired distribution, and click it to view details.
-### How to Use
+ **Figure 1** HPM page
-1. Search for distributions.
- 1. Access [DevEco Marketplace](https://repo.harmonyos.com/#/en/home), and click **Equipment Bundle**. Then go to the **Open Source Distribution** page.
- 2. Enter a keyword \(for example: **camera**\) in the search box. All matched distributions are found.
- 3. Specify filter criteria, such as the bundle type \(for example: **Board support** or **Kernel support**\), to further filter the distributions.
- 4. Find your desired distribution and click it to view details.
+ ![](figures/hpm-page.png "hpm-page")
- **Figure 1** HPM page
- ![](figures/hpm-page.png "hpm-page")
+2. Learn more about the distribution.
+ 1. Read carefully the information about the distribution to learn its application scenarios, features, components, usage, and customization methods.
+ 2. Click **Download** if you want to download the distribution to your local PC.
+ 3. Click **Device component tailoring** if you want to add or delete components of the distribution.
-2. Learn more about the distribution.
+ **Figure 2** Example distribution
- 1. Read carefully the information about the distribution to learn its application scenarios, features, bundles, usage, and customization methods, as shown in the following figure.
- 2. Click **Download** if you want to download the distribution to your local PC.
- 3. Click **Custom** if you want to add or delete bundles of the distribution.
+ ![](figures/example-distribution.png "example-distribution")
- **Figure 2** Example distribution
- ![](figures/example-distribution.png "example-distribution")
+3. Customize components.
+ 1. Access the **Device Component Tailoring** page.
+ 2. Add or delete components.
+ - In the **Customizable Components** pane, click the plus sign. In the displayed dialog box, add required components.
+ - In the **Customizable Components** pane, click the minus sign next to a component to delete it.
+ 3. Enter the basic information about your project, including the name, version, and description, on the right pane.
+ 4. Click **Download**. The system generates the OpenHarmony code structure file (for example, **my_cust_dist.zip**) and saves it to your local PC.
-3. Customize bundles.
- 1. Access the **Custom solution** page, as shown in the following figure.
- 2. Set the toggle switch next to a specific optional bundle to delete it from the distribution, or click **Add bundle** to add new bundles.
- 3. Enter the basic information about your project, including the bundle name, version, and description, on the right pane.
- 4. Click **Download**. The system generates the OpenHarmony code structure file \(for example, **my\_cust\_dist.zip**\) and saves it to your local PC.
+ **Figure 3** Customizing components
- **Figure 3** Customizing bundles
- ![](figures/customizing-bundles.png "customizing-bundles")
+ ![](figures/customizing-components.png "customizing-components")
-4. Install bundles.
- 1. Decompress the downloaded code structure file using CMD on Windows (or shell in Linux).
- 2. In the generated directory, run the **hpm install** command to download and install bundles. If the **Install successful** message is displayed, the command has been executed successfully.
- 3. Obtain the bundles. The downloaded bundles are stored in the **ohos\_bundles** folder under the project directory. \(The source code of some bundles will be copied to a specified directory after the bundles are installed.\)
+4. Install components.
+ 1. Decompress the downloaded code structure file using CMD on Windows (or shell in Linux).
+ 2. In the generated directory, run the **hpm install** command to download and install components. If the **Install successful** message is displayed, the command has been executed successfully.
+ 3. The downloaded components will be stored in the **ohos_bundles** folder under the project directory. (The source code of some components will be copied to a specified directory after the components are installed.)
-## Method 3: Acquiring Source Code from a Mirror Site
+## Method 3: Acquiring Source Code from a Mirror Site
To ensure the download performance, you are advised to download the source code or the corresponding solution from the image library of the respective site listed in the table below.
The table below provides only the sites for downloading the latest OpenHarmony LTS code. For details about how to obtain the source code of earlier versions, see the [Release Notes](../../release-notes/Readme.md).
-**Table 1** Sites for acquiring source code
+ **Table 1** Sites for acquiring source code
| **LTS Code**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| -------- | -------- | -------- | -------- | -------- |
@@ -182,22 +200,23 @@ The table below provides only the sites for downloading the latest OpenHarmony L
| Hi3516 solution-Linux (binary)| 3.0 | [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz.sha256) | 418.1 MB |
| RELEASE-NOTES | 3.0 | [Download](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.0-LTS/en/release-notes/OpenHarmony-v3.0-LTS.md)| - | - |
| **Source Code of the Latest Release**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
-| Full code base (for mini, small, and standard systems)| 3.2 Release | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz.sha256)| 21.8 GB |
+| Full code beta (for mini, small, and standard systems)| 3.2 Release | [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz.sha256)| 21.8 GB |
| Hi3861 solution (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz.sha256)| 22.9 MB |
-| Hi3516 solution-LiteOS (binary)| 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256)| 294.3 MB |
-| Hi3516 solution-Linux (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256)| 174.3 MB |
+| Hi3516 solution-LiteOS (binary)| 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256) | 294.3 MB |
+| Hi3516 solution-Linux (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz) | [Download](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB |
| RK3568 standard system solution (binary) | 3.2 Release| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz)| [Download](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz.sha256)| 3.9 GB |
| RELEASE-NOTES | 3.2 Release| [Download](../../release-notes/OpenHarmony-v3.2-release.md)| - | - |
-| **Compiler Toolchain**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
+| **Compiler Toolchain**| **Version**| **Site**| **SHA-256 Checksum**| Software Package Size|
| Compiler toolchain| - | [Download](https://repo.huaweicloud.com/openharmony/os/2.0/tool_chain/)| - | - |
-## Method 4: Acquiring Source Code from the GitHub Image Repository
->![](../public_sys-resources/icon-note.gif) **NOTE**
->
+## Method 4: Acquiring Source Code from the GitHub Image Repository
+
+> **NOTE**
> The image repository is synchronized at 23:00 (UTC +8:00) every day.
-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 GitHub. For details, see [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).\)
+
+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 GitHub. For details, see [Adding a new SSH key to your GitHub account](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account).)
```shell
repo init -u git@github.com:openharmony/manifest.git -b master --no-repo-verify
@@ -207,23 +226,25 @@ repo forall -c 'git lfs pull'
Method 2: Use the **repo** tool to download the source code over HTTPS.
+
```shell
repo init -u https://github.com/openharmony/manifest.git -b master --no-repo-verify
repo sync -c
repo forall -c 'git lfs pull'
```
-## Source Code Directories
+
+## Source Code Directories
The following table describes the OpenHarmony source code directories.
-**Table 2** Source code directories
+ **Table 2** Source code directories
-| Directory| Description|
+| **Directory**| **Description**|
| -------- | -------- |
| applications | Application samples, for example, **camera**.|
| base | Basic software service subsystem set and hardware service subsystem set.|
-| build | Bundle-based compilation, building, and configuration scripts.|
+| build | Component-based compilation, building, and configuration scripts.|
| docs | Reference documents.|
| domains | Enhanced software service subsystem set.|
| drivers | Driver subsystem.|
@@ -231,7 +252,7 @@ The following table describes the OpenHarmony source code directories.
| kernel | Kernel subsystem.|
| prebuilts | Compiler and tool chain subsystem.|
| test | Test subsystem.|
-| third_party | Open-source third-party software.|
+| third_party | Open source third-party software.|
| utils | Commonly used development utilities.|
| vendor | Vendor-provided software.|
| build.py | Build script file.|