提交 baa703b7 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 8c4b686d
...@@ -17,7 +17,7 @@ The application recovery APIs are provided by the **appRecovery** module, which ...@@ -17,7 +17,7 @@ The application recovery APIs are provided by the **appRecovery** module, which
| API | Description | | 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. | | 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.| | 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.|
......
...@@ -6,7 +6,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5 ...@@ -6,7 +6,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5
1. Locate the crash-related code based on the service log. 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? ## Why cannot access controls in the UiTest test framework?
......
...@@ -51,9 +51,9 @@ build() { ...@@ -51,9 +51,9 @@ build() {
Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9 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) Reference: [Resource Manager](../reference/apis/js-apis-resource-manager.md)
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
The Keycode module provides keycodes for a key device. The Keycode module provides keycodes for a key device.
> **NOTE**<br> > **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. > 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 ## Modules to Import
...@@ -337,7 +338,7 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode'; ...@@ -337,7 +338,7 @@ import {KeyCode} from '@ohos.multimodalInput.keyCode';
| KEYCODE_WWAN_WIMAX | number | Yes| No| WWAN WiMAX key| | KEYCODE_WWAN_WIMAX | number | Yes| No| WWAN WiMAX key|
| KEYCODE_RFKILL | number | Yes| No| RF Kill key| | KEYCODE_RFKILL | number | Yes| No| RF Kill key|
| KEYCODE_CHANNEL | number | Yes| No| Channel 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_1 | number | Yes| No| Button 1|
| KEYCODE_BTN_2 | number | Yes| No| Button 2| | KEYCODE_BTN_2 | number | Yes| No| Button 2|
| KEYCODE_BTN_3 | number | Yes| No| Button 3| | KEYCODE_BTN_3 | number | Yes| No| Button 3|
......
...@@ -332,7 +332,6 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -332,7 +332,6 @@ connection.getDefaultNet().then(function (netHandle) {
}); });
``` ```
## connection.reportNetConnected ## connection.reportNetConnected
reportNetConnected(netHandle: NetHandle): Promise&lt;void&gt; reportNetConnected(netHandle: NetHandle): Promise&lt;void&gt;
...@@ -490,7 +489,6 @@ connection.getAddressesByName(host).then(function (addresses) { ...@@ -490,7 +489,6 @@ connection.getAddressesByName(host).then(function (addresses) {
}) })
``` ```
## connection.enableAirplaneMode ## connection.enableAirplaneMode
enableAirplaneMode(callback: AsyncCallback\<void>): void enableAirplaneMode(callback: AsyncCallback\<void>): void
...@@ -539,7 +537,6 @@ connection.enableAirplaneMode().then(function (error) { ...@@ -539,7 +537,6 @@ connection.enableAirplaneMode().then(function (error) {
}) })
``` ```
## connection.disableAirplaneMode ## connection.disableAirplaneMode
disableAirplaneMode(callback: AsyncCallback\<void>): void disableAirplaneMode(callback: AsyncCallback\<void>): void
...@@ -588,7 +585,6 @@ connection.disableAirplaneMode().then(function (error) { ...@@ -588,7 +585,6 @@ connection.disableAirplaneMode().then(function (error) {
}) })
``` ```
## connection.createNetConnection ## connection.createNetConnection
createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection
...@@ -847,33 +843,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses ...@@ -847,33 +843,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses
**Example** **Example**
```js ```js
connection.getDefaultNet().then(function (netHandle) { import socket from "@ohos.net.socket";
connection.getDefaultNet().then((netHandle)=>{
var tcp = socket.constructTCPSocketInstance(); var tcp = socket.constructTCPSocketInstance();
var udp = socket.constructUDPSocketInstance(); var udp = socket.constructUDPSocketInstance();
let socketType = "xxxx"; let socketType = "TCPSocket";
if (socketType == "TCPSocket") { if (socketType == "TCPSocket") {
tcp.bind({ tcp.bind({
address: "xxxx", port: xxxx, family: xxxx address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => { }, err => {
netHandle.bindSocket(tcp, function (error, data) { if (err) {
console.log(JSON.stringify(error)) console.log('bind fail');
console.log(JSON.stringify(data)) }
netHandle.bindSocket(tcp, (error, data)=>{
if (error) {
console.log(JSON.stringify(error));
} else {
console.log(JSON.stringify(data));
}
})
}) })
} else { } else {
let callback = value => {
console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo);
}
udp.on('message', callback); udp.on('message', callback);
udp.bind({ udp.bind({
address: "xxxx", port: xxxx, family: xxxx address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => { }, err => {
if (err) {
console.log('bind fail');
}
udp.on('message', (data) => { udp.on('message', (data) => {
console.log(JSON.stringify(data)) console.log(JSON.stringify(data))
});
netHandle.bindSocket(udp, function (error, data) {
console.log(JSON.stringify(error))
console.log(JSON.stringify(data))
}); });
netHandle.bindSocket(udp,(error, data)=>{
if (error) {
console.log(JSON.stringify(error));
} else {
console.log(JSON.stringify(data));
}
})
}) })
} }
} })
``` ```
### bindSocket ### bindSocket
...@@ -901,31 +914,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses ...@@ -901,31 +914,50 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses
**Example** **Example**
```js ```js
connection.getDefaultNet().then(function (netHandle) { import socket from "@ohos.net.socket";
connection.getDefaultNet().then((netHandle)=>{
var tcp = socket.constructTCPSocketInstance(); var tcp = socket.constructTCPSocketInstance();
var udp = socket.constructUDPSocketInstance(); var udp = socket.constructUDPSocketInstance();
let socketType = "xxxx"; let socketType = "TCPSocket";
if(socketType == "TCPSocket") { if (socketType == "TCPSocket") {
tcp.bind({ tcp.bind({
address: "xxxx", port: xxxx, family: xxxx address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => { }, err => {
netHandle.bindSocket(tcp).then(err, data) { if (err) {
console.log(JSON.stringify(data)) console.log('bind fail');
}
netHandle.bindSocket(tcp).then((err, data) => {
if (err) {
console.log(JSON.stringify(err));
} else {
console.log(JSON.stringify(data));
}
})
}) })
} else { } else {
let callback = value => {
console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo);
}
udp.on('message', callback); udp.on('message', callback);
udp.bind({ udp.bind({
address: "xxxx", port: xxxx, family: xxxx address: '192.168.xx.xxx', port: xxxx, family: 1
}, err => { }, err => {
if (err) {
console.log('bind fail');
}
udp.on('message', (data) => { udp.on('message', (data) => {
console.log(JSON.stringify(data)) console.log(JSON.stringify(data));
}); })
netHandle.bindSocket(tcp).then(err, data) { netHandle.bindSocket(udp).then((err, data) => {
console.log(JSON.stringify(data)) if (err) {
}); console.log(JSON.stringify(err));
} else {
console.log(JSON.stringify(data));
}
})
}) })
} }
} })
``` ```
......
...@@ -405,7 +405,7 @@ Obtains the names of NICs in the specified network sharing state. This API uses ...@@ -405,7 +405,7 @@ Obtains the names of NICs in the specified network sharing state. This API uses
**Example** **Example**
```js ```js
import SharingIfaceState from '@ohos.net.sharing' import SharingIfaceType from '@ohos.net.sharing'
sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER, (error, data) => { sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER, (error, data) => {
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
...@@ -498,7 +498,7 @@ Obtains the network sharing state of the specified type. This API uses a promise ...@@ -498,7 +498,7 @@ Obtains the network sharing state of the specified type. This API uses a promise
```js ```js
import SharingIfaceType from '@ohos.net.sharing' 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)); console.log(JSON.stringify(data));
}).catch(error => { }).catch(error => {
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
...@@ -525,8 +525,8 @@ Obtains regular expressions of NICs of a specified type. This API uses an asynch ...@@ -525,8 +525,8 @@ Obtains regular expressions of NICs of a specified type. This API uses an asynch
**Example** **Example**
```js ```js
import SharingIfaceState from '@ohos.net.sharing' import SharingIfaceType from '@ohos.net.sharing'
sharing.getSharingState(SharingIfaceType.SHARING_WIFI, (error, data) => { sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI, (error, data) => {
console.log(JSON.stringify(error)); console.log(JSON.stringify(error));
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
}); });
...@@ -565,7 +565,7 @@ sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI).then(data => { ...@@ -565,7 +565,7 @@ sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI).then(data => {
}); });
``` ```
## on('sharingStateChange') ## sharing.on('sharingStateChange')
on(type: 'sharingStateChange', callback: Callback\<boolean>): void on(type: 'sharingStateChange', callback: Callback\<boolean>): void
...@@ -591,7 +591,7 @@ sharing.on('sharingStateChange', (error, data) => { ...@@ -591,7 +591,7 @@ sharing.on('sharingStateChange', (error, data) => {
}); });
``` ```
## off('sharingStateChange') ## sharing.off('sharingStateChange')
off(type: 'sharingStateChange', callback?: Callback\<boolean>): void off(type: 'sharingStateChange', callback?: Callback\<boolean>): void
...@@ -617,7 +617,7 @@ sharing.off('sharingStateChange', (error, data) => { ...@@ -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 on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void
...@@ -643,7 +643,7 @@ sharing.on('interfaceSharingStateChange', (error, data) => { ...@@ -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 off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void
...@@ -669,7 +669,7 @@ sharing.off('interfaceSharingStateChange', (error, data) => { ...@@ -669,7 +669,7 @@ sharing.off('interfaceSharingStateChange', (error, data) => {
}); });
``` ```
## on('sharingUpstreamChange') ## sharing.on('sharingUpstreamChange')
on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void
...@@ -695,7 +695,7 @@ sharing.on('sharingUpstreamChange', (error, data) => { ...@@ -695,7 +695,7 @@ sharing.on('sharingUpstreamChange', (error, data) => {
}); });
``` ```
## off('sharingUpstreamChange') ## sharing.off('sharingUpstreamChange')
off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void
......
...@@ -1734,8 +1734,8 @@ Enables listening for **imsRegStateChange** events for the SIM card in the speci ...@@ -1734,8 +1734,8 @@ Enables listening for **imsRegStateChange** events for the SIM card in the speci
**Example** **Example**
```js ```js
radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -1763,8 +1763,8 @@ Disables listening for **imsRegStateChange** events for the SIM card in the spec ...@@ -1763,8 +1763,8 @@ Disables listening for **imsRegStateChange** events for the SIM card in the spec
**Example** **Example**
```js ```js
radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: data->${JSON.stringify(data)}`);
}); });
``` ```
......
...@@ -638,16 +638,16 @@ Represents the USB endpoint from which data is sent or received. You can obtain ...@@ -638,16 +638,16 @@ Represents the USB endpoint from which data is sent or received. You can obtain
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------------- | ------------------------------------------- | ------------- | | -------- | ------- | --------- | ----------- |
| address | number | Endpoint address. | | address | number | Yes | Endpoint address. |
| attributes | number | Endpoint attributes. | | attributes | number | Yes | Endpoint attributes. |
| interval | number | Endpoint interval. | | interval | number | Yes | Endpoint interval. |
| maxPacketSize | number | Maximum size of data packets on the endpoint. | | maxPacketSize | number | Yes | Maximum size of data packets on the endpoint. |
| direction | [USBRequestDirection](#usbrequestdirection) | Endpoint direction. | | direction | [USBRequestDirection](#usbrequestdirection) | Yes | Endpoint direction. |
| number | number | Endpoint number. | | number | number | Yes | Endpoint number. |
| type | number | Endpoint type. | | type | number | Yes | Endpoint type. |
| interfaceId | number | Unique ID of the interface to which the endpoint belongs.| | interfaceId | number | Yes | Unique ID of the interface to which the endpoint belongs.|
## USBInterface ## USBInterface
...@@ -655,15 +655,15 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U ...@@ -655,15 +655,15 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ---------------- | ---------------------------------------- | --------------------- | | -------- | ------- | --------- | ----------- |
| id | number | Unique ID of the USB interface. | | id | number | Yes | Unique ID of the USB interface. |
| protocol | number | Interface protocol. | | protocol | number | Yes | Interface protocol. |
| clazz | number | Device type. | | clazz | number | Yes | Device type. |
| subClass | number | Device subclass. | | subClass | number | Yes | Device subclass. |
| alternateSetting | number | Settings for alternating between descriptors of the same USB interface.| | alternateSetting | number | Yes | Settings for alternating between descriptors of the same USB interface.|
| name | string | Interface name. | | name | string | Yes | Interface name. |
| endpoints | Array&lt;[USBEndpoint](#usbendpoint)&gt; | Endpoints that belong to the USB interface. | | endpoints | Array&lt;[USBEndpoint](#usbendpoint)&gt; | Yes | Endpoints that belong to the USB interface. |
## USBConfig ## USBConfig
...@@ -671,15 +671,15 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip ...@@ -671,15 +671,15 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Description | | Name | Type | Mandatory | Description |
| -------------- | ------------------------------------------------ | --------------- | | -------- | ------- | --------- | ----------- |
| id | number | Unique ID of the USB configuration. | | id | number | Yes | Unique ID of the USB configuration. |
| attributes | number | Configuration attributes. | | attributes | number | Yes | Configuration attributes. |
| maxPower | number | Maximum power consumption, in mA. | | maxPower | number | Yes | Maximum power consumption, in mA. |
| name | string | Configuration name, which can be left empty. | | name | string | Yes | Configuration name, which can be left empty. |
| isRemoteWakeup | boolean | Support for remote wakeup.| | isRemoteWakeup | boolean | Yes | Support for remote wakeup.|
| isSelfPowered | boolean | Support for independent power supplies.| | isSelfPowered | boolean | Yes | Support for independent power supplies.|
| interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Supported interface attributes. | | interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Yes | Supported interface attributes. |
## USBDevice ## USBDevice
...@@ -687,21 +687,21 @@ Represents the USB device information. ...@@ -687,21 +687,21 @@ Represents the USB device information.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ---------------- | ------------------------------------ | ---------- | | -------- | ------- | --------- | ----------- |
| busNum | number | Bus address. | | busNum | number | Yes | Bus address. |
| devAddress | number | Device address. | | devAddress | number | Yes | Device address. |
| serial | string | Sequence number. | | serial | string | Yes | Sequence number. |
| name | string | Device name. | | name | string | Yes | Device name. |
| manufacturerName | string | Device manufacturer. | | manufacturerName | string | Yes | Device manufacturer. |
| productName | string | Product name. | | productName | string | Yes | Product name. |
| version | string | Version number. | | version | string | Yes | Version number. |
| vendorId | number | Vendor ID. | | vendorId | number | Yes | Vendor ID. |
| productId | number | Product ID. | | productId | number | Yes | Product ID. |
| clazz | number | Device class. | | clazz | number | Yes | Device class. |
| subClass | number | Device subclass. | | subClass | number | Yes | Device subclass. |
| protocol | number | Device protocol code. | | protocol | number | Yes | Device protocol code. |
| configs | Array&lt;[USBConfig](#usbconfig)&gt; | Device configuration descriptor information.| | configs | Array&lt;[USBConfig](#usbconfig)&gt; | Yes | Device configuration descriptor information.|
## USBDevicePipe ## USBDevicePipe
...@@ -709,10 +709,10 @@ Represents a USB device pipe, which is used to determine a USB device. ...@@ -709,10 +709,10 @@ Represents a USB device pipe, which is used to determine a USB device.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ---------- | ------ | ----- | | -------- | ------- | --------- | ----------- |
| busNum | number | Bus address.| | busNum | number | Yes | Bus address.|
| devAddress | number | Device address.| | devAddress | number | Yes | Device address.|
## USBControlParams ## USBControlParams
...@@ -720,14 +720,14 @@ Represents control transfer parameters. ...@@ -720,14 +720,14 @@ Represents control transfer parameters.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Description | | Name | Type | Mandatory | Description |
| ------- | ----------------------------------------------- | ---------------- | | -------- | ------- | --------- | ----------- |
| request | number | Request type. | | request | number | Yes | Request type. |
| target | [USBRequestTargetType](#usbrequesttargettype) | Request target type. | | target | [USBRequestTargetType](#usbrequesttargettype) | Yes | Request target type. |
| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Control request type. | | reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes | Control request type. |
| value | number | Request parameter value. | | value | number | Yes | Request parameter value. |
| index | number | Index of the request parameter value.| | index | number | Yes | Index of the request parameter value.|
| data | Uint8Array | Buffer for writing or reading data. | | data | Uint8Array | Yes | Buffer for writing or reading data. |
## USBPort<sup>9+</sup> ## USBPort<sup>9+</sup>
...@@ -737,11 +737,11 @@ Represents a USB port. ...@@ -737,11 +737,11 @@ Represents a USB port.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type | Description | | Name | Type | Mandatory | Description |
| -------------- | -------------------------------- | ----------------------------------- | | -------- | ------- | --------- | ----------- |
| id | number | Unique identifier of a USB port. | | id | number | Yes | Unique identifier of a USB port. |
| supportedModes | [PortModeType](#portmodetype9) | Numeric mask combination for the supported mode list.| | supportedModes | [PortModeType](#portmodetype9) | Yes | Numeric mask combination for the supported mode list.|
| status | [USBPortStatus](#usbportstatus9) | USB port role. | | status | [USBPortStatus](#usbportstatus9) | Yes | USB port role. |
## USBPortStatus<sup>9+</sup> ## USBPortStatus<sup>9+</sup>
...@@ -751,11 +751,11 @@ Enumerates USB port roles. ...@@ -751,11 +751,11 @@ Enumerates USB port roles.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Type| Description | | Name | Type | Mandatory | Description |
| ---------------- | -------- | ---------------------- | | -------- | ------- | --------- | ----------- |
| currentMode | number | Current USB mode. | | currentMode | number | Yes | Current USB mode. |
| currentPowerRole | number | Current power role. | | currentPowerRole | number | Yes | Current power role. |
| currentDataRole | number | Current data role.| | currentDataRole | number | Yes | Current data role. |
## USBRequestTargetType ## USBRequestTargetType
......
...@@ -720,14 +720,14 @@ Represents the USB endpoint from which data is sent or received. You can obtain ...@@ -720,14 +720,14 @@ Represents the USB endpoint from which data is sent or received. You can obtain
| Name | Type | Mandatory |Description | | Name | Type | Mandatory |Description |
| ------------- | ------------------------------------------- | ------------- |------------- | | ------------- | ------------------------------------------- | ------------- |------------- |
| address | number | Yes|Endpoint address. | | address | number | Yes | Endpoint address. |
| attributes | number | Yes|Endpoint attributes. | | attributes | number | Yes | Endpoint attributes. |
| interval | number | Yes|Endpoint interval. | | interval | number | Yes | Endpoint interval. |
| maxPacketSize | number | Yes|Maximum size of data packets on the endpoint. | | maxPacketSize | number | Yes | Maximum size of data packets on the endpoint. |
| direction | [USBRequestDirection](#usbrequestdirection) | Yes|Endpoint direction. | | direction | [USBRequestDirection](#usbrequestdirection) | Yes | Endpoint direction. |
| number | number | Yes|Endpoint number. | | number | number | Yes | Endpoint number. |
| type | number | Yes|Endpoint type. | | type | number | Yes | Endpoint type. |
| interfaceId | number | Yes|Unique ID of the interface to which the endpoint belongs.| | interfaceId | number | Yes | Unique ID of the interface to which the endpoint belongs.|
## USBInterface ## USBInterface
...@@ -737,13 +737,13 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U ...@@ -737,13 +737,13 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U
| Name | Type | Mandatory |Description | | Name | Type | Mandatory |Description |
| ---------------- | ---------------------------------------- | ------------- |--------------------- | | ---------------- | ---------------------------------------- | ------------- |--------------------- |
| id | number | Yes|Unique ID of the USB interface. | | id | number | Yes | Unique ID of the USB interface. |
| protocol | number | Yes|Interface protocol. | | protocol | number | Yes | Interface protocol. |
| clazz | number | Yes|Device type. | | clazz | number | Yes | Device type. |
| subClass | number | Yes|Device subclass. | | subClass | number | Yes | Device subclass. |
| alternateSetting | number | Yes|Settings for alternating between descriptors of the same USB interface.| | alternateSetting | number | Yes | Settings for alternating between descriptors of the same USB interface.|
| name | string | Yes|Interface name. | | name | string | Yes | Interface name. |
| endpoints | Array&lt;[USBEndpoint](#usbendpoint)&gt; | Yes|Endpoints that belong to the USB interface. | | endpoints | Array&lt;[USBEndpoint](#usbendpoint)&gt; | Yes | Endpoints that belong to the USB interface. |
## USBConfig ## USBConfig
...@@ -753,13 +753,13 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip ...@@ -753,13 +753,13 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip
| Name | Type | Mandatory |Description | | Name | Type | Mandatory |Description |
| -------------- | ------------------------------------------------ | --------------- |--------------- | | -------------- | ------------------------------------------------ | --------------- |--------------- |
| id | number | Yes|Unique ID of the USB configuration. | | id | number | Yes | Unique ID of the USB configuration. |
| attributes | number | Yes|Configuration attributes. | | attributes | number | Yes | Configuration attributes. |
| maxPower | number | Yes|Maximum power consumption, in mA. | | maxPower | number | Yes | Maximum power consumption, in mA. |
| name | string | Yes|Configuration name, which can be left empty. | | name | string | Yes | Configuration name, which can be left empty. |
| isRemoteWakeup | boolean | Yes|Support for remote wakeup.| | isRemoteWakeup | boolean | Yes | Support for remote wakeup.|
| isSelfPowered | boolean | Yes| Support for independent power supplies.| | isSelfPowered | boolean | Yes | Support for independent power supplies.|
| interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Yes|Supported interface attributes. | | interfaces | Array&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Yes | Supported interface attributes. |
## USBDevice ## USBDevice
...@@ -769,19 +769,19 @@ Represents the USB device information. ...@@ -769,19 +769,19 @@ Represents the USB device information.
| Name | Type | Mandatory |Description | | Name | Type | Mandatory |Description |
| ---------------- | ------------------------------------ | ---------- |---------- | | ---------------- | ------------------------------------ | ---------- |---------- |
| busNum | number | Yes|Bus address. | | busNum | number | Yes | Bus address. |
| devAddress | number | Yes|Device address. | | devAddress | number | Yes | Device address. |
| serial | string | Yes|Sequence number. | | serial | string | Yes | Sequence number. |
| name | string | Yes|Device name. | | name | string | Yes | Device name. |
| manufacturerName | string | Yes| Device manufacturer. | | manufacturerName | string | Yes | Device manufacturer. |
| productName | string | Yes|Product name. | | productName | string | Yes | Product name. |
| version | string | Yes|Version number. | | version | string | Yes | Version number. |
| vendorId | number | Yes|Vendor ID. | | vendorId | number | Yes | Vendor ID. |
| productId | number | Yes|Product ID. | | productId | number | Yes | Product ID. |
| clazz | number | Yes|Device class. | | clazz | number | Yes | Device class. |
| subClass | number | Yes|Device subclass. | | subClass | number | Yes | Device subclass. |
| protocol | number | Yes|Device protocol code. | | protocol | number | Yes | Device protocol code. |
| configs | Array&lt;[USBConfig](#usbconfig)&gt; | Yes|Device configuration descriptor information.| | configs | Array&lt;[USBConfig](#usbconfig)&gt; | Yes | Device configuration descriptor information.|
## USBDevicePipe ## USBDevicePipe
...@@ -802,12 +802,12 @@ Represents control transfer parameters. ...@@ -802,12 +802,12 @@ Represents control transfer parameters.
| Name | Type | Mandatory |Description | | Name | Type | Mandatory |Description |
| ------- | ----------------------------------------------- | ---------------- |---------------- | | ------- | ----------------------------------------------- | ---------------- |---------------- |
| request | number | Yes |Request type. | | request | number | Yes | Request type. |
| target | [USBRequestTargetType](#usbrequesttargettype) | Yes |Request target type. | | target | [USBRequestTargetType](#usbrequesttargettype) | Yes | Request target type. |
| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes |Control request type. | | reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes | Control request type. |
| value | number | Yes |Request parameter value. | | value | number | Yes | Request parameter value. |
| index | number | Yes |Index of the request parameter value.| | index | number | Yes | Index of the request parameter value.|
| data | Uint8Array | Yes |Buffer for writing or reading data. | | data | Uint8Array | Yes | Buffer for writing or reading data. |
## USBPort ## USBPort
...@@ -819,9 +819,9 @@ Represents a USB port. ...@@ -819,9 +819,9 @@ Represents a USB port.
| Name | Type | Mandatory |Description | | Name | Type | Mandatory |Description |
| -------------- | ------------------------------- | ------------------- |------------------------ | | -------------- | ------------------------------- | ------------------- |------------------------ |
| id | number | Yes |Unique identifier of a USB port. | | id | number | Yes | Unique identifier of a USB port. |
| supportedModes | [PortModeType](#portmodetype) | Yes |Numeric mask combination for the supported mode list.| | supportedModes | [PortModeType](#portmodetype) | Yes | Numeric mask combination for the supported mode list.|
| status | [USBPortStatus](#usbportstatus) | Yes |USB port role. | | status | [USBPortStatus](#usbportstatus) | Yes | USB port role. |
## USBPortStatus ## USBPortStatus
...@@ -833,9 +833,9 @@ Enumerates USB port roles. ...@@ -833,9 +833,9 @@ Enumerates USB port roles.
| Name | Type| Mandatory |Description | | Name | Type| Mandatory |Description |
| ---------------- | -------- | ---------------- |---------------------- | | ---------------- | -------- | ---------------- |---------------------- |
| currentMode | number | Yes|Current USB mode. | | currentMode | number | Yes | Current USB mode. |
| currentPowerRole | number | Yes |Current power role. | | currentPowerRole | number | Yes | Current power role. |
| currentDataRole | number | Yes |Current data role.| | currentDataRole | number | Yes | Current data role.|
## USBRequestTargetType ## USBRequestTargetType
...@@ -843,12 +843,12 @@ Enumerates request target types. ...@@ -843,12 +843,12 @@ Enumerates request target types.
**System capability**: SystemCapability.USB.USBManager **System capability**: SystemCapability.USB.USBManager
| Name | Value | Description | | Name | Value | Description |
| ---------------------------- | ---- | ------ | | ---------------------------- | ----- | ----------- |
| USB_REQUEST_TARGET_DEVICE | 0 | Device| | USB_REQUEST_TARGET_DEVICE | 0 | Device |
| USB_REQUEST_TARGET_INTERFACE | 1 | Interface| | USB_REQUEST_TARGET_INTERFACE | 1 | Interface |
| USB_REQUEST_TARGET_ENDPOINT | 2 | Endpoint| | USB_REQUEST_TARGET_ENDPOINT | 2 | Endpoint |
| USB_REQUEST_TARGET_OTHER | 3 | Other| | USB_REQUEST_TARGET_OTHER | 3 | Other |
## USBControlRequestType ## USBControlRequestType
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册