diff --git a/en/application-dev/dfx/apprecovery-guidelines.md b/en/application-dev/dfx/apprecovery-guidelines.md
index 0e4e7c257cbde0853a36bd8a3729ee707a4b2391..b2992e7c9958f0a1ffd87db9e4549bf0187bad78 100644
--- a/en/application-dev/dfx/apprecovery-guidelines.md
+++ b/en/application-dev/dfx/apprecovery-guidelines.md
@@ -17,7 +17,7 @@ The application recovery APIs are provided by the **appRecovery** module, which
| API | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
-| enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void; | Enables the application recovery function. |
+| enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void; | Enables the application recovery function. |
| saveAppState(): boolean; | Saves the ability status of an application. |
| restartApp(): void; | Restarts the current process. If there is saved ability status, it will be passed to the **want** parameter's **wantParam** attribute of the **onCreate** lifecycle callback of the ability.|
diff --git a/en/application-dev/faqs/faqs-dfx.md b/en/application-dev/faqs/faqs-dfx.md
index ec1c8dbfedd5fa3c087c96d54c9c2aab73d75e8a..9fc12a1b1c26e109240702cca50e50b77495bdf5 100644
--- a/en/application-dev/faqs/faqs-dfx.md
+++ b/en/application-dev/faqs/faqs-dfx.md
@@ -6,7 +6,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5
1. Locate the crash-related code based on the service log.
-2. View the error information in the crash file. The crash file is located at **/data/log/faultlog/faultlogger/**.
+2. View the error information in the crash file, which is located at **/data/log/faultlog/faultlogger/**.
## Why cannot access controls in the UiTest test framework?
diff --git a/en/application-dev/faqs/faqs-language.md b/en/application-dev/faqs/faqs-language.md
index 4c0a6cba384f4e94832a6a4a933aebeee4b2f364..db7e95d5ede5c3bead52e16bceb16e90c6188b79 100644
--- a/en/application-dev/faqs/faqs-language.md
+++ b/en/application-dev/faqs/faqs-language.md
@@ -51,9 +51,9 @@ build() {
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
-1. Obtain data in Uint8Array format by calling the **RawFile** API of **resourceManager**.
+1. Obtain Uint8Array data by calling the **RawFile** API of **resourceManager**.
-2. Convert data in Uint8Array format to the string type by calling the **String.fromCharCode** API.
+2. Convert the Uint8Array data to strings by calling the **String.fromCharCode** API.
Reference: [Resource Manager](../reference/apis/js-apis-resource-manager.md)
diff --git a/en/application-dev/reference/apis/js-apis-keycode.md b/en/application-dev/reference/apis/js-apis-keycode.md
index 6680ea14f2ea3daa0d9144013469cf094c4904d2..a1261ce5d59d661af602b3ff3657a22ba3538764 100644
--- a/en/application-dev/reference/apis/js-apis-keycode.md
+++ b/en/application-dev/reference/apis/js-apis-keycode.md
@@ -2,7 +2,8 @@
The Keycode module provides keycodes for a key device.
-> **NOTE**
+> **NOTE**
+>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -337,7 +338,7 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode';
| KEYCODE_WWAN_WIMAX | number | Yes| No| WWAN WiMAX key|
| KEYCODE_RFKILL | number | Yes| No| RF Kill key|
| KEYCODE_CHANNEL | number | Yes| No| Channel key|
-| KEYCODE_BTN_0 | number | Yes| No| Key 0|
+| KEYCODE_BTN_0 | number | Yes| No| Button 0|
| KEYCODE_BTN_1 | number | Yes| No| Button 1|
| KEYCODE_BTN_2 | number | Yes| No| Button 2|
| KEYCODE_BTN_3 | number | Yes| No| Button 3|
diff --git a/en/application-dev/reference/apis/js-apis-net-connection.md b/en/application-dev/reference/apis/js-apis-net-connection.md
index eab804c642f60fd0159b61e9a1bae4d0efd17417..2fbe0e1c1d90b155fc52702d1dc69982e511c140 100644
--- a/en/application-dev/reference/apis/js-apis-net-connection.md
+++ b/en/application-dev/reference/apis/js-apis-net-connection.md
@@ -332,7 +332,6 @@ connection.getDefaultNet().then(function (netHandle) {
});
```
-
## connection.reportNetConnected
reportNetConnected(netHandle: NetHandle): Promise<void>
@@ -490,7 +489,6 @@ connection.getAddressesByName(host).then(function (addresses) {
})
```
-
## connection.enableAirplaneMode
enableAirplaneMode(callback: AsyncCallback\): void
@@ -539,7 +537,6 @@ connection.enableAirplaneMode().then(function (error) {
})
```
-
## connection.disableAirplaneMode
disableAirplaneMode(callback: AsyncCallback\): void
@@ -588,7 +585,6 @@ connection.disableAirplaneMode().then(function (error) {
})
```
-
## connection.createNetConnection
createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection
@@ -847,33 +843,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses
**Example**
```js
-connection.getDefaultNet().then(function (netHandle) {
+import socket from "@ohos.net.socket";
+connection.getDefaultNet().then((netHandle)=>{
var tcp = socket.constructTCPSocketInstance();
var udp = socket.constructUDPSocketInstance();
- let socketType = "xxxx";
+ let socketType = "TCPSocket";
if (socketType == "TCPSocket") {
tcp.bind({
- address: "xxxx", port: xxxx, family: xxxx
+ address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => {
- netHandle.bindSocket(tcp, function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
+ if (err) {
+ console.log('bind fail');
+ }
+ netHandle.bindSocket(tcp, (error, data)=>{
+ if (error) {
+ console.log(JSON.stringify(error));
+ } else {
+ console.log(JSON.stringify(data));
+ }
+ })
})
} else {
+ let callback = value => {
+ console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo);
+ }
udp.on('message', callback);
udp.bind({
- address: "xxxx", port: xxxx, family: xxxx
+ address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => {
+ if (err) {
+ console.log('bind fail');
+ }
udp.on('message', (data) => {
- console.log(JSON.stringify(data))
- });
- netHandle.bindSocket(udp, function (error, data) {
- console.log(JSON.stringify(error))
- console.log(JSON.stringify(data))
+ console.log(JSON.stringify(data))
});
+ netHandle.bindSocket(udp,(error, data)=>{
+ if (error) {
+ console.log(JSON.stringify(error));
+ } else {
+ console.log(JSON.stringify(data));
+ }
+ })
})
- }
-}
+ }
+})
```
### bindSocket
@@ -901,31 +914,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses
**Example**
```js
-connection.getDefaultNet().then(function (netHandle) {
+import socket from "@ohos.net.socket";
+connection.getDefaultNet().then((netHandle)=>{
var tcp = socket.constructTCPSocketInstance();
var udp = socket.constructUDPSocketInstance();
- let socketType = "xxxx";
- if(socketType == "TCPSocket") {
+ let socketType = "TCPSocket";
+ if (socketType == "TCPSocket") {
tcp.bind({
- address: "xxxx", port: xxxx, family: xxxx
+ address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => {
- netHandle.bindSocket(tcp).then(err, data) {
- console.log(JSON.stringify(data))
+ if (err) {
+ console.log('bind fail');
+ }
+ netHandle.bindSocket(tcp).then((err, data) => {
+ if (err) {
+ console.log(JSON.stringify(err));
+ } else {
+ console.log(JSON.stringify(data));
+ }
+ })
})
} else {
+ let callback = value => {
+ console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo);
+ }
udp.on('message', callback);
udp.bind({
- address: "xxxx", port: xxxx, family: xxxx
+ address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => {
+ if (err) {
+ console.log('bind fail');
+ }
udp.on('message', (data) => {
- console.log(JSON.stringify(data))
- });
- netHandle.bindSocket(tcp).then(err, data) {
- console.log(JSON.stringify(data))
- });
+ console.log(JSON.stringify(data));
+ })
+ netHandle.bindSocket(udp).then((err, data) => {
+ if (err) {
+ console.log(JSON.stringify(err));
+ } else {
+ console.log(JSON.stringify(data));
+ }
+ })
})
- }
-}
+ }
+})
```
diff --git a/en/application-dev/reference/apis/js-apis-net-sharing.md b/en/application-dev/reference/apis/js-apis-net-sharing.md
index 3c654bbbc7b9e3cca73f385ea5af025d2072b75d..c63c09c5a84bbec34b5b2274d3089fad4fbb603b 100644
--- a/en/application-dev/reference/apis/js-apis-net-sharing.md
+++ b/en/application-dev/reference/apis/js-apis-net-sharing.md
@@ -405,7 +405,7 @@ Obtains the names of NICs in the specified network sharing state. This API uses
**Example**
```js
-import SharingIfaceState from '@ohos.net.sharing'
+import SharingIfaceType from '@ohos.net.sharing'
sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER, (error, data) => {
console.log(JSON.stringify(error));
console.log(JSON.stringify(data));
@@ -498,7 +498,7 @@ Obtains the network sharing state of the specified type. This API uses a promise
```js
import SharingIfaceType from '@ohos.net.sharing'
-sharing.getSharingIfaces(SharingIfaceType.SHARING_WIFI).then(data => {
+sharing.getSharingState(SharingIfaceType.SHARING_WIFI).then(data => {
console.log(JSON.stringify(data));
}).catch(error => {
console.log(JSON.stringify(error));
@@ -525,8 +525,8 @@ Obtains regular expressions of NICs of a specified type. This API uses an asynch
**Example**
```js
-import SharingIfaceState from '@ohos.net.sharing'
-sharing.getSharingState(SharingIfaceType.SHARING_WIFI, (error, data) => {
+import SharingIfaceType from '@ohos.net.sharing'
+sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI, (error, data) => {
console.log(JSON.stringify(error));
console.log(JSON.stringify(data));
});
@@ -565,7 +565,7 @@ sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI).then(data => {
});
```
-## on('sharingStateChange')
+## sharing.on('sharingStateChange')
on(type: 'sharingStateChange', callback: Callback\): void
@@ -591,7 +591,7 @@ sharing.on('sharingStateChange', (error, data) => {
});
```
-## off('sharingStateChange')
+## sharing.off('sharingStateChange')
off(type: 'sharingStateChange', callback?: Callback\): void
@@ -617,7 +617,7 @@ sharing.off('sharingStateChange', (error, data) => {
});
```
-## on('interfaceSharingStateChange')
+## sharing.on('interfaceSharingStateChange')
on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void
@@ -643,7 +643,7 @@ sharing.on('interfaceSharingStateChange', (error, data) => {
});
```
-## off('interfaceSharingStateChange')
+## sharing.off('interfaceSharingStateChange')
off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void
@@ -669,7 +669,7 @@ sharing.off('interfaceSharingStateChange', (error, data) => {
});
```
-## on('sharingUpstreamChange')
+## sharing.on('sharingUpstreamChange')
on(type: 'sharingUpstreamChange', callback: Callback\): void
@@ -695,7 +695,7 @@ sharing.on('sharingUpstreamChange', (error, data) => {
});
```
-## off('sharingUpstreamChange')
+## sharing.off('sharingUpstreamChange')
off(type: 'sharingUpstreamChange', callback?: Callback\): void
diff --git a/en/application-dev/reference/apis/js-apis-radio.md b/en/application-dev/reference/apis/js-apis-radio.md
index 40051c22a874d420c4773c53142597eab952aa09..91c6be9cd7d076dbb72a502e64363d729668972f 100644
--- a/en/application-dev/reference/apis/js-apis-radio.md
+++ b/en/application-dev/reference/apis/js-apis-radio.md
@@ -1734,8 +1734,8 @@ Enables listening for **imsRegStateChange** events for the SIM card in the speci
**Example**
```js
-radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
+ console.log(`callback: data->${JSON.stringify(data)}`);
});
```
@@ -1763,8 +1763,8 @@ Disables listening for **imsRegStateChange** events for the SIM card in the spec
**Example**
```js
-radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
+ console.log(`callback: data->${JSON.stringify(data)}`);
});
```
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 ca250939af9aadf2c544dee30431c889331d332e..b3be9875df2554c6df5b8c358c9243d734d87874 100644
--- a/en/application-dev/reference/apis/js-apis-usb-deprecated.md
+++ b/en/application-dev/reference/apis/js-apis-usb-deprecated.md
@@ -638,16 +638,16 @@ Represents the USB endpoint from which data is sent or received. You can obtain
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Description |
-| ------------- | ------------------------------------------- | ------------- |
-| address | number | Endpoint address. |
-| attributes | number | Endpoint attributes. |
-| interval | number | Endpoint interval. |
-| maxPacketSize | number | Maximum size of data packets on the endpoint. |
-| direction | [USBRequestDirection](#usbrequestdirection) | Endpoint direction. |
-| number | number | Endpoint number. |
-| type | number | Endpoint type. |
-| interfaceId | number | 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
@@ -655,15 +655,15 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Description |
-| ---------------- | ---------------------------------------- | --------------------- |
-| id | number | Unique ID of the USB interface. |
-| protocol | number | Interface protocol. |
-| clazz | number | Device type. |
-| subClass | number | Device subclass. |
-| alternateSetting | number | Settings for alternating between descriptors of the same USB interface.|
-| name | string | Interface name. |
-| endpoints | Array<[USBEndpoint](#usbendpoint)> | 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
@@ -671,15 +671,15 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Description |
-| -------------- | ------------------------------------------------ | --------------- |
-| id | number | Unique ID of the USB configuration. |
-| attributes | number | Configuration attributes. |
-| maxPower | number | Maximum power consumption, in mA. |
-| name | string | Configuration name, which can be left empty. |
-| isRemoteWakeup | boolean | Support for remote wakeup.|
-| isSelfPowered | boolean | Support for independent power supplies.|
-| interfaces | Array <[USBInterface](#usbinterface)> | 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
@@ -687,21 +687,21 @@ Represents the USB device information.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Description |
-| ---------------- | ------------------------------------ | ---------- |
-| busNum | number | Bus address. |
-| devAddress | number | Device address. |
-| serial | string | Sequence number. |
-| name | string | Device name. |
-| manufacturerName | string | Device manufacturer. |
-| productName | string | Product name. |
-| version | string | Version number. |
-| vendorId | number | Vendor ID. |
-| productId | number | Product ID. |
-| clazz | number | Device class. |
-| subClass | number | Device subclass. |
-| protocol | number | Device protocol code. |
-| configs | Array<[USBConfig](#usbconfig)> | 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 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.|
## USBDevicePipe
@@ -709,10 +709,10 @@ Represents a USB device pipe, which is used to determine a USB device.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Description |
-| ---------- | ------ | ----- |
-| busNum | number | Bus address.|
-| devAddress | number | Device address.|
+| Name | Type | Mandatory | Description |
+| -------- | ------- | --------- | ----------- |
+| busNum | number | Yes | Bus address.|
+| devAddress | number | Yes | Device address.|
## USBControlParams
@@ -720,14 +720,14 @@ Represents control transfer parameters.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Description |
-| ------- | ----------------------------------------------- | ---------------- |
-| request | number | Request type. |
-| target | [USBRequestTargetType](#usbrequesttargettype) | Request target type. |
-| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Control request type. |
-| value | number | Request parameter value. |
-| index | number | Index of the request parameter value.|
-| data | Uint8Array | 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+
@@ -737,11 +737,11 @@ Represents a USB port.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type | Description |
-| -------------- | -------------------------------- | ----------------------------------- |
-| id | number | Unique identifier of a USB port. |
-| supportedModes | [PortModeType](#portmodetype9) | Numeric mask combination for the supported mode list.|
-| status | [USBPortStatus](#usbportstatus9) | 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+
@@ -751,11 +751,11 @@ Enumerates USB port roles.
**System capability**: SystemCapability.USB.USBManager
-| Name | Type| Description |
-| ---------------- | -------- | ---------------------- |
-| currentMode | number | Current USB mode. |
-| currentPowerRole | number | Current power role. |
-| currentDataRole | number | 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-usb.md b/en/application-dev/reference/apis/js-apis-usb.md
index 18c0ae75e03604340f2d9f61953c869605d01245..3e1c5b919c881ef5c0d0619a5b35e791c48c46cb 100644
--- a/en/application-dev/reference/apis/js-apis-usb.md
+++ b/en/application-dev/reference/apis/js-apis-usb.md
@@ -720,14 +720,14 @@ Represents the USB endpoint from which data is sent or received. You can obtain
| 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.|
+| 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
@@ -737,13 +737,13 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U
| 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. |
+| 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
@@ -753,13 +753,13 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip
| 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. |
+| 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
@@ -769,19 +769,19 @@ Represents the USB device 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 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.|
+| 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.|
## USBDevicePipe
@@ -802,12 +802,12 @@ Represents control transfer parameters.
| 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. |
+| 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. |
## USBPort
@@ -819,9 +819,9 @@ Represents a USB port.
| Name | Type | Mandatory |Description |
| -------------- | ------------------------------- | ------------------- |------------------------ |
-| id | number | Yes |Unique identifier of a USB port. |
-| supportedModes | [PortModeType](#portmodetype) | Yes |Numeric mask combination for the supported mode list.|
-| status | [USBPortStatus](#usbportstatus) | Yes |USB port role. |
+| id | number | Yes | Unique identifier of a USB port. |
+| supportedModes | [PortModeType](#portmodetype) | Yes | Numeric mask combination for the supported mode list.|
+| status | [USBPortStatus](#usbportstatus) | Yes | USB port role. |
## USBPortStatus
@@ -833,9 +833,9 @@ Enumerates USB port roles.
| Name | Type| Mandatory |Description |
| ---------------- | -------- | ---------------- |---------------------- |
-| currentMode | number | Yes|Current USB mode. |
-| currentPowerRole | number | Yes |Current power role. |
-| currentDataRole | number | Yes |Current data role.|
+| currentMode | number | Yes | Current USB mode. |
+| currentPowerRole | number | Yes | Current power role. |
+| currentDataRole | number | Yes | Current data role.|
## USBRequestTargetType
@@ -843,12 +843,12 @@ Enumerates request target types.
**System capability**: SystemCapability.USB.USBManager
-| Name | Value | Description |
-| ---------------------------- | ---- | ------ |
-| USB_REQUEST_TARGET_DEVICE | 0 | Device|
-| USB_REQUEST_TARGET_INTERFACE | 1 | Interface|
-| USB_REQUEST_TARGET_ENDPOINT | 2 | Endpoint|
-| USB_REQUEST_TARGET_OTHER | 3 | Other|
+| Name | Value | Description |
+| ---------------------------- | ----- | ----------- |
+| USB_REQUEST_TARGET_DEVICE | 0 | Device |
+| USB_REQUEST_TARGET_INTERFACE | 1 | Interface |
+| USB_REQUEST_TARGET_ENDPOINT | 2 | Endpoint |
+| USB_REQUEST_TARGET_OTHER | 3 | Other |
## USBControlRequestType