提交 50c57147 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 6232cd1a
...@@ -8,7 +8,7 @@ In Host mode, you can obtain the list of connected USB devices, enable or disabl ...@@ -8,7 +8,7 @@ In Host mode, you can obtain the list of connected USB devices, enable or disabl
The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management. The USB service provides the following functions: query of USB device list, bulk data transfer, control transfer, and access permission management.
The following table lists the USB APIs currently available. For details, see the [API Reference](../reference/apis/js-apis-usb.md). The following table lists the USB APIs currently available. For details, see the [API Reference](../reference/apis/js-apis-usbManager.md).
**Table 1** Open USB APIs **Table 1** Open USB APIs
...@@ -18,7 +18,7 @@ The following table lists the USB APIs currently available. For details, see the ...@@ -18,7 +18,7 @@ The following table lists the USB APIs currently available. For details, see the
| requestRight(deviceName: string): Promise\<boolean> | Requests the temporary permission for a given application to access the USB device. This API uses a promise to return the result. | | requestRight(deviceName: string): Promise\<boolean> | Requests the temporary permission for a given application to access the USB device. This API uses a promise to return the result. |
| connectDevice(device: USBDevice): Readonly\<USBDevicePipe> | Connects to the USB device based on the device list returned by `getDevices()`. | | connectDevice(device: USBDevice): Readonly\<USBDevicePipe> | Connects to the USB device based on the device list returned by `getDevices()`. |
| getDevices(): Array<Readonly\<USBDevice>> | Obtains the list of USB devices connected to the USB host. If no USB device is connected, an empty list is returned. | | getDevices(): Array<Readonly\<USBDevice>> | Obtains the list of USB devices connected to the USB host. If no USB device is connected, an empty list is returned. |
| setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | Sets the USB device configuration. | | setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number | Sets the USB device configuration. |
| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. | | setInterface(pipe: USBDevicePipe, iface: USBInterface): number | Sets a USB interface. |
| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force ?: boolean): number | Claims a USB interface. | | claimInterface(pipe: USBDevicePipe, iface: USBInterface, force ?: boolean): number | Claims a USB interface. |
| bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout ?: number): Promise\<number> | Performs bulk transfer. | | bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout ?: number): Promise\<number> | Performs bulk transfer. |
...@@ -36,7 +36,7 @@ You can set a USB device as the USB host to connect to other USB devices for dat ...@@ -36,7 +36,7 @@ You can set a USB device as the USB host to connect to other USB devices for dat
```js ```js
// Import the USB API package. // Import the USB API package.
import usb from '@ohos.usbV9'; import usb from '@ohos.usbManager';
// Obtain the USB device list. // Obtain the USB device list.
let deviceList = usb.getDevices(); let deviceList = usb.getDevices();
/* /*
......
...@@ -313,7 +313,7 @@ ...@@ -313,7 +313,7 @@
- [@ohos.systemParameterV9 (System Parameter)](js-apis-system-parameterV9.md) - [@ohos.systemParameterV9 (System Parameter)](js-apis-system-parameterV9.md)
- [@ohos.thermal (Thermal Management)](js-apis-thermal.md) - [@ohos.thermal (Thermal Management)](js-apis-thermal.md)
- [@ohos.update (Update)](js-apis-update.md) - [@ohos.update (Update)](js-apis-update.md)
- [@ohos.usbV9 (USB Management)](js-apis-usb.md) - [@ohos.usbManager (USB Management)](js-apis-usbManager.md)
- [@ohos.vibrator (Vibrator)](js-apis-vibrator.md) - [@ohos.vibrator (Vibrator)](js-apis-vibrator.md)
- Account Management - Account Management
- [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md) - [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md)
...@@ -371,7 +371,7 @@ ...@@ -371,7 +371,7 @@
- [@ohos.reminderAgent (Reminder Agent)](js-apis-reminderAgent.md) - [@ohos.reminderAgent (Reminder Agent)](js-apis-reminderAgent.md)
- [@ohos.statfs (statfs)](js-apis-statfs.md) - [@ohos.statfs (statfs)](js-apis-statfs.md)
- [@ohos.systemParameter (System Parameter)](js-apis-system-parameter.md) - [@ohos.systemParameter (System Parameter)](js-apis-system-parameter.md)
- [@ohos.usb (USB Management)](js-apis-usb-deprecated.md) - [@ohos.usbV9 (USB Management)](js-apis-usb.md)
- [@system.app (Application Context)](js-apis-system-app.md) - [@system.app (Application Context)](js-apis-system-app.md)
- [@system.battery (Battery Information)](js-apis-system-battery.md) - [@system.battery (Battery Information)](js-apis-system-battery.md)
- [@system.bluetooth (Bluetooth)](js-apis-system-bluetooth.md) - [@system.bluetooth (Bluetooth)](js-apis-system-bluetooth.md)
......
...@@ -30,6 +30,17 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified ...@@ -30,6 +30,17 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<{psRadioTech: [RadioTechnology](#radiotechnology), csRadioTech:[RadioTechnology](#radiotechnology)}\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<{psRadioTech: [RadioTechnology](#radiotechnology), csRadioTech:[RadioTechnology](#radiotechnology)}\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -62,6 +73,17 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified ...@@ -62,6 +73,17 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified
| ------------------------------------------------------------ | ----------------------------------------------- | | ------------------------------------------------------------ | ----------------------------------------------- |
| Promise<{psRadioTech: [RadioTechnology](#radiotechnology), csRadioTech: [RadioTechnology](#radiotechnology)}> | Promise used to return the result.| | Promise<{psRadioTech: [RadioTechnology](#radiotechnology), csRadioTech: [RadioTechnology](#radiotechnology)}> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -91,6 +113,17 @@ Obtains the network status. This API uses an asynchronous callback to return the ...@@ -91,6 +113,17 @@ Obtains the network status. This API uses an asynchronous callback to return the
| -------- | ---------------------------------------------- | ---- | ---------- | | -------- | ---------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -104,7 +137,7 @@ radio.getNetworkState((err, data) =>{ ...@@ -104,7 +137,7 @@ radio.getNetworkState((err, data) =>{
getNetworkState\(slotId: number, callback: AsyncCallback<NetworkState\>\): void getNetworkState\(slotId: number, callback: AsyncCallback<NetworkState\>\): void
Obtains the network status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the network status. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO **Required permission**: ohos.permission.GET_NETWORK_INFO
...@@ -117,6 +150,17 @@ Obtains the network status of the SIM card in the specified slot. This API uses ...@@ -117,6 +150,17 @@ Obtains the network status of the SIM card in the specified slot. This API uses
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<[NetworkState](#networkstate)\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -131,7 +175,7 @@ radio.getNetworkState(slotId, (err, data) => { ...@@ -131,7 +175,7 @@ radio.getNetworkState(slotId, (err, data) => {
getNetworkState\(slotId?: number\): Promise<NetworkState\> getNetworkState\(slotId?: number\): Promise<NetworkState\>
Obtains the network status of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the network status. This API uses a promise to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO **Required permission**: ohos.permission.GET_NETWORK_INFO
...@@ -149,6 +193,17 @@ Obtains the network status of the SIM card in the specified slot. This API uses ...@@ -149,6 +193,17 @@ Obtains the network status of the SIM card in the specified slot. This API uses
| ---------------------------------------- | --------------------------- | | ---------------------------------------- | --------------------------- |
| Promise\<[NetworkState](#networkstate)\> | Promise used to return the result.| | Promise\<[NetworkState](#networkstate)\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -177,6 +232,16 @@ Obtains the network selection mode of the SIM card in the specified slot. This A ...@@ -177,6 +232,16 @@ Obtains the network selection mode of the SIM card in the specified slot. This A
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[NetworkSelectionMode](#networkselectionmode)\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<[NetworkSelectionMode](#networkselectionmode)\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -207,6 +272,16 @@ Obtains the network selection mode of the SIM card in the specified slot. This A ...@@ -207,6 +272,16 @@ Obtains the network selection mode of the SIM card in the specified slot. This A
| -------------------------------------------------------- | ------------------------------- | | -------------------------------------------------------- | ------------------------------- |
| Promise\<[NetworkSelectionMode](#networkselectionmode)\> | Promise used to return the result.| | Promise\<[NetworkSelectionMode](#networkselectionmode)\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -235,6 +310,16 @@ Obtains the ISO country code of the network with which the SIM card in the speci ...@@ -235,6 +310,16 @@ Obtains the ISO country code of the network with which the SIM card in the speci
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).| | callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -265,6 +350,16 @@ Obtains the ISO country code of the network with which the SIM card in the speci ...@@ -265,6 +350,16 @@ Obtains the ISO country code of the network with which the SIM card in the speci
| ----------------- | ------------------------------------------------------------ | | ----------------- | ------------------------------------------------------------ |
| Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).| | Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -290,7 +385,17 @@ Obtains the ID of the slot in which the primary card is located. This API uses a ...@@ -290,7 +385,17 @@ Obtains the ID of the slot in which the primary card is located. This API uses a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback\<number\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<number\> | Yes | Callback invoked to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -315,6 +420,16 @@ Obtains the ID of the slot in which the primary card is located. This API uses a ...@@ -315,6 +420,16 @@ Obtains the ID of the slot in which the primary card is located. This API uses a
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<number\> | Promise used to return the result.| | Promise\<number\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -331,7 +446,7 @@ promise.then(data => { ...@@ -331,7 +446,7 @@ promise.then(data => {
getSignalInformation\(slotId: number, callback: AsyncCallback<Array<SignalInformation\>\>\): void getSignalInformation\(slotId: number, callback: AsyncCallback<Array<SignalInformation\>\>\): void
Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. This API uses an asynchronous callback to return the result. Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -342,6 +457,16 @@ Obtains a list of signal strengths of the network with which the SIM card in the ...@@ -342,6 +457,16 @@ Obtains a list of signal strengths of the network with which the SIM card in the
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<Array\<[SignalInformation](#signalinformation)\>\> | Yes | Callback used to return the result, which is a list of [SignalInformation](#signalinformation) objects.| | callback | AsyncCallback\<Array\<[SignalInformation](#signalinformation)\>\> | Yes | Callback used to return the result, which is a list of [SignalInformation](#signalinformation) objects.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -356,7 +481,7 @@ radio.getSignalInformation(slotId, (err, data) => { ...@@ -356,7 +481,7 @@ radio.getSignalInformation(slotId, (err, data) => {
getSignalInformation\(slotId: number\): Promise<Array<SignalInformation\>\> getSignalInformation\(slotId: number\): Promise<Array<SignalInformation\>\>
Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. This API uses a promise to return the result. Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -372,6 +497,16 @@ Obtains a list of signal strengths of the network with which the SIM card in the ...@@ -372,6 +497,16 @@ Obtains a list of signal strengths of the network with which the SIM card in the
| ----------------------------------------------------------- | ------------------------------------------------------------ | | ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<Array\<[SignalInformation](#signalinformation)\>\> | Promise used to return the result, which is a list of [SignalInformation](#signalinformation) objects.| | Promise\<Array\<[SignalInformation](#signalinformation)\>\> | Promise used to return the result, which is a list of [SignalInformation](#signalinformation) objects.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -384,12 +519,16 @@ promise.then(data => { ...@@ -384,12 +519,16 @@ promise.then(data => {
}); });
``` ```
## radio.isNrSupported<sup>7+</sup> ## radio.isNrSupported<sup>(deprecated)</sup>
isNrSupported\(\): boolean isNrSupported\(\): boolean
Checks whether the current device supports 5G \(NR\). Checks whether the current device supports 5G \(NR\).
> **NOTE**
>
> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9) instead.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
**Return value** **Return value**
...@@ -405,12 +544,15 @@ let result = radio.isNrSupported(); ...@@ -405,12 +544,15 @@ let result = radio.isNrSupported();
console.log("Result: "+ result); console.log("Result: "+ result);
``` ```
## radio.isNrSupported<sup>(deprecated)</sup>
## radio.isNrSupported<sup>8+</sup>
isNrSupported\(slotId: number\): boolean isNrSupported\(slotId: number\): boolean
Checks whether the current device supports 5G \(NR\) for the SIM card in the specified slot. Checks whether the current device supports 5G \(NR\).
> **NOTE**
>
> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isNRSupported](#radioisnrsupported9-1) instead.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -435,6 +577,57 @@ console.log("Result: "+ result); ...@@ -435,6 +577,57 @@ console.log("Result: "+ result);
``` ```
## radio.isNRSupported<sup>9+</sup>
isNRSupported\(\): boolean
Checks whether the current device supports 5G \(NR\).
**System capability**: SystemCapability.Telephony.CoreService
**Return value**
| Type | Description |
| ------- | -------------------------------- |
| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).|
**Example**
```js
let result = radio.isNRSupported();
console.log("Result: "+ result);
```
## radio.isNRSupported<sup>9+</sup>
isNRSupported\(slotId: number\): boolean
Checks whether the current device supports 5G \(NR\).
**System capability**: SystemCapability.Telephony.CoreService
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return value**
| Type | Description |
| ------------------ | ------------------------------------------------------------ |
| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).|
**Example**
```js
let slotId = 0;
let result = radio.isNRSupported(slotId);
console.log("Result: "+ result);
```
## radio.isRadioOn<sup>7+</sup> ## radio.isRadioOn<sup>7+</sup>
isRadioOn\(callback: AsyncCallback<boolean\>\): void isRadioOn\(callback: AsyncCallback<boolean\>\): void
...@@ -451,6 +644,17 @@ Checks whether the radio service is enabled on the primary SIM card. This API us ...@@ -451,6 +644,17 @@ Checks whether the radio service is enabled on the primary SIM card. This API us
| -------- | ------------------------ | ---- | ------------------------------------------------------- | | -------- | ------------------------ | ---- | ------------------------------------------------------- |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| | callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -477,6 +681,17 @@ Checks whether the radio service is enabled on the SIM card in the specified slo ...@@ -477,6 +681,17 @@ Checks whether the radio service is enabled on the SIM card in the specified slo
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| | callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -509,6 +724,17 @@ Checks whether the radio service is enabled on the SIM card in the specified slo ...@@ -509,6 +724,17 @@ Checks whether the radio service is enabled on the SIM card in the specified slo
| ------------------ | ------------------------------------------------------------ | | ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.| | Promise\<boolean\> | Promise used to return the result.<br>- **true**: The radio service is enabled.<br>- **false**: The radio service is disabled.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -537,6 +763,16 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a ...@@ -537,6 +763,16 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is the carrier name, for example, China Mobile.| | callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is the carrier name, for example, China Mobile.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -567,6 +803,16 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a ...@@ -567,6 +803,16 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a
| ----------------- | ------------------------------------------------------------ | | ----------------- | ------------------------------------------------------------ |
| Promise\<string\> | Promise used t return the result, which is the carrier name, for example, China Mobile. | | Promise\<string\> | Promise used t return the result, which is the carrier name, for example, China Mobile. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -596,7 +842,19 @@ Sets the ID of the slot in which the primary card is located. This API uses an a ...@@ -596,7 +842,19 @@ Sets the ID of the slot in which the primary card is located. This API uses an a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | -------------------------------------- | | -------- | --------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -632,6 +890,18 @@ Sets the ID of the slot in which the primary card is located. This API uses a pr ...@@ -632,6 +890,18 @@ Sets the ID of the slot in which the primary card is located. This API uses a pr
| --------------- | ------------------------------- | | --------------- | ------------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -662,6 +932,17 @@ Obtains the IMEI of the SIM card in a card slot. This API uses an asynchronous c ...@@ -662,6 +932,17 @@ Obtains the IMEI of the SIM card in a card slot. This API uses an asynchronous c
| -------- | ----------------------- | ---- | ------------------------------------------ | | -------- | ----------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. If the IMEI does not exist, an empty string is returned.| | callback | AsyncCallback\<string\> | Yes | Callback used to return the result. If the IMEI does not exist, an empty string is returned.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -675,7 +956,7 @@ radio.getIMEI((err, data) => { ...@@ -675,7 +956,7 @@ radio.getIMEI((err, data) => {
getIMEI(slotId: number, callback: AsyncCallback<string\>): void getIMEI(slotId: number, callback: AsyncCallback<string\>): void
Obtains the IMEI of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the IMEI of the SIM card in the specified card slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -690,6 +971,17 @@ Obtains the IMEI of the SIM card in the specified slot. This API uses an asynchr ...@@ -690,6 +971,17 @@ Obtains the IMEI of the SIM card in the specified slot. This API uses an asynchr
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. If the IMEI does not exist, an empty string is returned.| | callback | AsyncCallback\<string\> | Yes | Callback used to return the result. If the IMEI does not exist, an empty string is returned.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -704,7 +996,7 @@ radio.getIMEI(slotId, (err, data) => { ...@@ -704,7 +996,7 @@ radio.getIMEI(slotId, (err, data) => {
getIMEI(slotId?: number): Promise<string\> getIMEI(slotId?: number): Promise<string\>
Obtains the IMEI of the SIM card in a card slot. This API uses a promise to return the result. Obtains the IMEI of the SIM card in the specified card slot. This API uses a promise to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -724,6 +1016,17 @@ Obtains the IMEI of the SIM card in a card slot. This API uses a promise to retu ...@@ -724,6 +1016,17 @@ Obtains the IMEI of the SIM card in a card slot. This API uses a promise to retu
| ----------------- | ------------------------------------------ | | ----------------- | ------------------------------------------ |
| Promise\<string\> | Promise used to return the result. If the IMEI does not exist, an empty string is returned.| | Promise\<string\> | Promise used to return the result. If the IMEI does not exist, an empty string is returned.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -754,6 +1057,17 @@ Obtains the MEID of the SIM card in a card slot. This API uses an asynchronous c ...@@ -754,6 +1057,17 @@ Obtains the MEID of the SIM card in a card slot. This API uses an asynchronous c
| -------- | ----------------------- | ---- | ---------- | | -------- | ----------------------- | ---- | ---------- |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<string\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -767,7 +1081,7 @@ radio.getMEID((err, data) => { ...@@ -767,7 +1081,7 @@ radio.getMEID((err, data) => {
getMEID(slotId: number, callback: AsyncCallback<string\>): void getMEID(slotId: number, callback: AsyncCallback<string\>): void
Obtains the MEID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the MEID of the SIM card in the specified card slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -782,6 +1096,17 @@ Obtains the MEID of the SIM card in the specified slot. This API uses an asynchr ...@@ -782,6 +1096,17 @@ Obtains the MEID of the SIM card in the specified slot. This API uses an asynchr
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -796,7 +1121,7 @@ radio.getMEID(slotId, (err, data) => { ...@@ -796,7 +1121,7 @@ radio.getMEID(slotId, (err, data) => {
getMEID(slotId?: number): Promise<string\> getMEID(slotId?: number): Promise<string\>
Obtains the MEID of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the MEID of the SIM card in the specified card slot. This API uses a promise to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -816,6 +1141,17 @@ Obtains the MEID of the SIM card in the specified slot. This API uses a promise ...@@ -816,6 +1141,17 @@ Obtains the MEID of the SIM card in the specified slot. This API uses a promise
| ----------------- | --------------------------------------- | | ----------------- | --------------------------------------- |
| Promise\<string\> | Promise used to return the result.| | Promise\<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -846,6 +1182,17 @@ Obtains the unique device ID of the SIM card in a card slot. This API uses an as ...@@ -846,6 +1182,17 @@ Obtains the unique device ID of the SIM card in a card slot. This API uses an as
| -------- | ----------------------- | ---- | ---------- | | -------- | ----------------------- | ---- | ---------- |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<string\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -859,7 +1206,7 @@ radio.getUniqueDeviceId((err, data) => { ...@@ -859,7 +1206,7 @@ radio.getUniqueDeviceId((err, data) => {
getUniqueDeviceId(slotId: number, callback: AsyncCallback<string\>): void getUniqueDeviceId(slotId: number, callback: AsyncCallback<string\>): void
Obtains the unique device ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the unique device ID of the SIM card in the specified card slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -874,6 +1221,17 @@ Obtains the unique device ID of the SIM card in the specified slot. This API use ...@@ -874,6 +1221,17 @@ Obtains the unique device ID of the SIM card in the specified slot. This API use
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -888,7 +1246,7 @@ radio.getUniqueDeviceId(slotId, (err, data) => { ...@@ -888,7 +1246,7 @@ radio.getUniqueDeviceId(slotId, (err, data) => {
getUniqueDeviceId(slotId?: number): Promise<string\> getUniqueDeviceId(slotId?: number): Promise<string\>
Obtains the unique device ID of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the unique device ID of the SIM card in the specified card slot. This API uses a promise to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -908,6 +1266,17 @@ Obtains the unique device ID of the SIM card in the specified slot. This API use ...@@ -908,6 +1266,17 @@ Obtains the unique device ID of the SIM card in the specified slot. This API use
| ----------------- | --------------------------------------------- | | ----------------- | --------------------------------------------- |
| Promise\<string\> | Promise used to return the result.| | Promise\<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -928,7 +1297,7 @@ Sends a cell location update request. This API uses an asynchronous callback to ...@@ -928,7 +1297,7 @@ Sends a cell location update request. This API uses an asynchronous callback to
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -938,6 +1307,17 @@ Sends a cell location update request. This API uses an asynchronous callback to ...@@ -938,6 +1307,17 @@ Sends a cell location update request. This API uses an asynchronous callback to
| -------- | --------------------- | ---- | ---------- | | -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -954,7 +1334,7 @@ Sends a cell location update request for the SIM card in the specified slot. Thi ...@@ -954,7 +1334,7 @@ Sends a cell location update request for the SIM card in the specified slot. Thi
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -965,6 +1345,17 @@ Sends a cell location update request for the SIM card in the specified slot. Thi ...@@ -965,6 +1345,17 @@ Sends a cell location update request for the SIM card in the specified slot. Thi
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -978,11 +1369,11 @@ radio.sendUpdateCellLocationRequest(slotId, (err, data) => { ...@@ -978,11 +1369,11 @@ radio.sendUpdateCellLocationRequest(slotId, (err, data) => {
sendUpdateCellLocationRequest\(slotId?: number): Promise<void\> sendUpdateCellLocationRequest\(slotId?: number): Promise<void\>
Sends a cell location update request for the SIM card in the specified slot.This API uses a promise to return the result. Sends a cell location update request for the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.LOCATION **Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -998,6 +1389,17 @@ Sends a cell location update request for the SIM card in the specified slot.This ...@@ -998,6 +1389,17 @@ Sends a cell location update request for the SIM card in the specified slot.This
| --------------- | ----------------------- | | --------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1028,6 +1430,17 @@ Obtains cell information. This API uses an asynchronous callback to return the r ...@@ -1028,6 +1430,17 @@ Obtains cell information. This API uses an asynchronous callback to return the r
| -------- | ------------------------------------------------------------ | ---- | ------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------ |
| callback | AsyncCallback\<Array<[CellInformation](#cellinformation8)\>\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<Array<[CellInformation](#cellinformation8)\>\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1056,6 +1469,17 @@ Obtains cell information for the SIM card in the specified slot. This API uses a ...@@ -1056,6 +1469,17 @@ Obtains cell information for the SIM card in the specified slot. This API uses a
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<Array<[CellInformation](#cellinformation8)\>\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<Array<[CellInformation](#cellinformation8)\>\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1090,6 +1514,17 @@ Obtains cell information for the SIM card in the specified slot. This API uses a ...@@ -1090,6 +1514,17 @@ Obtains cell information for the SIM card in the specified slot. This API uses a
| ------------------------------------------------------- | ----------------------- | | ------------------------------------------------------- | ----------------------- |
| Promise\<Array<[CellInformation](#cellinformation8)\>\> | Promise used to return the result.| | Promise\<Array<[CellInformation](#cellinformation8)\>\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1121,6 +1556,17 @@ Sets the network selection mode. This API uses an asynchronous callback to retur ...@@ -1121,6 +1556,17 @@ Sets the network selection mode. This API uses an asynchronous callback to retur
| options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | Yes | Network selection mode.| | options | [NetworkSelectionModeOptions](#networkselectionmodeoptions) | Yes | Network selection mode.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1165,6 +1611,17 @@ Sets the network selection mode. This API uses a promise to return the result. ...@@ -1165,6 +1611,17 @@ Sets the network selection mode. This API uses a promise to return the result.
| --------------- | ----------------------- | | --------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1192,7 +1649,7 @@ promise.then(data => { ...@@ -1192,7 +1649,7 @@ promise.then(data => {
getNetworkSearchInformation\(slotId: number, callback: AsyncCallback<NetworkSearchResult\>\): void getNetworkSearchInformation\(slotId: number, callback: AsyncCallback<NetworkSearchResult\>\): void
Obtains network search information for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains network search information for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -1205,7 +1662,18 @@ Obtains network search information for the SIM card in the specified slot. This ...@@ -1205,7 +1662,18 @@ Obtains network search information for the SIM card in the specified slot. This
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[NetworkSearchResult](#networksearchresult)\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<[NetworkSearchResult](#networksearchresult)\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1239,6 +1707,17 @@ Obtains network search information for the SIM card in the specified slot. This ...@@ -1239,6 +1707,17 @@ Obtains network search information for the SIM card in the specified slot. This
| ------------------------------------------------------ | ----------------------- | | ------------------------------------------------------ | ----------------------- |
| Promise\<[NetworkSearchResult](#networksearchresult)\> | Promise used to return the result.| | Promise\<[NetworkSearchResult](#networksearchresult)\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1266,6 +1745,16 @@ Obtains the NR option mode. This API uses an asynchronous callback to return the ...@@ -1266,6 +1745,16 @@ Obtains the NR option mode. This API uses an asynchronous callback to return the
| -------- | ----------------------------------------------- | ---- | ---------- | | -------- | ----------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1292,6 +1781,16 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses ...@@ -1292,6 +1781,16 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<[NrOptionMode](#nroptionmode8)\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1324,6 +1823,16 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses ...@@ -1324,6 +1823,16 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses
| ----------------------------------------- | ----------------------- | | ----------------------------------------- | ----------------------- |
| Promise\<[NrOptionMode](#nroptionmode8)\> | Promise used to return the result.| | Promise\<[NrOptionMode](#nroptionmode8)\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1354,6 +1863,17 @@ Turns on the radio function. This API uses an asynchronous callback to return th ...@@ -1354,6 +1863,17 @@ Turns on the radio function. This API uses an asynchronous callback to return th
| -------- | --------------------- | ---- | ---------- | | -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1382,6 +1902,17 @@ Turns on the radio function for the SIM card in the specified slot. This API use ...@@ -1382,6 +1902,17 @@ Turns on the radio function for the SIM card in the specified slot. This API use
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1416,6 +1947,17 @@ Turns on the radio function for the SIM card in the specified slot. This API use ...@@ -1416,6 +1947,17 @@ Turns on the radio function for the SIM card in the specified slot. This API use
| --------------- | ----------------------- | | --------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1446,6 +1988,17 @@ Turns off the radio function. This API uses an asynchronous callback to return t ...@@ -1446,6 +1988,17 @@ Turns off the radio function. This API uses an asynchronous callback to return t
| -------- | --------------------- | ---- | ---------- | | -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1474,6 +2027,17 @@ Turns off the radio function for the SIM card in the specified slot. This API us ...@@ -1474,6 +2027,17 @@ Turns off the radio function for the SIM card in the specified slot. This API us
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1508,6 +2072,17 @@ Turns off the radio function for the SIM card in the specified slot. This API us ...@@ -1508,6 +2072,17 @@ Turns off the radio function for the SIM card in the specified slot. This API us
| --------------- | ----------------------- | | --------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1540,6 +2115,17 @@ Sets the preferred network for the SIM card in the specified slot. This API uses ...@@ -1540,6 +2115,17 @@ Sets the preferred network for the SIM card in the specified slot. This API uses
| networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | Yes | Preferred network mode. | | networkMode | [PreferredNetworkMode](#preferrednetworkmode8) | Yes | Preferred network mode. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1573,6 +2159,17 @@ Sets the preferred network for the SIM card in the specified slot. This API uses ...@@ -1573,6 +2159,17 @@ Sets the preferred network for the SIM card in the specified slot. This API uses
| --------------- | ----------------------- | | --------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1598,11 +2195,22 @@ Obtains the preferred network for the SIM card in the specified slot. This API u ...@@ -1598,11 +2195,22 @@ Obtains the preferred network for the SIM card in the specified slot. This API u
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | -------- | --------------------------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[PreferredNetworkMode](#preferrednetworkmode8)\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<[PreferredNetworkMode](#preferrednetworkmode8)\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1635,6 +2243,17 @@ Obtains the preferred network for the SIM card in the specified slot. This API u ...@@ -1635,6 +2243,17 @@ Obtains the preferred network for the SIM card in the specified slot. This API u
| --------------- | ----------------------- | | --------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1666,6 +2285,17 @@ Obtains the IMS registration status of the specified IMS service type for the SI ...@@ -1666,6 +2285,17 @@ Obtains the IMS registration status of the specified IMS service type for the SI
| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | | imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. |
| callback | AsyncCallback<[ImsRegInfo](#imsreginfo9)\> | Yes | Callback used to return the result. | | callback | AsyncCallback<[ImsRegInfo](#imsreginfo9)\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1699,6 +2329,17 @@ Obtains the IMS registration status of the specified IMS service type for the SI ...@@ -1699,6 +2329,17 @@ Obtains the IMS registration status of the specified IMS service type for the SI
| ------------------------------------- | ----------------------- | | ------------------------------------- | ----------------------- |
| Promise\<[ImsRegInfo](#imsreginfo9)\> | Promise used to return the result.| | Promise\<[ImsRegInfo](#imsreginfo9)\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1714,7 +2355,7 @@ promise.then(data => { ...@@ -1714,7 +2355,7 @@ promise.then(data => {
on(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: Callback<ImsRegInfo\>): void on(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: Callback<ImsRegInfo\>): void
Enables listening for **imsRegStateChange** events for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Enables listening for **imsRegStateChange** events. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -1731,6 +2372,17 @@ Enables listening for **imsRegStateChange** events for the SIM card in the speci ...@@ -1731,6 +2372,17 @@ Enables listening for **imsRegStateChange** events for the SIM card in the speci
| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | | imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. |
| callback | Callback<[ImsRegInfo](#imsreginfo9)> | Yes | Callback used to return the result. | | callback | Callback<[ImsRegInfo](#imsreginfo9)> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1743,7 +2395,7 @@ radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { ...@@ -1743,7 +2395,7 @@ radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback?: Callback<ImsRegInfo\>): void off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback?: Callback<ImsRegInfo\>): void
Disables listening for **imsRegStateChange** events for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Disables listening for **imsRegStateChange** events. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -1760,6 +2412,17 @@ Disables listening for **imsRegStateChange** events for the SIM card in the spec ...@@ -1760,6 +2412,17 @@ Disables listening for **imsRegStateChange** events for the SIM card in the spec
| imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. | | imsType | [ImsServiceType](#imsservicetype9) | Yes | IMS service type. |
| callback | Callback<[ImsRegInfo](#imsreginfo9)> | No | Callback used to return the result. | | callback | Callback<[ImsRegInfo](#imsreginfo9)> | No | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1770,7 +2433,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { ...@@ -1770,7 +2433,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
## RadioTechnology ## RadioTechnology
Enumerates radio access technologies. Enumerates radio access technologies.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -1797,11 +2460,11 @@ Defines the signal strength. ...@@ -1797,11 +2460,11 @@ Defines the signal strength.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | --------------- | --------------------------- | ---- | ------------------ |
| signalType | [NetworkType](#networktype) | Yes| Signal strength type.| | signalType | [NetworkType](#networktype) | Yes | Signal strength type.|
| signalLevel | number | Yes| Signal strength level.| | signalLevel | number | Yes | Signal strength level.|
| dBm<sup>9+</sup>| number | Yes | Network signal strength. |
## NetworkType ## NetworkType
...@@ -1825,17 +2488,17 @@ Defines the network status. ...@@ -1825,17 +2488,17 @@ Defines the network status.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | -------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ |
| longOperatorName | string | Yes | Long carrier name of the registered network.| | longOperatorName | string | Yes | Long carrier name of the registered network. |
| shortOperatorName | string | Yes | Short carrier name of the registered network.| | shortOperatorName | string | Yes | Short carrier name of the registered network. |
| plmnNumeric | string | Yes | PLMN code of the registered network.| | plmnNumeric | string | Yes | PLMN code of the registered network. |
| isRoaming | boolean | Yes | Whether the user is roaming.| | isRoaming | boolean | Yes | Whether the user is roaming. |
| regState | [RegState](#regstate) | Yes | Network registration status of the device.| | regState | [RegState](#regstate) | Yes | Network registration status of the device. |
| cfgTech<sup>8+</sup> | [RadioTechnology](#radiotechnology) | Yes | RAT of the device.| | cfgTech<sup>8+</sup> | [RadioTechnology](#radiotechnology) | Yes | RAT of the device. |
| nsaState | [NsaState](#nsastate) | Yes | NSA network registration status of the device.| | nsaState | [NsaState](#nsastate) | Yes | NSA network registration status of the device. |
| isCaActive | boolean | Yes | CA status.| | isCaActive | boolean | Yes | CA status. |
| isEmergency | boolean | Yes | Whether only emergency calls are allowed.| | isEmergency | boolean | Yes | Whether only emergency calls are allowed. |
## RegState ## RegState
...@@ -1848,7 +2511,7 @@ Defines the network status. ...@@ -1848,7 +2511,7 @@ Defines the network status.
| ----------------------------- | ---- | -------------------------- | | ----------------------------- | ---- | -------------------------- |
| REG_STATE_NO_SERVICE | 0 | The device cannot use any services, including data, SMS, and call services. | | REG_STATE_NO_SERVICE | 0 | The device cannot use any services, including data, SMS, and call services. |
| REG_STATE_IN_SERVICE | 1 | The device can use services properly, including data, SMS, and call services. | | REG_STATE_IN_SERVICE | 1 | The device can use services properly, including data, SMS, and call services. |
| REG_STATE_EMERGENCY_CALL_ONLY | 2 | The device can use only the emergency call service. | | REG_STATE_EMERGENCY_CALL_ONLY | 2 | The device can use only the emergency call service.|
| REG_STATE_POWER_OFF | 3 | The device cannot communicate with the network because the cellular radio service is disabled or the modem is powered off. | | REG_STATE_POWER_OFF | 3 | The device cannot communicate with the network because the cellular radio service is disabled or the modem is powered off. |
...@@ -1922,7 +2585,7 @@ Enumerates preferred network modes. ...@@ -1922,7 +2585,7 @@ Enumerates preferred network modes.
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM | 38 | NR+LTE+TD-SCDMA+GSM network mode. | | PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM | 38 | NR+LTE+TD-SCDMA+GSM network mode. |
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA | 39 | NR+LTE+TD-SCDMA+WCDMA network mode. | | PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA | 39 | NR+LTE+TD-SCDMA+WCDMA network mode. |
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM | 40 | NR+LTE+TD-SCDMA+WCDMA+GSM network mode. | | PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM | 40 | NR+LTE+TD-SCDMA+WCDMA+GSM network mode. |
| PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 41 | NR+LTE+TD-SCDMA+WCDMA+GSM+EVDO+CDMA network mode. | | PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA | 41 | NR+LTE+TD-SCDMA+WCDMA+GSM network mode. |
| PREFERRED_NETWORK_MODE_MAX_VALUE | 99 | Maximum value of the preferred network mode. | | PREFERRED_NETWORK_MODE_MAX_VALUE | 99 | Maximum value of the preferred network mode. |
## CellInformation<sup>8+</sup> ## CellInformation<sup>8+</sup>
...@@ -1933,13 +2596,13 @@ Defines the cell information. ...@@ -1933,13 +2596,13 @@ Defines the cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ----------------- | --------------------------------------- | ---- | ------------------------------------------------------------ |
| networkType | [NetworkType](#networktype) | Yes | Network type of the cell. | | networkType | [NetworkType](#networktype) | Yes | Network type of the cell. |
| isCamped | boolean | Yes | Status of the cell. | | isCamped | boolean | Yes | Cell status. |
| timeStamp | number | Yes | Timestamp when cell information is obtained. | | timeStamp | number | Yes | Timestamp when cell information is obtained. |
| signalInformation | [SignalInformation](#signalinformation) | Yes | Signal information. | | signalInformation | [SignalInformation](#signalinformation) | Yes | Signal information. |
| data | [CdmaCellInformation](#cdmacellinformation8) \| [GsmCellInformation](#gsmcellinformation8) \| [LteCellInformation](#ltecellinformation8) \| [NrCellInformation](#nrcellinformation8) \| [TdscdmaCellInformation](#tdscdmacellinformation8) | Yes | CDMA cell information \|GSM cell information \|LTE cell information \|NR cell information \|TD-SCDMA cell information| | data | [CdmaCellInformation](#cdmacellinformation8) \| [GsmCellInformation](#gsmcellinformation8) \| [LteCellInformation](#ltecellinformation8) \| [NrCellInformation](#nrcellinformation8) \| [TdscdmaCellInformation](#tdscdmacellinformation8) | Yes | CDMA cell information\|GSM cell information\|LTE cell information\|NR cell information\|TD-SCDMA cell information|
## CdmaCellInformation<sup>8+</sup> ## CdmaCellInformation<sup>8+</sup>
...@@ -1949,13 +2612,13 @@ Defines the CDMA cell information. ...@@ -1949,13 +2612,13 @@ Defines the CDMA cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | --------- | ------ | ---- | ------------ |
| baseId | number | Yes | Base station ID. | | baseId | number | Yes | Base station ID. |
| latitude | number | Yes | Longitude. | | latitude | number | Yes | Longitude. |
| longitude | number | Yes | Latitude. | | longitude | number | Yes | Latitude. |
| nid | number | Yes | Network ID.| | nid | number | Yes | Network ID.|
| sid | number | Yes | System ID.| | sid | number | Yes | System ID.|
## GsmCellInformation<sup>8+</sup> ## GsmCellInformation<sup>8+</sup>
...@@ -1965,50 +2628,50 @@ Defines the GSM cell information. ...@@ -1965,50 +2628,50 @@ Defines the GSM cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------ | ------ | ---- | -------------------- |
| lac | number | Yes | Location area code. | | lac | number | Yes | Location area code. |
| cellId | number | Yes | Cell ID. | | cellId | number | Yes | Cell ID. |
| arfcn | number | Yes | Absolute radio frequency channel number.| | arfcn | number | Yes | Absolute radio frequency channel number.|
| bsic | number | Yes | Base station ID. | | bsic | number | Yes | Base station ID. |
| mcc | string | Yes | Mobile country code. | | mcc | string | Yes | Mobile country code. |
| mnc | string | Yes | Mobile network code. | | mnc | string | Yes | Mobile network code. |
## LteCellInformation<sup>8+</sup> ## LteCellInformation<sup>8+</sup>
Defines the LTE cell information. LTE cell information.
**System API**: This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------------- | ------- | ---- | ----------------------- |
| cgi | number | Yes | Cell global identification. | | cgi | number | Yes | Cell global identification. |
| pci | number | Yes | Physical cell ID. | | pci | number | Yes | Physical cell ID. |
| tac | number | Yes | Tracking area code. | | tac | number | Yes | Tracking area code. |
| earfcn | number | Yes | Absolute radio frequency channel number. | | earfcn | number | Yes | Absolute radio frequency channel number. |
| bandwidth | number | Yes | Bandwidth. | | bandwidth | number | Yes | Bandwidth. |
| mcc | string | Yes | Mobile country code. | | mcc | string | Yes | Mobile country code. |
| mnc | string | Yes | Mobile network code. | | mnc | string | Yes | Mobile network code. |
| isSupportEndc | boolean | Yes | Support for New Radio_Dual Connectivity. | | isSupportEndc | boolean | Yes | Support for New Radio_Dual Connectivity.|
## NrCellInformation<sup>8+</sup> ## NrCellInformation<sup>8+</sup>
Defines the NR cell information. Defines the 5G NR cell information.
**System API**: This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------- | ------ | ---- | ---------------- |
| nrArfcn | number | Yes | 5G frequency number. | | nrArfcn | number | Yes | 5G frequency number. |
| pci | number | Yes | Physical cell ID. | | pci | number | Yes | Physical cell ID. |
| tac | number | Yes | Tracking area code. | | tac | number | Yes | Tracking area code. |
| nci | number | Yes | 5G network cell ID.| | nci | number | Yes | 5G network cell ID.|
| mcc | string | Yes | Mobile country code. | | mcc | string | Yes | Mobile country code. |
| mnc | string | Yes | Mobile network code. | | mnc | string | Yes | Mobile network code. |
## TdscdmaCellInformation<sup>8+</sup> ## TdscdmaCellInformation<sup>8+</sup>
...@@ -2018,14 +2681,14 @@ Defines the TD-SCDMA cell information. ...@@ -2018,14 +2681,14 @@ Defines the TD-SCDMA cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------ | ------ | ---- | ------------ |
| lac | number | Yes | Location area code.| | lac | number | Yes | Location area code.|
| cellId | number | Yes | Cell ID. | | cellId | number | Yes | Cell ID. |
| cpid | number | Yes | Cell parameter ID.| | cpid | number | Yes | Cell parameter ID.|
| uarfcn | number | Yes | Absolute radio frequency number.| | uarfcn | number | Yes | Absolute radio frequency number.|
| mcc | string | Yes | Mobile country code.| | mcc | string | Yes | Mobile country code.|
| mnc | string | Yes | Mobile network code. | | mnc | string | Yes | Mobile network code. |
## WcdmaCellInformation<sup>8+</sup> ## WcdmaCellInformation<sup>8+</sup>
...@@ -2035,14 +2698,14 @@ Defines the WCDMA cell information. ...@@ -2035,14 +2698,14 @@ Defines the WCDMA cell information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------ | ------ | ---- | ------------ |
| lac | number | Yes | Location area code.| | lac | number | Yes | Location area code.|
| cellId | number | Yes | Cell ID. | | cellId | number | Yes | Cell ID. |
| psc | number | Yes | Primary scrambling code. | | psc | number | Yes | Primary scrambling code. |
| uarfcn | number | Yes | Absolute radio frequency number.| | uarfcn | number | Yes | Absolute radio frequency number.|
| mcc | string | Yes | Mobile country code.| | mcc | string | Yes | Mobile country code.|
| mnc | string | Yes | Mobile network code. | | mnc | string | Yes | Mobile network code. |
## NrOptionMode<sup>8+</sup> ## NrOptionMode<sup>8+</sup>
...@@ -2056,7 +2719,7 @@ Enumerates NR selection modes. ...@@ -2056,7 +2719,7 @@ Enumerates NR selection modes.
| -------------------- | ---- | ---------------------------------- | | -------------------- | ---- | ---------------------------------- |
| NR_OPTION_UNKNOWN | 0 | Unknown NR selection mode. | | NR_OPTION_UNKNOWN | 0 | Unknown NR selection mode. |
| NR_OPTION_NSA_ONLY | 1 | NR selection mode in 5G non-standalone networking. | | NR_OPTION_NSA_ONLY | 1 | NR selection mode in 5G non-standalone networking. |
| NR_OPTION_SA_ONLY | 2 | NR selection mode in 5G standalone networking. | | NR_OPTION_SA_ONLY | 2 | NR selection mode in 5G non-standalone networking. |
| NR_OPTION_NSA_AND_SA | 3 | NR selection mode in non-standalone and standalone networking.| | NR_OPTION_NSA_AND_SA | 3 | NR selection mode in non-standalone and standalone networking.|
## NetworkSearchResult ## NetworkSearchResult
...@@ -2067,10 +2730,10 @@ Defines the network search result. ...@@ -2067,10 +2730,10 @@ Defines the network search result.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ---------------------- | ------------------------------------------------- | ---- | -------------- |
| isNetworkSearchSuccess | boolean | Yes | Successful network search.| | isNetworkSearchSuccess | boolean | Yes | Successful network search.|
| networkSearchResult | Array<[NetworkInformation](#networkinformation)\> | Yes | Network search result.| | networkSearchResult | Array<[NetworkInformation](#networkinformation)\> | Yes | Network search result.|
## NetworkInformation ## NetworkInformation
...@@ -2080,12 +2743,12 @@ Defines the network information. ...@@ -2080,12 +2743,12 @@ Defines the network information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | --------------- | --------------------------------------------------- | ---- | -------------- |
| operatorName | string | Yes | Carrier name.| | operatorName | string | Yes | Carrier name.|
| operatorNumeric | string | Yes | Carrier number. | | operatorNumeric | string | Yes | Carrier number. |
| state | [NetworkInformation](#networkinformationstate) | Yes | Network information status.| | state | [NetworkInformationState](#networkinformationstate) | Yes | Network information status.|
| radioTech | string | Yes | Radio technology. | | radioTech | string | Yes | Radio access technology. |
## NetworkInformationState ## NetworkInformationState
...@@ -2110,12 +2773,12 @@ Defines the network selection mode. ...@@ -2110,12 +2773,12 @@ Defines the network selection mode.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------------------ | --------------------------------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| selectMode | [NetworkSelectionMode](#networkselectionmode) | Yes | Network selection mode. | | selectMode | [NetworkSelectionMode](#networkselectionmode) | Yes | Network selection mode. |
| networkInformation | [NetworkInformation](#networkinformation) | Yes | Network information. | | networkInformation | [NetworkInformation](#networkinformation) | Yes | Network information. |
| resumeSelection | boolean | Yes | Whether to resume selection. | | resumeSelection | boolean | Yes | Whether to resume selection. |
## ImsRegState<sup>9+</sup> ## ImsRegState<sup>9+</sup>
...@@ -2153,10 +2816,10 @@ Defines the IMS registration information. ...@@ -2153,10 +2816,10 @@ Defines the IMS registration information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ----------- | ---------------------------- | ---- | ------------- |
| imsRegState | [ImsRegState](#imsregstate9) | Yes | IMS registration state.| | imsRegState | [ImsRegState](#imsregstate9) | Yes | IMS registration state.|
| imsRegTech | [ImsRegTech](#imsregtech9) | Yes | IMS registration technology.| | imsRegTech | [ImsRegTech](#imsregtech9) | Yes | IMS registration technology.|
## ImsServiceType<sup>9+</sup> ## ImsServiceType<sup>9+</sup>
......
...@@ -5,6 +5,7 @@ The **usb** module provides USB device management functions, including USB devic ...@@ -5,6 +5,7 @@ The **usb** module provides USB device management functions, including USB devic
> **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 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.
> This module is deprecated since API version 9. You are advised to use [`@ohos.usbManager`](js-apis-usbManager.md) instead.
## Modules to Import ## Modules to Import
......
# @ohos.usbManager (USB Management)
The **usbManager** module provides USB device management functions, including USB device list query, bulk data transfer, control transfer, and permission control on the host side as well as port management, and function switch and query on the device side.
> **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
```js
import usb from "@ohos.usbManager";
```
## usb.getDevices
getDevices(): Array&lt;Readonly&lt;USBDevice&gt;&gt;
Obtains the list of USB devices connected to the host. If no device is connected, an empty list is returned.
**System capability**: SystemCapability.USB.USBManager
**Return value**
| Type | Description |
| ---------------------------------------------------- | ------- |
| Array&lt;Readonly&lt;[USBDevice](#usbdevice)&gt;&gt; | USB device list.|
**Example**
```js
let devicesList = usb.getDevices();
console.log(`devicesList = ${JSON.stringify(devicesList)}`);
// devicesList is a list of USB devices.
// A simple example of devicesList is provided as follows:
[
{
name: "1-1",
serial: "",
manufacturerName: "",
productName: "",
version: "",
vendorId: 7531,
productId: 2,
clazz: 9,
subClass: 0,
protocol: 1,
devAddress: 1,
busNum: 1,
configs: [
{
id: 1,
attributes: 224,
isRemoteWakeup: true,
isSelfPowered: true,
maxPower: 0,
name: "1-1",
interfaces: [
{
id: 0,
protocol: 0,
clazz: 9,
subClass: 0,
alternateSetting: 0,
name: "1-1",
endpoints: [
{
address: 129,
attributes: 3,
interval: 12,
maxPacketSize: 4,
direction: 128,
number: 1,
type: 3,
interfaceId: 0,
},
],
},
],
},
],
},
]
```
## usb.connectDevice
connectDevice(device: USBDevice): Readonly&lt;USBDevicePipe&gt;
Connects to the USB device based on the device information returned by **getDevices()**.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and device information, and then call [usb.requestRight](#usbrequestright) to request the device access permission.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| device | [USBDevice](#usbdevice) | Yes| USB device information.|
**Return value**
| Type| Description|
| -------- | -------- |
| Readonly&lt;[USBDevicePipe](#usbdevicepipe)&gt; | USB device pipe for data transfer.|
**Error codes**
For details about the error codes, see [USB Error Codes](../errorcodes/errorcode-usb.md).
| ID| Error Message|
| -------- | -------- |
| 14400001 |Permission denied. Need call requestRight to get permission. |
**Example**
```js
let devicesList = usb.getDevices();
if (devicesList.length == 0) {
console.log(`device list is empty`);
return;
}
let device = devicesList[0];
usb.requestRight(device.name);
let devicepipe = usb.connectDevice(device);
console.log(`devicepipe = ${JSON.stringify(devicepipe)}`);
```
## usb.hasRight
hasRight(deviceName: string): boolean
Checks whether the application has the permission to access the device.
Checks whether the user, for example, the application or system, has the device access permissions. The value **true** is returned if the user has the device access permissions; the value **false** is returned otherwise.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.|
**Example**
```js
let devicesName="1-1";
let bool = usb.hasRight(devicesName);
console.log(bool);
```
## usb.requestRight
requestRight(deviceName: string): Promise&lt;boolean&gt;
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
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;boolean&gt; | 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";
usb.requestRight(devicesName).then((ret) => {
console.log(`requestRight = ${JSON.stringify(ret)}`);
});
```
## usb.removeRight
removeRight(deviceName: string): boolean
Removes the permission for the application to access a USB device.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Permission removal result. The value **true** indicates that the access permission is removed successfully; and the value **false** indicates the opposite.|
**Example**
```js
let devicesName="1-1";
if (usb.removeRight(devicesName) {
console.log(`Succeed in removing right`);
}
```
## usb.addRight
addRight(bundleName: string, deviceName: string): boolean
Adds the permission for the application to access a USB device.
[requestRight](#usbrequestright) triggers a dialog box to request for user authorization, whereas **addRight** adds the access permission directly without displaying a dialog box.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| deviceName | string | Yes| Device name.|
| bundleName | string | Yes| Bundle name of the application.|
**Return value**
| Type| Description|
| -------- | -------- |
| boolean | Permission addition result. The value **true** indicates that the access permission is added successfully; and the value **false** indicates the opposite.|
**Example**
```js
let devicesName = "1-1";
let bundleName = "com.example.hello";
if (usb.addRight(bundleName, devicesName) {
console.log(`Succeed in adding right`);
}
```
## usb.claimInterface
claimInterface(pipe: USBDevicePipe, iface: USBInterface, force ?: boolean): number
Claims a USB interface.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and USB interfaces, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.|
| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.|
**Example**
```js
let ret = usb.claimInterface(devicepipe, interfaces);
console.log(`claimInterface = ${ret}`);
```
## usb.releaseInterface
releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number
Releases a USB interface.
Before you do this, ensure that you have claimed the interface by calling [usb.claimInterface](#usbclaiminterface).
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.|
**Example**
```js
let ret = usb.releaseInterface(devicepipe, interfaces);
console.log(`releaseInterface = ${ret}`);
```
## usb.setConfiguration
setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number
Sets the device configuration.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and device configuration, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
| config | [USBConfiguration](#usbconfiguration) | Yes| USB configuration to set.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.|
**Example**
```js
let ret = usb.setConfiguration(devicepipe, config);
console.log(`setConfiguration = ${ret}`);
```
## usb.setInterface
setInterface(pipe: USBDevicePipe, iface: USBInterface): number
Sets a USB interface.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and interfaces, call [usb.requestRight](#usbrequestright) to request the device access permission, call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter, and call [usb.claimInterface](#usbclaiminterface) to claim the USB interface.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------------------------------- | --- | ------------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes | Device pipe, which is used to determine the bus number and device address.|
| iface | [USBInterface](#usbinterface) | Yes | USB interface to set. |
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.|
**Example**
```js
let ret = usb.setInterface(devicepipe, interfaces);
console.log(`setInterface = ${ret}`);
```
## usb.getRawDescriptor
getRawDescriptor(pipe: USBDevicePipe): Uint8Array
Obtains the raw USB descriptor.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Return value**
| Type| Description|
| -------- | -------- |
| Uint8Array | Returns the raw USB descriptor if the operation is successful; returns **undefined** otherwise.|
**Example**
```js
let ret = usb.getRawDescriptor(devicepipe);
```
## usb.getFileDescriptor
getFileDescriptor(pipe: USBDevicePipe): number
Obtains the file descriptor.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.|
**Return value**
| Type | Description |
| ------ | -------------------- |
| number | Returns the file descriptor of the USB device if the operation is successful; returns **-1** otherwise.|
**Example**
```js
let ret = usb.getFileDescriptor(devicepipe);
```
## usb.controlTransfer
controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: number): Promise&lt;number&gt;
Performs control transfer.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| controlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.|
| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.|
**Example**
```js
usb.controlTransfer(devicepipe, USBControlParams).then((ret) => {
console.log(`controlTransfer = ${JSON.stringify(ret)}`);
})
```
## usb.bulkTransfer
bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout ?: number): Promise&lt;number&gt;
Performs bulk transfer.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and endpoints, call [usb.requestRight](#usbrequestright) to request the device access permission, call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter, and call [usb.claimInterface](#usbclaiminterface) to claim the USB interface.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.|
| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.|
| buffer | Uint8Array | Yes| Buffer for writing or reading data.|
| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise&lt;number&gt; | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.|
**Example**
```js
// Call usb.getDevices to obtain a data set. Then, obtain a USB device and its access permission.
// 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)}`);
});
```
## usb.closePipe
closePipe(pipe: USBDevicePipe): number
Closes a USB device pipe.
Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.|
**Return value**
| Type| Description|
| -------- | -------- |
| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.|
**Example**
```js
let ret = usb.closePipe(devicepipe);
console.log(`closePipe = ${ret}`);
```
## usb.usbFunctionsFromString
usbFunctionsFromString(funcs: string): number
Converts the USB function list in the string format to a numeric mask in Device mode.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------- |
| funcs | string | Yes | Function list in string format.|
**Return value**
| Type | Description |
| ------ | ------------------ |
| number | Function list in numeric mask format.|
**Example**
```js
let funcs = "acm";
let ret = usb.usbFunctionsFromString(funcs);
```
## usb.usbFunctionsToString
usbFunctionsToString(funcs: FunctionType): string
Converts the USB function list in the numeric mask format to a string in Device mode.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------------ | ---- | ----------------- |
| funcs | [FunctionType](#functiontype) | Yes | USB function list in numeric mask format.|
**Return value**
| Type | Description |
| ------ | ------------------------------ |
| string | Function list in string format.|
**Example**
```js
let funcs = ACM | ECM;
let ret = usb.usbFunctionsToString(funcs);
```
## usb.setCurrentFunctions
setCurrentFunctions(funcs: FunctionType): Promise\<void\>
Sets the current USB function list in Device mode.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------------------------------ | ---- | ----------------- |
| funcs | [FunctionType](#functiontype) | Yes | USB function list in numeric mask format.|
**Return value**
| Type | Description |
| --------------- | ------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
```js
let funcs = HDC;
usb.setCurrentFunctions(funcs).then(() => {
console.info('usb setCurrentFunctions successfully.');
}).catch(err => {
console.error('usb setCurrentFunctions failed: ' + err.code + ' message: ' + err.message);
});
```
## usb.getCurrentFunctions
getCurrentFunctions(): FunctionType
Obtains the numeric mask combination for the USB function list in Device mode.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
**Return value**
| Type | Description |
| ------------------------------ | --------------------------------- |
| [FunctionType](#functiontype) | Numeric mask combination for the USB function list.|
**Example**
```js
let ret = usb.getCurrentFunctions();
```
## usb.getPorts
getPorts(): Array\<USBPort\>
Obtains the list of all physical USB ports.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
**Return value**
| Type | Description |
| ----------------------------- | --------------------- |
| [Array\<USBPort\>](#usbport) | List of physical USB ports.|
**Example**
```js
let ret = usb.getPorts();
```
## usb.getSupportedModes
getSupportedModes(portId: number): PortModeType
Obtains the mask combination for the supported mode list of a given USB port.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------- |
| portId | number | Yes | Port number.|
**Return value**
| Type | Description |
| ------------------------------ | -------------------------- |
| [PortModeType](#portmodetype) | Mask combination for the supported mode list.|
**Example**
```js
let ret = usb.getSupportedModes(0);
```
## usb.setPortRoles
setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\<void\>
Sets the role types supported by a specified port, which can be **powerRole** (for charging) and **dataRole** (for data transfer).
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
**Parameters**
| Name | Type | Mandatory| Description |
| --------- | -------------------------------- | ---- | ---------------- |
| portId | number | Yes | Port number. |
| powerRole | [PowerRoleType](#powerroletype) | Yes | Role for charging. |
| dataRole | [DataRoleType](#dataroletype) | Yes | Role for data transfer.|
**Return value**
| Type | Description |
| --------------- | ------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
```js
let portId = 1;
usb.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
Represents the USB endpoint from which data is sent or received. You can obtain the USB endpoint through [USBInterface](#usbinterface).
**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.|
## USBInterface
Represents a USB interface. One [USBConfiguration](#usbconfiguration) object can contain multiple **USBInterface** instances, each providing a specific function.
**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&lt;[USBEndpoint](#usbendpoint)&gt; | Yes|Endpoints that belong to the USB interface. |
## USBConfiguration
Represents the USB configuration. One [USBDevice](#usbdevice) can contain multiple **USBConfig** instances.
**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&nbsp;&lt;[USBInterface](#usbinterface)&gt; | Yes|Supported interface attributes. |
## USBDevice
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&lt;[USBConfiguration](#usbconfiguration)&gt; | Yes|Device configuration descriptor information.|
## USBDevicePipe
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.|
## USBControlParams
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. |
## USBPort
Represents a USB port.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
| 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. |
## USBPortStatus
Enumerates USB port roles.
**System API**: This is a system API.
**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.|
## USBRequestTargetType
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.|
## USBControlRequestType
Enumerates control request types.
**System capability**: SystemCapability.USB.USBManager
| Name | Value | Description |
| ------------------------- | ---- | ------ |
| USB_REQUEST_TYPE_STANDARD | 0 | Standard.|
| USB_REQUEST_TYPE_CLASS | 1 | Class. |
| USB_REQUEST_TYPE_VENDOR | 2 | Vendor.|
## USBRequestDirection
Enumerates request directions.
**System capability**: SystemCapability.USB.USBManager
| Name | Value | Description |
| --------------------------- | ---- | ------------------------ |
| USB_REQUEST_DIR_TO_DEVICE | 0 | Request for writing data from the host to the device.|
| USB_REQUEST_DIR_FROM_DEVICE | 0x80 | Request for reading data from the device to the host.|
## FunctionType
Enumerates USB device function types.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
| Name | Value | Description |
| ------------ | ---- | ---------- |
| NONE | 0 | No function.|
| ACM | 1 | ACM function. |
| ECM | 2 | ECM function. |
| HDC | 4 | HDC function. |
| MTP | 8 | Not supported currently.|
| PTP | 16 | Not supported currently.|
| RNDIS | 32 | Not supported currently.|
| MIDI | 64 | Not supported currently.|
| AUDIO_SOURCE | 128 | Not supported currently.|
| NCM | 256 | Not supported currently.|
## PortModeType
Enumerates USB port mode types.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
| Name | Value | Description |
| --------- | ---- | ---------------------------------------------------- |
| NONE | 0 | None |
| UFP | 1 | Upstream facing port, which functions as the sink of power supply. |
| DFP | 2 | Downstream facing port, which functions as the source of power supply. |
| DRP | 3 | Dynamic reconfiguration port (DRP), which can function as the DFP (host) or UFP (device). It is not supported currently.|
| NUM_MODES | 4 | Not supported currently. |
## PowerRoleType
Enumerates power role types.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
| Name | Value | Description |
| ------ | ---- | ---------- |
| NONE | 0 | None |
| SOURCE | 1 | External power supply.|
| SINK | 2 | Internal power supply.|
## DataRoleType
Enumerates data role types.
**System API**: This is a system API.
**System capability**: SystemCapability.USB.USBManager
| Name | Value | Description |
| ------ | ---- | ------------ |
| NONE | 0 | None |
| HOST | 1 | USB host.|
| DEVICE | 2 | USB device.|
# Telephony Subsystem Changelog
## cl.telephony.1 Radio Module API Change
### Changed the `isNrSupported` API in the radio module of the telephone subsystem:
NR is a proper noun and must be capitalized.
You need to adapt your application.
**Change Impacts**
The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.
**Key API/Component Changes**
- Involved APIs:
isNrSupported(): boolean;
isNrSupported(slotId: number): boolean;
- Before change:
```js
function isNrSupported(): boolean;
function isNrSupported(slotId: number): boolean;
```
- After change:
```js
function isNRSupported(): boolean;
function isNRSupported(slotId: number): boolean;
```
**Adaptation Guide**
Use the new API. The sample code is as follows:
```js
let result = radio.isNrSupported();
console.log("Result: "+ result);
```
```js
let slotId = 0;
let result = radio.isNRSupported(slotId);
console.log("Result: "+ result);
```
# Telephony Subsystem ChangeLog # Telephony Subsystem Changelog
...@@ -56,4 +56,4 @@ promise.then(data => { ...@@ -56,4 +56,4 @@ promise.then(data => {
}).catch(err => { }).catch(err => {
console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`); console.error(`isImsSmsSupported failed, promise: err->${JSON.stringify(err)}`);
}); });
``` ```
\ No newline at end of file
# USB Subsystem API Changelog
## cl.usb_manager.1 Bundle Name Change
For applications developed based on earlier versions, you need to change the name of the imported bundle. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
| Original Bundle Name | New Bundle Name |
|------------------ | ------------------- |
| ohos.usbV9.d.ts | ohos.usbManager.d.ts |
**Adaptation Guide**
Change **@ohos.usbV9** to **@ohos.usbManager** when importing the bundle.
## cl.usb_manager.2 API Parameter Type Change
For applications developed based on earlier versions, you need to modify the parameter type. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
| Original Class Name | New Class Name |
|---------------| ------------- |
| interface USBConfig | interface USBConfiguration |
| Original Namespace | New Namespace |
|---------------| ------------- |
| @namespace usbV9 | @namespace usbManager |
| Bundle Name | Original API | New API |
| --------------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ohos.usbManager.d.ts | function setConfiguration(pipe: USBDevicePipe, config: USBConfig): number; | function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number; |
**Adaptation Guide**
When calling **setConfiguration**, change the parameter type from **USBConfig** to **USBConfiguration**.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册