提交 8b53e742 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 5fdf4414
...@@ -36,7 +36,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ...@@ -36,7 +36,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message | | Code | Error Message |
|---------|---------| |---------|---------|
| 4600101 | Operation failed. Cannot connect to service.| | 4600101 | If connecting to the service failed. |
**Example** **Example**
...@@ -72,7 +72,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ...@@ -72,7 +72,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message | | Code | Error Message |
|---------|---------| |---------|---------|
| 4600101 | Operation failed. Cannot connect to service.| | 4600101 | If connecting to the service failed. |
**Example** **Example**
...@@ -114,7 +114,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ...@@ -114,7 +114,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message | | Code | Error Message |
|---------|---------| |---------|---------|
| 4600101 | Operation failed. Cannot connect to service.| | 4600101 | If connecting to the service failed. |
**Example** **Example**
...@@ -155,7 +155,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ...@@ -155,7 +155,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message | | Code | Error Message |
|---------|---------| |---------|---------|
| 4600101 | Operation failed. Cannot connect to service.| | 4600101 | If connecting to the service failed. |
**Example** **Example**
...@@ -196,13 +196,13 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ...@@ -196,13 +196,13 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message | | Code | Error Message |
|---------|---------| |---------|---------|
| 4600101 | Operation failed. Cannot connect to service.| | 4600101 | If connecting to the service failed. |
**Example** **Example**
```js ```js
try { try {
var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN); var value = batteryStats.getHardwareUnitPowerValue(batteryStats.ConsumptionType.CONSUMPTION_TYPE_SCREEN);
console.info('battery statistics value of hardware is: ' + value); console.info('battery statistics value of hardware is: ' + value);
} catch(err) { } catch(err) {
console.error('get battery statistics percent of hardware failed, err: ' + err); console.error('get battery statistics percent of hardware failed, err: ' + err);
...@@ -237,13 +237,13 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod ...@@ -237,13 +237,13 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod
| Code | Error Message | | Code | Error Message |
|---------|---------| |---------|---------|
| 4600101 | Operation failed. Cannot connect to service.| | 4600101 | If connecting to the service failed. |
**Example** **Example**
```js ```js
try { try {
var percent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); var percent = batteryStats.getHardwareUnitPowerPercent(batteryStats.ConsumptionType.CONSUMPTION_TYPE_SCREEN);
console.info('battery statistics percent of hardware is: ' + percent); console.info('battery statistics percent of hardware is: ' + percent);
} catch(err) { } catch(err) {
console.error('get battery statistics percent of hardware failed, err: ' + err); console.error('get battery statistics percent of hardware failed, err: ' + err);
......
...@@ -22,7 +22,7 @@ Sets the screen brightness. ...@@ -22,7 +22,7 @@ Sets the screen brightness.
**System API**: This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.DisplayPowerManager **System capability:** SystemCapability.PowerManager.DisplayPowerManager
**Parameters** **Parameters**
...@@ -34,9 +34,9 @@ Sets the screen brightness. ...@@ -34,9 +34,9 @@ Sets the screen brightness.
For details about the error codes, see [Screen Brightness Error Codes](../errorcodes/errorcode-brightness.md). For details about the error codes, see [Screen Brightness Error Codes](../errorcodes/errorcode-brightness.md).
| Code | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4700101 | Operation failed. Cannot connect to service.| | 4700101 | If connecting to the service failed. |
**Example** **Example**
......
...@@ -16,7 +16,7 @@ import call from '@ohos.telephony.call'; ...@@ -16,7 +16,7 @@ import call from '@ohos.telephony.call';
## call.dialCall<sup>9+</sup> ## call.dialCall<sup>9+</sup>
dialCall\(phoneNumber: string, callback: AsyncCallback<void\>\): void dialCall\(phoneNumber: string, callback: AsyncCallback\<void\>\): void
Initiates a call. This API uses an asynchronous callback to return the result. Initiates a call. This API uses an asynchronous callback to return the result.
...@@ -40,6 +40,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -40,6 +40,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -57,7 +58,7 @@ call.dialCall("138xxxxxxxx", (err) => { ...@@ -57,7 +58,7 @@ call.dialCall("138xxxxxxxx", (err) => {
## call.dialCall<sup>9+</sup> ## call.dialCall<sup>9+</sup>
dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback<void\>\): void dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\<void\>\): void
Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result.
...@@ -82,6 +83,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -82,6 +83,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -104,7 +106,7 @@ call.dialCall("138xxxxxxxx", { ...@@ -104,7 +106,7 @@ call.dialCall("138xxxxxxxx", {
## call.dialCall<sup>9+</sup> ## call.dialCall<sup>9+</sup>
dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise<void\> dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise\<void\>
Initiates a call. You can set call options as needed. This API uses a promise to return the result. Initiates a call. You can set call options as needed. This API uses a promise to return the result.
...@@ -119,7 +121,7 @@ Initiates a call. You can set call options as needed. This API uses a promise to ...@@ -119,7 +121,7 @@ Initiates a call. You can set call options as needed. This API uses a promise to
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------- | ----------------------------------- | ---- | -------------------------------------- | | ----------- | ----------------------------------- | ---- | -------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [DialCallOptions](#dialcalloptions9)| No | Call options, which carry other configuration information of the call.| | options | [DialCallOptions](#dialcalloptions9)| No | Call options, which carry other configuration information of the call.<br>If this parameter is not set, the following configuration is used by default. For details, see [DialCallOptions](#dialcalloptions9).<br>- **accountId**: 0 (card slot 1)<br>- **videoState**: voice call<br>- **dialScene**: common call<br>- **dialType**: carrier call |
**Return value** **Return value**
...@@ -134,6 +136,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -134,6 +136,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -158,7 +161,7 @@ promise.then(() => { ...@@ -158,7 +161,7 @@ promise.then(() => {
## call.dial<sup>(deprecated)</sup> ## call.dial<sup>(deprecated)</sup>
dial\(phoneNumber: string, callback: AsyncCallback<boolean\>\): void dial\(phoneNumber: string, callback: AsyncCallback\<boolean\>\): void
Initiates a call. This API uses an asynchronous callback to return the result. Initiates a call. This API uses an asynchronous callback to return the result.
...@@ -188,7 +191,7 @@ call.dial("138xxxxxxxx", (err, data) => { ...@@ -188,7 +191,7 @@ call.dial("138xxxxxxxx", (err, data) => {
## call.dial<sup>(deprecated)</sup> ## call.dial<sup>(deprecated)</sup>
dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean\>\): void dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\<boolean\>\): void
Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result.
...@@ -220,7 +223,7 @@ call.dial("138xxxxxxxx", { ...@@ -220,7 +223,7 @@ call.dial("138xxxxxxxx", {
## call.dial<sup>(deprecated)</sup> ## call.dial<sup>(deprecated)</sup>
dial\(phoneNumber: string, options?: DialOptions\): Promise<boolean\> dial\(phoneNumber: string, options?: DialOptions\): Promise\<boolean\>
Initiates a call. You can set call options as needed. This API uses a promise to return the result. Initiates a call. You can set call options as needed. This API uses a promise to return the result.
...@@ -260,7 +263,7 @@ promise.then(data => { ...@@ -260,7 +263,7 @@ promise.then(data => {
## call.makeCall<sup>7+</sup> ## call.makeCall<sup>7+</sup>
makeCall(phoneNumber: string, callback: AsyncCallback\<void\>): void makeCall\(phoneNumber: string, callback: AsyncCallback\<void\>\): void
Launches the call screen and displays the dialed number. This API uses an asynchronous callback to return the result. Launches the call screen and displays the dialed number. This API uses an asynchronous callback to return the result.
...@@ -296,7 +299,7 @@ call.makeCall("138xxxxxxxx", err => { ...@@ -296,7 +299,7 @@ call.makeCall("138xxxxxxxx", err => {
## call.makeCall<sup>7+</sup> ## call.makeCall<sup>7+</sup>
makeCall(phoneNumber: string): Promise\<void\> makeCall\(phoneNumber: string\): Promise\<void\>
Launches the call screen and displays the dialed number. This API uses a promise to return the result. Launches the call screen and displays the dialed number. This API uses a promise to return the result.
...@@ -339,7 +342,7 @@ promise.then(() => { ...@@ -339,7 +342,7 @@ promise.then(() => {
## call.hasCall ## call.hasCall
hasCall\(callback: AsyncCallback<boolean\>\): void hasCall\(callback: AsyncCallback\<boolean\>\): void
Checks whether a call is in progress. This API uses an asynchronous callback to return the result. Checks whether a call is in progress. This API uses an asynchronous callback to return the result.
...@@ -362,7 +365,7 @@ call.hasCall((err, data) => { ...@@ -362,7 +365,7 @@ call.hasCall((err, data) => {
## call.hasCall ## call.hasCall
hasCall\(\): Promise<boolean\> hasCall\(\): Promise\<boolean\>
Checks whether a call is in progress. This API uses a promise to return the result. Checks whether a call is in progress. This API uses a promise to return the result.
...@@ -388,7 +391,7 @@ promise.then(data => { ...@@ -388,7 +391,7 @@ promise.then(data => {
## call.getCallState ## call.getCallState
getCallState\(callback: AsyncCallback<CallState\>\): void getCallState\(callback: AsyncCallback\<CallState\>\): void
Obtains the call status. This API uses an asynchronous callback to return the result. Obtains the call status. This API uses an asynchronous callback to return the result.
...@@ -411,7 +414,7 @@ call.getCallState((err, data) => { ...@@ -411,7 +414,7 @@ call.getCallState((err, data) => {
## call.getCallState ## call.getCallState
getCallState\(\): Promise<CallState\> getCallState\(\): Promise\<CallState\>
Obtains the call status. This API uses a promise to return the result. Obtains the call status. This API uses a promise to return the result.
...@@ -436,7 +439,7 @@ promise.then(data => { ...@@ -436,7 +439,7 @@ promise.then(data => {
## call.hasVoiceCapability<sup>7+</sup> ## call.hasVoiceCapability<sup>7+</sup>
hasVoiceCapability(): boolean hasVoiceCapability\(\): boolean
Checks whether a device supports voice calls. Checks whether a device supports voice calls.
...@@ -455,7 +458,7 @@ console.log(`hasVoiceCapability: ${JSON.stringify(result)}`); ...@@ -455,7 +458,7 @@ console.log(`hasVoiceCapability: ${JSON.stringify(result)}`);
## call.isEmergencyPhoneNumber<sup>7+</sup> ## call.isEmergencyPhoneNumber<sup>7+</sup>
isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback<boolean\>\): void isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback\<boolean\>\): void
Checks whether the called number is an emergency number. This API uses an asynchronous callback to return the result. Checks whether the called number is an emergency number. This API uses an asynchronous callback to return the result.
...@@ -491,7 +494,7 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => { ...@@ -491,7 +494,7 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => {
## call.isEmergencyPhoneNumber<sup>7+</sup> ## call.isEmergencyPhoneNumber<sup>7+</sup>
isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback<boolean\>\): void isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\<boolean\>\): void
Checks whether the called number is an emergency number based on the phone number. This API uses an asynchronous callback to return the result. Checks whether the called number is an emergency number based on the phone number. This API uses an asynchronous callback to return the result.
...@@ -528,7 +531,7 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => { ...@@ -528,7 +531,7 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => {
## call.isEmergencyPhoneNumber<sup>7+</sup> ## call.isEmergencyPhoneNumber<sup>7+</sup>
isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise<boolean\> isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise\<boolean\>
Checks whether the called number is an emergency number based on the phone number. This API uses a promise to return the result. Checks whether the called number is an emergency number based on the phone number. This API uses a promise to return the result.
...@@ -572,7 +575,7 @@ promise.then(data => { ...@@ -572,7 +575,7 @@ promise.then(data => {
## call.formatPhoneNumber<sup>7+</sup> ## call.formatPhoneNumber<sup>7+</sup>
formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback<string\>\): void formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback\<string\>\): void
Formats a phone number. This API uses an asynchronous callback to return the result. Formats a phone number. This API uses an asynchronous callback to return the result.
...@@ -609,7 +612,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => { ...@@ -609,7 +612,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => {
## call.formatPhoneNumber<sup>7+</sup> ## call.formatPhoneNumber<sup>7+</sup>
formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback<string\>\): void formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\<string\>\): void
Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result. Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result.
...@@ -650,7 +653,7 @@ call.formatPhoneNumber("138xxxxxxxx", { ...@@ -650,7 +653,7 @@ call.formatPhoneNumber("138xxxxxxxx", {
## call.formatPhoneNumber<sup>7+</sup> ## call.formatPhoneNumber<sup>7+</sup>
formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise<string\> formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise\<string\>
Formats a phone number based on specified formatting options. This API uses a promise to return the result. Formats a phone number based on specified formatting options. This API uses a promise to return the result.
...@@ -698,7 +701,7 @@ promise.then(data => { ...@@ -698,7 +701,7 @@ promise.then(data => {
## call.formatPhoneNumberToE164<sup>7+</sup> ## call.formatPhoneNumberToE164<sup>7+</sup>
formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: AsyncCallback<string\>\): void formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: AsyncCallback\<string\>\): void
Converts a phone number into the E.164 format. This API uses an asynchronous callback to return the result. Converts a phone number into the E.164 format. This API uses an asynchronous callback to return the result.
...@@ -737,7 +740,7 @@ call.formatPhoneNumberToE164("138xxxxxxxx", "CN", (err, data) => { ...@@ -737,7 +740,7 @@ call.formatPhoneNumberToE164("138xxxxxxxx", "CN", (err, data) => {
## call.formatPhoneNumberToE164<sup>7+</sup> ## call.formatPhoneNumberToE164<sup>7+</sup>
formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise<string\> formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise\<string\>
Converts a phone number into the E.164 format. This API uses a promise to return the result. Converts a phone number into the E.164 format. This API uses a promise to return the result.
...@@ -785,7 +788,7 @@ promise.then(data => { ...@@ -785,7 +788,7 @@ promise.then(data => {
## call.muteRinger<sup>8+</sup> ## call.muteRinger<sup>8+</sup>
muteRinger\(callback: AsyncCallback<void\>\): void muteRinger\(callback: AsyncCallback\<void\>\): void
Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses an asynchronous callback to return the result. Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses an asynchronous callback to return the result.
...@@ -808,6 +811,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -808,6 +811,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -825,7 +829,7 @@ call.muteRinger((err) => { ...@@ -825,7 +829,7 @@ call.muteRinger((err) => {
## call.muteRinger<sup>8+</sup> ## call.muteRinger<sup>8+</sup>
muteRinger\(\): Promise<void\> muteRinger\(\): Promise\<void\>
Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses a promise to return the result. Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses a promise to return the result.
...@@ -848,6 +852,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -848,6 +852,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -865,7 +870,7 @@ call.muteRinger().then(() => { ...@@ -865,7 +870,7 @@ call.muteRinger().then(() => {
## call.answerCall<sup>9+</sup> ## call.answerCall<sup>9+</sup>
answerCall\(callId: number, callback: AsyncCallback<void\>\): void answerCall\(callId: number, callback: AsyncCallback\<void\>\): void
Answers a call. This API uses an asynchronous callback to return the result. Answers a call. This API uses an asynchronous callback to return the result.
...@@ -889,6 +894,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -889,6 +894,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -906,7 +912,7 @@ call.answerCall(1, (err) => { ...@@ -906,7 +912,7 @@ call.answerCall(1, (err) => {
## call.answerCall<sup>9+</sup> ## call.answerCall<sup>9+</sup>
answerCall(callId?: number\): Promise<void\> answerCall(callId?: number\): Promise\<void\>
Answers a call. This API uses a promise to return the result. Answers a call. This API uses a promise to return the result.
...@@ -920,7 +926,7 @@ Answers a call. This API uses a promise to return the result. ...@@ -920,7 +926,7 @@ Answers a call. This API uses a promise to return the result.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.| | callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.<br>If this parameter is not set, the latest ringing call will be connected.|
**Return value** **Return value**
...@@ -935,6 +941,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -935,6 +941,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -954,7 +961,7 @@ call.answerCall(1).then(() => { ...@@ -954,7 +961,7 @@ call.answerCall(1).then(() => {
## call.answerCall<sup>9+</sup> ## call.answerCall<sup>9+</sup>
answerCall\(callback: AsyncCallback<void\>\): void answerCall\(callback: AsyncCallback\<void\>\): void
Answers a call. This API uses an asynchronous callback to return the result. Answers a call. This API uses an asynchronous callback to return the result.
...@@ -977,6 +984,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -977,6 +984,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -994,7 +1002,7 @@ call.answerCall((err) => { ...@@ -994,7 +1002,7 @@ call.answerCall((err) => {
## call.hangUpCall<sup>9+</sup> ## call.hangUpCall<sup>9+</sup>
hangUpCall\(callId: number, callback: AsyncCallback<void\>\): void hangUpCall\(callId: number, callback: AsyncCallback\<void\>\): void
Ends a call. This API uses an asynchronous callback to return the result. Ends a call. This API uses an asynchronous callback to return the result.
...@@ -1018,6 +1026,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1018,6 +1026,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1035,7 +1044,7 @@ call.hangUpCall(1, (err) => { ...@@ -1035,7 +1044,7 @@ call.hangUpCall(1, (err) => {
## call.hangUpCall<sup>9+</sup> ## call.hangUpCall<sup>9+</sup>
hangUpCall\(callId?: number\): Promise<void\> hangUpCall\(callId?: number\): Promise\<void\>
Ends a call. This API uses a promise to return the result. Ends a call. This API uses a promise to return the result.
...@@ -1049,7 +1058,7 @@ Ends a call. This API uses a promise to return the result. ...@@ -1049,7 +1058,7 @@ Ends a call. This API uses a promise to return the result.
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.| | callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.<br>If this parameter is not set, the latest ongoing, dialed, or connected call will be ended.|
**Return value** **Return value**
...@@ -1064,6 +1073,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1064,6 +1073,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1083,7 +1093,7 @@ call.hangUpCall(1).then(() => { ...@@ -1083,7 +1093,7 @@ call.hangUpCall(1).then(() => {
## call.hangUpCall<sup>9+</sup> ## call.hangUpCall<sup>9+</sup>
hangUpCall\(callback: AsyncCallback<void\>\): void hangUpCall\(callback: AsyncCallback\<void\>\): void
Ends a call. This API uses an asynchronous callback to return the result. Ends a call. This API uses an asynchronous callback to return the result.
...@@ -1106,6 +1116,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1106,6 +1116,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1124,7 +1135,7 @@ call.hangUpCall((err) => { ...@@ -1124,7 +1135,7 @@ call.hangUpCall((err) => {
## call.rejectCall<sup>9+</sup> ## call.rejectCall<sup>9+</sup>
rejectCall(callId: number, callback: AsyncCallback\<void>): void rejectCall\(callId: number, callback: AsyncCallback\<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result. Rejects a call. This API uses an asynchronous callback to return the result.
...@@ -1148,6 +1159,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1148,6 +1159,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1166,7 +1178,7 @@ call.rejectCall(1, (err) => { ...@@ -1166,7 +1178,7 @@ call.rejectCall(1, (err) => {
## call.rejectCall<sup>9+</sup> ## call.rejectCall<sup>9+</sup>
rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void\>\): void rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result. Rejects a call. This API uses an asynchronous callback to return the result.
...@@ -1191,6 +1203,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1191,6 +1203,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1211,7 +1224,7 @@ call.rejectCall(1, rejectMessageOptions, (err) => { ...@@ -1211,7 +1224,7 @@ call.rejectCall(1, rejectMessageOptions, (err) => {
## call.rejectCall<sup>9+</sup> ## call.rejectCall<sup>9+</sup>
rejectCall(callId?: number, options?: RejectMessageOptions\): Promise<void\> rejectCall\(callId?: number, options?: RejectMessageOptions\): Promise\<void\>
Rejects a call. This API uses a promise to return the result. Rejects a call. This API uses a promise to return the result.
...@@ -1225,8 +1238,8 @@ Rejects a call. This API uses a promise to return the result. ...@@ -1225,8 +1238,8 @@ Rejects a call. This API uses a promise to return the result.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | | ------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.| | callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.<br>If this parameter is not set, the latest ringing call will be rejected.|
| options | [RejectMessageOptions](#rejectmessageoptions7) | No | Options for the call rejection message. | | options | [RejectMessageOptions](#rejectmessageoptions7) | No | Options for the call rejection message. If this parameter is not set, no call rejection message will be sent.|
**Return value** **Return value**
...@@ -1241,6 +1254,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1241,6 +1254,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1263,7 +1277,7 @@ call.reject(1, rejectMessageOptions).then(() => { ...@@ -1263,7 +1277,7 @@ call.reject(1, rejectMessageOptions).then(() => {
## call.rejectCall<sup>9+</sup> ## call.rejectCall<sup>9+</sup>
rejectCall\(callback: AsyncCallback<void\>\): void rejectCall\(callback: AsyncCallback\<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result. Rejects a call. This API uses an asynchronous callback to return the result.
...@@ -1286,6 +1300,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1286,6 +1300,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1303,7 +1318,7 @@ call.rejectCall((err) => { ...@@ -1303,7 +1318,7 @@ call.rejectCall((err) => {
## call.rejectCall<sup>9+</sup> ## call.rejectCall<sup>9+</sup>
rejectCall\(options: RejectMessageOptions, callback: AsyncCallback<void\>\): void rejectCall\(options: RejectMessageOptions, callback: AsyncCallback\<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result. Rejects a call. This API uses an asynchronous callback to return the result.
...@@ -1327,6 +1342,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1327,6 +1342,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1347,7 +1363,7 @@ call.rejectCall(rejectMessageOptions, (err) => { ...@@ -1347,7 +1363,7 @@ call.rejectCall(rejectMessageOptions, (err) => {
## call.holdCall<sup>7+</sup> ## call.holdCall<sup>7+</sup>
holdCall\(callId: number, callback: AsyncCallback<void\>\): void holdCall\(callId: number, callback: AsyncCallback\<void\>\): void
Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result. Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result.
...@@ -1371,6 +1387,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1371,6 +1387,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1388,7 +1405,7 @@ call.holdCall(1, (err) => { ...@@ -1388,7 +1405,7 @@ call.holdCall(1, (err) => {
## call.holdCall<sup>7+</sup> ## call.holdCall<sup>7+</sup>
holdCall\(callId: number\): Promise<void\> holdCall\(callId: number\): Promise\<void\>
Holds a call based on the specified call ID. This API uses a promise to return the result. Holds a call based on the specified call ID. This API uses a promise to return the result.
...@@ -1417,6 +1434,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1417,6 +1434,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1435,7 +1453,7 @@ call.holdCall(1).then(() => { ...@@ -1435,7 +1453,7 @@ call.holdCall(1).then(() => {
## call.unHoldCall<sup>7+</sup> ## call.unHoldCall<sup>7+</sup>
unHoldCall\(callId: number, callback: AsyncCallback<void\>\): void unHoldCall\(callId: number, callback: AsyncCallback\<void\>\): void
Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result. Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result.
...@@ -1459,6 +1477,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1459,6 +1477,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1476,7 +1495,7 @@ call.unHoldCall(1, (err) => { ...@@ -1476,7 +1495,7 @@ call.unHoldCall(1, (err) => {
## call.unHoldCall<sup>7+</sup> ## call.unHoldCall<sup>7+</sup>
unHoldCall\(callId: number\): Promise<void\> unHoldCall\(callId: number\): Promise\<void\>
Unholds a call based on the specified call ID. This API uses a promise to return the result. Unholds a call based on the specified call ID. This API uses a promise to return the result.
...@@ -1505,6 +1524,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1505,6 +1524,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1523,7 +1543,7 @@ call.unHoldCall(1).then(() => { ...@@ -1523,7 +1543,7 @@ call.unHoldCall(1).then(() => {
## call.switchCall<sup>7+</sup> ## call.switchCall<sup>7+</sup>
switchCall\(callId: number, callback: AsyncCallback<void\>\): void switchCall\(callId: number, callback: AsyncCallback\<void\>\): void
Switches a call. This API uses an asynchronous callback to return the result. Switches a call. This API uses an asynchronous callback to return the result.
...@@ -1547,6 +1567,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1547,6 +1567,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1564,7 +1585,7 @@ call.switchCall(1, (err) => { ...@@ -1564,7 +1585,7 @@ call.switchCall(1, (err) => {
## call.switchCall<sup>7+</sup> ## call.switchCall<sup>7+</sup>
switchCall\(callId: number\): Promise<void\> switchCall\(callId: number\): Promise\<void\>
Switches a call. This API uses a promise to return the result. Switches a call. This API uses a promise to return the result.
...@@ -1593,6 +1614,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1593,6 +1614,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1611,7 +1633,7 @@ call.switchCall(1).then(() => { ...@@ -1611,7 +1633,7 @@ call.switchCall(1).then(() => {
## call.combineConference<sup>7+</sup> ## call.combineConference<sup>7+</sup>
combineConference\(callId: number, callback: AsyncCallback<void\>\): void combineConference\(callId: number, callback: AsyncCallback\<void\>\): void
Combines two calls into a conference call. This API uses an asynchronous callback to return the result. Combines two calls into a conference call. This API uses an asynchronous callback to return the result.
...@@ -1632,11 +1654,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1632,11 +1654,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1649,7 +1671,7 @@ call.combineConference(1, (err) => { ...@@ -1649,7 +1671,7 @@ call.combineConference(1, (err) => {
## call.combineConference<sup>7+</sup> ## call.combineConference<sup>7+</sup>
combineConference\(callId: number\): Promise<void\> combineConference\(callId: number\): Promise\<void\>
Combines two calls into a conference call. This API uses a promise to return the result. Combines two calls into a conference call. This API uses a promise to return the result.
...@@ -1675,11 +1697,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1675,11 +1697,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1693,7 +1715,7 @@ call.combineConference(1).then(() => { ...@@ -1693,7 +1715,7 @@ call.combineConference(1).then(() => {
## call.getMainCallId<sup>7+</sup> ## call.getMainCallId<sup>7+</sup>
getMainCallId\(callId: number, callback: AsyncCallback<number\>\): void getMainCallId\(callId: number, callback: AsyncCallback\<number\>\): void
Obtains the main call ID. This API uses an asynchronous callback to return the result. Obtains the main call ID. This API uses an asynchronous callback to return the result.
...@@ -1714,11 +1736,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1714,11 +1736,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1732,7 +1754,7 @@ call.getMainCallId(1, (err, data) => { ...@@ -1732,7 +1754,7 @@ call.getMainCallId(1, (err, data) => {
## call.getMainCallId<sup>7+</sup> ## call.getMainCallId<sup>7+</sup>
getMainCallId\(callId: number\): Promise<number\> getMainCallId\(callId: number\): Promise\<number\>
Obtains the main call ID. This API uses a promise to return the result. Obtains the main call ID. This API uses a promise to return the result.
...@@ -1758,11 +1780,12 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1758,11 +1780,12 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1777,7 +1800,7 @@ promise.then(data => { ...@@ -1777,7 +1800,7 @@ promise.then(data => {
## call.getSubCallIdList<sup>7+</sup> ## call.getSubCallIdList<sup>7+</sup>
getSubCallIdList\(callId: number, callback: AsyncCallback<Array<string\>\>\): void getSubCallIdList\(callId: number, callback: AsyncCallback\<Array\<string\>\>\): void
Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result. Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result.
...@@ -1798,11 +1821,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1798,11 +1821,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1815,7 +1838,7 @@ call.getSubCallIdList(1, (err, data) => { ...@@ -1815,7 +1838,7 @@ call.getSubCallIdList(1, (err, data) => {
## call.getSubCallIdList<sup>7+</sup> ## call.getSubCallIdList<sup>7+</sup>
getSubCallIdList\(callId: number\): Promise<Array<string\>\> getSubCallIdList\(callId: number\): Promise\<Array\<string\>\>
Obtains the list of subcall IDs. This API uses a promise to return the result. Obtains the list of subcall IDs. This API uses a promise to return the result.
...@@ -1841,11 +1864,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1841,11 +1864,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1860,7 +1883,7 @@ promise.then(data => { ...@@ -1860,7 +1883,7 @@ promise.then(data => {
## call.getCallIdListForConference<sup>7+</sup> ## call.getCallIdListForConference<sup>7+</sup>
getCallIdListForConference\(callId: number, callback: AsyncCallback<Array<string\>>\): void getCallIdListForConference\(callId: number, callback: AsyncCallback\<Array\<string\>\>\): void
Obtains the list of call IDs in a conference. This API uses an asynchronous callback to return the result. Obtains the list of call IDs in a conference. This API uses an asynchronous callback to return the result.
...@@ -1881,11 +1904,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1881,11 +1904,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1898,7 +1921,7 @@ call.getCallIdListForConference(1, (err, data) => { ...@@ -1898,7 +1921,7 @@ call.getCallIdListForConference(1, (err, data) => {
## call.getCallIdListForConference<sup>7+</sup> ## call.getCallIdListForConference<sup>7+</sup>
getCallIdListForConference\(callId: number\): Promise<Array<string\>\> getCallIdListForConference\(callId: number\): Promise\<Array\<string\>\>
Obtains the list of call IDs in a conference. This API uses a promise to return the result. Obtains the list of call IDs in a conference. This API uses a promise to return the result.
...@@ -1924,11 +1947,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1924,11 +1947,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1943,7 +1966,7 @@ promise.then(data => { ...@@ -1943,7 +1966,7 @@ promise.then(data => {
## call.getCallWaitingStatus<sup>7+</sup> ## call.getCallWaitingStatus<sup>7+</sup>
getCallWaitingStatus\(slotId: number, callback: AsyncCallback<CallWaitingStatus\>\): void getCallWaitingStatus\(slotId: number, callback: AsyncCallback\<CallWaitingStatus\>\): void
Obtains the call waiting status. This API uses an asynchronous callback to return the result. Obtains the call waiting status. This API uses an asynchronous callback to return the result.
...@@ -1967,11 +1990,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1967,11 +1990,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -1984,7 +2007,7 @@ call.getCallWaitingStatus(0, (err, data) => { ...@@ -1984,7 +2007,7 @@ call.getCallWaitingStatus(0, (err, data) => {
## call.getCallWaitingStatus<sup>7+</sup> ## call.getCallWaitingStatus<sup>7+</sup>
getCallWaitingStatus\(slotId: number\): Promise<CallWaitingStatus\> getCallWaitingStatus\(slotId: number\): Promise\<CallWaitingStatus\>
Obtains the call waiting status. This API uses a promise to return the result. Obtains the call waiting status. This API uses a promise to return the result.
...@@ -2013,11 +2036,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2013,11 +2036,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2032,7 +2055,7 @@ promise.then(data => { ...@@ -2032,7 +2055,7 @@ promise.then(data => {
## call.setCallWaiting<sup>7+</sup> ## call.setCallWaiting<sup>7+</sup>
setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback<void\>\): void setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback\<void\>\): void
Sets the call waiting switch. This API uses an asynchronous callback to return the result. Sets the call waiting switch. This API uses an asynchronous callback to return the result.
...@@ -2057,11 +2080,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2057,11 +2080,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2074,7 +2097,7 @@ call.setCallWaiting(0, true, (err) => { ...@@ -2074,7 +2097,7 @@ call.setCallWaiting(0, true, (err) => {
## call.setCallWaiting<sup>7+</sup> ## call.setCallWaiting<sup>7+</sup>
setCallWaiting\(slotId: number, activate: boolean\): Promise<void\> setCallWaiting\(slotId: number, activate: boolean\): Promise\<void\>
Sets the call waiting switch. This API uses a promise to return the result. Sets the call waiting switch. This API uses a promise to return the result.
...@@ -2104,11 +2127,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2104,11 +2127,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2122,7 +2145,7 @@ call.setCallWaiting(0, true).then(() => { ...@@ -2122,7 +2145,7 @@ call.setCallWaiting(0, true).then(() => {
## call.startDTMF<sup>7+</sup> ## call.startDTMF<sup>7+</sup>
startDTMF\(callId: number, character: string, callback: AsyncCallback<void\>\): void startDTMF\(callId: number, character: string, callback: AsyncCallback\<void\>\): void
Enables DTMF. This API uses an asynchronous callback to return the result. Enables DTMF. This API uses an asynchronous callback to return the result.
...@@ -2144,11 +2167,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2144,11 +2167,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2161,7 +2184,7 @@ call.startDTMF(1, "0", (err) => { ...@@ -2161,7 +2184,7 @@ call.startDTMF(1, "0", (err) => {
## call.startDTMF<sup>7+</sup> ## call.startDTMF<sup>7+</sup>
startDTMF\(callId: number, character: string\): Promise<void\> startDTMF\(callId: number, character: string\): Promise\<void\>
Enables DTMF. This API uses a promise to return the result. Enables DTMF. This API uses a promise to return the result.
...@@ -2188,11 +2211,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2188,11 +2211,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2206,7 +2229,7 @@ call.startDTMF(1, "0").then(() => { ...@@ -2206,7 +2229,7 @@ call.startDTMF(1, "0").then(() => {
## call.stopDTMF<sup>7+</sup> ## call.stopDTMF<sup>7+</sup>
stopDTMF\(callId: number, callback: AsyncCallback<void\>\): void stopDTMF\(callId: number, callback: AsyncCallback\<void\>\): void
Stops DTMF. This API uses an asynchronous callback to return the result. Stops DTMF. This API uses an asynchronous callback to return the result.
...@@ -2227,11 +2250,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2227,11 +2250,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2244,7 +2267,7 @@ call.stopDTMF(1, (err) => { ...@@ -2244,7 +2267,7 @@ call.stopDTMF(1, (err) => {
## call.stopDTMF<sup>7+</sup> ## call.stopDTMF<sup>7+</sup>
stopDTMF\(callId: number\): Promise<void\> stopDTMF\(callId: number\): Promise\<void\>
Stops DTMF. This API uses a promise to return the result. Stops DTMF. This API uses a promise to return the result.
...@@ -2270,11 +2293,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2270,11 +2293,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2288,7 +2311,7 @@ call.stopDTMF(1).then(() => { ...@@ -2288,7 +2311,7 @@ call.stopDTMF(1).then(() => {
## call.isInEmergencyCall<sup>7+</sup> ## call.isInEmergencyCall<sup>7+</sup>
isInEmergencyCall\(callback: AsyncCallback<boolean\>\): void isInEmergencyCall\(callback: AsyncCallback\<boolean\>\): void
Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result. Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result.
...@@ -2311,6 +2334,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2311,6 +2334,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2328,7 +2352,7 @@ call.isInEmergencyCall((err, data) => { ...@@ -2328,7 +2352,7 @@ call.isInEmergencyCall((err, data) => {
## call.isInEmergencyCall<sup>7+</sup> ## call.isInEmergencyCall<sup>7+</sup>
isInEmergencyCall\(\): Promise<boolean\> isInEmergencyCall\(\): Promise\<boolean\>
Checks whether a call is an emergency call. This API uses a promise to return the result. Checks whether a call is an emergency call. This API uses a promise to return the result.
...@@ -2351,8 +2375,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2351,8 +2375,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -2370,7 +2393,7 @@ promise.then(data => { ...@@ -2370,7 +2393,7 @@ promise.then(data => {
## call.on('callDetailsChange')<sup>7+</sup> ## call.on('callDetailsChange')<sup>7+</sup>
on\(type: 'callDetailsChange', callback: Callback<CallAttributeOptions\>\): void on\(type: 'callDetailsChange', callback: Callback\<CallAttributeOptions\>\): void
Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result. Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result.
...@@ -2394,6 +2417,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2394,6 +2417,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2410,7 +2434,7 @@ call.on('callDetailsChange', data => { ...@@ -2410,7 +2434,7 @@ call.on('callDetailsChange', data => {
## call.on('callEventChange')<sup>8+</sup> ## call.on('callEventChange')<sup>8+</sup>
on\(type: 'callEventChange', callback: Callback<CallEventOptions\>\): void on\(type: 'callEventChange', callback: Callback\<CallEventOptions\>\): void
Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result. Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result.
...@@ -2434,6 +2458,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2434,6 +2458,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2450,7 +2475,7 @@ call.on('callEventChange', data => { ...@@ -2450,7 +2475,7 @@ call.on('callEventChange', data => {
## call.on('callDisconnectedCause')<sup>8+</sup> ## call.on('callDisconnectedCause')<sup>8+</sup>
on\(type: 'callDisconnectedCause', callback: Callback<DisconnectedDetails\>): void on\(type: 'callDisconnectedCause', callback: Callback\<DisconnectedDetails\>\): void
Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result.
...@@ -2474,6 +2499,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2474,6 +2499,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2490,7 +2516,7 @@ call.on('callDisconnectedCause', data => { ...@@ -2490,7 +2516,7 @@ call.on('callDisconnectedCause', data => {
## call.on('mmiCodeResult')<sup>9+</sup> ## call.on('mmiCodeResult')<sup>9+</sup>
on\(type: 'mmiCodeResult', callback: Callback<MmiCodeResults\>\): void on\(type: 'mmiCodeResult', callback: Callback\<MmiCodeResults\>\): void
Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result. Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result.
...@@ -2514,6 +2540,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2514,6 +2540,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2530,7 +2557,7 @@ call.on('mmiCodeResult', data => { ...@@ -2530,7 +2557,7 @@ call.on('mmiCodeResult', data => {
## call.off('callDetailsChange')<sup>7+</sup> ## call.off('callDetailsChange')<sup>7+</sup>
off\(type: 'callDetailsChange', callback?: Callback<CallAttributeOptions\>\): void off\(type: 'callDetailsChange', callback?: Callback\<CallAttributeOptions\>\): void
Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result. Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result.
...@@ -2545,7 +2572,7 @@ Unsubscribes from **callDetailsChange** events. This API uses an asynchronous ca ...@@ -2545,7 +2572,7 @@ Unsubscribes from **callDetailsChange** events. This API uses an asynchronous ca
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------------- | ---- | ---------------------------------- | | -------- | -------------------------------------------------------- | ---- | ---------------------------------- |
| type | string | Yes | Call details change. This field has a fixed value of **callDetailsChange**.| | type | string | Yes | Call details change. This field has a fixed value of **callDetailsChange**.|
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. | | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received.|
**Error codes** **Error codes**
...@@ -2554,6 +2581,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2554,6 +2581,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2570,7 +2598,7 @@ call.off('callDetailsChange', data => { ...@@ -2570,7 +2598,7 @@ call.off('callDetailsChange', data => {
## call.off('callEventChange')<sup>8+</sup> ## call.off('callEventChange')<sup>8+</sup>
off\(type: 'callEventChange', callback?: Callback<CallEventOptions\>\): void off\(type: 'callEventChange', callback?: Callback\<CallEventOptions\>\): void
Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result. Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result.
...@@ -2585,7 +2613,7 @@ Unsubscribes from **callEventChange** events. This API uses an asynchronous call ...@@ -2585,7 +2613,7 @@ Unsubscribes from **callEventChange** events. This API uses an asynchronous call
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ---------------------------------- | | -------- | ------------------------------------------------ | ---- | ---------------------------------- |
| type | string | Yes | Call event change. This field has a fixed value of **callEventChange**.| | type | string | Yes | Call event change. This field has a fixed value of **callEventChange**.|
| callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. | | callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received.|
**Error codes** **Error codes**
...@@ -2594,6 +2622,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2594,6 +2622,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2610,7 +2639,7 @@ call.off('callEventChange', data => { ...@@ -2610,7 +2639,7 @@ call.off('callEventChange', data => {
## call.off('callDisconnectedCause')<sup>8+</sup> ## call.off('callDisconnectedCause')<sup>8+</sup>
off\(type: 'callDisconnectedCause', callback?: Callback<DisconnectedDetails\>\): void off\(type: 'callDisconnectedCause', callback?: Callback\<DisconnectedDetails\>\): void
Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result.
...@@ -2625,7 +2654,7 @@ Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronou ...@@ -2625,7 +2654,7 @@ Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronou
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------------- | ---- | ------------------- | | -------- | ---------------------------------------------------------- | ---- | ------------------- |
| type | string | Yes | Call disconnection cause. This field has a fixed value of **callDisconnectedCause**.| | type | string | Yes | Call disconnection cause. This field has a fixed value of **callDisconnectedCause**.|
| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. | | callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received.|
**Error codes** **Error codes**
...@@ -2634,6 +2663,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2634,6 +2663,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2650,7 +2680,7 @@ call.off('callDisconnectedCause', data => { ...@@ -2650,7 +2680,7 @@ call.off('callDisconnectedCause', data => {
## call.off('mmiCodeResult')<sup>9+</sup> ## call.off('mmiCodeResult')<sup>9+</sup>
off\(type: 'mmiCodeResult', callback?: Callback<MmiCodeResults\>\): void off\(type: 'mmiCodeResult', callback?: Callback\<MmiCodeResults\>\): void
Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result. Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result.
...@@ -2665,7 +2695,7 @@ Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callba ...@@ -2665,7 +2695,7 @@ Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callba
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ----------- | | -------- | ------------------------------------------------ | ---- | ----------- |
| type | string | Yes | MMI code result. This field has a fixed value of **mmiCodeResult**.| | type | string | Yes | MMI code result. This field has a fixed value of **mmiCodeResult**.|
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. | | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received.|
**Error codes** **Error codes**
...@@ -2674,6 +2704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2674,6 +2704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2690,7 +2721,7 @@ call.off('mmiCodeResult', data => { ...@@ -2690,7 +2721,7 @@ call.off('mmiCodeResult', data => {
## call.isNewCallAllowed<sup>8+</sup> ## call.isNewCallAllowed<sup>8+</sup>
isNewCallAllowed\(callback: AsyncCallback<boolean\>\): void isNewCallAllowed\(callback: AsyncCallback\<boolean\>\): void
Checks whether a new call is allowed. This API uses an asynchronous callback to return the result. Checks whether a new call is allowed. This API uses an asynchronous callback to return the result.
...@@ -2710,6 +2741,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2710,6 +2741,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2727,7 +2759,7 @@ call.isNewCallAllowed((err, data) => { ...@@ -2727,7 +2759,7 @@ call.isNewCallAllowed((err, data) => {
## call.isNewCallAllowed<sup>8+</sup> ## call.isNewCallAllowed<sup>8+</sup>
isNewCallAllowed\(\): Promise<boolean\> isNewCallAllowed\(\): Promise\<boolean\>
Checks whether a new call is allowed. This API uses a promise to return the result. Checks whether a new call is allowed. This API uses a promise to return the result.
...@@ -2747,8 +2779,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2747,8 +2779,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -2766,7 +2797,7 @@ promise.then(data => { ...@@ -2766,7 +2797,7 @@ promise.then(data => {
## call.separateConference<sup>8+</sup> ## call.separateConference<sup>8+</sup>
separateConference\(callId: number, callback: AsyncCallback<void\>\): void separateConference\(callId: number, callback: AsyncCallback\<void\>\): void
Separates calls from a conference call. This API uses an asynchronous callback to return the result. Separates calls from a conference call. This API uses an asynchronous callback to return the result.
...@@ -2787,6 +2818,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2787,6 +2818,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2804,7 +2836,7 @@ call.separateConference(1, (err) => { ...@@ -2804,7 +2836,7 @@ call.separateConference(1, (err) => {
## call.separateConference<sup>8+</sup> ## call.separateConference<sup>8+</sup>
separateConference\(callId: number\): Promise<void\> separateConference\(callId: number\): Promise\<void\>
Separates calls from a conference call. This API uses a promise to return the result. Separates calls from a conference call. This API uses a promise to return the result.
...@@ -2830,6 +2862,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2830,6 +2862,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2848,7 +2881,7 @@ call.separateConference(1).then(() => { ...@@ -2848,7 +2881,7 @@ call.separateConference(1).then(() => {
## call.getCallRestrictionStatus<sup>8+</sup> ## call.getCallRestrictionStatus<sup>8+</sup>
getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback<RestrictionStatus\>\): void getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback\<RestrictionStatus\>\): void
Obtains the call restriction status. This API uses an asynchronous callback to return the result. Obtains the call restriction status. This API uses an asynchronous callback to return the result.
...@@ -2873,11 +2906,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2873,11 +2906,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2890,7 +2923,7 @@ call.getCallRestrictionStatus(0, 1, (err, data) => { ...@@ -2890,7 +2923,7 @@ call.getCallRestrictionStatus(0, 1, (err, data) => {
## call.getCallRestrictionStatus<sup>8+</sup> ## call.getCallRestrictionStatus<sup>8+</sup>
getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise<RestrictionStatus\> getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise\<RestrictionStatus\>
Obtains the call restriction status. This API uses a promise to return the result. Obtains the call restriction status. This API uses a promise to return the result.
...@@ -2920,11 +2953,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2920,11 +2953,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2939,7 +2972,7 @@ promise.then(data => { ...@@ -2939,7 +2972,7 @@ promise.then(data => {
## call.setCallRestriction<sup>8+</sup> ## call.setCallRestriction<sup>8+</sup>
setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback<void\>\): void setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\<void\>\): void
Sets the call restriction status. This API uses an asynchronous callback to return the result. Sets the call restriction status. This API uses an asynchronous callback to return the result.
...@@ -2964,11 +2997,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2964,11 +2997,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2986,7 +3019,7 @@ call.setCallRestriction(0, callRestrictionInfo, (err) => { ...@@ -2986,7 +3019,7 @@ call.setCallRestriction(0, callRestrictionInfo, (err) => {
## call.setCallRestriction<sup>8+</sup> ## call.setCallRestriction<sup>8+</sup>
setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise<void\> setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise\<void\>
Sets the call restriction status. This API uses a promise to return the result. Sets the call restriction status. This API uses a promise to return the result.
...@@ -3016,11 +3049,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3016,11 +3049,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -3039,7 +3072,7 @@ call.setCallRestriction(0, callRestrictionInfo).then(() => { ...@@ -3039,7 +3072,7 @@ call.setCallRestriction(0, callRestrictionInfo).then(() => {
## call.getCallTransferInfo<sup>8+</sup> ## call.getCallTransferInfo<sup>8+</sup>
getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback<CallTransferResult\>\): void getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback\<CallTransferResult\>\): void
Obtains call transfer information. This API uses an asynchronous callback to return the result. Obtains call transfer information. This API uses an asynchronous callback to return the result.
...@@ -3064,11 +3097,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3064,11 +3097,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -3081,7 +3114,7 @@ call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY, (err, data ...@@ -3081,7 +3114,7 @@ call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY, (err, data
## call.getCallTransferInfo<sup>8+</sup> ## call.getCallTransferInfo<sup>8+</sup>
getCallTransferInfo\(slotId: number, type: CallTransferType): Promise<CallTransferResult\> getCallTransferInfo\(slotId: number, type: CallTransferType\): Promise\<CallTransferResult\>
Obtains call transfer information. This API uses a promise to return the result. Obtains call transfer information. This API uses a promise to return the result.
...@@ -3111,11 +3144,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3111,11 +3144,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -3130,7 +3163,7 @@ promise.then(data => { ...@@ -3130,7 +3163,7 @@ promise.then(data => {
## call.setCallTransfer<sup>8+</sup> ## call.setCallTransfer<sup>8+</sup>
setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback<void\>\): void setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback\<void\>\): void
Sets call transfer information. This API uses an asynchronous callback to return the result. Sets call transfer information. This API uses an asynchronous callback to return the result.
...@@ -3155,11 +3188,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3155,11 +3188,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -3177,7 +3210,7 @@ call.setCallTransfer(0, callTransferInfo, (err) => { ...@@ -3177,7 +3210,7 @@ call.setCallTransfer(0, callTransferInfo, (err) => {
## call.setCallTransfer<sup>8+</sup> ## call.setCallTransfer<sup>8+</sup>
setCallTransfer\(slotId: number, info: CallTransferInfo): Promise<void\> setCallTransfer\(slotId: number, info: CallTransferInfo\): Promise\<void\>
Sets call transfer information. This API uses a promise to return the result. Sets call transfer information. This API uses a promise to return the result.
...@@ -3207,11 +3240,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3207,11 +3240,11 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -3230,7 +3263,7 @@ call.setCallTransfer(0, callTransferInfo).then(() => { ...@@ -3230,7 +3263,7 @@ call.setCallTransfer(0, callTransferInfo).then(() => {
## call.isRinging<sup>8+</sup> ## call.isRinging<sup>8+</sup>
isRinging\(callback: AsyncCallback<boolean\>\): void isRinging\(callback: AsyncCallback\<boolean\>\): void
Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result. Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result.
...@@ -3253,6 +3286,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3253,6 +3286,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3270,7 +3304,7 @@ call.isRinging((err, data) => { ...@@ -3270,7 +3304,7 @@ call.isRinging((err, data) => {
## call.isRinging<sup>8+</sup> ## call.isRinging<sup>8+</sup>
isRinging\(\): Promise<boolean\> isRinging\(\): Promise\<boolean\>
Checks whether the ringtone is playing. This API uses a promise to return the result. Checks whether the ringtone is playing. This API uses a promise to return the result.
...@@ -3293,8 +3327,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3293,8 +3327,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -3312,7 +3345,7 @@ promise.then(data => { ...@@ -3312,7 +3345,7 @@ promise.then(data => {
## call.setMuted<sup>8+</sup> ## call.setMuted<sup>8+</sup>
setMuted\(callback: AsyncCallback<void\>\): void setMuted\(callback: AsyncCallback\<void\>\): void
Sets call muting. This API uses an asynchronous callback to return the result. Sets call muting. This API uses an asynchronous callback to return the result.
...@@ -3332,6 +3365,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3332,6 +3365,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3349,7 +3383,7 @@ call.setMuted((err) => { ...@@ -3349,7 +3383,7 @@ call.setMuted((err) => {
## call.setMuted<sup>8+</sup> ## call.setMuted<sup>8+</sup>
setMuted\(\): Promise<void\> setMuted\(\): Promise\<void\>
Sets call muting. This API uses a promise to return the result. Sets call muting. This API uses a promise to return the result.
...@@ -3369,8 +3403,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3369,8 +3403,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -3387,7 +3420,7 @@ call.setMuted().then(() => { ...@@ -3387,7 +3420,7 @@ call.setMuted().then(() => {
## call.cancelMuted<sup>8+</sup> ## call.cancelMuted<sup>8+</sup>
cancelMuted(callback: AsyncCallback<void\>): void cancelMuted\(callback: AsyncCallback\<void\>\): void
Cancels call muting. This API uses an asynchronous callback to return the result. Cancels call muting. This API uses an asynchronous callback to return the result.
...@@ -3407,6 +3440,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3407,6 +3440,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3424,7 +3458,7 @@ call.cancelMuted((err) => { ...@@ -3424,7 +3458,7 @@ call.cancelMuted((err) => {
## call.cancelMuted<sup>8+</sup> ## call.cancelMuted<sup>8+</sup>
cancelMuted(): Promise<void\> cancelMuted\(\): Promise\<void\>
Cancels call muting. This API uses a promise to return the result. Cancels call muting. This API uses a promise to return the result.
...@@ -3444,8 +3478,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3444,8 +3478,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -3462,7 +3495,7 @@ call.cancelMuted().then(() => { ...@@ -3462,7 +3495,7 @@ call.cancelMuted().then(() => {
## call.setAudioDevice<sup>8+</sup> ## call.setAudioDevice<sup>8+</sup>
setAudioDevice\(device: AudioDevice, callback: AsyncCallback<void\>\): void setAudioDevice\(device: AudioDevice, callback: AsyncCallback\<void\>\): void
Sets the audio device for a call. This API uses an asynchronous callback to return the result. Sets the audio device for a call. This API uses an asynchronous callback to return the result.
...@@ -3483,6 +3516,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3483,6 +3516,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3500,9 +3534,9 @@ call.setAudioDevice(1, (err) => { ...@@ -3500,9 +3534,9 @@ call.setAudioDevice(1, (err) => {
## call.setAudioDevice<sup>9+</sup> ## call.setAudioDevice<sup>9+</sup>
setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback<void\>\): void setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\<void\>\): void
Sets the audio device for a call based on the specified options. This API uses an asynchronous callback to return the result. Sets the audio device for a call. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -3522,6 +3556,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3522,6 +3556,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3542,7 +3577,7 @@ call.setAudioDevice(1, audioDeviceOptions, (err) => { ...@@ -3542,7 +3577,7 @@ call.setAudioDevice(1, audioDeviceOptions, (err) => {
## call.setAudioDevice<sup>9+</sup> ## call.setAudioDevice<sup>9+</sup>
setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise<void\> setAudioDevice\(device: AudioDevice, options?: AudioDeviceOptions\): Promise\<void\>
Sets the audio device for a call based on the specified options. This API uses a promise to return the result. Sets the audio device for a call based on the specified options. This API uses a promise to return the result.
...@@ -3569,6 +3604,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3569,6 +3604,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3590,7 +3626,7 @@ call.setAudioDevice(1, audioDeviceOptions).then(() => { ...@@ -3590,7 +3626,7 @@ call.setAudioDevice(1, audioDeviceOptions).then(() => {
## call.joinConference<sup>8+</sup> ## call.joinConference<sup>8+</sup>
joinConference(mainCallId: number, callNumberList: Array<string\>, callback: AsyncCallback<void\>): void joinConference\(mainCallId: number, callNumberList: Array\<string\>, callback: AsyncCallback\<void\>\): void
Joins a conference call. This API uses an asynchronous callback to return the result. Joins a conference call. This API uses an asynchronous callback to return the result.
...@@ -3612,6 +3648,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3612,6 +3648,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3631,7 +3668,7 @@ call.joinConference(1, callNumberList, (err) => { ...@@ -3631,7 +3668,7 @@ call.joinConference(1, callNumberList, (err) => {
## call.joinConference<sup>8+</sup> ## call.joinConference<sup>8+</sup>
joinConference(mainCallId: number, callNumberList: Array<string\>): Promise<void\> joinConference\(mainCallId: number, callNumberList: Array\<string\>\): Promise\<void\>
Joins a conference call. This API uses a promise to return the result. Joins a conference call. This API uses a promise to return the result.
...@@ -3658,6 +3695,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3658,6 +3695,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3679,7 +3717,7 @@ call.joinConference(1, callNumberList).then(() => { ...@@ -3679,7 +3717,7 @@ call.joinConference(1, callNumberList).then(() => {
## call.updateImsCallMode<sup>8+</sup> ## call.updateImsCallMode<sup>8+</sup>
updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback<void\>): void updateImsCallMode\(callId: number, mode: ImsCallMode, callback: AsyncCallback\<void\>\): void
Updates the IMS call mode. This API uses an asynchronous callback to return the result. Updates the IMS call mode. This API uses an asynchronous callback to return the result.
...@@ -3701,6 +3739,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3701,6 +3739,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3717,7 +3756,7 @@ call.updateImsCallMode(1, 1, (err) => { ...@@ -3717,7 +3756,7 @@ call.updateImsCallMode(1, 1, (err) => {
## call.updateImsCallMode<sup>8+</sup> ## call.updateImsCallMode<sup>8+</sup>
updateImsCallMode(callId: number, mode: ImsCallMode): Promise<void\> updateImsCallMode\(callId: number, mode: ImsCallMode\): Promise\<void\>
Updates the IMS call mode. This API uses a promise to return the result. Updates the IMS call mode. This API uses a promise to return the result.
...@@ -3744,6 +3783,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3744,6 +3783,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3762,7 +3802,7 @@ call.updateImsCallMode(1, 1).then(() => { ...@@ -3762,7 +3802,7 @@ call.updateImsCallMode(1, 1).then(() => {
## call.enableImsSwitch<sup>8+</sup> ## call.enableImsSwitch<sup>8+</sup>
enableImsSwitch(slotId: number, callback: AsyncCallback<void\>): void enableImsSwitch\(slotId: number, callback: AsyncCallback\<void\>\): void
Enables the IMS switch. This API uses an asynchronous callback to return the result. Enables the IMS switch. This API uses an asynchronous callback to return the result.
...@@ -3786,6 +3826,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3786,6 +3826,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3802,7 +3843,7 @@ call.enableImsSwitch(0, (err) => { ...@@ -3802,7 +3843,7 @@ call.enableImsSwitch(0, (err) => {
## call.enableImsSwitch<sup>8+</sup> ## call.enableImsSwitch<sup>8+</sup>
enableImsSwitch(slotId: number): Promise<void\> enableImsSwitch\(slotId: number\): Promise\<void\>
Enables the IMS switch. This API uses a promise to return the result. Enables the IMS switch. This API uses a promise to return the result.
...@@ -3831,6 +3872,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3831,6 +3872,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3849,7 +3891,7 @@ call.enableImsSwitch(0).then(() => { ...@@ -3849,7 +3891,7 @@ call.enableImsSwitch(0).then(() => {
## call.disableImsSwitch<sup>8+</sup> ## call.disableImsSwitch<sup>8+</sup>
disableImsSwitch(slotId: number, callback: AsyncCallback<void\>): void disableImsSwitch\(slotId: number, callback: AsyncCallback\<void\>\): void
Disables the IMS switch. This API uses an asynchronous callback to return the result. Disables the IMS switch. This API uses an asynchronous callback to return the result.
...@@ -3873,6 +3915,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3873,6 +3915,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3889,7 +3932,7 @@ call.disableImsSwitch(0, (err) => { ...@@ -3889,7 +3932,7 @@ call.disableImsSwitch(0, (err) => {
## call.disableImsSwitch<sup>8+</sup> ## call.disableImsSwitch<sup>8+</sup>
disableImsSwitch(slotId: number): Promise<void\> disableImsSwitch\(slotId: number\): Promise\<void\>
Disables the IMS switch. This API uses a promise to return the result. Disables the IMS switch. This API uses a promise to return the result.
...@@ -3918,6 +3961,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3918,6 +3961,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3936,7 +3980,7 @@ call.disableImsSwitch(0).then(() => { ...@@ -3936,7 +3980,7 @@ call.disableImsSwitch(0).then(() => {
## call.isImsSwitchEnabled<sup>8+</sup> ## call.isImsSwitchEnabled<sup>8+</sup>
isImsSwitchEnabled(slotId: number, callback: AsyncCallback<boolean\>): void isImsSwitchEnabled\(slotId: number, callback: AsyncCallback\<boolean\>\): void
Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result. Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result.
...@@ -3957,6 +4001,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3957,6 +4001,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3973,7 +4018,7 @@ call.isImsSwitchEnabled(0, (err, data) => { ...@@ -3973,7 +4018,7 @@ call.isImsSwitchEnabled(0, (err, data) => {
## call.isImsSwitchEnabled<sup>8+</sup> ## call.isImsSwitchEnabled<sup>8+</sup>
isImsSwitchEnabled(slotId: number): Promise<boolean\> isImsSwitchEnabled\(slotId: number\): Promise\<boolean\>
Checks whether the IMS switch is enabled. This API uses a promise to return the result. Checks whether the IMS switch is enabled. This API uses a promise to return the result.
...@@ -3999,6 +4044,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3999,6 +4044,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -4024,11 +4070,11 @@ Provides an option for determining whether a call is a video call. ...@@ -4024,11 +4070,11 @@ Provides an option for determining whether a call is a video call.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- | | ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- |
| extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call| | extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call |
| accountId <sup>8+</sup> | number | No | Account ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br>This is a system API. | | accountId <sup>8+</sup> | number | No | Account ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br> |
| videoState <sup>8+</sup> | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | | videoState <sup>8+</sup> | [VideoStateType](#videostatetype7) | No | Video state type. |
| dialScene <sup>8+</sup> | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | | dialScene <sup>8+</sup> | [DialScene](#dialscene8) | No | Dialup scenario. |
| dialType <sup>8+</sup> | [DialType](#dialtype8) | No | Dialup type. This is a system API. | | dialType <sup>8+</sup> | [DialType](#dialtype8) | No | Dialup type. |
## DialCallOptions<sup>9+</sup> ## DialCallOptions<sup>9+</sup>
...@@ -4409,7 +4455,7 @@ Enumerates call transfer states. ...@@ -4409,7 +4455,7 @@ Enumerates call transfer states.
## DisconnectedDetails<sup>9+</sup> ## DisconnectedDetails<sup>9+</sup>
Defines the cause of a call disconnection. Defines the call disconnection cause.
**System API**: This is a system API. **System API**: This is a system API.
...@@ -4417,12 +4463,12 @@ Defines the cause of a call disconnection. ...@@ -4417,12 +4463,12 @@ Defines the cause of a call disconnection.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------------------------------------------ | ---- | --------------- | | ------- | ------------------------------------------ | ---- | --------------- |
| reason | [DisconnectedReason](#disconnectedreason8) | Yes | Cause of the call disconnection. | | reason | [DisconnectedReason](#disconnectedreason8) | Yes | Call disconnection cause. |
| message | string | Yes | Message indicating the call disconnection.| | message | string | Yes | Call ending message.|
## DisconnectedReason<sup>8+</sup> ## DisconnectedReason<sup>8+</sup>
Enumerates causes of call disconnection. Enumerates call disconnection causes.
**System API**: This is a system API. **System API**: This is a system API.
......
...@@ -17,6 +17,8 @@ import charger from '@ohos.charger'; ...@@ -17,6 +17,8 @@ import charger from '@ohos.charger';
Enumerates charging types. Enumerates charging types.
**System API**: This is a system API.
**System capability**: SystemCapability.PowerManager.BatteryManager.Core **System capability**: SystemCapability.PowerManager.BatteryManager.Core
| Name | Value | Description | | Name | Value | Description |
......
# @ohos.multimodalInput.inputDeviceCooperate (Screen Hopping) # @ohos.multimodalInput.inputDeviceCooperate (Screen Hopping)
The **inputDeviceCooperate** module enables two or more networked devices to share the keyboard and mouse for collaborative operations. The **inputDeviceCooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
> **NOTE** > **NOTE**
> >
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs. > - The APIs provided by this module are system APIs.
## Modules to Import ## Modules to Import
```js ```js
...@@ -66,7 +66,7 @@ Specifies whether to enable screen hopping. This API uses a promise to return th ...@@ -66,7 +66,7 @@ Specifies whether to enable screen hopping. This API uses a promise to return th
**Return value** **Return value**
| Name | Description | | Parameters | Description |
| ------------------- | ------------------------------- | | ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. | | Promise&lt;void&gt; | Promise used to return the result. |
...@@ -287,7 +287,7 @@ Checks whether screen hopping is enabled. This API uses a promise to return the ...@@ -287,7 +287,7 @@ Checks whether screen hopping is enabled. This API uses a promise to return the
**Return value** **Return value**
| Name | Description | | Parameters | Description |
| ------------------- | ------------------------------- | | ------------------- | ------------------------------- |
| Promise<{ state: boolean }>| Promise used to return the result. | | Promise<{ state: boolean }>| Promise used to return the result. |
...@@ -296,6 +296,7 @@ Checks whether screen hopping is enabled. This API uses a promise to return the ...@@ -296,6 +296,7 @@ Checks whether screen hopping is enabled. This API uses a promise to return the
**Example** **Example**
```js ```js
let deviceDescriptor = "descriptor";
try { try {
inputDeviceCooperate.getState(deviceDescriptor).then((data) => { inputDeviceCooperate.getState(deviceDescriptor).then((data) => {
console.log(`Get the status success, data: ${JSON.stringify(data)}`); console.log(`Get the status success, data: ${JSON.stringify(data)}`);
...@@ -311,7 +312,7 @@ try { ...@@ -311,7 +312,7 @@ try {
on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, eventMsg: EventMsg }>): void on(type: 'cooperation', callback: AsyncCallback<{ deviceDescriptor: string, eventMsg: EventMsg }>): void
Enables listening for screen hopping events. Enables listening for screen hopping status change events.
**System capability**: SystemCapability.MultimodalInput.Input.Cooperator **System capability**: SystemCapability.MultimodalInput.Input.Cooperator
...@@ -340,7 +341,7 @@ try { ...@@ -340,7 +341,7 @@ try {
off(type: 'cooperation', callback?: AsyncCallback\<void>): void off(type: 'cooperation', callback?: AsyncCallback\<void>): void
Disables listening for screen hopping events. Disables listening for screen hopping status change events.
**System capability**: SystemCapability.MultimodalInput.Input.Cooperator **System capability**: SystemCapability.MultimodalInput.Input.Cooperator
......
# @ohos.cooperate (Screen Hopping)
The **cooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs.
## Modules to Import
```js
import cooperate from '@ohos.cooperate'
```
## cooperate.prepare
prepare(callback: AsyncCallback&lt;void&gt;): void;
Prepares for screen hopping. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | --------------------------- |
| callback | AsyncCallback&lt;void&gt; | Yes|Callback used to return the result. |
**Example**
```js
try {
cooperate.prepare((error) => {
if (error) {
console.log(`Keyboard mouse crossing prepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Keyboard mouse crossing prepare success.`);
});
} catch (error) {
console.log(`Keyboard mouse crossing prepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.prepare
prepare(): Promise&lt;void&gt;
Prepares for screen hopping. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Return value**
| Parameters | Description |
| ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
**Example**
```js
try {
cooperate.prepare().then(() => {
console.log(`Keyboard mouse crossing prepare success.`);
}, (error) => {
console.log(`Keyboard mouse crossing prepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Keyboard mouse crossing prepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.unprepare
unprepare(callback: AsyncCallback&lt;void&gt;): void;
Cancels the preparation for screen hopping. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Example**
```js
try {
cooperate.unprepare((error) => {
if (error) {
console.log(`Keyboard mouse crossing unprepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Keyboard mouse crossing unprepare success.`);
});
} catch (error) {
console.log(`Keyboard mouse crossing unprepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.unprepare
unprepare(): Promise&lt;void&gt;;
Cancels the preparation for screen hopping. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Return value**
| Parameters | Description |
| ------------------- | --------------------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.|
```js
try {
cooperate.unprepare().then(() => {
console.log(`Keyboard mouse crossing unprepare success.`);
}, (error) => {
console.log(`Keyboard mouse crossing unprepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Keyboard mouse crossing unprepare failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.activate
activate(targetNetworkId: string, inputDeviceId: number, callback: AsyncCallback&lt;void&gt;): void;
Starts screen hopping. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| targetNetworkId | string | Yes | Descriptor of the target device for screen hopping. |
| inputDeviceId | number | Yes | Identifier of the input device for screen hopping.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Screen Hopping Error Codes](../errorcodes/errorcode-devicestatus.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 20900001 | This error code is reported if the screen hopping status is abnormal when the screen hopping API is called. |
**Example**
```js
let targetNetworkId = "networkId";
let inputDeviceId = 0;
try {
cooperate.activate(targetNetworkId, inputDeviceId, (error) => {
if (error) {
console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Start Keyboard mouse crossing success.`);
});
} catch (error) {
console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.activate
activate(targetNetworkId: string, inputDeviceId: number): Promise&lt;void&gt;;
Starts screen hopping. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| targetNetworkId | string | Yes | Descriptor of the target device for screen hopping. |
| inputDeviceId | number | Yes | Identifier of the input device for screen hopping.|
**Return value**
| Name | Description |
| ---------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. |
**Error codes**
For details about the error codes, see [Screen Hopping Error Codes](../errorcodes/errorcode-devicestatus.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 20900001 | This error code is reported if the screen hopping status is abnormal when the screen hopping API is called. |
**Example**
```js
let targetNetworkId = "networkId";
let inputDeviceId = 0;
try {
cooperate.activate(targetNetworkId, inputDeviceId).then(() => {
console.log(`Start Keyboard mouse crossing success.`);
}, (error) => {
console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Start Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.deactivate
deactivate(isUnchained: boolean, callback: AsyncCallback&lt;void&gt;): void;
Stops screen hopping. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| isUnchained | boolean | Yes| Whether to disable the cross-device link.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Example**
```js
try {
cooperate.deactivate(false, (error) => {
if (error) {
console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Stop Keyboard mouse crossing success.`);
});
} catch (error) {
console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.deactivate
deactivate(isUnchained: boolean): Promise&lt;void&gt;;
Stops screen hopping. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory| Description |
| ----------- | ------- | ---- | ------------------ |
| isUnchained | boolean | Yes | Whether to disable the cross-device link.|
**Return value**
| Name | Description |
| -------- | ---------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. |
**Example**
```js
try {
cooperate.deactivate(false).then(() => {
console.log(`Stop Keyboard mouse crossing success.`);
}, (error) => {
console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Stop Keyboard mouse crossing failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.getCrossingSwitchState
getCrossingSwitchState(networkId: string, callback: AsyncCallback&lt;boolean&gt;): void;
Obtains the screen hopping status of the target device. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------- | ---- | ---------------------------- |
| networkId | string | Yes | Descriptor of the target device for screen hopping. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.|
**Example**
```js
let deviceDescriptor = "networkId";
try {
cooperate.getCrossingSwitchState(deviceDescriptor, (error, data) => {
if (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
return;
}
console.log(`Get the status success, data: ${JSON.stringify(data)}`);
});
} catch (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## cooperate.getCrossingSwitchState
getCrossingSwitchState(networkId: string): Promise&lt;boolean&gt;;
Obtains the screen hopping status of the target device. This API uses a promise to return the result.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------- | ---- | ---------------------------- |
| networkId | string | Yes | Descriptor of the target device for screen hopping. |
**Return value**
| Parameters | Description |
| ------------------- | ------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.|
**Example**
```js
let deviceDescriptor = "networkId";
try {
cooperate.getCrossingSwitchState(deviceDescriptor).then((data) => {
console.log(`Get the status success, data: ${JSON.stringify(data)}`);
}, (error) => {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
});
} catch (error) {
console.log(`Get the status failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## on('cooperate')
on(type: 'cooperate', callback: Callback&lt;{ networkId: string, msg: CooperateMsg }&gt;): void;
Enables listening for screen hopping status change events.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| type | string | Yes | Event type. The value is **cooperate**.|
| callback | Callback&lt;{ networkId: string, msg: [CooperateMsg](#cooperatemsg) }&gt; | Yes | Callback used to return the result.|
**Example**
```js
try {
cooperate.on('cooperate', (data) => {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(data)}`);
});
} catch (error) {
console.log(`Register failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## off('cooperate')
off(type: 'cooperate', callback?: Callback&lt;void&gt;): void;
Disables listening for screen hopping status change events.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------------- | ---- | ---------------------------- |
| type | string | Yes | Event type. The value is **cooperate**.|
| callback | AsyncCallback&lt;void&gt; | No | Callback to be unregistered. If this parameter is not specified, all callbacks registered by the current application will be unregistered.|
**Example**
```js
// Unregister a single callback.
function callback(event) {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(event)}`);
return false;
}
try {
cooperate.on('cooperate', callback);
cooperate.off("cooperate", callback);
} catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
```js
// Unregister all callbacks.
function callback(event) {
console.log(`Keyboard mouse crossing event: ${JSON.stringify(event)}`);
return false;
}
try {
cooperate.on('cooperate', callback);
cooperate.off("cooperate");
} catch (error) {
console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`);
}
```
## CooperateMsg
Represents a screen hopping message notification.
**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate
| Name | Value | Description |
| -------- | ----------------- | ----------------- |
| COOPERATE_PREPARE | 0 | The preparation for screen hopping is finished. |
| COOPERATE_UNPREPARE | 1 | The preparation for screen hopping is cancelled. |
| COOPERATE_ACTIVATE | 2 | Screen hopping starts. |
| COOPERATE_ACTIVATE_SUCCESS | 3 | Starting screen hopping succeeds.|
| COOPERATE_ACTIVATE_FAIL | 4 | Starting screen hopping fails.|
| COOPERATE_DEACTIVATE_SUCCESS | 5 | Stopping screen hopping succeeds.|
| COOPERATE_DEACTIVATE_FAIL | 6 | Stopping screen hopping fails.|
...@@ -45,7 +45,8 @@ httpRequest.request( ...@@ -45,7 +45,8 @@ httpRequest.request(
connectTimeout: 60000 // Optional. The default value is 60000, in ms. connectTimeout: 60000 // Optional. The default value is 60000, in ms.
readTimeout: 60000, // Optional. The default value is 60000, in ms. readTimeout: 60000, // Optional. The default value is 60000, in ms.
usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system. usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system.
usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API 10. usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API version 10.
caPath: "", // Optional. The preset CA certificate is used by default. This field is supported since API version 10.
}, (err, data) => { }, (err, data) => {
if (!err) { if (!err) {
// data.result carries the HTTP response. Parse the response based on service requirements. // data.result carries the HTTP response. Parse the response based on service requirements.
...@@ -68,7 +69,7 @@ httpRequest.request( ...@@ -68,7 +69,7 @@ httpRequest.request(
> **NOTE** > **NOTE**
> If the data in **console.info()** contains a newline character, the data will be truncated. > If the data in **console.info()** contains a newline character, the data will be truncated.
## http.createHttp ## http.createHttp<sup>6+</sup>
createHttp(): HttpRequest createHttp(): HttpRequest
...@@ -94,7 +95,7 @@ let httpRequest = http.createHttp(); ...@@ -94,7 +95,7 @@ let httpRequest = http.createHttp();
Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object. Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object.
### request ### request<sup>6+</sup>
request(url: string, callback: AsyncCallback\<HttpResponse\>):void request(url: string, callback: AsyncCallback\<HttpResponse\>):void
...@@ -116,14 +117,38 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback ...@@ -116,14 +117,38 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
**Error codes** **Error codes**
| Code | Error Message | | ID | Error Message |
|---------|-------------------------------------------------------| |---------|-------------------------------------------------------|
| 401 | Parameter error. | | 401 | Parameter error. |
| 201 | Permission denied. | | 201 | Permission denied. |
| 2300001 | Unsupported protocol. |
| 2300003 | URL using bad/illegal format or missing URL. | | 2300003 | URL using bad/illegal format or missing URL. |
| 2300005 | Couldn't resolve proxy name. |
| 2300006 | Couldn't resolve host name. |
| 2300007 | Couldn't connect to server. | | 2300007 | Couldn't connect to server. |
| 2300008 | Weird server reply. |
| 2300009 | Access denied to remote resource. |
| 2300016 | Error in the HTTP2 framing layer. |
| 2300018 | Transferred a partial file. |
| 2300023 | Failed writing received data to disk/application. |
| 2300025 | Upload failed. |
| 2300026 | Failed to open/read local data from file/application. |
| 2300027 | Out of memory. |
| 2300028 | Timeout was reached. | | 2300028 | Timeout was reached. |
| 2300047 | Number of redirects hit maximum amount. |
| 2300052 | Server returned nothing (no headers, no data). | | 2300052 | Server returned nothing (no headers, no data). |
| 2300055 | Failed sending data to the peer. |
| 2300056 | Failure when receiving data from the peer. |
| 2300058 | Problem with the local SSL certificate. |
| 2300059 | Couldn't use specified SSL cipher. |
| 2300060 | SSL peer certificate or SSH remote key was not OK. |
| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.|
| 2300063 | Maximum file size exceeded. |
| 2300070 | Disk full or allocation exceeded. |
| 2300073 | Remote file already exists. |
| 2300077 | Problem with the SSL CA cert (path? access rights?). |
| 2300078 | Remote file not found. |
| 2300094 | An authentication function returned an error. |
| 2300999 | Unknown Other Error. | | 2300999 | Unknown Other Error. |
> **NOTE** > **NOTE**
...@@ -145,7 +170,7 @@ httpRequest.request("EXAMPLE_URL", (err, data) => { ...@@ -145,7 +170,7 @@ httpRequest.request("EXAMPLE_URL", (err, data) => {
}); });
``` ```
### request ### request<sup>6+</sup>
request(url: string, options: HttpRequestOptions, callback: AsyncCallback\<HttpResponse\>):void request(url: string, options: HttpRequestOptions, callback: AsyncCallback\<HttpResponse\>):void
...@@ -168,7 +193,7 @@ Initiates an HTTP request containing specified options to a given URL. This API ...@@ -168,7 +193,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes** **Error codes**
| Code | Error Message | | ID | Error Message |
|---------|-------------------------------------------------------| |---------|-------------------------------------------------------|
| 401 | Parameter error. | | 401 | Parameter error. |
| 201 | Permission denied. | | 201 | Permission denied. |
...@@ -231,7 +256,7 @@ httpRequest.request("EXAMPLE_URL", ...@@ -231,7 +256,7 @@ httpRequest.request("EXAMPLE_URL",
}); });
``` ```
### request ### request<sup>6+</sup>
request(url: string, options? : HttpRequestOptions): Promise\<HttpResponse\> request(url: string, options? : HttpRequestOptions): Promise\<HttpResponse\>
...@@ -259,7 +284,7 @@ Initiates an HTTP request containing specified options to a given URL. This API ...@@ -259,7 +284,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes** **Error codes**
| Code | Error Message | | ID | Error Message |
|---------|-------------------------------------------------------| |---------|-------------------------------------------------------|
| 401 | Parameter error. | | 401 | Parameter error. |
| 201 | Permission denied. | | 201 | Permission denied. |
...@@ -353,14 +378,38 @@ Initiates an HTTP request containing specified options to a given URL. This API ...@@ -353,14 +378,38 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes** **Error codes**
| Code | Error Message | | ID | Error Message |
|---------|-------------------------------------------------------| |---------|-------------------------------------------------------|
| 401 | Parameter error. | | 401 | Parameter error. |
| 201 | Permission denied. | | 201 | Permission denied. |
| 2300001 | Unsupported protocol. |
| 2300003 | URL using bad/illegal format or missing URL. | | 2300003 | URL using bad/illegal format or missing URL. |
| 2300005 | Couldn't resolve proxy name. |
| 2300006 | Couldn't resolve host name. |
| 2300007 | Couldn't connect to server. | | 2300007 | Couldn't connect to server. |
| 2300008 | Weird server reply. |
| 2300009 | Access denied to remote resource. |
| 2300016 | Error in the HTTP2 framing layer. |
| 2300018 | Transferred a partial file. |
| 2300023 | Failed writing received data to disk/application. |
| 2300025 | Upload failed. |
| 2300026 | Failed to open/read local data from file/application. |
| 2300027 | Out of memory. |
| 2300028 | Timeout was reached. | | 2300028 | Timeout was reached. |
| 2300047 | Number of redirects hit maximum amount. |
| 2300052 | Server returned nothing (no headers, no data). | | 2300052 | Server returned nothing (no headers, no data). |
| 2300055 | Failed sending data to the peer. |
| 2300056 | Failure when receiving data from the peer. |
| 2300058 | Problem with the local SSL certificate. |
| 2300059 | Couldn't use specified SSL cipher. |
| 2300060 | SSL peer certificate or SSH remote key was not OK. |
| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.|
| 2300063 | Maximum file size exceeded. |
| 2300070 | Disk full or allocation exceeded. |
| 2300073 | Remote file already exists. |
| 2300077 | Problem with the SSL CA cert (path? access rights?). |
| 2300078 | Remote file not found. |
| 2300094 | An authentication function returned an error. |
| 2300999 | Unknown Other Error. | | 2300999 | Unknown Other Error. |
> **NOTE** > **NOTE**
...@@ -383,7 +432,7 @@ httpRequest.request2("EXAMPLE_URL", (err, data) => { ...@@ -383,7 +432,7 @@ httpRequest.request2("EXAMPLE_URL", (err, data) => {
request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\<number\>): void request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\<number\>): void
Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response. Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
**Required permissions**: ohos.permission.INTERNET **Required permissions**: ohos.permission.INTERNET
...@@ -399,7 +448,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback ...@@ -399,7 +448,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
**Error codes** **Error codes**
| Code | Error Message | | ID | Error Message |
|---------|-------------------------------------------------------| |---------|-------------------------------------------------------|
| 401 | Parameter error. | | 401 | Parameter error. |
| 201 | Permission denied. | | 201 | Permission denied. |
...@@ -482,7 +531,7 @@ Initiates an HTTP request containing specified options to a given URL. This API ...@@ -482,7 +531,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes** **Error codes**
| Code | Error Message | | ID | Error Message |
|---------|-------------------------------------------------------| |---------|-------------------------------------------------------|
| 401 | Parameter error. | | 401 | Parameter error. |
| 201 | Permission denied. | | 201 | Permission denied. |
...@@ -757,7 +806,7 @@ httpRequest.off('dataEnd'); ...@@ -757,7 +806,7 @@ httpRequest.off('dataEnd');
### on('dataProgress')<sup>10+</sup> ### on('dataProgress')<sup>10+</sup>
on(type: 'dataProgress', callback: AsyncCallback\<{ receiveSize: number, totalSize: number }\>): void on(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>): void
Registers an observer for events indicating progress of receiving HTTP streaming responses. Registers an observer for events indicating progress of receiving HTTP streaming responses.
...@@ -802,7 +851,7 @@ Unregisters the observer for events indicating progress of receiving HTTP stream ...@@ -802,7 +851,7 @@ Unregisters the observer for events indicating progress of receiving HTTP stream
httpRequest.off('dataProgress'); httpRequest.off('dataProgress');
``` ```
## HttpRequestOptions ## HttpRequestOptions<sup>6+</sup>
Specifies the type and value range of the optional parameters in the HTTP request. Specifies the type and value range of the optional parameters in the HTTP request.
...@@ -819,9 +868,10 @@ Specifies the type and value range of the optional parameters in the HTTP reques ...@@ -819,9 +868,10 @@ Specifies the type and value range of the optional parameters in the HTTP reques
| readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms.<br>The value **0** indicates no timeout.| | readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms.<br>The value **0** indicates no timeout.|
| connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. | | connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. |
| usingProtocol<sup>9+</sup> | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. | | usingProtocol<sup>9+</sup> | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. |
| usingProxy<sup>10+</sup> | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.<br>- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.<br>- If **usingProxy** is of the **object** type, the specified network proxy is used. | | usingProxy<sup>10+</sup> | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.<br>- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.<br>- If **usingProxy** is of the **object** type, the specified network proxy is used.
| caPath<sup>10+</sup> | string | No | Path of the CA certificate. If this parameter is set, the system uses the CA certificate in the specified path. Otherwise, the system uses the preset CA certificate. |
## RequestMethod ## RequestMethod<sup>6+</sup>
Defines an HTTP request method. Defines an HTTP request method.
...@@ -838,7 +888,7 @@ Defines an HTTP request method. ...@@ -838,7 +888,7 @@ Defines an HTTP request method.
| TRACE | "TRACE" | TRACE method. | | TRACE | "TRACE" | TRACE method. |
| CONNECT | "CONNECT" | CONNECT method.| | CONNECT | "CONNECT" | CONNECT method.|
## ResponseCode ## ResponseCode<sup>6+</sup>
Enumerates the response codes for an HTTP request. Enumerates the response codes for an HTTP request.
...@@ -882,7 +932,7 @@ Enumerates the response codes for an HTTP request. ...@@ -882,7 +932,7 @@ Enumerates the response codes for an HTTP request.
| GATEWAY_TIMEOUT | 504 | "Gateway Timeout." The server acting as a gateway or proxy does not receive requests from the remote server within the timeout period. | | GATEWAY_TIMEOUT | 504 | "Gateway Timeout." The server acting as a gateway or proxy does not receive requests from the remote server within the timeout period. |
| VERSION | 505 | "HTTP Version Not Supported." The server does not support the HTTP protocol version used in the request. | | VERSION | 505 | "HTTP Version Not Supported." The server does not support the HTTP protocol version used in the request. |
## HttpResponse ## HttpResponse<sup>6+</sup>
Defines the response to an HTTP request. Defines the response to an HTTP request.
......
...@@ -11,7 +11,7 @@ The network connection management module provides basic network management capab ...@@ -11,7 +11,7 @@ The network connection management module provides basic network management capab
import connection from '@ohos.net.connection' import connection from '@ohos.net.connection'
``` ```
## connection.createNetConnection ## connection.createNetConnection<sup>8+</sup>
createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection
...@@ -46,7 +46,7 @@ let netConnectionCellular = connection.createNetConnection({ ...@@ -46,7 +46,7 @@ let netConnectionCellular = connection.createNetConnection({
}) })
``` ```
## connection.getDefaultNet ## connection.getDefaultNet<sup>8+</sup>
getDefaultNet(callback: AsyncCallback\<NetHandle>): void getDefaultNet(callback: AsyncCallback\<NetHandle>): void
...@@ -79,7 +79,7 @@ connection.getDefaultNet(function (error, data) { ...@@ -79,7 +79,7 @@ connection.getDefaultNet(function (error, data) {
}) })
``` ```
## connection.getDefaultNet ## connection.getDefaultNet<sup>8+</sup>
getDefaultNet(): Promise\<NetHandle> getDefaultNet(): Promise\<NetHandle>
...@@ -444,7 +444,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -444,7 +444,7 @@ connection.getDefaultNet().then(function (netHandle) {
}) })
``` ```
## connection.getAllNets ## connection.getAllNets<sup>8+</sup>
getAllNets(callback: AsyncCallback&lt;Array&lt;NetHandle&gt;&gt;): void getAllNets(callback: AsyncCallback&lt;Array&lt;NetHandle&gt;&gt;): void
...@@ -477,7 +477,7 @@ connection.getAllNets(function (error, data) { ...@@ -477,7 +477,7 @@ connection.getAllNets(function (error, data) {
}); });
``` ```
## connection.getAllNets ## connection.getAllNets<sup>8+</sup>
getAllNets(): Promise&lt;Array&lt;NetHandle&gt;&gt; getAllNets(): Promise&lt;Array&lt;NetHandle&gt;&gt;
...@@ -509,7 +509,7 @@ connection.getAllNets().then(function (data) { ...@@ -509,7 +509,7 @@ connection.getAllNets().then(function (data) {
}); });
``` ```
## connection.getConnectionProperties ## connection.getConnectionProperties<sup>8+</sup>
getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\<ConnectionProperties>): void getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\<ConnectionProperties>): void
...@@ -547,7 +547,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -547,7 +547,7 @@ connection.getDefaultNet().then(function (netHandle) {
}) })
``` ```
## connection.getConnectionProperties ## connection.getConnectionProperties<sup>8+</sup>
getConnectionProperties(netHandle: NetHandle): Promise\<ConnectionProperties> getConnectionProperties(netHandle: NetHandle): Promise\<ConnectionProperties>
...@@ -589,7 +589,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -589,7 +589,7 @@ connection.getDefaultNet().then(function (netHandle) {
}) })
``` ```
## connection.getNetCapabilities ## connection.getNetCapabilities<sup>8+</sup>
getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\<NetCapabilities>): void getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\<NetCapabilities>): void
...@@ -627,7 +627,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -627,7 +627,7 @@ connection.getDefaultNet().then(function (netHandle) {
}) })
``` ```
## connection.getNetCapabilities ## connection.getNetCapabilities<sup>8+</sup>
getNetCapabilities(netHandle: NetHandle): Promise\<NetCapabilities> getNetCapabilities(netHandle: NetHandle): Promise\<NetCapabilities>
...@@ -734,7 +734,7 @@ connection.isDefaultNetMetered().then(function (data) { ...@@ -734,7 +734,7 @@ connection.isDefaultNetMetered().then(function (data) {
}) })
``` ```
## connection.hasDefaultNet ## connection.hasDefaultNet<sup>8+</sup>
hasDefaultNet(callback: AsyncCallback\<boolean>): void hasDefaultNet(callback: AsyncCallback\<boolean>): void
...@@ -767,7 +767,7 @@ connection.hasDefaultNet(function (error, data) { ...@@ -767,7 +767,7 @@ connection.hasDefaultNet(function (error, data) {
}) })
``` ```
## connection.hasDefaultNet ## connection.hasDefaultNet<sup>8+</sup>
hasDefaultNet(): Promise\<boolean> hasDefaultNet(): Promise\<boolean>
...@@ -799,7 +799,7 @@ connection.hasDefaultNet().then(function (data) { ...@@ -799,7 +799,7 @@ connection.hasDefaultNet().then(function (data) {
}) })
``` ```
## connection.enableAirplaneMode ## connection.enableAirplaneMode<sup>8+</sup>
enableAirplaneMode(callback: AsyncCallback\<void>): void enableAirplaneMode(callback: AsyncCallback\<void>): void
...@@ -821,6 +821,7 @@ Enables the airplane mode. This API uses an asynchronous callback to return the ...@@ -821,6 +821,7 @@ Enables the airplane mode. This API uses an asynchronous callback to return the
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------- | | ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 2100002 | Operation failed. Cannot connect to service.| | 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. | | 2100003 | System internal error. |
...@@ -832,7 +833,7 @@ connection.enableAirplaneMode(function (error) { ...@@ -832,7 +833,7 @@ connection.enableAirplaneMode(function (error) {
}) })
``` ```
## connection.enableAirplaneMode ## connection.enableAirplaneMode<sup>8+</sup>
enableAirplaneMode(): Promise\<void> enableAirplaneMode(): Promise\<void>
...@@ -854,6 +855,7 @@ Enables the airplane mode. This API uses a promise to return the result. ...@@ -854,6 +855,7 @@ Enables the airplane mode. This API uses a promise to return the result.
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------- | | ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 2100002 | Operation failed. Cannot connect to service.| | 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. | | 2100003 | System internal error. |
...@@ -865,7 +867,7 @@ connection.enableAirplaneMode().then(function (error) { ...@@ -865,7 +867,7 @@ connection.enableAirplaneMode().then(function (error) {
}) })
``` ```
## connection.disableAirplaneMode ## connection.disableAirplaneMode<sup>8+</sup>
disableAirplaneMode(callback: AsyncCallback\<void>): void disableAirplaneMode(callback: AsyncCallback\<void>): void
...@@ -887,6 +889,7 @@ Disables the airplane mode. This API uses an asynchronous callback to return the ...@@ -887,6 +889,7 @@ Disables the airplane mode. This API uses an asynchronous callback to return the
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------- | | ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 2100002 | Operation failed. Cannot connect to service.| | 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. | | 2100003 | System internal error. |
...@@ -898,7 +901,7 @@ connection.disableAirplaneMode(function (error) { ...@@ -898,7 +901,7 @@ connection.disableAirplaneMode(function (error) {
}) })
``` ```
## connection.disableAirplaneMode ## connection.disableAirplaneMode<sup>8+</sup>
disableAirplaneMode(): Promise\<void> disableAirplaneMode(): Promise\<void>
...@@ -920,6 +923,7 @@ Disables the airplane mode. This API uses a promise to return the result. ...@@ -920,6 +923,7 @@ Disables the airplane mode. This API uses a promise to return the result.
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------- | | ------- | ----------------------------- |
| 202 | Non-system applications use system APIs.|
| 2100002 | Operation failed. Cannot connect to service.| | 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. | | 2100003 | System internal error. |
...@@ -931,7 +935,7 @@ connection.disableAirplaneMode().then(function (error) { ...@@ -931,7 +935,7 @@ connection.disableAirplaneMode().then(function (error) {
}) })
``` ```
## connection.reportNetConnected ## connection.reportNetConnected<sup>8+</sup>
reportNetConnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;): void reportNetConnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;): void
...@@ -968,7 +972,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -968,7 +972,7 @@ connection.getDefaultNet().then(function (netHandle) {
}); });
``` ```
## connection.reportNetConnected ## connection.reportNetConnected<sup>8+</sup>
reportNetConnected(netHandle: NetHandle): Promise&lt;void&gt; reportNetConnected(netHandle: NetHandle): Promise&lt;void&gt;
...@@ -1009,7 +1013,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -1009,7 +1013,7 @@ connection.getDefaultNet().then(function (netHandle) {
}); });
``` ```
## connection.reportNetDisconnected ## connection.reportNetDisconnected<sup>8+</sup>
reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;): void reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;): void
...@@ -1046,7 +1050,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -1046,7 +1050,7 @@ connection.getDefaultNet().then(function (netHandle) {
}); });
``` ```
## connection.reportNetDisconnected ## connection.reportNetDisconnected<sup>8+</sup>
reportNetDisconnected(netHandle: NetHandle): Promise&lt;void&gt; reportNetDisconnected(netHandle: NetHandle): Promise&lt;void&gt;
...@@ -1087,7 +1091,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -1087,7 +1091,7 @@ connection.getDefaultNet().then(function (netHandle) {
}); });
``` ```
## connection.getAddressesByName ## connection.getAddressesByName<sup>8+</sup>
getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void
...@@ -1124,7 +1128,7 @@ connection.getAddressesByName(host, function (error, data) { ...@@ -1124,7 +1128,7 @@ connection.getAddressesByName(host, function (error, data) {
}) })
``` ```
## connection.getAddressesByName ## connection.getAddressesByName<sup>8+</sup>
getAddressesByName(host: string): Promise\<Array\<NetAddress>> getAddressesByName(host: string): Promise\<Array\<NetAddress>>
...@@ -1174,7 +1178,7 @@ Represents the network connection handle. ...@@ -1174,7 +1178,7 @@ Represents the network connection handle.
> When a device changes to the network disconnected state, the **netLost** event will be triggered. > When a device changes to the network disconnected state, the **netLost** event will be triggered.
> When a device switches from a Wi-Fi network to a cellular network, the **netLost** event will be first triggered to indicate that the Wi-Fi network is lost and then the **netAvaliable** event will be triggered to indicate that the cellular network is available. > When a device switches from a Wi-Fi network to a cellular network, the **netLost** event will be first triggered to indicate that the Wi-Fi network is lost and then the **netAvaliable** event will be triggered to indicate that the cellular network is available.
### register ### register<sup>8+</sup>
register(callback: AsyncCallback\<void>): void register(callback: AsyncCallback\<void>): void
...@@ -1195,9 +1199,10 @@ Registers a listener for network status changes. ...@@ -1195,9 +1199,10 @@ Registers a listener for network status changes.
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------- | | ------- | ----------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.| | 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. | | 2100003 | System internal error. |
| 2101008 | The callback is not exists. | | 2101008 | The same callback exists. |
| 2101022 | The number of requests exceeded the maximum. | | 2101022 | The number of requests exceeded the maximum. |
**Example** **Example**
...@@ -1208,7 +1213,7 @@ netConnection.register(function (error) { ...@@ -1208,7 +1213,7 @@ netConnection.register(function (error) {
}) })
``` ```
### unregister ### unregister<sup>8+</sup>
unregister(callback: AsyncCallback\<void>): void unregister(callback: AsyncCallback\<void>): void
...@@ -1226,9 +1231,11 @@ Unregisters the listener for network status changes. ...@@ -1226,9 +1231,11 @@ Unregisters the listener for network status changes.
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------- | | ------- | ----------------------------- |
| 201 | Permission denied.|
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.| | 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. | | 2100003 | System internal error. |
| 2101007 | The same callback exists. | | 2101007 | The callback is not exists. |
**Example** **Example**
...@@ -1238,7 +1245,7 @@ netConnection.unregister(function (error) { ...@@ -1238,7 +1245,7 @@ netConnection.unregister(function (error) {
}) })
``` ```
### on('netAvailable') ### on('netAvailable')<sup>8+</sup>
on(type: 'netAvailable', callback: Callback\<NetHandle>): void on(type: 'netAvailable', callback: Callback\<NetHandle>): void
...@@ -1277,7 +1284,7 @@ netCon.unregister(function (error) { ...@@ -1277,7 +1284,7 @@ netCon.unregister(function (error) {
}) })
``` ```
### on('netBlockStatusChange') ### on('netBlockStatusChange')<sup>8+</sup>
on(type: 'netBlockStatusChange', callback: Callback&lt;{ netHandle: NetHandle, blocked: boolean }&gt;): void on(type: 'netBlockStatusChange', callback: Callback&lt;{ netHandle: NetHandle, blocked: boolean }&gt;): void
...@@ -1316,7 +1323,7 @@ netCon.unregister(function (error) { ...@@ -1316,7 +1323,7 @@ netCon.unregister(function (error) {
}) })
``` ```
### on('netCapabilitiesChange') ### on('netCapabilitiesChange')<sup>8+</sup>
on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void
...@@ -1355,7 +1362,7 @@ netCon.unregister(function (error) { ...@@ -1355,7 +1362,7 @@ netCon.unregister(function (error) {
}) })
``` ```
### on('netConnectionPropertiesChange') ### on('netConnectionPropertiesChange')<sup>8+</sup>
on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties:
ConnectionProperties }>): void ConnectionProperties }>): void
...@@ -1395,7 +1402,7 @@ netCon.unregister(function (error) { ...@@ -1395,7 +1402,7 @@ netCon.unregister(function (error) {
}) })
``` ```
### on('netLost') ### on('netLost')<sup>8+</sup>
on(type: 'netLost', callback: Callback\<NetHandle>): void on(type: 'netLost', callback: Callback\<NetHandle>): void
...@@ -1434,7 +1441,7 @@ netCon.unregister(function (error) { ...@@ -1434,7 +1441,7 @@ netCon.unregister(function (error) {
}) })
``` ```
### on('netUnavailable') ### on('netUnavailable')<sup>8+</sup>
on(type: 'netUnavailable', callback: Callback\<void>): void on(type: 'netUnavailable', callback: Callback\<void>): void
...@@ -1473,7 +1480,7 @@ netCon.unregister(function (error) { ...@@ -1473,7 +1480,7 @@ netCon.unregister(function (error) {
}) })
``` ```
## NetHandle ## NetHandle<sup>8+</sup>
Defines the handle of the data network. Defines the handle of the data network.
...@@ -1640,7 +1647,7 @@ connection.getDefaultNet().then((netHandle) => { ...@@ -1640,7 +1647,7 @@ connection.getDefaultNet().then((netHandle) => {
}) })
``` ```
### getAddressesByName ### getAddressesByName<sup>8+</sup>
getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void
...@@ -1679,7 +1686,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -1679,7 +1686,7 @@ connection.getDefaultNet().then(function (netHandle) {
}) })
``` ```
### getAddressesByName ### getAddressesByName<sup>8+</sup>
getAddressesByName(host: string): Promise\<Array\<NetAddress>> getAddressesByName(host: string): Promise\<Array\<NetAddress>>
...@@ -1722,7 +1729,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -1722,7 +1729,7 @@ connection.getDefaultNet().then(function (netHandle) {
}) })
``` ```
### getAddressByName ### getAddressByName<sup>8+</sup>
getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void
...@@ -1761,7 +1768,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -1761,7 +1768,7 @@ connection.getDefaultNet().then(function (netHandle) {
}) })
``` ```
### getAddressByName ### getAddressByName<sup>8+</sup>
getAddressByName(host: string): Promise\<NetAddress> getAddressByName(host: string): Promise\<NetAddress>
...@@ -1804,7 +1811,7 @@ connection.getDefaultNet().then(function (netHandle) { ...@@ -1804,7 +1811,7 @@ connection.getDefaultNet().then(function (netHandle) {
}) })
``` ```
## NetCap ## NetCap<sup>8+</sup>
Defines the network capability. Defines the network capability.
...@@ -1818,7 +1825,7 @@ Defines the network capability. ...@@ -1818,7 +1825,7 @@ Defines the network capability.
| NET_CAPABILITY_NOT_VPN | 15 | The network does not use a virtual private network (VPN).| | NET_CAPABILITY_NOT_VPN | 15 | The network does not use a virtual private network (VPN).|
| NET_CAPABILITY_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.| | NET_CAPABILITY_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.|
## NetBearType ## NetBearType<sup>8+</sup>
Enumerates network types. Enumerates network types.
...@@ -1842,7 +1849,7 @@ Defines the global HTTP proxy configuration of the network. ...@@ -1842,7 +1849,7 @@ Defines the global HTTP proxy configuration of the network.
| port | number | No | Host port.| | port | number | No | Host port.|
| exclusionList | Array<string> | No | Exclusion list of hosts that do not use the proxy server. The length of the combined elements in the list cannot exceed 96 bytes.<br>For example, the length of **baidu.com,zhihu.com** is 20 bytes.| | exclusionList | Array<string> | No | Exclusion list of hosts that do not use the proxy server. The length of the combined elements in the list cannot exceed 96 bytes.<br>For example, the length of **baidu.com,zhihu.com** is 20 bytes.|
## NetSpecifier ## NetSpecifier<sup>8+</sup>
Provides an instance that bears data network capabilities. Provides an instance that bears data network capabilities.
...@@ -1853,7 +1860,7 @@ Provides an instance that bears data network capabilities. ...@@ -1853,7 +1860,7 @@ Provides an instance that bears data network capabilities.
| netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. | | netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. |
| bearerPrivateIdentifier | string | No | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).| | bearerPrivateIdentifier | string | No | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).|
## NetCapabilities ## NetCapabilities<sup>8+</sup>
Defines the network capability set. Defines the network capability set.
...@@ -1866,7 +1873,7 @@ Defines the network capability set. ...@@ -1866,7 +1873,7 @@ Defines the network capability set.
| networkCap | Array\<[NetCap](#netcap)> | No| Network capability. | | networkCap | Array\<[NetCap](#netcap)> | No| Network capability. |
| bearerTypes | Array\<[NetBearType](#netbeartype)> | Yes| Network type. | | bearerTypes | Array\<[NetBearType](#netbeartype)> | Yes| Network type. |
## ConnectionProperties ## ConnectionProperties<sup>8+</sup>
Defines the network connection properties. Defines the network connection properties.
...@@ -1881,7 +1888,7 @@ Defines the network connection properties. ...@@ -1881,7 +1888,7 @@ Defines the network connection properties.
| dnses | Array\<[NetAddress](#netaddress)> | Yes|Network address. For details, see [NetAddress](#netaddress).| | dnses | Array\<[NetAddress](#netaddress)> | Yes|Network address. For details, see [NetAddress](#netaddress).|
| mtu | number | Yes|Maximum transmission unit (MTU). | | mtu | number | Yes|Maximum transmission unit (MTU). |
## RouteInfo ## RouteInfo<sup>8+</sup>
Defines network route information. Defines network route information.
...@@ -1895,7 +1902,7 @@ Defines network route information. ...@@ -1895,7 +1902,7 @@ Defines network route information.
| hasGateway | boolean | Yes|Whether a gateway is present. | | hasGateway | boolean | Yes|Whether a gateway is present. |
| isDefaultRoute | boolean | Yes|Whether the route is the default route.| | isDefaultRoute | boolean | Yes|Whether the route is the default route.|
## LinkAddress ## LinkAddress<sup>8+</sup>
Defines network link information. Defines network link information.
...@@ -1906,7 +1913,7 @@ Defines network link information. ...@@ -1906,7 +1913,7 @@ Defines network link information.
| address | [NetAddress](#netaddress) | Yes| Link address. | | address | [NetAddress](#netaddress) | Yes| Link address. |
| prefixLength | number | Yes|Length of the link address prefix.| | prefixLength | number | Yes|Length of the link address prefix.|
## NetAddress ## NetAddress<sup>8+</sup>
Defines a network address. Defines a network address.
......
...@@ -11,7 +11,7 @@ The **ethernet** module provides wired network capabilities, which allow users t ...@@ -11,7 +11,7 @@ The **ethernet** module provides wired network capabilities, which allow users t
import ethernet from '@ohos.net.ethernet' import ethernet from '@ohos.net.ethernet'
``` ```
## ethernet.setIfaceConfig ## ethernet.setIfaceConfig<sup>9+</sup>
setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\<void>): void setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\<void>): void
...@@ -36,13 +36,15 @@ Sets the network interface configuration. This API uses an asynchronous callback ...@@ -36,13 +36,15 @@ Sets the network interface configuration. This API uses an asynchronous callback
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------| | ------- | ----------------------------------------|
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2200001 | Invalid parameter value. | | 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.| | 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2201005 | The device information does not exist. | | 2201004 | Invalid Ethernet profile. |
| 2201006 | Device disconnected. | | 2201005 | Device information does not exist. |
| 2201007 | Failed to write the user configuration. | | 2201006 | Ethernet device not connected. |
| 2201007 | Ethernet failed to write user configuration information. |
**Example** **Example**
...@@ -64,7 +66,7 @@ ethernet.setIfaceConfig("eth0", { ...@@ -64,7 +66,7 @@ ethernet.setIfaceConfig("eth0", {
}); });
``` ```
## ethernet.setIfaceConfig ## ethernet.setIfaceConfig<sup>9+</sup>
setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void> setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void>
...@@ -94,13 +96,15 @@ Sets the network interface configuration. This API uses a promise to return the ...@@ -94,13 +96,15 @@ Sets the network interface configuration. This API uses a promise to return the
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------| | ------- | ----------------------------------------|
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2200001 | Invalid parameter value. | | 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.| | 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2201005 | The device information does not exist. | | 2201004 | Invalid Ethernet profile. |
| 2201006 | Device disconnected. | | 2201005 | Device information does not exist. |
| 2201007 | Failed to write the user configuration. | | 2201006 | Ethernet device not connected. |
| 2201007 | Ethernet failed to write user configuration information. |
**Example** **Example**
...@@ -120,7 +124,7 @@ ethernet.setIfaceConfig("eth0", { ...@@ -120,7 +124,7 @@ ethernet.setIfaceConfig("eth0", {
}); });
``` ```
## ethernet.getIfaceConfig ## ethernet.getIfaceConfig<sup>9+</sup>
getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>): void getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>): void
...@@ -144,11 +148,12 @@ Obtains the configuration of a network interface. This API uses an asynchronous ...@@ -144,11 +148,12 @@ Obtains the configuration of a network interface. This API uses an asynchronous
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------| | ------- | ----------------------------------------|
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2200001 | Invalid parameter value. | | 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.| | 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2201005 | The device information does not exist. | | 2201005 | Device information does not exist. |
**Example** **Example**
...@@ -168,7 +173,7 @@ ethernet.getIfaceConfig("eth0", (error, value) => { ...@@ -168,7 +173,7 @@ ethernet.getIfaceConfig("eth0", (error, value) => {
}); });
``` ```
## ethernet.getIfaceConfig ## ethernet.getIfaceConfig<sup>9+</sup>
getIfaceConfig(iface: string): Promise\<InterfaceConfiguration> getIfaceConfig(iface: string): Promise\<InterfaceConfiguration>
...@@ -197,11 +202,12 @@ Obtains the configuration of a network interface. This API uses a promise to ret ...@@ -197,11 +202,12 @@ Obtains the configuration of a network interface. This API uses a promise to ret
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------| | ------- | ----------------------------------------|
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2200001 | Invalid parameter value. | | 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.| | 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2201005 | The device information does not exist. | | 2201005 | Device information does not exist. |
**Example** **Example**
...@@ -219,7 +225,7 @@ ethernet.getIfaceConfig("eth0").then((data) => { ...@@ -219,7 +225,7 @@ ethernet.getIfaceConfig("eth0").then((data) => {
}); });
``` ```
## ethernet.isIfaceActive ## ethernet.isIfaceActive<sup>9+</sup>
isIfaceActive(iface: string, callback: AsyncCallback\<number>): void isIfaceActive(iface: string, callback: AsyncCallback\<number>): void
...@@ -243,11 +249,12 @@ Checks whether a network interface is active. This API uses an asynchronous call ...@@ -243,11 +249,12 @@ Checks whether a network interface is active. This API uses an asynchronous call
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------| | ------- | ----------------------------------------|
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2200001 | Invalid parameter value. | | 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.| | 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2201005 | The device information does not exist. | | 2201005 | Device information does not exist. |
**Example** **Example**
...@@ -261,7 +268,7 @@ ethernet.isIfaceActive("eth0", (error, value) => { ...@@ -261,7 +268,7 @@ ethernet.isIfaceActive("eth0", (error, value) => {
}); });
``` ```
## ethernet.isIfaceActive ## ethernet.isIfaceActive<sup>9+</sup>
isIfaceActive(iface: string): Promise\<number> isIfaceActive(iface: string): Promise\<number>
...@@ -290,11 +297,12 @@ Checks whether a network interface is active. This API uses a promise to return ...@@ -290,11 +297,12 @@ Checks whether a network interface is active. This API uses a promise to return
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------| | ------- | ----------------------------------------|
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2200001 | Invalid parameter value. | | 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service.| | 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2201005 | The device information does not exist. | | 2201005 | Device information does not exist. |
**Example** **Example**
...@@ -306,7 +314,7 @@ ethernet.isIfaceActive("eth0").then((data) => { ...@@ -306,7 +314,7 @@ ethernet.isIfaceActive("eth0").then((data) => {
}); });
``` ```
## ethernet.getAllActiveIfaces ## ethernet.getAllActiveIfaces<sup>9+</sup>
getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void
...@@ -329,6 +337,7 @@ Obtains the list of all active network interfaces. This API uses an asynchronous ...@@ -329,6 +337,7 @@ Obtains the list of all active network interfaces. This API uses an asynchronous
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------| | ------- | ----------------------------------------|
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service.| | 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. | | 2200003 | System internal error. |
...@@ -347,7 +356,7 @@ ethernet.getAllActiveIfaces((error, value) => { ...@@ -347,7 +356,7 @@ ethernet.getAllActiveIfaces((error, value) => {
}); });
``` ```
## ethernet.getAllActiveIfaces ## ethernet.getAllActiveIfaces<sup>9+</sup>
getAllActiveIfaces(): Promise\<Array\<string>> getAllActiveIfaces(): Promise\<Array\<string>>
...@@ -370,6 +379,7 @@ Obtains the list of all active network interfaces. This API uses a promise to re ...@@ -370,6 +379,7 @@ Obtains the list of all active network interfaces. This API uses a promise to re
| ID| Error Message | | ID| Error Message |
| ------- | ----------------------------------------| | ------- | ----------------------------------------|
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service.| | 2200002 | Operation failed. Cannot connect to service.|
| 2200003 | System internal error. | | 2200003 | System internal error. |
...@@ -403,21 +413,19 @@ Registers an observer for NIC hot swap events. This API uses an asynchronous cal ...@@ -403,21 +413,19 @@ Registers an observer for NIC hot swap events. This API uses an asynchronous cal
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------- | | -------- | --------------------------------------- | ---- | ---------- |
| type | string | Yes | Event type. The value is **interfaceStateChange**.| | type | string | Yes | Event type. The value is **interfaceStateChange**.|
| callback | Callback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.| | callback | AsyncCallback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
**Error codes** **Error codes**
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 202 | Non-system applications use system APIs. |
| 202 | Applicable only to system applications. |
| 401 | Parameter error. |
**Example** **Example**
```js ```js
ethernet.on('interfaceStateChange', (data) => { ethernet.on('interfaceStateChange', (data) => {
console.log('on interfaceSharingStateChange: ' + JSON.stringify(data.iface) + JSON.stringify(data.active)); console.log('on interfaceSharingStateChange: ' + JSON.stringify(data));
}); });
``` ```
...@@ -438,15 +446,13 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous ...@@ -438,15 +446,13 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------- | | -------- | --------------------------------------- | ---- | ---------- |
| type | string | Yes | Event type. The value is **interfaceStateChange**.| | type | string | Yes | Event type. The value is **interfaceStateChange**.|
| callback | Callback\<{ iface: string, active: boolean }> | No | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.| | callback | AsyncCallback\<{ iface: string, active: boolean }> | No | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
**Error codes** **Error codes**
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 202 | Non-system applications use system APIs. |
| 202 | Applicable only to system applications. |
| 401 | Parameter error. |
**Example** **Example**
...@@ -454,7 +460,7 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous ...@@ -454,7 +460,7 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
ethernet.off('interfaceStateChange'); ethernet.off('interfaceStateChange');
``` ```
## InterfaceConfiguration ## InterfaceConfiguration<sup>9+</sup>
Defines the network configuration for the Ethernet connection. Defines the network configuration for the Ethernet connection.
...@@ -471,7 +477,7 @@ Defines the network configuration for the Ethernet connection. ...@@ -471,7 +477,7 @@ Defines the network configuration for the Ethernet connection.
| netMask | string | Yes| Subnet mask of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.| | netMask | string | Yes| Subnet mask of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.|
| dnsServers | string | Yes| DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).| | dnsServers | string | Yes| DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).|
## IPSetMode ## IPSetMode<sup>9+</sup>
Defines the configuration mode of the Ethernet connection. Defines the configuration mode of the Ethernet connection.
......
...@@ -11,7 +11,7 @@ Multicast DNS (mDNS) provides functions such as adding, removing, discovering, a ...@@ -11,7 +11,7 @@ Multicast DNS (mDNS) provides functions such as adding, removing, discovering, a
import mdns from '@ohos.net.mdns' import mdns from '@ohos.net.mdns'
``` ```
## mdns.addLocalService ## mdns.addLocalService<sup>10+</sup>
addLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void addLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void
...@@ -100,7 +100,7 @@ mdns.addLocalService(context, localServiceInfo, function (error, data) { ...@@ -100,7 +100,7 @@ mdns.addLocalService(context, localServiceInfo, function (error, data) {
}); });
``` ```
## mdns.addLocalService ## mdns.addLocalService<sup>10+</sup>
addLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo> addLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo>
...@@ -192,7 +192,7 @@ mdns.addLocalService(context, localServiceInfo).then(function (data) { ...@@ -192,7 +192,7 @@ mdns.addLocalService(context, localServiceInfo).then(function (data) {
}); });
``` ```
## mdns.removeLocalService ## mdns.removeLocalService<sup>10+</sup>
removeLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void removeLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void
...@@ -216,7 +216,7 @@ Removes an mDNS service. This API uses an asynchronous callback to return the re ...@@ -216,7 +216,7 @@ Removes an mDNS service. This API uses an asynchronous callback to return the re
| 2100002 | Operation failed. Cannot connect to service. | | 2100002 | Operation failed. Cannot connect to service. |
| 2100003 | System internal error. | | 2100003 | System internal error. |
| 2204002 | Callback not found. | | 2204002 | Callback not found. |
| 2204008 | Service instance duplicated. | | 2204008 | Service instance not found. |
| 2204010 | Send packet failed. | | 2204010 | Send packet failed. |
> **NOTE** > **NOTE**
...@@ -281,7 +281,7 @@ mdns.removeLocalService(context, localServiceInfo, function (error, data) { ...@@ -281,7 +281,7 @@ mdns.removeLocalService(context, localServiceInfo, function (error, data) {
}); });
``` ```
## mdns.removeLocalService ## mdns.removeLocalService<sup>10+</sup>
removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo> removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo>
...@@ -310,7 +310,7 @@ Removes an mDNS service. This API uses a promise to return the result. ...@@ -310,7 +310,7 @@ Removes an mDNS service. This API uses a promise to return the result.
| 2100002 | Operation failed. Cannot connect to service. | | 2100002 | Operation failed. Cannot connect to service. |
| 2100003 | System internal error. | | 2100003 | System internal error. |
| 2204002 | Callback not found. | | 2204002 | Callback not found. |
| 2204008 | Service instance duplicated. | | 2204008 | Service instance not found. |
| 2204010 | Send packet failed. | | 2204010 | Send packet failed. |
> **NOTE** > **NOTE**
...@@ -373,7 +373,7 @@ mdns.removeLocalService(context, localServiceInfo).then(function (data) { ...@@ -373,7 +373,7 @@ mdns.removeLocalService(context, localServiceInfo).then(function (data) {
}); });
``` ```
## mdns.createDiscoveryService ## mdns.createDiscoveryService<sup>10+</sup>
createDiscoveryService(context: Context, serviceType: string): DiscoveryService createDiscoveryService(context: Context, serviceType: string): DiscoveryService
...@@ -423,7 +423,7 @@ let serviceType = "_print._tcp"; ...@@ -423,7 +423,7 @@ let serviceType = "_print._tcp";
let discoveryService = mdns.createDiscoveryService(context, serviceType); let discoveryService = mdns.createDiscoveryService(context, serviceType);
``` ```
## mdns.resolveLocalService ## mdns.resolveLocalService<sup>10+</sup>
resolveLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void resolveLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\<LocalServiceInfo>): void
...@@ -512,7 +512,7 @@ mdns.resolveLocalService(context, localServiceInfo, function (error, data) { ...@@ -512,7 +512,7 @@ mdns.resolveLocalService(context, localServiceInfo, function (error, data) {
}); });
``` ```
## mdns.resolveLocalService ## mdns.resolveLocalService<sup>10+</sup>
resolveLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo> resolveLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\<LocalServiceInfo>
...@@ -603,11 +603,11 @@ mdns.resolveLocalService(context, localServiceInfo).then(function (data) { ...@@ -603,11 +603,11 @@ mdns.resolveLocalService(context, localServiceInfo).then(function (data) {
console.log(JSON.stringify(data)); console.log(JSON.stringify(data));
}); });
``` ```
## DiscoveryService ## DiscoveryService<sup>10+</sup>
Defines a **DiscoveryService** object for discovering mDNS services of the specified type. Defines a **DiscoveryService** object for discovering mDNS services of the specified type.
### startSearchingMDNS ### startSearchingMDNS<sup>10+</sup>
startSearchingMDNS(): void startSearchingMDNS(): void
...@@ -644,7 +644,7 @@ let discoveryService = mdns.createDiscoveryService(context, serviceType); ...@@ -644,7 +644,7 @@ let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.startSearchingMDNS(); discoveryService.startSearchingMDNS();
``` ```
### stopSearchingMDNS ### stopSearchingMDNS<sup>10+</sup>
stopSearchingMDNS(): void stopSearchingMDNS(): void
...@@ -681,7 +681,7 @@ let discoveryService = mdns.createDiscoveryService(context, serviceType); ...@@ -681,7 +681,7 @@ let discoveryService = mdns.createDiscoveryService(context, serviceType);
discoveryService.stopSearchingMDNS(); discoveryService.stopSearchingMDNS();
``` ```
### on('discoveryStart') ### on('discoveryStart')<sup>10+</sup>
on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void
...@@ -710,7 +710,7 @@ discoveryService.on('discoveryStart', (data) => { ...@@ -710,7 +710,7 @@ discoveryService.on('discoveryStart', (data) => {
discoveryService.stopSearchingMDNS(); discoveryService.stopSearchingMDNS();
``` ```
### on('discoveryStop') ### on('discoveryStop')<sup>10+</sup>
on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void
...@@ -739,7 +739,7 @@ discoveryService.on('discoveryStop', (data) => { ...@@ -739,7 +739,7 @@ discoveryService.on('discoveryStop', (data) => {
discoveryService.stopSearchingMDNS(); discoveryService.stopSearchingMDNS();
``` ```
### on('serviceFound') ### on('serviceFound')<sup>10+</sup>
on(type: 'serviceFound', callback: Callback\<LocalServiceInfo>): void on(type: 'serviceFound', callback: Callback\<LocalServiceInfo>): void
...@@ -768,7 +768,7 @@ discoveryService.on('serviceFound', (data) => { ...@@ -768,7 +768,7 @@ discoveryService.on('serviceFound', (data) => {
discoveryService.stopSearchingMDNS(); discoveryService.stopSearchingMDNS();
``` ```
### on('serviceLost') ### on('serviceLost')<sup>10+</sup>
on(type: 'serviceLost', callback: Callback\<LocalServiceInfo>): void on(type: 'serviceLost', callback: Callback\<LocalServiceInfo>): void
...@@ -797,7 +797,7 @@ discoveryService.on('serviceLost', (data) => { ...@@ -797,7 +797,7 @@ discoveryService.on('serviceLost', (data) => {
discoveryService.stopSearchingMDNS(); discoveryService.stopSearchingMDNS();
``` ```
## LocalServiceInfo ## LocalServiceInfo<sup>10+</sup>
Defines the mDNS service information. Defines the mDNS service information.
...@@ -811,7 +811,7 @@ Defines the mDNS service information. ...@@ -811,7 +811,7 @@ Defines the mDNS service information.
| host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. | | host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. |
| serviceAttribute | serviceAttribute\<[ServiceAttribute](#serviceattribute)> | No| mDNS service attribute information. | | serviceAttribute | serviceAttribute\<[ServiceAttribute](#serviceattribute)> | No| mDNS service attribute information. |
## ServiceAttribute ## ServiceAttribute<sup>10+</sup>
Defines the mDNS service attribute information. Defines the mDNS service attribute information.
......
...@@ -12,7 +12,7 @@ The **sharing** module allows you to share your device's Internet connection wit ...@@ -12,7 +12,7 @@ The **sharing** module allows you to share your device's Internet connection wit
import sharing from '@ohos.net.sharing' import sharing from '@ohos.net.sharing'
``` ```
## sharing.isSharingSupported ## sharing.isSharingSupported<sup>9+</sup>
isSharingSupported(callback: AsyncCallback\<boolean>): void isSharingSupported(callback: AsyncCallback\<boolean>): void
...@@ -48,7 +48,7 @@ sharing.isSharingSupported((error, data) => { ...@@ -48,7 +48,7 @@ sharing.isSharingSupported((error, data) => {
}); });
``` ```
## sharing.isSharingSupported ## sharing.isSharingSupported<sup>9+</sup>
isSharingSupported(): Promise\<boolean> isSharingSupported(): Promise\<boolean>
...@@ -85,7 +85,7 @@ sharing.isSharingSupported().then(data => { ...@@ -85,7 +85,7 @@ sharing.isSharingSupported().then(data => {
}); });
``` ```
## sharing.isSharing ## sharing.isSharing<sup>9+</sup>
isSharing(callback: AsyncCallback\<boolean>): void isSharing(callback: AsyncCallback\<boolean>): void
...@@ -108,8 +108,10 @@ Checks whether network sharing is in progress. This API uses an asynchronous cal ...@@ -108,8 +108,10 @@ Checks whether network sharing is in progress. This API uses an asynchronous cal
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service. | | 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
**Example** **Example**
...@@ -120,7 +122,7 @@ sharing.isSharing((error, data) => { ...@@ -120,7 +122,7 @@ sharing.isSharing((error, data) => {
}); });
``` ```
## sharing.isSharing ## sharing.isSharing<sup>9+</sup>
isSharing(): Promise\<boolean> isSharing(): Promise\<boolean>
...@@ -143,8 +145,10 @@ Checks whether network sharing is in progress. This API uses a promise to return ...@@ -143,8 +145,10 @@ Checks whether network sharing is in progress. This API uses a promise to return
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 2200002 | Operation failed. Cannot connect to service. | | 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2202011 | Cannot get network sharing configuration. |
**Example** **Example**
...@@ -156,7 +160,7 @@ sharing.isSharing().then(data => { ...@@ -156,7 +160,7 @@ sharing.isSharing().then(data => {
}); });
``` ```
## sharing.startSharing ## sharing.startSharing<sup>9+</sup>
startSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void startSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void
...@@ -201,7 +205,7 @@ sharing.startSharing(SHARING_WIFI, (error) => { ...@@ -201,7 +205,7 @@ sharing.startSharing(SHARING_WIFI, (error) => {
}); });
``` ```
## sharing.startSharing ## sharing.startSharing<sup>9+</sup>
startSharing(type: SharingIfaceType): Promise\<void> startSharing(type: SharingIfaceType): Promise\<void>
...@@ -253,7 +257,7 @@ sharing.startSharing(SHARING_WIFI).then(() => { ...@@ -253,7 +257,7 @@ sharing.startSharing(SHARING_WIFI).then(() => {
}); });
``` ```
## sharing.stopSharing ## sharing.stopSharing<sup>9+</sup>
stopSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void stopSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void
...@@ -277,10 +281,12 @@ Stops network sharing of a specified type. This API uses an asynchronous callbac ...@@ -277,10 +281,12 @@ Stops network sharing of a specified type. This API uses an asynchronous callbac
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2200001 | Invalid parameter value. | | 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. | | 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2202004 | Try to share an unavailable iface. |
| 2202005 | WiFi sharing failed. | | 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. | | 2202006 | Bluetooth sharing failed. |
| 2202011 | Cannot get network sharing configuration. | | 2202011 | Cannot get network sharing configuration. |
...@@ -296,7 +302,7 @@ sharing.stopSharing(SHARING_WIFI, (error) => { ...@@ -296,7 +302,7 @@ sharing.stopSharing(SHARING_WIFI, (error) => {
}); });
``` ```
## sharing.stopSharing ## sharing.stopSharing<sup>9+</sup>
stopSharing(type: SharingIfaceType): Promise\<void> stopSharing(type: SharingIfaceType): Promise\<void>
...@@ -325,10 +331,12 @@ Stops network sharing of a specified type. This API uses a promise to return the ...@@ -325,10 +331,12 @@ Stops network sharing of a specified type. This API uses a promise to return the
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2200001 | Invalid parameter value. | | 2200001 | Invalid parameter value. |
| 2200002 | Operation failed. Cannot connect to service. | | 2200002 | Operation failed. Cannot connect to service. |
| 2200003 | System internal error. | | 2200003 | System internal error. |
| 2202004 | Try to share an unavailable iface. |
| 2202005 | WiFi sharing failed. | | 2202005 | WiFi sharing failed. |
| 2202006 | Bluetooth sharing failed. | | 2202006 | Bluetooth sharing failed. |
| 2202011 | Cannot get network sharing configuration. | | 2202011 | Cannot get network sharing configuration. |
...@@ -346,7 +354,7 @@ sharing.stopSharing(SHARING_WIFI).then(() => { ...@@ -346,7 +354,7 @@ sharing.stopSharing(SHARING_WIFI).then(() => {
}); });
``` ```
## sharing.getStatsRxBytes ## sharing.getStatsRxBytes<sup>9+</sup>
getStatsRxBytes(callback: AsyncCallback\<number>): void getStatsRxBytes(callback: AsyncCallback\<number>): void
...@@ -381,7 +389,7 @@ sharing.getStatsRxBytes((error, data) => { ...@@ -381,7 +389,7 @@ sharing.getStatsRxBytes((error, data) => {
}); });
``` ```
## sharing.getStatsRxBytes ## sharing.getStatsRxBytes<sup>9+</sup>
getStatsRxBytes(): Promise\<number> getStatsRxBytes(): Promise\<number>
...@@ -417,7 +425,7 @@ sharing.getStatsRxBytes().then(data => { ...@@ -417,7 +425,7 @@ sharing.getStatsRxBytes().then(data => {
}); });
``` ```
## sharing.getStatsTxBytes ## sharing.getStatsTxBytes<sup>9+</sup>
getStatsTxBytes(callback: AsyncCallback\<number>): void getStatsTxBytes(callback: AsyncCallback\<number>): void
...@@ -452,7 +460,7 @@ sharing.getStatsTxBytes((error, data) => { ...@@ -452,7 +460,7 @@ sharing.getStatsTxBytes((error, data) => {
}); });
``` ```
## sharing.getStatsTxBytes ## sharing.getStatsTxBytes<sup>9+</sup>
getStatsTxBytes(): Promise\<number> getStatsTxBytes(): Promise\<number>
...@@ -488,7 +496,7 @@ sharing.getStatsTxBytes().then(data => { ...@@ -488,7 +496,7 @@ sharing.getStatsTxBytes().then(data => {
}); });
``` ```
## sharing.getStatsTotalBytes ## sharing.getStatsTotalBytes<sup>9+</sup>
getStatsTotalBytes(callback: AsyncCallback\<number>): void getStatsTotalBytes(callback: AsyncCallback\<number>): void
...@@ -523,7 +531,7 @@ sharing.getStatsTotalBytes((error, data) => { ...@@ -523,7 +531,7 @@ sharing.getStatsTotalBytes((error, data) => {
}); });
``` ```
## sharing.getStatsTotalBytes ## sharing.getStatsTotalBytes<sup>9+</sup>
getStatsTotalBytes(): Promise\<number> getStatsTotalBytes(): Promise\<number>
...@@ -559,7 +567,7 @@ sharing.getStatsTotalBytes().then(data => { ...@@ -559,7 +567,7 @@ sharing.getStatsTotalBytes().then(data => {
}); });
``` ```
## sharing.getSharingIfaces ## sharing.getSharingIfaces<sup>9+</sup>
getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\<Array\<string>>): void getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\<Array\<string>>): void
...@@ -600,7 +608,7 @@ sharing.getSharingIfaces(SHARING_BLUETOOTH, (error, data) => { ...@@ -600,7 +608,7 @@ sharing.getSharingIfaces(SHARING_BLUETOOTH, (error, data) => {
}); });
``` ```
## sharing.getSharingIfaces ## sharing.getSharingIfaces<sup>9+</sup>
getSharingIfaces(state: SharingIfaceState): Promise\<Array\<string>> getSharingIfaces(state: SharingIfaceState): Promise\<Array\<string>>
...@@ -647,7 +655,7 @@ sharing.getSharingIfaces(SHARING_BLUETOOTH).then(data => { ...@@ -647,7 +655,7 @@ sharing.getSharingIfaces(SHARING_BLUETOOTH).then(data => {
}); });
``` ```
## sharing.getSharingState ## sharing.getSharingState<sup>9+</sup>
getSharingState(type: SharingIfaceType, callback: AsyncCallback\<SharingIfaceState>): void getSharingState(type: SharingIfaceType, callback: AsyncCallback\<SharingIfaceState>): void
...@@ -688,7 +696,7 @@ sharing.getSharingState(SHARING_WIFI, (error, data) => { ...@@ -688,7 +696,7 @@ sharing.getSharingState(SHARING_WIFI, (error, data) => {
}); });
``` ```
## sharing.getSharingState ## sharing.getSharingState<sup>9+</sup>
getSharingState(type: SharingIfaceType): Promise\<SharingIfaceState> getSharingState(type: SharingIfaceType): Promise\<SharingIfaceState>
...@@ -735,7 +743,7 @@ sharing.getSharingState(SHARING_WIFI).then(data => { ...@@ -735,7 +743,7 @@ sharing.getSharingState(SHARING_WIFI).then(data => {
}); });
``` ```
## sharing.getSharableRegexes ## sharing.getSharableRegexes<sup>9+</sup>
getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\<Array\<string>>): void getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\<Array\<string>>): void
...@@ -776,7 +784,7 @@ sharing.getSharableRegexes(SHARING_WIFI, (error, data) => { ...@@ -776,7 +784,7 @@ sharing.getSharableRegexes(SHARING_WIFI, (error, data) => {
}); });
``` ```
## sharing.getSharableRegexes ## sharing.getSharableRegexes<sup>9+</sup>
getSharableRegexes(type: SharingIfaceType): Promise\<Array\<string>> getSharableRegexes(type: SharingIfaceType): Promise\<Array\<string>>
...@@ -823,7 +831,7 @@ sharing.getSharableRegexes(SHARING_WIFI).then(data => { ...@@ -823,7 +831,7 @@ sharing.getSharableRegexes(SHARING_WIFI).then(data => {
}); });
``` ```
## sharing.on('sharingStateChange') ## sharing.on('sharingStateChange')<sup>9+</sup>
on(type: 'sharingStateChange', callback: Callback\<boolean>): void on(type: 'sharingStateChange', callback: Callback\<boolean>): void
...@@ -846,8 +854,7 @@ Subscribes to network sharing state changes. This API uses an asynchronous callb ...@@ -846,8 +854,7 @@ Subscribes to network sharing state changes. This API uses an asynchronous callb
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example** **Example**
...@@ -857,7 +864,7 @@ sharing.on('sharingStateChange', (data) => { ...@@ -857,7 +864,7 @@ sharing.on('sharingStateChange', (data) => {
}); });
``` ```
## sharing.off('sharingStateChange') ## sharing.off('sharingStateChange')<sup>9+</sup>
off(type: 'sharingStateChange', callback?: Callback\<boolean>): void off(type: 'sharingStateChange', callback?: Callback\<boolean>): void
...@@ -880,8 +887,7 @@ Unsubscribes from network sharing state changes. This API uses an asynchronous c ...@@ -880,8 +887,7 @@ Unsubscribes from network sharing state changes. This API uses an asynchronous c
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example** **Example**
...@@ -891,7 +897,7 @@ sharing.off('sharingStateChange', (data) => { ...@@ -891,7 +897,7 @@ sharing.off('sharingStateChange', (data) => {
}); });
``` ```
## sharing.on('interfaceSharingStateChange') ## sharing.on('interfaceSharingStateChange')<sup>9+</sup>
on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state:
SharingIfaceState }>): void SharingIfaceState }>): void
...@@ -915,8 +921,7 @@ Subscribes to network sharing state changes of a specified NIC. This API uses an ...@@ -915,8 +921,7 @@ Subscribes to network sharing state changes of a specified NIC. This API uses an
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example** **Example**
...@@ -926,7 +931,7 @@ sharing.on('interfaceSharingStateChange', (data) => { ...@@ -926,7 +931,7 @@ sharing.on('interfaceSharingStateChange', (data) => {
}); });
``` ```
## sharing.off('interfaceSharingStateChange') ## sharing.off('interfaceSharingStateChange')<sup>9+</sup>
off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state:
SharingIfaceState }>): void SharingIfaceState }>): void
...@@ -950,8 +955,7 @@ Unsubscribes from network sharing status changes of a specified NIC. This API us ...@@ -950,8 +955,7 @@ Unsubscribes from network sharing status changes of a specified NIC. This API us
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example** **Example**
...@@ -961,7 +965,7 @@ sharing.off('interfaceSharingStateChange', (data) => { ...@@ -961,7 +965,7 @@ sharing.off('interfaceSharingStateChange', (data) => {
}); });
``` ```
## sharing.on('sharingUpstreamChange') ## sharing.on('sharingUpstreamChange')<sup>9+</sup>
on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void
...@@ -984,8 +988,7 @@ Subscribes to upstream network changes. This API uses an asynchronous callback t ...@@ -984,8 +988,7 @@ Subscribes to upstream network changes. This API uses an asynchronous callback t
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example** **Example**
...@@ -995,7 +998,7 @@ sharing.on('sharingUpstreamChange', (data) => { ...@@ -995,7 +998,7 @@ sharing.on('sharingUpstreamChange', (data) => {
}); });
``` ```
## sharing.off('sharingUpstreamChange') ## sharing.off('sharingUpstreamChange')<sup>9+</sup>
off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void
...@@ -1018,8 +1021,7 @@ Unsubscribes from upstream network changes. This API uses an asynchronous callba ...@@ -1018,8 +1021,7 @@ Unsubscribes from upstream network changes. This API uses an asynchronous callba
| ID| Error Message | | ID| Error Message |
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 201 | Permission denied. | | 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
**Example** **Example**
...@@ -1029,7 +1031,7 @@ sharing.off('sharingUpstreamChange', (data) => { ...@@ -1029,7 +1031,7 @@ sharing.off('sharingUpstreamChange', (data) => {
}); });
``` ```
## SharingIfaceState ## SharingIfaceState<sup>9+</sup>
Enumerates the network sharing states of an NIC. Enumerates the network sharing states of an NIC.
...@@ -1043,7 +1045,7 @@ Enumerates the network sharing states of an NIC. ...@@ -1043,7 +1045,7 @@ Enumerates the network sharing states of an NIC.
| SHARING_NIC_CAN_SERVER | 2 | Network sharing is supported.| | SHARING_NIC_CAN_SERVER | 2 | Network sharing is supported.|
| SHARING_NIC_ERROR | 3 | An error occurred during network sharing.| | SHARING_NIC_ERROR | 3 | An error occurred during network sharing.|
## SharingIfaceType ## SharingIfaceType<sup>9+</sup>
Enumerates the network sharing types of an NIC. Enumerates the network sharing types of an NIC.
......
...@@ -15,7 +15,7 @@ import observer from '@ohos.telephony.observer'; ...@@ -15,7 +15,7 @@ import observer from '@ohos.telephony.observer';
## observer.on('networkStateChange') ## observer.on('networkStateChange')
on\(type: \'networkStateChange\', callback: Callback<NetworkState\>\): void; on\(type: \'networkStateChange\', callback: Callback\<NetworkState\>\): void;
Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result. Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result.
...@@ -54,7 +54,7 @@ observer.on('networkStateChange', data => { ...@@ -54,7 +54,7 @@ observer.on('networkStateChange', data => {
## observer.on('networkStateChange') ## observer.on('networkStateChange')
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback<NetworkState\>\): void; on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback\<NetworkState\>\): void;
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...@@ -94,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data => { ...@@ -94,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data => {
## observer.off('networkStateChange') ## observer.off('networkStateChange')
off\(type: \'networkStateChange\', callback?: Callback<NetworkState\>\): void; off\(type: \'networkStateChange\', callback?: Callback\<NetworkState\>\): void;
Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result. Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result.
...@@ -111,6 +111,10 @@ Unregisters the observer for network status change events. This API uses an asyn ...@@ -111,6 +111,10 @@ Unregisters the observer for network status change events. This API uses an asyn
| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. | | type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. |
| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 401 | Parameter error. | | 401 | Parameter error. |
...@@ -133,7 +137,7 @@ observer.off('networkStateChange'); ...@@ -133,7 +137,7 @@ observer.off('networkStateChange');
## observer.on('signalInfoChange') ## observer.on('signalInfoChange')
on\(type: \'signalInfoChange\', callback: Callback<Array<SignalInformation\>\>): void; on\(type: \'signalInfoChange\', callback: Callback\<Array\<SignalInformation\>\>): void;
Registers an observer for signal status change events. This API uses an asynchronous callback to return the execution result. Registers an observer for signal status change events. This API uses an asynchronous callback to return the execution result.
...@@ -144,7 +148,7 @@ Registers an observer for signal status change events. This API uses an asynchro ...@@ -144,7 +148,7 @@ Registers an observer for signal status change events. This API uses an asynchro
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | | type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| | callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes** **Error codes**
...@@ -152,7 +156,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -152,7 +156,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -170,7 +173,7 @@ observer.on('signalInfoChange', data => { ...@@ -170,7 +173,7 @@ observer.on('signalInfoChange', data => {
## observer.on('signalInfoChange') ## observer.on('signalInfoChange')
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback<Array<SignalInformation\>\>): void; on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback\<Array\<SignalInformation\>\>): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...@@ -182,7 +185,7 @@ Registers an observer for signal status change events of the SIM card in the spe ...@@ -182,7 +185,7 @@ Registers an observer for signal status change events of the SIM card in the spe
| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | | type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| 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 | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| | callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes** **Error codes**
...@@ -190,7 +193,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -190,7 +193,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -208,7 +210,7 @@ observer.on('signalInfoChange', {slotId: 0}, data => { ...@@ -208,7 +210,7 @@ observer.on('signalInfoChange', {slotId: 0}, data => {
## observer.off('signalInfoChange') ## observer.off('signalInfoChange')
off\(type: \'signalInfoChange\', callback?: Callback<Array<SignalInformation\>\>): void; off\(type: \'signalInfoChange\', callback?: Callback\<Array\<SignalInformation\>\>): void;
Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the execution result. Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the execution result.
...@@ -223,7 +225,7 @@ Unregisters the observer for signal status change events. This API uses an async ...@@ -223,7 +225,7 @@ Unregisters the observer for signal status change events. This API uses an async
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | | type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| | callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes** **Error codes**
...@@ -251,7 +253,7 @@ observer.off('signalInfoChange'); ...@@ -251,7 +253,7 @@ observer.off('signalInfoChange');
## observer.on('cellInfoChange')<sup>8+</sup> ## observer.on('cellInfoChange')<sup>8+</sup>
on\(type: \'cellInfoChange\', callback: Callback<CellInformation\>\): void; on\(type: \'cellInfoChange\', callback: Callback\<Array\<CellInformation\>\>\): void;
Registers an observer for cell information change events. This API uses an asynchronous callback to return the result. Registers an observer for cell information change events. This API uses an asynchronous callback to return the result.
...@@ -264,15 +266,18 @@ Registers an observer for cell information change events. This API uses an async ...@@ -264,15 +266,18 @@ Registers an observer for cell information change events. This API uses an async
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- |------------------------------------------------------------| | -------- | --------------------------------------------------------- | ---- |------------------------------------------|
| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | | type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**.|
| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | Yes | Callback used to return the result.| | callback | Callback\<Array\<[CellInformation](js-apis-radio.md#cellinformation8)\>\> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -290,7 +295,7 @@ observer.on('cellInfoChange', data => { ...@@ -290,7 +295,7 @@ observer.on('cellInfoChange', data => {
## observer.on('cellInfoChange')<sup>8+</sup> ## observer.on('cellInfoChange')<sup>8+</sup>
on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback<CellInformation\>\): void; on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback\<Array\<CellInformation\>\>\): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...@@ -303,16 +308,19 @@ Registers an observer for signal status change events of the SIM card in the spe ...@@ -303,16 +308,19 @@ Registers an observer for signal status change events of the SIM card in the spe
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ |--------------------------------------------------| ---- |------------------------------------------------------------| | ------ |--------------------------------------------------| ---- |--------------------------------------------|
| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | | type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**.|
| 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 | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | Yes | Callback used to return the result.| | callback | Callback\<Array\<[CellInformation](js-apis-radio.md#cellinformation8)\>\> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -330,7 +338,7 @@ observer.on('cellInfoChange', {slotId: 0}, data => { ...@@ -330,7 +338,7 @@ observer.on('cellInfoChange', {slotId: 0}, data => {
## observer.off('cellInfoChange')<sup>8+</sup> ## observer.off('cellInfoChange')<sup>8+</sup>
off\(type: \'cellInfoChange\', callback?: Callback<CellInformation\>\): void; off\(type: \'cellInfoChange\', callback?: Callback\<Array\<CellInformation\>\>\): void;
Unregisters the observer for cell information change events. This API uses an asynchronous callback to return the result. Unregisters the observer for cell information change events. This API uses an asynchronous callback to return the result.
...@@ -347,10 +355,15 @@ Unregisters the observer for cell information change events. This API uses an as ...@@ -347,10 +355,15 @@ Unregisters the observer for cell information change events. This API uses an as
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | | type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. |
| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | No | Callback used to return the result.| | callback | Callback\<Array\<[CellInformation](js-apis-radio.md#cellinformation8)\>\> | No | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
......
# @ohos.power (Power Manager) # @ohos.power (Power Management)
The **power** module provides APIs for rebooting and shutting down the system, as well as querying the screen status. The **power** module provides APIs for rebooting and shutting down the system, as well as querying the screen status.
...@@ -36,7 +36,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes ...@@ -36,7 +36,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -72,7 +72,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes ...@@ -72,7 +72,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -98,7 +98,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes ...@@ -98,7 +98,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -133,7 +133,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes ...@@ -133,7 +133,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -161,7 +161,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes ...@@ -161,7 +161,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -193,7 +193,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes ...@@ -193,7 +193,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -231,7 +231,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes ...@@ -231,7 +231,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -275,7 +275,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes ...@@ -275,7 +275,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes
| ID | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
......
...@@ -103,7 +103,7 @@ promise.then(data => { ...@@ -103,7 +103,7 @@ promise.then(data => {
## radio.getNetworkState ## radio.getNetworkState
getNetworkState\(callback: AsyncCallback<NetworkState\>\): void getNetworkState\(callback: AsyncCallback\<NetworkState\>\): void
Obtains the network status. This API uses an asynchronous callback to return the result. Obtains the network status. This API uses an asynchronous callback to return the result.
...@@ -141,7 +141,7 @@ radio.getNetworkState((err, data) => { ...@@ -141,7 +141,7 @@ radio.getNetworkState((err, data) => {
## radio.getNetworkState ## radio.getNetworkState
getNetworkState\(slotId: number, callback: AsyncCallback<NetworkState\>\): void getNetworkState\(slotId: number, callback: AsyncCallback\<NetworkState\>\): void
Obtains the network status. This API uses an asynchronous callback to return the result. Obtains the network status. This API uses an asynchronous callback to return the result.
...@@ -181,7 +181,7 @@ radio.getNetworkState(slotId, (err, data) => { ...@@ -181,7 +181,7 @@ radio.getNetworkState(slotId, (err, data) => {
## radio.getNetworkState ## radio.getNetworkState
getNetworkState\(slotId?: number\): Promise<NetworkState\> getNetworkState\(slotId?: number\): Promise\<NetworkState\>
Obtains the network status. This API uses a promise to return the result. Obtains the network status. This API uses a promise to return the result.
...@@ -229,7 +229,7 @@ promise.then(data => { ...@@ -229,7 +229,7 @@ promise.then(data => {
## radio.getNetworkSelectionMode ## radio.getNetworkSelectionMode
getNetworkSelectionMode\(slotId: number, callback: AsyncCallback<NetworkSelectionMode\>\): void getNetworkSelectionMode\(slotId: number, callback: AsyncCallback\<NetworkSelectionMode\>\): void
Obtains the network selection mode of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the network selection mode of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -266,7 +266,7 @@ radio.getNetworkSelectionMode(slotId, (err, data) => { ...@@ -266,7 +266,7 @@ radio.getNetworkSelectionMode(slotId, (err, data) => {
## radio.getNetworkSelectionMode ## radio.getNetworkSelectionMode
getNetworkSelectionMode\(slotId: number\): Promise<NetworkSelectionMode\> getNetworkSelectionMode\(slotId: number\): Promise\<NetworkSelectionMode\>
Obtains the network selection mode of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the network selection mode of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -311,7 +311,7 @@ promise.then(data => { ...@@ -311,7 +311,7 @@ promise.then(data => {
## radio.getISOCountryCodeForNetwork<sup>7+</sup> ## radio.getISOCountryCodeForNetwork<sup>7+</sup>
getISOCountryCodeForNetwork\(slotId: number, callback: AsyncCallback<string\>\): void getISOCountryCodeForNetwork\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the ISO country code 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 the ISO country code of the network with which the SIM card in the specified slot is registered. This API uses an asynchronous callback to return the result.
...@@ -348,7 +348,7 @@ radio.getISOCountryCodeForNetwork(slotId, (err, data) => { ...@@ -348,7 +348,7 @@ radio.getISOCountryCodeForNetwork(slotId, (err, data) => {
## radio.getISOCountryCodeForNetwork<sup>7+</sup> ## radio.getISOCountryCodeForNetwork<sup>7+</sup>
getISOCountryCodeForNetwork\(slotId: number\): Promise<string\> getISOCountryCodeForNetwork\(slotId: number\): Promise\<string\>
Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. This API uses a promise to return the result. Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. This API uses a promise to return the result.
...@@ -403,7 +403,7 @@ Obtains the ID of the slot in which the primary card is located. This API uses a ...@@ -403,7 +403,7 @@ 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 invoked to return the result.| | callback | AsyncCallback\<number\> | Yes | Callback used to return the result.|
**Error codes** **Error codes**
...@@ -445,7 +445,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -445,7 +445,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -464,7 +463,7 @@ promise.then(data => { ...@@ -464,7 +463,7 @@ promise.then(data => {
## radio.getSignalInformation<sup>7+</sup> ## radio.getSignalInformation<sup>7+</sup>
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.
...@@ -501,7 +500,7 @@ radio.getSignalInformation(slotId, (err, data) => { ...@@ -501,7 +500,7 @@ radio.getSignalInformation(slotId, (err, data) => {
## radio.getSignalInformation<sup>7+</sup> ## radio.getSignalInformation<sup>7+</sup>
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.
...@@ -654,7 +653,7 @@ console.log("Result: "+ result); ...@@ -654,7 +653,7 @@ console.log("Result: "+ result);
## radio.isRadioOn<sup>7+</sup> ## radio.isRadioOn<sup>7+</sup>
isRadioOn\(callback: AsyncCallback<boolean\>\): void isRadioOn\(callback: AsyncCallback\<boolean\>\): void
Checks whether the radio service is enabled on the primary SIM card. This API uses an asynchronous callback to return the result. Checks whether the radio service is enabled on the primary SIM card. This API uses an asynchronous callback to return the result.
...@@ -692,7 +691,7 @@ radio.isRadioOn((err, data) => { ...@@ -692,7 +691,7 @@ radio.isRadioOn((err, data) => {
## radio.isRadioOn<sup>7+</sup> ## radio.isRadioOn<sup>7+</sup>
isRadioOn\(slotId: number, callback: AsyncCallback<boolean\>\): void isRadioOn\(slotId: number, callback: AsyncCallback\<boolean\>\): void
Checks whether the radio service is enabled on the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Checks whether the radio service is enabled on the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -732,7 +731,7 @@ radio.isRadioOn(slotId, (err, data) => { ...@@ -732,7 +731,7 @@ radio.isRadioOn(slotId, (err, data) => {
## radio.isRadioOn<sup>7+</sup> ## radio.isRadioOn<sup>7+</sup>
isRadioOn\(slotId?: number\): Promise<boolean\> isRadioOn\(slotId?: number\): Promise\<boolean\>
Checks whether the radio service is enabled on the SIM card in the specified slot. This API uses a promise to return the result. Checks whether the radio service is enabled on the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -780,7 +779,7 @@ promise.then(data => { ...@@ -780,7 +779,7 @@ promise.then(data => {
## radio.getOperatorName<sup>7+</sup> ## radio.getOperatorName<sup>7+</sup>
getOperatorName\(slotId: number, callback: AsyncCallback<string\>\): void getOperatorName\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the carrier name for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the carrier name for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -817,7 +816,7 @@ radio.getOperatorName(slotId, (err, data) => { ...@@ -817,7 +816,7 @@ radio.getOperatorName(slotId, (err, data) => {
## radio.getOperatorName<sup>7+</sup> ## radio.getOperatorName<sup>7+</sup>
getOperatorName\(slotId: number\): Promise<string\> getOperatorName\(slotId: number\): Promise\<string\>
Obtains the carrier name for the SIM card in the specified slot. This API uses a promise to return the result. Obtains the carrier name for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -861,7 +860,7 @@ promise.then(data => { ...@@ -861,7 +860,7 @@ promise.then(data => {
## radio.setPrimarySlotId<sup>8+</sup> ## radio.setPrimarySlotId<sup>8+</sup>
setPrimarySlotId(slotId: number, callback: AsyncCallback<void\>): void setPrimarySlotId\(slotId: number, callback: AsyncCallback\<void\>\): void
Sets the ID of the slot in which the primary card is located. This API uses an asynchronous callback to return the result. Sets the ID of the slot in which the primary card is located. This API uses an asynchronous callback to return the result.
...@@ -885,6 +884,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -885,6 +884,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -933,6 +933,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -933,6 +933,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -954,7 +955,7 @@ promise.then(() => { ...@@ -954,7 +955,7 @@ promise.then(() => {
## radio.getIMEI<sup>8+</sup> ## radio.getIMEI<sup>8+</sup>
getIMEI(callback: AsyncCallback<string\>): void getIMEI\(callback: AsyncCallback\<string\>\): void
Obtains the IMEI of the SIM card in a card slot. This API uses an asynchronous callback to return the result. Obtains the IMEI of the SIM card in a card slot. This API uses an asynchronous callback to return the result.
...@@ -977,6 +978,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -977,6 +978,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -994,9 +996,9 @@ radio.getIMEI((err, data) => { ...@@ -994,9 +996,9 @@ radio.getIMEI((err, data) => {
## radio.getIMEI<sup>8+</sup> ## radio.getIMEI<sup>8+</sup>
getIMEI(slotId: number, callback: AsyncCallback<string\>): void getIMEI\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the IMEI of the SIM card in the specified card slot. This API uses an asynchronous callback to return the result. Obtains the IMEI of the SIM card in a 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.
...@@ -1018,6 +1020,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1018,6 +1020,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1036,7 +1039,7 @@ radio.getIMEI(slotId, (err, data) => { ...@@ -1036,7 +1039,7 @@ radio.getIMEI(slotId, (err, data) => {
## radio.getIMEI<sup>8+</sup> ## radio.getIMEI<sup>8+</sup>
getIMEI(slotId?: number): Promise<string\> getIMEI\(slotId?: number\): Promise\<string\>
Obtains the IMEI of the SIM card in the specified 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.
...@@ -1065,6 +1068,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1065,6 +1068,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1085,7 +1089,7 @@ promise.then(data => { ...@@ -1085,7 +1089,7 @@ promise.then(data => {
## radio.getMEID<sup>8+</sup> ## radio.getMEID<sup>8+</sup>
getMEID(callback: AsyncCallback<string\>): void getMEID\(callback: AsyncCallback\<string\>\): void
Obtains the MEID of the SIM card in a card slot. This API uses an asynchronous callback to return the result. Obtains the MEID of the SIM card in a card slot. This API uses an asynchronous callback to return the result.
...@@ -1108,6 +1112,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1108,6 +1112,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1125,9 +1130,9 @@ radio.getMEID((err, data) => { ...@@ -1125,9 +1130,9 @@ radio.getMEID((err, data) => {
## radio.getMEID<sup>8+</sup> ## radio.getMEID<sup>8+</sup>
getMEID(slotId: number, callback: AsyncCallback<string\>): void getMEID\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the MEID of the SIM card in the specified card slot. This API uses an asynchronous callback to return the result. Obtains the MEID of the SIM card in a 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.
...@@ -1149,6 +1154,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1149,6 +1154,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1167,7 +1173,7 @@ radio.getMEID(slotId, (err, data) => { ...@@ -1167,7 +1173,7 @@ radio.getMEID(slotId, (err, data) => {
## radio.getMEID<sup>8+</sup> ## radio.getMEID<sup>8+</sup>
getMEID(slotId?: number): Promise<string\> getMEID\(slotId?: number\): Promise\<string\>
Obtains the MEID of the SIM card in the specified card 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.
...@@ -1196,6 +1202,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1196,6 +1202,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1216,7 +1223,7 @@ promise.then(data => { ...@@ -1216,7 +1223,7 @@ promise.then(data => {
## radio.getUniqueDeviceId<sup>8+</sup> ## radio.getUniqueDeviceId<sup>8+</sup>
getUniqueDeviceId(callback: AsyncCallback<string\>): void getUniqueDeviceId\(callback: AsyncCallback\<string\>\): void
Obtains the unique device ID of the SIM card in a card slot. This API uses an asynchronous callback to return the result. Obtains the unique device ID of the SIM card in a card slot. This API uses an asynchronous callback to return the result.
...@@ -1239,6 +1246,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1239,6 +1246,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1256,9 +1264,9 @@ radio.getUniqueDeviceId((err, data) => { ...@@ -1256,9 +1264,9 @@ radio.getUniqueDeviceId((err, data) => {
## radio.getUniqueDeviceId<sup>8+</sup> ## radio.getUniqueDeviceId<sup>8+</sup>
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 card slot. This API uses an asynchronous callback to return the result. Obtains the unique device ID of the SIM card in a 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.
...@@ -1280,6 +1288,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1280,6 +1288,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1298,7 +1307,7 @@ radio.getUniqueDeviceId(slotId, (err, data) => { ...@@ -1298,7 +1307,7 @@ radio.getUniqueDeviceId(slotId, (err, data) => {
## radio.getUniqueDeviceId<sup>8+</sup> ## radio.getUniqueDeviceId<sup>8+</sup>
getUniqueDeviceId(slotId?: number): Promise<string\> getUniqueDeviceId\(slotId?: number\): Promise\<string\>
Obtains the unique device ID of the SIM card in the specified card 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.
...@@ -1327,6 +1336,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1327,6 +1336,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1347,7 +1357,7 @@ promise.then(data => { ...@@ -1347,7 +1357,7 @@ promise.then(data => {
## radio.sendUpdateCellLocationRequest<sup>8+</sup> ## radio.sendUpdateCellLocationRequest<sup>8+</sup>
sendUpdateCellLocationRequest\(callback: AsyncCallback<void\>\): void sendUpdateCellLocationRequest\(callback: AsyncCallback\<void\>\): void
Sends a cell location update request. This API uses an asynchronous callback to return the result. Sends a cell location update request. This API uses an asynchronous callback to return the result.
...@@ -1370,6 +1380,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1370,6 +1380,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1386,7 +1397,7 @@ radio.sendUpdateCellLocationRequest((err) => { ...@@ -1386,7 +1397,7 @@ radio.sendUpdateCellLocationRequest((err) => {
## radio.sendUpdateCellLocationRequest<sup>8+</sup> ## radio.sendUpdateCellLocationRequest<sup>8+</sup>
sendUpdateCellLocationRequest\(slotId: number, callback: AsyncCallback<void\>\): void sendUpdateCellLocationRequest\(slotId: number, callback: AsyncCallback\<void\>\): void
Sends a cell location update request for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Sends a cell location update request for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1410,6 +1421,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1410,6 +1421,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1427,7 +1439,7 @@ radio.sendUpdateCellLocationRequest(slotId, (err) => { ...@@ -1427,7 +1439,7 @@ radio.sendUpdateCellLocationRequest(slotId, (err) => {
## radio.sendUpdateCellLocationRequest<sup>8+</sup> ## radio.sendUpdateCellLocationRequest<sup>8+</sup>
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.
...@@ -1456,6 +1468,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1456,6 +1468,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1475,7 +1488,7 @@ radio.sendUpdateCellLocationRequest(slotId).then(() => { ...@@ -1475,7 +1488,7 @@ radio.sendUpdateCellLocationRequest(slotId).then(() => {
## radio.getCellInformation<sup>8+</sup> ## radio.getCellInformation<sup>8+</sup>
getCellInformation(callback: AsyncCallback<Array<CellInformation\>>): void getCellInformation\(callback: AsyncCallback\<Array\<CellInformation\>\>\): void
Obtains cell information. This API uses an asynchronous callback to return the result. Obtains cell information. This API uses an asynchronous callback to return the result.
...@@ -1498,6 +1511,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1498,6 +1511,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1515,7 +1529,7 @@ radio.getCellInformation((err, data) => { ...@@ -1515,7 +1529,7 @@ radio.getCellInformation((err, data) => {
## radio.getCellInformation<sup>8+</sup> ## radio.getCellInformation<sup>8+</sup>
getCellInformation(slotId: number, callback: AsyncCallback<Array<CellInformation\>\>): void getCellInformation\(slotId: number, callback: AsyncCallback\<Array\<CellInformation\>\>\): void
Obtains cell information for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains cell information for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1539,6 +1553,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1539,6 +1553,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1557,7 +1572,7 @@ radio.getCellInformation(slotId, (err, data) => { ...@@ -1557,7 +1572,7 @@ radio.getCellInformation(slotId, (err, data) => {
## radio.getCellInformation<sup>8+</sup> ## radio.getCellInformation<sup>8+</sup>
getCellInformation(slotId?: number): Promise<Array<CellInformation\>\> getCellInformation\(slotId?: number\): Promise\<Array\<CellInformation\>\>
Obtains cell information for the SIM card in the specified slot. This API uses a promise to return the result. Obtains cell information for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1586,6 +1601,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1586,6 +1601,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1606,7 +1622,7 @@ promise.then(data => { ...@@ -1606,7 +1622,7 @@ promise.then(data => {
## radio.setNetworkSelectionMode ## radio.setNetworkSelectionMode
setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCallback<void\>\): void setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCallback\<void\>\): void
Sets the network selection mode. This API uses an asynchronous callback to return the result. Sets the network selection mode. This API uses an asynchronous callback to return the result.
...@@ -1630,6 +1646,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1630,6 +1646,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1658,7 +1675,7 @@ radio.setNetworkSelectionMode(networkSelectionModeOptions, (err) => { ...@@ -1658,7 +1675,7 @@ radio.setNetworkSelectionMode(networkSelectionModeOptions, (err) => {
## radio.setNetworkSelectionMode ## radio.setNetworkSelectionMode
setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise<void\> setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise\<void\>
Sets the network selection mode. This API uses a promise to return the result. Sets the network selection mode. This API uses a promise to return the result.
...@@ -1687,6 +1704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1687,6 +1704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1718,7 +1736,7 @@ promise.then(() => { ...@@ -1718,7 +1736,7 @@ promise.then(() => {
## radio.getNetworkSearchInformation ## radio.getNetworkSearchInformation
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.
...@@ -1742,6 +1760,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1742,6 +1760,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1758,7 +1777,7 @@ radio.getNetworkSearchInformation(0, (err, data) => { ...@@ -1758,7 +1777,7 @@ radio.getNetworkSearchInformation(0, (err, data) => {
## radio.getNetworkSearchInformation ## radio.getNetworkSearchInformation
getNetworkSearchInformation\(slotId: number\): Promise<NetworkSearchResult\> getNetworkSearchInformation\(slotId: number\): Promise\<NetworkSearchResult\>
Obtains network search information for the SIM card in the specified slot. This API uses a promise to return the result. Obtains network search information for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1787,6 +1806,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1787,6 +1806,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1806,7 +1826,7 @@ promise.then(data => { ...@@ -1806,7 +1826,7 @@ promise.then(data => {
## radio.getNrOptionMode<sup>8+</sup> ## radio.getNrOptionMode<sup>8+</sup>
getNrOptionMode(callback: AsyncCallback<NrOptionMode\>): void getNrOptionMode\(callback: AsyncCallback\<NrOptionMode\>\): void
Obtains the NR option mode. This API uses an asynchronous callback to return the result. Obtains the NR option mode. This API uses an asynchronous callback to return the result.
...@@ -1826,6 +1846,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1826,6 +1846,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1843,7 +1864,7 @@ radio.getNrOptionMode((err, data) => { ...@@ -1843,7 +1864,7 @@ radio.getNrOptionMode((err, data) => {
## radio.getNrOptionMode<sup>8+</sup> ## radio.getNrOptionMode<sup>8+</sup>
getNrOptionMode(slotId: number, callback: AsyncCallback<NrOptionMode\>): void getNrOptionMode\(slotId: number, callback: AsyncCallback\<NrOptionMode\>\): void
Obtains the NR option mode for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the NR option mode for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1864,6 +1885,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1864,6 +1885,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1882,7 +1904,7 @@ radio.getNrOptionMode(slotId, (err, data) => { ...@@ -1882,7 +1904,7 @@ radio.getNrOptionMode(slotId, (err, data) => {
## radio.getNrOptionMode<sup>8+</sup> ## radio.getNrOptionMode<sup>8+</sup>
getNrOptionMode(slotId?: number): Promise<NrOptionMode\> getNrOptionMode\(slotId?: number\): Promise\<NrOptionMode\>
Obtains the NR option mode for the SIM card in the specified slot. This API uses a promise to return the result. Obtains the NR option mode for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1908,6 +1930,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1908,6 +1930,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1928,7 +1951,7 @@ promise.then(data => { ...@@ -1928,7 +1951,7 @@ promise.then(data => {
## radio.turnOnRadio<sup>7+</sup> ## radio.turnOnRadio<sup>7+</sup>
turnOnRadio(callback: AsyncCallback<void\>): void turnOnRadio\(callback: AsyncCallback\<void\>\): void
Turns on the radio function. This API uses an asynchronous callback to return the result. Turns on the radio function. This API uses an asynchronous callback to return the result.
...@@ -1951,6 +1974,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1951,6 +1974,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1968,7 +1992,7 @@ radio.turnOnRadio((err) => { ...@@ -1968,7 +1992,7 @@ radio.turnOnRadio((err) => {
## radio.turnOnRadio<sup>7+</sup> ## radio.turnOnRadio<sup>7+</sup>
turnOnRadio(slotId: number, callback: AsyncCallback<void\>): void turnOnRadio\(slotId: number, callback: AsyncCallback\<void\>\): void
Turns on the radio function for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Turns on the radio function for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1992,6 +2016,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1992,6 +2016,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2010,7 +2035,7 @@ radio.turnOnRadio(slotId, (err) => { ...@@ -2010,7 +2035,7 @@ radio.turnOnRadio(slotId, (err) => {
## radio.turnOnRadio<sup>7+</sup> ## radio.turnOnRadio<sup>7+</sup>
turnOnRadio(slotId?: number): Promise<void\> turnOnRadio(slotId?: number): Promise\<void\>
Turns on the radio function for the SIM card in the specified slot. This API uses a promise to return the result. Turns on the radio function for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2039,6 +2064,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2039,6 +2064,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2058,7 +2084,7 @@ radio.turnOnRadio(slotId).then(() => { ...@@ -2058,7 +2084,7 @@ radio.turnOnRadio(slotId).then(() => {
## radio.turnOffRadio<sup>7+</sup> ## radio.turnOffRadio<sup>7+</sup>
turnOffRadio(callback: AsyncCallback<void\>): void turnOffRadio\(callback: AsyncCallback\<void\>\): void
Turns off the radio function. This API uses an asynchronous callback to return the result. Turns off the radio function. This API uses an asynchronous callback to return the result.
...@@ -2081,6 +2107,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2081,6 +2107,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2098,7 +2125,7 @@ radio.turnOffRadio((err) => { ...@@ -2098,7 +2125,7 @@ radio.turnOffRadio((err) => {
## radio.turnOffRadio<sup>7+</sup> ## radio.turnOffRadio<sup>7+</sup>
turnOffRadio(slotId: number, callback: AsyncCallback<void\>): void turnOffRadio\(slotId: number, callback: AsyncCallback\<void\>\): void
Turns off the radio function for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Turns off the radio function for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2122,6 +2149,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2122,6 +2149,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2140,7 +2168,7 @@ radio.turnOffRadio(slotId, (err) => { ...@@ -2140,7 +2168,7 @@ radio.turnOffRadio(slotId, (err) => {
## radio.turnOffRadio<sup>7+</sup> ## radio.turnOffRadio<sup>7+</sup>
turnOffRadio(slotId?: number): Promise<void\> turnOffRadio\(slotId?: number\): Promise\<void\>
Turns off the radio function for the SIM card in the specified slot. This API uses a promise to return the result. Turns off the radio function for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2169,6 +2197,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2169,6 +2197,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2188,7 +2217,7 @@ radio.turnOffRadio(slotId).then(() => { ...@@ -2188,7 +2217,7 @@ radio.turnOffRadio(slotId).then(() => {
## radio.setPreferredNetwork<sup>8+</sup> ## radio.setPreferredNetwork<sup>8+</sup>
setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback<void\>\): void setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\<void\>\): void
Sets the preferred network for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Sets the preferred network for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2213,6 +2242,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2213,6 +2242,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2230,7 +2260,7 @@ radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_M ...@@ -2230,7 +2260,7 @@ radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_M
## radio.setPreferredNetwork<sup>8+</sup> ## radio.setPreferredNetwork<sup>8+</sup>
setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise<void\> setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode\): Promise\<void\>
Sets the preferred network for the SIM card in the specified slot. This API uses a promise to return the result. Sets the preferred network for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2260,6 +2290,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2260,6 +2290,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2279,7 +2310,7 @@ radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_M ...@@ -2279,7 +2310,7 @@ radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_M
## radio.getPreferredNetwork<sup>8+</sup> ## radio.getPreferredNetwork<sup>8+</sup>
getPreferredNetwork\(slotId: number, callback: AsyncCallback<PreferredNetworkMode\>\): void getPreferredNetwork\(slotId: number, callback: AsyncCallback\<PreferredNetworkMode\>\): void
Obtains the preferred network for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the preferred network for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2303,6 +2334,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2303,6 +2334,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2319,7 +2351,7 @@ radio.getPreferredNetwork(0, (err, data) => { ...@@ -2319,7 +2351,7 @@ radio.getPreferredNetwork(0, (err, data) => {
## radio.getPreferredNetwork<sup>8+</sup> ## radio.getPreferredNetwork<sup>8+</sup>
getPreferredNetwork(slotId: number): Promise<PreferredNetworkMode\> getPreferredNetwork\(slotId: number\): Promise\<PreferredNetworkMode\>
Obtains the preferred network for the SIM card in the specified slot. This API uses a promise to return the result. Obtains the preferred network for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2348,6 +2380,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2348,6 +2380,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2367,7 +2400,7 @@ promise.then(data => { ...@@ -2367,7 +2400,7 @@ promise.then(data => {
## radio.getImsRegInfo<sup>9+</sup> ## radio.getImsRegInfo<sup>9+</sup>
getImsRegInfo(slotId: number, imsType: ImsServiceType, callback: AsyncCallback<ImsRegInfo\>): void getImsRegInfo\(slotId: number, imsType: ImsServiceType, callback: AsyncCallback\<ImsRegInfo\>\): void
Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2392,6 +2425,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2392,6 +2425,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2408,7 +2442,7 @@ radio.getImsRegInfo(0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { ...@@ -2408,7 +2442,7 @@ radio.getImsRegInfo(0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => {
## radio.getImsRegInfo<sup>9+</sup> ## radio.getImsRegInfo<sup>9+</sup>
getImsRegInfo(slotId: number, imsType: ImsServiceType): Promise<ImsRegInfo\> getImsRegInfo\(slotId: number, imsType: ImsServiceType\): Promise\<ImsRegInfo\>
Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses a promise to return the result. Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2438,6 +2472,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2438,6 +2472,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2457,7 +2492,7 @@ promise.then(data => { ...@@ -2457,7 +2492,7 @@ promise.then(data => {
## radio.on('imsRegStateChange')<sup>9+</sup> ## radio.on('imsRegStateChange')<sup>9+</sup>
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. 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.
...@@ -2483,6 +2518,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2483,6 +2518,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2499,7 +2535,7 @@ radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { ...@@ -2499,7 +2535,7 @@ radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
## radio.off('imsRegStateChange')<sup>9+</sup> ## radio.off('imsRegStateChange')<sup>9+</sup>
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. 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.
...@@ -2516,7 +2552,7 @@ Disables listening for **imsRegStateChange** events. This API uses an asynchrono ...@@ -2516,7 +2552,7 @@ Disables listening for **imsRegStateChange** events. This API uses an asynchrono
| type | string | Yes | IMS registration status changes. | | type | string | Yes | IMS registration status changes. |
| 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|
| 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. If this parameter is not set, the API unsubscribes from all callbacks.|
**Error codes** **Error codes**
...@@ -2525,6 +2561,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2525,6 +2561,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2539,6 +2576,101 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { ...@@ -2539,6 +2576,101 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => {
}); });
``` ```
## radio.getBasebandVersion<sup>10+</sup>
getBasebandVersion\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the baseband version of the device. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**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|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. Baseband version of the device. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example**
```js
let slotId = 0;
radio.getBasebandVersion(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
## radio.getBasebandVersion<sup>10+</sup>
getBasebandVersion\(slotId: number\): Promise\<string\>
Obtains the baseband version of the device. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE
**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 |
| ----------------- | -------------------------------------- |
| Promise\<string\> | Promise used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example**
```js
let slotId = 0;
let promise = radio.getBasebandVersion(slotId);
promise.then(data => {
console.log(`getBasebandVersion success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
console.error(`getBasebandVersion failed, promise: err->${JSON.stringify(err)}`);
});
```
## RadioTechnology ## RadioTechnology
Enumerates radio access technologies. Enumerates radio access technologies.
......
# @ohos.resourceManager (Resource Manager) # @ohos.resourceManager (Resource Manager)
The Resource Manager module provides APIs to obtain information about application resources based on the current configuration, including the language, region, screen direction, MCC/MNC, as well as device capability and density. The **resourceManager** module provides APIs to obtain information about application resources based on the current configuration, including the language, region, screen direction, MCC/MNC, as well as device capability and density.
> **NOTE** > **NOTE**
> >
...@@ -13,7 +13,7 @@ The Resource Manager module provides APIs to obtain information about applicatio ...@@ -13,7 +13,7 @@ The Resource Manager module provides APIs to obtain information about applicatio
import resourceManager from '@ohos.resourceManager'; import resourceManager from '@ohos.resourceManager';
``` ```
## Instruction ## How to Use
Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model. For the FA model, you need to import the required bundle and then call the [getResourceManager](#resourcemanagergetresourcemanager) API to obtain a **ResourceManager** object. Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model. For the FA model, you need to import the required bundle and then call the [getResourceManager](#resourcemanagergetresourcemanager) API to obtain a **ResourceManager** object.
For details about how to reference context in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md). For details about how to reference context in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md).
...@@ -171,12 +171,12 @@ Enumerates the device types. ...@@ -171,12 +171,12 @@ Enumerates the device types.
| Name | Value | Description | | Name | Value | Description |
| -------------------- | ---- | ---- | | -------------------- | ---- | ---- |
| DEVICE_TYPE_PHONE | 0x00 | Phone | | DEVICE_TYPE_PHONE | 0x00 | Phone. |
| DEVICE_TYPE_TABLET | 0x01 | Tablet | | DEVICE_TYPE_TABLET | 0x01 | Tablet. |
| DEVICE_TYPE_CAR | 0x02 | Head unit | | DEVICE_TYPE_CAR | 0x02 | Head unit. |
| DEVICE_TYPE_PC | 0x03 | PC | | DEVICE_TYPE_PC | 0x03 | PC. |
| DEVICE_TYPE_TV | 0x04 | TV | | DEVICE_TYPE_TV | 0x04 | TV. |
| DEVICE_TYPE_WEARABLE | 0x06 | Wearable | | DEVICE_TYPE_WEARABLE | 0x06 | Wearable. |
## ScreenDensity ## ScreenDensity
...@@ -253,7 +253,7 @@ Defines the descriptor of the raw file. ...@@ -253,7 +253,7 @@ Defines the descriptor of the raw file.
| Name | Type | Readable | Writable | Description | | Name | Type | Readable | Writable | Description |
| ------ | ------ | ---- | ---- | ------------------ | | ------ | ------ | ---- | ---- | ------------------ |
| fd | number | Yes | No| Descriptor of the raw file.| | fd | number | Yes | No| File descriptor of the HAP where the raw file is located.|
| offset | number | Yes | No| Start offset of the raw file. | | offset | number | Yes | No| Start offset of the raw file. |
| length | number | Yes | No| Length of the raw file. | | length | number | Yes | No| Length of the raw file. |
...@@ -278,7 +278,7 @@ Defines the capability of accessing application resources. ...@@ -278,7 +278,7 @@ Defines the capability of accessing application resources.
> **NOTE** > **NOTE**
> >
> - The APIs involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm. > - The methods involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm.
> >
> - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**. > - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**.
...@@ -343,10 +343,10 @@ Obtains the string corresponding to the specified resource ID. This API uses a p ...@@ -343,10 +343,10 @@ Obtains the string corresponding to the specified resource ID. This API uses a p
| --------------------- | ----------- | | --------------------- | ----------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -382,10 +382,10 @@ Obtains the string corresponding to the specified resource object. This API uses ...@@ -382,10 +382,10 @@ Obtains the string corresponding to the specified resource object. This API uses
| resource | [Resource](#resource9) | Yes | Resource object. | | resource | [Resource](#resource9) | Yes | Resource object. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -434,10 +434,10 @@ Obtains the string corresponding to the specified resource object. This API uses ...@@ -434,10 +434,10 @@ Obtains the string corresponding to the specified resource object. This API uses
| --------------------- | ---------------- | | --------------------- | ---------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -478,10 +478,10 @@ Obtains the string array corresponding to the specified resource ID. This API us ...@@ -478,10 +478,10 @@ Obtains the string array corresponding to the specified resource ID. This API us
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -524,10 +524,10 @@ Obtains the string array corresponding to the specified resource ID. This API us ...@@ -524,10 +524,10 @@ Obtains the string array corresponding to the specified resource ID. This API us
| ---------------------------------- | ------------- | | ---------------------------------- | ------------- |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the result.| | Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -562,10 +562,10 @@ Obtains the string array corresponding to the specified resource object. This AP ...@@ -562,10 +562,10 @@ Obtains the string array corresponding to the specified resource object. This AP
| resource | [Resource](#resource9) | Yes | Resource object. | | resource | [Resource](#resource9) | Yes | Resource object. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -612,10 +612,10 @@ Obtains the string array corresponding to the specified resource object. This AP ...@@ -612,10 +612,10 @@ Obtains the string array corresponding to the specified resource object. This AP
| ---------------------------------- | ------------------ | | ---------------------------------- | ------------------ |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the result.| | Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -640,7 +640,6 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -640,7 +640,6 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContent<sup>9+</sup> ### getMediaContent<sup>9+</sup>
getMediaContent(resId: number, callback: AsyncCallback&lt;Uint8Array&gt;): void getMediaContent(resId: number, callback: AsyncCallback&lt;Uint8Array&gt;): void
...@@ -656,10 +655,10 @@ Obtains the content of the media file corresponding to the specified resource ID ...@@ -656,10 +655,10 @@ Obtains the content of the media file corresponding to the specified resource ID
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -680,6 +679,45 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -680,6 +679,45 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContent<sup>10+</sup>
getMediaContent(resId: number, density: number, callback: AsyncCallback&lt;Uint8Array&gt;): void
Obtains the content of the media file with the screen density corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------------- | ---- | ------------------ |
| resId | number | Yes | Resource ID. |
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
**Example**
```ts
try {
this.context.resourceManager.getMediaContent($r('app.media.test').id, 120, (error, value) => {
if (error != null) {
console.error(`callback getMediaContent failed, error code: ${error.code}, message: ${error.message}.`);
} else {
let media = value;
}
});
} catch (error) {
console.error(`callback getMediaContent failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaContent<sup>9+</sup> ### getMediaContent<sup>9+</sup>
...@@ -701,10 +739,10 @@ Obtains the content of the media file corresponding to the specified resource ID ...@@ -701,10 +739,10 @@ Obtains the content of the media file corresponding to the specified resource ID
| ------------------------- | -------------- | | ------------------------- | -------------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the result.| | Promise&lt;Uint8Array&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -723,6 +761,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -723,6 +761,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContent<sup>10+</sup>
getMediaContent(resId: number, density: number): Promise&lt;Uint8Array&gt;
Obtains the content of the media file with the screen density corresponding to the specified resource ID. This API uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----- |
| resId | number | Yes | Resource ID.|
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
**Return value**
| Type | Description |
| ------------------------- | -------------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
**Example**
```ts
try {
this.context.resourceManager.getMediaContent($r('app.media.test').id, 120).then(value => {
let media = value;
}).catch(error => {
console.error(`promise getMediaContent failed, error code: ${error.code}, message: ${error.message}.`);
});
} catch (error) {
console.error(`promise getMediaContent failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaContent<sup>9+</sup> ### getMediaContent<sup>9+</sup>
getMediaContent(resource: Resource, callback: AsyncCallback&lt;Uint8Array&gt;): void getMediaContent(resource: Resource, callback: AsyncCallback&lt;Uint8Array&gt;): void
...@@ -738,10 +819,10 @@ Obtains the content of the media file corresponding to the specified resource ob ...@@ -738,10 +819,10 @@ Obtains the content of the media file corresponding to the specified resource ob
| resource | [Resource](#resource9) | Yes | Resource object. | | resource | [Resource](#resource9) | Yes | Resource object. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -767,6 +848,51 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -767,6 +848,51 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContent<sup>10+</sup>
getMediaContent(resource: Resource, density: number, callback: AsyncCallback&lt;Uint8Array&gt;): void
Obtains the content of the media file with the screen density corresponding to the specified resource object. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------------- | ---- | ------------------ |
| resource | [Resource](#resource9) | Yes | Resource object. |
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
**Example**
```ts
let resource = {
bundleName: "com.example.myapplication",
moduleName: "entry",
id: $r('app.media.test').id
};
try {
this.context.resourceManager.getMediaContent(resource, 120, (error, value) => {
if (error != null) {
console.error(`callback getMediaContent failed, error code: ${error.code}, message: ${error.message}.`);
} else {
let media = value;
}
});
} catch (error) {
console.error(`callback getMediaContent failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaContent<sup>9+</sup> ### getMediaContent<sup>9+</sup>
getMediaContent(resource: Resource): Promise&lt;Uint8Array&gt; getMediaContent(resource: Resource): Promise&lt;Uint8Array&gt;
...@@ -787,10 +913,10 @@ Obtains the content of the media file corresponding to the specified resource ob ...@@ -787,10 +913,10 @@ Obtains the content of the media file corresponding to the specified resource ob
| ------------------------- | ------------------- | | ------------------------- | ------------------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the result.| | Promise&lt;Uint8Array&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -814,6 +940,53 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -814,6 +940,53 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContent<sup>10+</sup>
getMediaContent(resource: Resource, density: number): Promise&lt;Uint8Array&gt;
Obtains the content of the media file with the screen density corresponding to the specified resource object. This API uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ---- |
| resource | [Resource](#resource9) | Yes | Resource object.|
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
**Return value**
| Type | Description |
| ------------------------- | ------------------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
**Example**
```ts
let resource = {
bundleName: "com.example.myapplication",
moduleName: "entry",
id: $r('app.media.test').id
};
try {
this.context.resourceManager.getMediaContent(resource, 120).then(value => {
let media = value;
}).catch(error => {
console.error(`promise getMediaContent failed, error code: ${error.code}, message: ${error.message}.`);
});
} catch (error) {
console.error(`promise getMediaContent failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaContentBase64<sup>9+</sup> ### getMediaContentBase64<sup>9+</sup>
...@@ -830,10 +1003,10 @@ Obtains the Base64 code of the image corresponding to the specified resource ID. ...@@ -830,10 +1003,10 @@ Obtains the Base64 code of the image corresponding to the specified resource ID.
| resId | number | Yes | Resource ID. | | resId | number | Yes | Resource ID. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -854,6 +1027,45 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -854,6 +1027,45 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContentBase64<sup>10+</sup>
getMediaContentBase64(resId: number, density: number, callback: AsyncCallback&lt;string&gt;): void
Obtains the Base64 code of an image with the screen density corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | ------------------------ |
| resId | number | Yes | Resource ID. |
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
**Example**
```ts
try {
this.context.resourceManager.getMediaContentBase64($r('app.media.test').id, 120, (error, value) => {
if (error != null) {
console.error(`callback getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`);
} else {
let media = value;
}
});
} catch (error) {
console.error(`callback getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaContentBase64<sup>9+</sup> ### getMediaContentBase64<sup>9+</sup>
...@@ -875,10 +1087,10 @@ Obtains the Base64 code of the image corresponding to the specified resource ID. ...@@ -875,10 +1087,10 @@ Obtains the Base64 code of the image corresponding to the specified resource ID.
| --------------------- | -------------------- | | --------------------- | -------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -897,6 +1109,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -897,6 +1109,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContentBase64<sup>10+</sup>
getMediaContentBase64(resId: number, density: number): Promise&lt;string&gt;
Obtains the Base64 code of an image with the screen density corresponding to the specified resource ID. This API uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ----- | ------ | ---- | ----- |
| resId | number | Yes | Resource ID.|
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
**Return value**
| Type | Description |
| --------------------- | -------------------- |
| Promise&lt;string&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
**Example**
```ts
try {
this.context.resourceManager.getMediaContentBase64($r('app.media.test').id, 120).then(value => {
let media = value;
}).catch(error => {
console.error(`promise getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`);
});
} catch (error) {
console.error(`promise getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaContentBase64<sup>9+</sup> ### getMediaContentBase64<sup>9+</sup>
getMediaContentBase64(resource: Resource, callback: AsyncCallback&lt;string&gt;): void getMediaContentBase64(resource: Resource, callback: AsyncCallback&lt;string&gt;): void
...@@ -912,10 +1167,10 @@ Obtains the Base64 code of the image corresponding to the specified resource obj ...@@ -912,10 +1167,10 @@ Obtains the Base64 code of the image corresponding to the specified resource obj
| resource | [Resource](#resource9) | Yes | Resource object. | | resource | [Resource](#resource9) | Yes | Resource object. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -941,6 +1196,51 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -941,6 +1196,51 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContentBase64<sup>10+</sup>
getMediaContentBase64(resource: Resource, density: number, callback: AsyncCallback&lt;string&gt;): void
Obtains the Base64 code of an image with the screen density corresponding to the specified resource object. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | ------------------------ |
| resource | [Resource](#resource9) | Yes | Resource object. |
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
**Example**
```ts
let resource = {
bundleName: "com.example.myapplication",
moduleName: "entry",
id: $r('app.media.test').id
};
try {
this.context.resourceManager.getMediaContentBase64(resource, 120, (error, value) => {
if (error != null) {
console.error(`promise getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`);
} else {
let media = value;
}
});
} catch (error) {
console.error(`promise getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaContentBase64<sup>9+</sup> ### getMediaContentBase64<sup>9+</sup>
getMediaContentBase64(resource: Resource): Promise&lt;string&gt; getMediaContentBase64(resource: Resource): Promise&lt;string&gt;
...@@ -961,10 +1261,10 @@ Obtains the Base64 code of the image corresponding to the specified resource obj ...@@ -961,10 +1261,10 @@ Obtains the Base64 code of the image corresponding to the specified resource obj
| --------------------- | ------------------------- | | --------------------- | ------------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -988,6 +1288,53 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -988,6 +1288,53 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaContentBase64<sup>10+</sup>
getMediaContentBase64(resource: Resource, density: number): Promise&lt;string&gt;
Obtains the Base64 code of an image with the screen density corresponding to the specified resource object. This API uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ---------------------- | ---- | ---- |
| resource | [Resource](#resource9) | Yes | Resource object.|
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
**Return value**
| Type | Description |
| --------------------- | ------------------------- |
| Promise&lt;string&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. |
| 9001002 | If the resource not found by resId. |
**Example**
```ts
let resource = {
bundleName: "com.example.myapplication",
moduleName: "entry",
id: $r('app.media.test').id
};
try {
this.context.resourceManager.getMediaContentBase64(resource, 120).then(value => {
let media = value;
}).catch(error => {
console.error(`promise getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`);
});
} catch (error) {
console.error(`promise getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getConfiguration ### getConfiguration
...@@ -1117,10 +1464,10 @@ Obtains the singular-plural string corresponding to the specified resource ID ba ...@@ -1117,10 +1464,10 @@ Obtains the singular-plural string corresponding to the specified resource ID ba
| num | number | Yes | Number. | | num | number | Yes | Number. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -1164,10 +1511,10 @@ Obtains the singular-plural string corresponding to the specified resource ID ba ...@@ -1164,10 +1511,10 @@ Obtains the singular-plural string corresponding to the specified resource ID ba
| --------------------- | ------------------------- | | --------------------- | ------------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -1203,10 +1550,10 @@ Obtains the singular-plural string corresponding to the specified resource objec ...@@ -1203,10 +1550,10 @@ Obtains the singular-plural string corresponding to the specified resource objec
| num | number | Yes | Number. | | num | number | Yes | Number. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -1255,10 +1602,10 @@ Obtains the singular-plural string corresponding to the specified resource objec ...@@ -1255,10 +1602,10 @@ Obtains the singular-plural string corresponding to the specified resource objec
| --------------------- | ------------------------------ | | --------------------- | ------------------------------ |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -1299,10 +1646,10 @@ Obtains the content of the raw file in the **resources/rawfile** directory. This ...@@ -1299,10 +1646,10 @@ Obtains the content of the raw file in the **resources/rawfile** directory. This
| path | string | Yes | Path of the raw file. | | path | string | Yes | Path of the raw file. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001005 | If the resource not found by path. | | 9001005 | If the resource not found by path. |
...@@ -1343,10 +1690,10 @@ Obtains the content of the raw file in the **resources/rawfile** directory. This ...@@ -1343,10 +1690,10 @@ Obtains the content of the raw file in the **resources/rawfile** directory. This
| ------------------------- | ----------- | | ------------------------- | ----------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the result.| | Promise&lt;Uint8Array&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001005 | If the resource not found by path. | | 9001005 | If the resource not found by path. |
...@@ -1380,10 +1727,10 @@ Obtains the descriptor of the raw file in the **resources/rawfile** directory. T ...@@ -1380,10 +1727,10 @@ Obtains the descriptor of the raw file in the **resources/rawfile** directory. T
| path | string | Yes | Path of the raw file. | | path | string | Yes | Path of the raw file. |
| callback | AsyncCallback&lt;[RawFileDescriptor](#rawfiledescriptor8)&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;[RawFileDescriptor](#rawfiledescriptor8)&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001005 | If the resource not found by path. | | 9001005 | If the resource not found by path. |
...@@ -1425,10 +1772,10 @@ Obtains the descriptor of the raw file in the **resources/rawfile** directory. T ...@@ -1425,10 +1772,10 @@ Obtains the descriptor of the raw file in the **resources/rawfile** directory. T
| ---------------------------------------- | ------------------- | | ---------------------------------------- | ------------------- |
| Promise&lt;[RawFileDescriptor](#rawfiledescriptor8)&gt; | Promise used to return the result.| | Promise&lt;[RawFileDescriptor](#rawfiledescriptor8)&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001005 | If the resource not found by path. | | 9001005 | If the resource not found by path. |
...@@ -1448,6 +1795,86 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -1448,6 +1795,86 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
}; };
``` ```
### getRawFileList<sup>10+</sup>
getRawFileList(path: string, callback: AsyncCallback&lt;Array\<string\>&gt;): void;
Obtains the list of files in the **resources/rawfile** directory. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------------- | ---- | ----------------------- |
| path | string | Yes | Path of the **rawfile** folder. |
| callback | AsyncCallback&lt;Array\<string\>&gt; | Yes| Callback used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001005 | If the resource not found by path. |
**Example**
```ts
try { // Passing "" means to obtain the list of files in the root directory of the raw file.
this.context.resourceManager.getRawFileList("", (error, value) => {
if (error != null) {
console.error(`callback getRawFileList failed, error code: ${error.code}, message: ${error.message}.`)
} else {
let rawFile = value;
}
});
} catch (error) {
console.error(`callback getRawFileList failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getRawFileList<sup>10+</sup>
getRawFileList(path: string): Promise&lt;Array\<string\>&gt;
Obtains the list of files in the **resources/rawfile** directory. This API uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ---- | ------ | ---- | ----------- |
| path | string | Yes | Path of the **rawfile** folder.|
**Return value**
| Type | Description |
| ------------------------- | ----------- |
| Promise&lt;Array\<string\>&gt; | List of files in the **rawfile** folder.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001005 | If the resource not found by path. |
**Example**
```ts
try { // Passing "" means to obtain the list of files in the root directory of the raw file.
this.context.resourceManager.getRawFileList("").then(value => {
let rawFile = value;
}).catch(error => {
console.error(`promise getRawFileList failed, error code: ${error.code}, message: ${error.message}.`)
});
} catch (error) {
console.error(`promise getRawFileList failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### closeRawFileDescriptor<sup>8+</sup> ### closeRawFileDescriptor<sup>8+</sup>
closeRawFileDescriptor(path: string, callback: AsyncCallback&lt;void&gt;): void closeRawFileDescriptor(path: string, callback: AsyncCallback&lt;void&gt;): void
...@@ -1521,10 +1948,10 @@ Closes the descriptor of the raw file in the **resources/rawfile** directory. Th ...@@ -1521,10 +1948,10 @@ Closes the descriptor of the raw file in the **resources/rawfile** directory. Th
| path | string | Yes | Path of the raw file.| | path | string | Yes | Path of the raw file.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001005 | The resource not found by path. | | 9001005 | The resource not found by path. |
...@@ -1563,10 +1990,10 @@ Closes the descriptor of the raw file in the **resources/rawfile** directory. Th ...@@ -1563,10 +1990,10 @@ Closes the descriptor of the raw file in the **resources/rawfile** directory. Th
| ------------------- | ---- | | ------------------- | ---- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001005 | If the resource not found by path. | | 9001005 | If the resource not found by path. |
...@@ -1614,10 +2041,10 @@ Obtains the string corresponding to the specified resource name. This API uses a ...@@ -1614,10 +2041,10 @@ Obtains the string corresponding to the specified resource name. This API uses a
| resName | string | Yes | Resource name. | | resName | string | Yes | Resource name. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -1658,12 +2085,12 @@ Obtains the string corresponding to the specified resource name. This API uses a ...@@ -1658,12 +2085,12 @@ Obtains the string corresponding to the specified resource name. This API uses a
| Type | Description | | Type | Description |
| --------------------- | ---------- | | --------------------- | ---------- |
| Promise&lt;string&gt; | String corresponding to the resource name.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -1698,10 +2125,10 @@ Obtains the string array corresponding to the specified resource name. This API ...@@ -1698,10 +2125,10 @@ Obtains the string array corresponding to the specified resource name. This API
| resName | string | Yes | Resource name. | | resName | string | Yes | Resource name. |
| callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;Array&lt;string&gt;&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -1743,10 +2170,10 @@ Obtains the string array corresponding to the specified resource name. This API ...@@ -1743,10 +2170,10 @@ Obtains the string array corresponding to the specified resource name. This API
| ---------------------------------- | ------------ | | ---------------------------------- | ------------ |
| Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the result.| | Promise&lt;Array&lt;string&gt;&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -1781,15 +2208,14 @@ Obtains the content of the media file corresponding to the specified resource ID ...@@ -1781,15 +2208,14 @@ Obtains the content of the media file corresponding to the specified resource ID
| resName | string | Yes | Resource name. | | resName | string | Yes | Resource name. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
| 9001004 | If the resource not found by resName. | | 9001004 | If the resource not found by resName. |
| 9001006 | If the resource re-ref too much. |
**Example** **Example**
```ts ```ts
...@@ -1806,6 +2232,46 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -1806,6 +2232,46 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaByName<sup>10+</sup>
getMediaByName(resName: string, density: number, callback: AsyncCallback&lt;Uint8Array&gt;): void
Obtains the content of the media file with the screen density corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | ------------------------------- | ---- | ------------------ |
| resName | string | Yes | Resource name. |
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
| callback | AsyncCallback&lt;Uint8Array&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. |
| 9001004 | If the resource not found by resName. |
**Example**
```ts
try {
this.context.resourceManager.getMediaByName("test", 120, (error, value) => {
if (error != null) {
console.error(`callback getMediaByName failed, error code: ${error.code}, message: ${error.message}.`);
} else {
let media = value;
}
});
} catch (error) {
console.error(`callback getMediaByName failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaByName<sup>9+</sup> ### getMediaByName<sup>9+</sup>
getMediaByName(resName: string): Promise&lt;Uint8Array&gt; getMediaByName(resName: string): Promise&lt;Uint8Array&gt;
...@@ -1826,15 +2292,14 @@ Obtains the content of the media file corresponding to the specified resource na ...@@ -1826,15 +2292,14 @@ Obtains the content of the media file corresponding to the specified resource na
| ------------------------- | ------------- | | ------------------------- | ------------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the result.| | Promise&lt;Uint8Array&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
| 9001004 | If the resource not found by resName. | | 9001004 | If the resource not found by resName. |
| 9001006 | If the resource re-ref too much. |
**Example** **Example**
```ts ```ts
...@@ -1849,6 +2314,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -1849,6 +2314,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaByName<sup>10+</sup>
getMediaByName(resName: string, density: number): Promise&lt;Uint8Array&gt;
Obtains the content of the media file with the screen density corresponding to the specified resource name. This API uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ---- |
| resName | string | Yes | Resource name.|
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
**Return value**
| Type | Description |
| ------------------------- | ------------- |
| Promise&lt;Uint8Array&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. |
| 9001004 | If the resource not found by resName. |
**Example**
```ts
try {
this.context.resourceManager.getMediaByName("test", 120).then(value => {
let media = value;
}).catch(error => {
console.error(`promise getMediaByName failed, error code: ${error.code}, message: ${error.message}.`);
});
} catch (error) {
console.error(`promise getMediaByName failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaBase64ByName<sup>9+</sup> ### getMediaBase64ByName<sup>9+</sup>
getMediaBase64ByName(resName: string, callback: AsyncCallback&lt;string&gt;): void getMediaBase64ByName(resName: string, callback: AsyncCallback&lt;string&gt;): void
...@@ -1864,15 +2372,14 @@ Obtains the Base64 code of the image corresponding to the specified resource nam ...@@ -1864,15 +2372,14 @@ Obtains the Base64 code of the image corresponding to the specified resource nam
| resName | string | Yes | Resource name. | | resName | string | Yes | Resource name. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
| 9001004 | If the resource not found by resName. | | 9001004 | If the resource not found by resName. |
| 9001006 | If the resource re-ref too much. |
**Example** **Example**
```ts ```ts
...@@ -1889,6 +2396,46 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -1889,6 +2396,46 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaBase64ByName<sup>10+</sup>
getMediaBase64ByName(resName: string, density: number, callback: AsyncCallback&lt;string&gt;): void
Obtains the Base64 code of an image with the screen density corresponding to the specified resource name. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| -------- | --------------------------- | ---- | ------------------------ |
| resName | string | Yes | Resource name. |
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. |
| 9001004 | If the resource not found by resName. |
**Example**
```ts
try {
this.context.resourceManager.getMediaBase64ByName("test", 120, (error, value) => {
if (error != null) {
console.error(`callback getMediaBase64ByName failed, error code: ${error.code}, message: ${error.message}.`);
} else {
let media = value;
}
});
} catch (error) {
console.error(`callback getMediaBase64ByName failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getMediaBase64ByName<sup>9+</sup> ### getMediaBase64ByName<sup>9+</sup>
getMediaBase64ByName(resName: string): Promise&lt;string&gt; getMediaBase64ByName(resName: string): Promise&lt;string&gt;
...@@ -1909,15 +2456,14 @@ Obtains the Base64 code of the image corresponding to the specified resource nam ...@@ -1909,15 +2456,14 @@ Obtains the Base64 code of the image corresponding to the specified resource nam
| --------------------- | ------------------- | | --------------------- | ------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
| 9001004 | If the resource not found by resName. | | 9001004 | If the resource not found by resName. |
| 9001006 | If the resource re-ref too much. |
**Example** **Example**
```ts ```ts
...@@ -1932,6 +2478,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -1932,6 +2478,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
} }
``` ```
### getMediaBase64ByName<sup>10+</sup>
getMediaBase64ByName(resName: string, density: number): Promise&lt;string&gt;
Obtains the Base64 code of an image with the screen density corresponding to the specified resource name. This API uses a promise to return the result.
**System capability**: SystemCapability.Global.ResourceManager
**Parameters**
| Name | Type | Mandatory | Description |
| ------- | ------ | ---- | ---- |
| resName | string | Yes | Resource name.|
| [density](#screendensity) | number | Yes | Screen density. The value **0** indicates the default screen density. |
**Return value**
| Type | Description |
| --------------------- | ------------------- |
| Promise&lt;string&gt; | Promise used to return the result.|
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message|
| -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. |
| 9001004 | If the resource not found by resName. |
**Example**
```ts
try {
this.context.resourceManager.getMediaBase64ByName("test", 120).then(value => {
let media = value;
}).catch(error => {
console.error(`promise getMediaBase64ByName failed, error code: ${error.code}, message: ${error.message}.`);
});
} catch (error) {
console.error(`promise getMediaBase64ByName failed, error code: ${error.code}, message: ${error.message}.`)
}
```
### getPluralStringByName<sup>9+</sup> ### getPluralStringByName<sup>9+</sup>
getPluralStringByName(resName: string, num: number, callback: AsyncCallback&lt;string&gt;): void getPluralStringByName(resName: string, num: number, callback: AsyncCallback&lt;string&gt;): void
...@@ -1948,10 +2537,10 @@ Obtains the plural string corresponding to the specified resource name based on ...@@ -1948,10 +2537,10 @@ Obtains the plural string corresponding to the specified resource name based on
| num | number | Yes | Number. | | num | number | Yes | Number. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -1995,10 +2584,10 @@ Obtains the plural string corresponding to the specified resource name based on ...@@ -1995,10 +2584,10 @@ Obtains the plural string corresponding to the specified resource name based on
| --------------------- | ---------------------- | | --------------------- | ---------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -2036,12 +2625,12 @@ Obtains the string corresponding to the specified resource ID. This API returns ...@@ -2036,12 +2625,12 @@ Obtains the string corresponding to the specified resource ID. This API returns
| Type | Description | | Type | Description |
| ------ | ----------- | | ------ | ----------- |
| string | Promise used to return the result.| | string | String corresponding to the specified resource ID.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2078,10 +2667,10 @@ Obtains the string corresponding to the specified resource ID and formats the st ...@@ -2078,10 +2667,10 @@ Obtains the string corresponding to the specified resource ID and formats the st
| ------ | ---------------------------- | | ------ | ---------------------------- |
| string | Formatted string.| | string | Formatted string.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ----------------------------------------------- | | -------- | ----------------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2116,12 +2705,12 @@ Obtains the string corresponding to the specified resource object. This API retu ...@@ -2116,12 +2705,12 @@ Obtains the string corresponding to the specified resource object. This API retu
| Type | Description | | Type | Description |
| ------ | ---------------- | | ------ | ---------------- |
| string | Promise used to return the result.| | string | String corresponding to the specified resource object.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2163,10 +2752,10 @@ Obtains the string corresponding to the specified resource object and formats th ...@@ -2163,10 +2752,10 @@ Obtains the string corresponding to the specified resource object and formats th
| ------ | ---------------------------- | | ------ | ---------------------------- |
| string | Formatted string.| | string | Formatted string.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2208,10 +2797,10 @@ Obtains the string corresponding to the specified resource name. This API return ...@@ -2208,10 +2797,10 @@ Obtains the string corresponding to the specified resource name. This API return
| ------ | ---------- | | ------ | ---------- |
| string | String corresponding to the specified resource name.| | string | String corresponding to the specified resource name.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -2248,10 +2837,10 @@ Obtains the string corresponding to the specified resource name and formats the ...@@ -2248,10 +2837,10 @@ Obtains the string corresponding to the specified resource name and formats the
| ------ | ---------------------------- | | ------ | ---------------------------- |
| string | Formatted string.| | string | Formatted string.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -2288,10 +2877,10 @@ Obtains the Boolean result corresponding to the specified resource ID. This API ...@@ -2288,10 +2877,10 @@ Obtains the Boolean result corresponding to the specified resource ID. This API
| ------- | ------------ | | ------- | ------------ |
| boolean | Boolean result corresponding to the specified resource ID.| | boolean | Boolean result corresponding to the specified resource ID.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2326,10 +2915,10 @@ Obtains the Boolean result corresponding to the specified resource object. This ...@@ -2326,10 +2915,10 @@ Obtains the Boolean result corresponding to the specified resource object. This
| ------- | ----------------- | | ------- | ----------------- |
| boolean | Boolean result corresponding to the specified resource object.| | boolean | Boolean result corresponding to the specified resource object.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2370,10 +2959,10 @@ Obtains the Boolean result corresponding to the specified resource name. This AP ...@@ -2370,10 +2959,10 @@ Obtains the Boolean result corresponding to the specified resource name. This AP
| ------- | ----------- | | ------- | ----------- |
| boolean | Boolean result corresponding to the specified resource name.| | boolean | Boolean result corresponding to the specified resource name.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -2407,12 +2996,12 @@ Obtains the integer or float value corresponding to the specified resource ID. T ...@@ -2407,12 +2996,12 @@ Obtains the integer or float value corresponding to the specified resource ID. T
| Type | Description | | Type | Description |
| ------ | ---------- | | ------ | ---------- |
| number | Integer or float value corresponding to the specified resource ID. Wherein, the integer value is the original value, and the float value is the actual pixel value.| | number | Integer or float value corresponding to the specified resource ID. Wherein, the integer value is the original value, and the float value is the actual pixel value. For details, see the sample code.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2452,12 +3041,12 @@ Obtains the integer or float value corresponding to the specified resource objec ...@@ -2452,12 +3041,12 @@ Obtains the integer or float value corresponding to the specified resource objec
| Type | Description | | Type | Description |
| ------ | --------------- | | ------ | --------------- |
| number | Integer or float value corresponding to the specified resource object. Wherein, the integer value is the original value, and the float value is the actual pixel value.| | number | Integer or float value corresponding to the specified resource object. Wherein, the integer value is the original value, and the float value is the actual pixel value. For details, see the sample code.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2498,10 +3087,10 @@ Obtains the integer or float value corresponding to the specified resource name. ...@@ -2498,10 +3087,10 @@ Obtains the integer or float value corresponding to the specified resource name.
| ------ | --------- | | ------ | --------- |
| number | Integer or float value corresponding to the specified resource name.| | number | Integer or float value corresponding to the specified resource name.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -2542,12 +3131,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc ...@@ -2542,12 +3131,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc
| Type | Description | | Type | Description |
| ------ | ---------- | | ------ | ---------- |
| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| | DrawableDescriptor | **DrawableDescriptor** object corresponding to the specified resource ID.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2571,7 +3160,7 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ...@@ -2571,7 +3160,7 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco
getDrawableDescriptor(resource: Resource, density?: number): DrawableDescriptor; getDrawableDescriptor(resource: Resource, density?: number): DrawableDescriptor;
Obtains the **DrawableDescriptor** object corresponding to the specified resource. This API returns the result synchronously. Obtains the **DrawableDescriptor** object corresponding to the specified resource object. This API returns the result synchronously.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2586,12 +3175,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc ...@@ -2586,12 +3175,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc
| Type | Description | | Type | Description |
| ------- | ----------------- | | ------- | ----------------- |
| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| | DrawableDescriptor | **DrawableDescriptor** object corresponding to the specified resource ID.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001001 | If the resId invalid. | | 9001001 | If the resId invalid. |
...@@ -2635,12 +3224,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc ...@@ -2635,12 +3224,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc
| Type | Description | | Type | Description |
| ------ | --------- | | ------ | --------- |
| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| | DrawableDescriptor | **DrawableDescriptor** object corresponding to the specified resource ID.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes** **Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
| ID| Error Message| | ID| Error Message|
| -------- | ---------------------------------------- | | -------- | ---------------------------------------- |
| 9001003 | If the resName invalid. | | 9001003 | If the resName invalid. |
...@@ -2666,7 +3255,7 @@ getString(resId: number, callback: AsyncCallback&lt;string&gt;): void ...@@ -2666,7 +3255,7 @@ getString(resId: number, callback: AsyncCallback&lt;string&gt;): void
Obtains the string corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. Obtains the string corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getStringValue](#getstringvalue9). This API is deprecated since API version 9. You are advised to use [getStringValue](#getstringvalue9) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2697,7 +3286,7 @@ getString(resId: number): Promise&lt;string&gt; ...@@ -2697,7 +3286,7 @@ getString(resId: number): Promise&lt;string&gt;
Obtains the string corresponding to the specified resource ID. This API uses a promise to return the result. Obtains the string corresponding to the specified resource ID. This API uses a promise to return the result.
This API is deprecated since API version 9. You are advised to use [getStringValue](#getstringvalue9-1). This API is deprecated since API version 9. You are advised to use [getStringValue](#getstringvalue9-1) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2731,7 +3320,7 @@ getStringArray(resId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt; ...@@ -2731,7 +3320,7 @@ getStringArray(resId: number, callback: AsyncCallback&lt;Array&lt;string&gt;&gt;
Obtains the string array corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. Obtains the string array corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getStringArrayValue](#getstringarrayvalue9). This API is deprecated since API version 9. You are advised to use [getStringArrayValue](#getstringarrayvalue9) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2762,7 +3351,7 @@ getStringArray(resId: number): Promise&lt;Array&lt;string&gt;&gt; ...@@ -2762,7 +3351,7 @@ getStringArray(resId: number): Promise&lt;Array&lt;string&gt;&gt;
Obtains the string array corresponding to the specified resource ID. This API uses a promise to return the result. Obtains the string array corresponding to the specified resource ID. This API uses a promise to return the result.
This API is deprecated since API version 9. You are advised to use [getStringArrayValue](#getstringarrayvalue9-1). This API is deprecated since API version 9. You are advised to use [getStringArrayValue](#getstringarrayvalue9-1) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2796,7 +3385,7 @@ getMedia(resId: number, callback: AsyncCallback&lt;Uint8Array&gt;): void ...@@ -2796,7 +3385,7 @@ getMedia(resId: number, callback: AsyncCallback&lt;Uint8Array&gt;): void
Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getMediaContent](#getmediacontent9). This API is deprecated since API version 9. You are advised to use [getMediaContent](#getmediacontent9) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2827,7 +3416,7 @@ getMedia(resId: number): Promise&lt;Uint8Array&gt; ...@@ -2827,7 +3416,7 @@ getMedia(resId: number): Promise&lt;Uint8Array&gt;
Obtains the content of the media file corresponding to the specified resource ID. This API uses a promise to return the result. Obtains the content of the media file corresponding to the specified resource ID. This API uses a promise to return the result.
This API is deprecated since API version 9. You are advised to use [getMediaContent](#getmediacontent9-1). This API is deprecated since API version 9. You are advised to use [getMediaContent](#getmediacontent9-1) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2861,7 +3450,7 @@ getMediaBase64(resId: number, callback: AsyncCallback&lt;string&gt;): void ...@@ -2861,7 +3450,7 @@ getMediaBase64(resId: number, callback: AsyncCallback&lt;string&gt;): void
Obtains the Base64 code of the image corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. Obtains the Base64 code of the image corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getMediaContentBase64](#getmediacontentbase649). This API is deprecated since API version 9. You are advised to use [getMediaContentBase64](#getmediacontentbase649) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2892,7 +3481,7 @@ getMediaBase64(resId: number): Promise&lt;string&gt; ...@@ -2892,7 +3481,7 @@ getMediaBase64(resId: number): Promise&lt;string&gt;
Obtains the Base64 code of the image corresponding to the specified resource ID. This API uses a promise to return the result. Obtains the Base64 code of the image corresponding to the specified resource ID. This API uses a promise to return the result.
This API is deprecated since API version 9. You are advised to use [getMediaContentBase64](#getmediacontentbase649-1). This API is deprecated since API version 9. You are advised to use [getMediaContentBase64](#getmediacontentbase649-1) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2926,7 +3515,7 @@ getPluralString(resId: number, num: number): Promise&lt;string&gt; ...@@ -2926,7 +3515,7 @@ getPluralString(resId: number, num: number): Promise&lt;string&gt;
Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses a promise to return the result. Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses a promise to return the result.
This API is deprecated since API version 9. You are advised to use [getPluralStringValue](#getpluralstringvalue9). This API is deprecated since API version 9. You are advised to use [getPluralStringValue](#getpluralstringvalue9) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2961,7 +3550,7 @@ getPluralString(resId: number, num: number, callback: AsyncCallback&lt;string&gt ...@@ -2961,7 +3550,7 @@ getPluralString(resId: number, num: number, callback: AsyncCallback&lt;string&gt
Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses an asynchronous callback to return the result. Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getPluralStringValue](#getpluralstringvalue9-1). This API is deprecated since API version 9. You are advised to use [getPluralStringValue](#getpluralstringvalue9-1) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -2993,7 +3582,7 @@ getRawFile(path: string, callback: AsyncCallback&lt;Uint8Array&gt;): void ...@@ -2993,7 +3582,7 @@ getRawFile(path: string, callback: AsyncCallback&lt;Uint8Array&gt;): void
Obtains the content of the raw file in the **resources/rawfile** directory. This API uses an asynchronous callback to return the result. Obtains the content of the raw file in the **resources/rawfile** directory. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getRawFileContent](#getrawfilecontent9). This API is deprecated since API version 9. You are advised to use [getRawFileContent](#getrawfilecontent9) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -3024,7 +3613,7 @@ getRawFile(path: string): Promise&lt;Uint8Array&gt; ...@@ -3024,7 +3613,7 @@ getRawFile(path: string): Promise&lt;Uint8Array&gt;
Obtains the content of the raw file in the **resources/rawfile** directory. This API uses a promise to return the result. Obtains the content of the raw file in the **resources/rawfile** directory. This API uses a promise to return the result.
This API is deprecated since API version 9. You are advised to use [getRawFileContent](#getrawfilecontent9-1). This API is deprecated since API version 9. You are advised to use [getRawFileContent](#getrawfilecontent9-1) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -3058,7 +3647,7 @@ getRawFileDescriptor(path: string, callback: AsyncCallback&lt;RawFileDescriptor& ...@@ -3058,7 +3647,7 @@ getRawFileDescriptor(path: string, callback: AsyncCallback&lt;RawFileDescriptor&
Obtains the descriptor of the raw file in the **resources/rawfile** directory. This API uses an asynchronous callback to return the result. Obtains the descriptor of the raw file in the **resources/rawfile** directory. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getRawFd](#getrawfd9). This API is deprecated since API version 9. You are advised to use [getRawFd](#getrawfd9) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
...@@ -3090,7 +3679,7 @@ getRawFileDescriptor(path: string): Promise&lt;RawFileDescriptor&gt; ...@@ -3090,7 +3679,7 @@ getRawFileDescriptor(path: string): Promise&lt;RawFileDescriptor&gt;
Obtains the descriptor of the raw file in the **resources/rawfile** directory. This API uses a promise to return the result. Obtains the descriptor of the raw file in the **resources/rawfile** directory. This API uses a promise to return the result.
This API is deprecated since API version 9. You are advised to use [getRawFd](#getrawfd9-1). This API is deprecated since API version 9. You are advised to use [getRawFd](#getrawfd9-1) instead.
**System capability**: SystemCapability.Global.ResourceManager **System capability**: SystemCapability.Global.ResourceManager
......
# @ohos.runningLock (Runninglock) # @ohos.runningLock (Running Lock)
The **runningLock** module provides APIs for creating, querying, holding, and releasing running locks. The **runningLock** module provides APIs for creating, querying, holding, and releasing running locks.
> **NOTE**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 7. 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 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import ## Modules to Import
...@@ -15,7 +16,7 @@ import runningLock from '@ohos.runningLock'; ...@@ -15,7 +16,7 @@ import runningLock from '@ohos.runningLock';
isSupported(type: RunningLockType): boolean; isSupported(type: RunningLockType): boolean;
Checks whether a specified type of **RunningLock** is supported. Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
...@@ -25,7 +26,7 @@ Checks whether a specified type of **RunningLock** is supported. ...@@ -25,7 +26,7 @@ Checks whether a specified type of **RunningLock** is supported.
| ------ | ----------------------------------- | ---- | -------------------- | | ------ | ----------------------------------- | ---- | -------------------- |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.| | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.|
**Return value** **Return Value**
| Type | Description | | Type | Description |
| ------- | --------------------------------------- | | ------- | --------------------------------------- |
...@@ -35,9 +36,9 @@ Checks whether a specified type of **RunningLock** is supported. ...@@ -35,9 +36,9 @@ Checks whether a specified type of **RunningLock** is supported.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md). For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -72,9 +73,9 @@ Creates a **RunningLock** object. ...@@ -72,9 +73,9 @@ Creates a **RunningLock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md). For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message | | ID | Error Message |
|---------|----------| |---------|----------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -105,7 +106,7 @@ Creates a **RunningLock** object. ...@@ -105,7 +106,7 @@ Creates a **RunningLock** object.
| name | string | Yes | Name of the **RunningLock** object. | | name | string | Yes | Name of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.| | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.|
**Return value** **Return Value**
| Type | Description | | Type | Description |
| ------------------------------------------ | ------------------------------------ | | ------------------------------------------ | ------------------------------------ |
...@@ -115,9 +116,9 @@ Creates a **RunningLock** object. ...@@ -115,9 +116,9 @@ Creates a **RunningLock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md). For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message | | ID | Error Message |
|---------|----------| |---------|----------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -135,10 +136,9 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND) ...@@ -135,10 +136,9 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback&lt;boolean&gt;): void isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback&lt;boolean&gt;): void
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead.
Checks whether a specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses an asynchronous callback to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
...@@ -147,7 +147,7 @@ Checks whether a specified type of **RunningLock** is supported. This API uses a ...@@ -147,7 +147,7 @@ Checks whether a specified type of **RunningLock** is supported. This API uses a
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------------------------- | ---- | ------------------------------------------------------------ |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object. | | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the query result obtained, where the value **true** indicates that **RunningLock** is supported and **false** indicates the opposite. Otherwise, **err** is an error object.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the query result obtained, where the value **true** indicates that the specified type of **RunningLock** is supported and **false** indicates the opposite. Otherwise, **err** is an error object.|
**Example** **Example**
...@@ -165,10 +165,9 @@ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND, ( ...@@ -165,10 +165,9 @@ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND, (
isRunningLockTypeSupported(type: RunningLockType): Promise&lt;boolean> isRunningLockTypeSupported(type: RunningLockType): Promise&lt;boolean>
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead.
Checks whether a specified type of **RunningLock** is supported. This API uses a promise to return the result. Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
...@@ -178,7 +177,7 @@ Checks whether a specified type of **RunningLock** is supported. This API uses a ...@@ -178,7 +177,7 @@ Checks whether a specified type of **RunningLock** is supported. This API uses a
| ------ | ----------------------------------- | ---- | -------------------- | | ------ | ----------------------------------- | ---- | -------------------- |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.| | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.|
**Return value** **Return Value**
| Type | Description | | Type | Description |
| ---------------------- | ---------------------------------------------------- | | ---------------------- | ---------------------------------------------------- |
...@@ -200,8 +199,7 @@ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND) ...@@ -200,8 +199,7 @@ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND)
createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&lt;RunningLock&gt;): void createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback&lt;RunningLock&gt;): void
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9).
> This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9) instead.
Creates a **RunningLock** object. Creates a **RunningLock** object.
...@@ -233,8 +231,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B ...@@ -233,8 +231,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B
createRunningLock(name: string, type: RunningLockType): Promise&lt;RunningLock&gt; createRunningLock(name: string, type: RunningLockType): Promise&lt;RunningLock&gt;
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9).
> This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9) instead.
Creates a **RunningLock** object. Creates a **RunningLock** object.
...@@ -249,7 +246,7 @@ Creates a **RunningLock** object. ...@@ -249,7 +246,7 @@ Creates a **RunningLock** object.
| name | string | Yes | Name of the **RunningLock** object. | | name | string | Yes | Name of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.| | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.|
**Return value** **Return Value**
| Type | Description | | Type | Description |
| ------------------------------------------ | ------------------------------------ | | ------------------------------------------ | ------------------------------------ |
...@@ -269,7 +266,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B ...@@ -269,7 +266,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B
## RunningLock ## RunningLock
Represents a **RunningLock** object. Defines a **RunningLock** object.
### hold<sup>9+</sup> ### hold<sup>9+</sup>
...@@ -291,9 +288,9 @@ Locks and holds a **RunningLock** object. ...@@ -291,9 +288,9 @@ Locks and holds a **RunningLock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md). For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message | | ID | Error Message |
|---------|----------| |---------|----------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -327,9 +324,9 @@ Releases a **RunningLock** object. ...@@ -327,9 +324,9 @@ Releases a **RunningLock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md). For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message | | ID | Error Message |
|---------|----------| |---------|----------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -357,7 +354,7 @@ Checks the hold status of the **Runninglock** object. ...@@ -357,7 +354,7 @@ Checks the hold status of the **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
**Return value** **Return Value**
| Type | Description | | Type | Description |
| ------- | ------------------------------------------------------------ | | ------- | ------------------------------------------------------------ |
...@@ -367,9 +364,9 @@ Checks the hold status of the **Runninglock** object. ...@@ -367,9 +364,9 @@ Checks the hold status of the **Runninglock** object.
For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md). For details about the error codes, see [RunningLock Error Codes](../errorcodes/errorcode-runninglock.md).
| Code | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4900101 | Operation failed. Cannot connect to service.| | 4900101 | If connecting to the service failed. |
**Example** **Example**
...@@ -393,8 +390,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND) ...@@ -393,8 +390,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND)
lock(timeout: number): void lock(timeout: number): void
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [RunningLock.hold](#hold9).
> This API is deprecated since API version 9. You are advised to use [RunningLock.hold](#hold9) instead.
Locks and holds a **RunningLock** object. Locks and holds a **RunningLock** object.
...@@ -425,8 +421,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B ...@@ -425,8 +421,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B
unlock(): void unlock(): void
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [RunningLock.unhold](#unhold9).
> This API is deprecated since API version 9. You are advised to use [RunningLock.unhold](#unhold9) instead.
Releases a **RunningLock** object. Releases a **RunningLock** object.
...@@ -451,14 +446,13 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B ...@@ -451,14 +446,13 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B
isUsed(): boolean isUsed(): boolean
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [RunningLock.isHolding](#isholding9).
> This API is deprecated since API version 9. You are advised to use [RunningLock.isHolding](#isholding9) instead.
Checks the hold status of the **Runninglock** object. Checks the hold status of the **Runninglock** object.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
**Return value** **Return Value**
| Type | Description | | Type | Description |
| ------- | ------------------------------------------------------------ | | ------- | ------------------------------------------------------------ |
| boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.| | boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.|
......
# @ohos.telephony.sim (SIM) # @ohos.telephony.sim (SIM Management)
The SIM management module provides basic SIM card management functions. You can obtain the name, number, ISO country code, home PLMN number, service provider name, SIM card status, type, installation status, activation status, and lock status of the SIM card in the specified slot. Besides, you can set the name, number, and lock status of the SIM card, activate or deactivate the SIM card, and change the PIN or unlock the PIN or PUK of the SIM card. The **sim** module provides basic SIM card management functions. You can obtain the name, number, ISO country code, home PLMN number, service provider name, SIM card status, type, installation status, activation status, and lock status of the SIM card in the specified slot. Besides, you can set the name, number, and lock status of the SIM card, activate or deactivate the SIM card, and change the PIN or unlock the PIN or PUK of the SIM card.
>**NOTE** >**NOTE**
> >
...@@ -15,7 +15,7 @@ import sim from '@ohos.telephony.sim'; ...@@ -15,7 +15,7 @@ import sim from '@ohos.telephony.sim';
## sim.isSimActive<sup>7+</sup> ## sim.isSimActive<sup>7+</sup>
isSimActive\(slotId: number, callback: AsyncCallback<boolean\>\): void isSimActive\(slotId: number, callback: AsyncCallback\<boolean\>\): void
Checks whether the SIM card in the specified slot is activated. This API uses an asynchronous callback to return the result. Checks whether the SIM card in the specified slot is activated. This API uses an asynchronous callback to return the result.
...@@ -39,7 +39,7 @@ sim.isSimActive(0, (err, data) => { ...@@ -39,7 +39,7 @@ sim.isSimActive(0, (err, data) => {
## sim.isSimActive<sup>7+</sup> ## sim.isSimActive<sup>7+</sup>
isSimActive\(slotId: number\): Promise<boolean\> isSimActive\(slotId: number\): Promise\<boolean\>
Checks whether the SIM card in the specified slot is activated. This API uses a promise to return the result. Checks whether the SIM card in the specified slot is activated. This API uses a promise to return the result.
...@@ -71,7 +71,7 @@ promise.then(data => { ...@@ -71,7 +71,7 @@ promise.then(data => {
## sim.getDefaultVoiceSlotId<sup>7+</sup> ## sim.getDefaultVoiceSlotId<sup>7+</sup>
getDefaultVoiceSlotId\(callback: AsyncCallback<number\>\): void getDefaultVoiceSlotId\(callback: AsyncCallback\<number\>\): void
Obtains the default slot ID of the SIM card that provides voice services. This API uses an asynchronous callback to return the result. Obtains the default slot ID of the SIM card that provides voice services. This API uses an asynchronous callback to return the result.
...@@ -94,7 +94,7 @@ sim.getDefaultVoiceSlotId((err, data) => { ...@@ -94,7 +94,7 @@ sim.getDefaultVoiceSlotId((err, data) => {
## sim.getDefaultVoiceSlotId<sup>7+</sup> ## sim.getDefaultVoiceSlotId<sup>7+</sup>
getDefaultVoiceSlotId\(\): Promise<number\> getDefaultVoiceSlotId\(\): Promise\<number\>
Obtains the default slot ID of the SIM card that provides voice services. This API uses a promise to return the result. Obtains the default slot ID of the SIM card that provides voice services. This API uses a promise to return the result.
...@@ -119,7 +119,7 @@ promise.then(data => { ...@@ -119,7 +119,7 @@ promise.then(data => {
## sim.hasOperatorPrivileges<sup>7+</sup> ## sim.hasOperatorPrivileges<sup>7+</sup>
hasOperatorPrivileges(slotId: number, callback: AsyncCallback\<boolean\>): void hasOperatorPrivileges\(slotId: number, callback: AsyncCallback\<boolean\>\): void
Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result. Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result.
...@@ -154,7 +154,7 @@ sim.hasOperatorPrivileges(0, (err, data) => { ...@@ -154,7 +154,7 @@ sim.hasOperatorPrivileges(0, (err, data) => {
## sim.hasOperatorPrivileges<sup>7+</sup> ## sim.hasOperatorPrivileges<sup>7+</sup>
hasOperatorPrivileges(slotId: number): Promise<boolean\> hasOperatorPrivileges\(slotId: number\): Promise\<boolean\>
Checks whether the application (caller) has been granted the operator permission. This API uses a promise to return the result. Checks whether the application (caller) has been granted the operator permission. This API uses a promise to return the result.
...@@ -197,7 +197,7 @@ promise.then(data => { ...@@ -197,7 +197,7 @@ promise.then(data => {
## sim.getISOCountryCodeForSim ## sim.getISOCountryCodeForSim
getISOCountryCodeForSim\(slotId: number, callback: AsyncCallback<string\>\): void getISOCountryCodeForSim\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the ISO country code of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the ISO country code of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -234,7 +234,7 @@ sim.getISOCountryCodeForSim(0, (err, data) => { ...@@ -234,7 +234,7 @@ sim.getISOCountryCodeForSim(0, (err, data) => {
## sim.getISOCountryCodeForSim ## sim.getISOCountryCodeForSim
getISOCountryCodeForSim\(slotId: number\): Promise<string\> getISOCountryCodeForSim\(slotId: number\): Promise\<string\>
Obtains the ISO country code of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the ISO country code of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -279,7 +279,7 @@ promise.then(data => { ...@@ -279,7 +279,7 @@ promise.then(data => {
## sim.getSimOperatorNumeric ## sim.getSimOperatorNumeric
getSimOperatorNumeric\(slotId: number, callback: AsyncCallback<string\>\): void getSimOperatorNumeric\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -316,7 +316,7 @@ sim.getSimOperatorNumeric(0, (err, data) => { ...@@ -316,7 +316,7 @@ sim.getSimOperatorNumeric(0, (err, data) => {
## sim.getSimOperatorNumeric ## sim.getSimOperatorNumeric
getSimOperatorNumeric\(slotId: number\): Promise<string\> getSimOperatorNumeric\(slotId: number\): Promise\<string\>
Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -361,7 +361,7 @@ promise.then(data => { ...@@ -361,7 +361,7 @@ promise.then(data => {
## sim.getSimSpn ## sim.getSimSpn
getSimSpn\(slotId: number, callback: AsyncCallback<string\>\): void getSimSpn\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -398,7 +398,7 @@ sim.getSimSpn(0, (err, data) => { ...@@ -398,7 +398,7 @@ sim.getSimSpn(0, (err, data) => {
## sim.getSimSpn ## sim.getSimSpn
getSimSpn\(slotId: number\): Promise<string\> getSimSpn\(slotId: number\): Promise\<string\>
Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -443,7 +443,7 @@ promise.then(data => { ...@@ -443,7 +443,7 @@ promise.then(data => {
## sim.getSimState ## sim.getSimState
getSimState\(slotId: number, callback: AsyncCallback<SimState\>\): void getSimState\(slotId: number, callback: AsyncCallback\<SimState\>\): void
Obtains the state of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the state of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -479,7 +479,7 @@ sim.getSimState(0, (err, data) => { ...@@ -479,7 +479,7 @@ sim.getSimState(0, (err, data) => {
## sim.getSimState ## sim.getSimState
getSimState\(slotId: number\): Promise<SimState\> getSimState\(slotId: number\): Promise\<SimState\>
Obtains the state of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the state of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -522,7 +522,7 @@ promise.then(data => { ...@@ -522,7 +522,7 @@ promise.then(data => {
## sim.getCardType<sup>7+</sup> ## sim.getCardType<sup>7+</sup>
getCardType\(slotId: number, callback: AsyncCallback<CardType\>\): void getCardType\(slotId: number, callback: AsyncCallback\<CardType\>\): void
Obtains the type of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the type of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -559,7 +559,7 @@ sim.getCardType(0, (err, data) => { ...@@ -559,7 +559,7 @@ sim.getCardType(0, (err, data) => {
## sim.getCardType<sup>7+</sup> ## sim.getCardType<sup>7+</sup>
getCardType\(slotId: number\): Promise<CardType\> getCardType\(slotId: number\): Promise\<CardType\>
Obtains the type of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the type of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -604,7 +604,7 @@ promise.then(data => { ...@@ -604,7 +604,7 @@ promise.then(data => {
## sim.hasSimCard<sup>7+</sup> ## sim.hasSimCard<sup>7+</sup>
hasSimCard\(slotId: number, callback: AsyncCallback<boolean\>\): void hasSimCard\(slotId: number, callback: AsyncCallback\<boolean\>\): void
Checks whether the SIM card in the specified slot is installed. This API uses an asynchronous callback to return the result. Checks whether the SIM card in the specified slot is installed. This API uses an asynchronous callback to return the result.
...@@ -640,7 +640,7 @@ sim.hasSimCard(0, (err, data) => { ...@@ -640,7 +640,7 @@ sim.hasSimCard(0, (err, data) => {
## sim.hasSimCard<sup>7+</sup> ## sim.hasSimCard<sup>7+</sup>
hasSimCard\(slotId: number\): Promise<boolean\> hasSimCard\(slotId: number\): Promise\<boolean\>
Checks whether the SIM card in the specified slot is installed. This API uses a promise to return the result. Checks whether the SIM card in the specified slot is installed. This API uses a promise to return the result.
...@@ -683,7 +683,7 @@ promise.then(data => { ...@@ -683,7 +683,7 @@ promise.then(data => {
## sim.getSimAccountInfo<sup>7+</sup> ## sim.getSimAccountInfo<sup>7+</sup>
getSimAccountInfo(slotId: number, callback: AsyncCallback<IccAccountInfo\>): void getSimAccountInfo\(slotId: number, callback: AsyncCallback\<IccAccountInfo\>\): void
Obtains SIM card account information. This API uses an asynchronous callback to return the result. Obtains SIM card account information. This API uses an asynchronous callback to return the result.
...@@ -707,6 +707,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -707,6 +707,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -726,7 +727,7 @@ sim.getSimAccountInfo(0, (err, data) => { ...@@ -726,7 +727,7 @@ sim.getSimAccountInfo(0, (err, data) => {
## sim.getSimAccountInfo<sup>7+</sup> ## sim.getSimAccountInfo<sup>7+</sup>
getSimAccountInfo(slotId: number): Promise<IccAccountInfo\> getSimAccountInfo\(slotId: number\): Promise\<IccAccountInfo\>
Obtains SIM card account information. This API uses a promise to return the result. Obtains SIM card account information. This API uses a promise to return the result.
...@@ -755,6 +756,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -755,6 +756,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -776,7 +778,7 @@ promise.then(data => { ...@@ -776,7 +778,7 @@ promise.then(data => {
## sim.getActiveSimAccountInfoList<sup>8+</sup> ## sim.getActiveSimAccountInfoList<sup>8+</sup>
getActiveSimAccountInfoList(callback: AsyncCallback<Array<IccAccountInfo\>>): void getActiveSimAccountInfoList\(callback: AsyncCallback\<Array\<IccAccountInfo\>\>\): void
Obtains the account information list of the active SIM card. This API uses an asynchronous callback to return the result. Obtains the account information list of the active SIM card. This API uses an asynchronous callback to return the result.
...@@ -799,7 +801,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -799,7 +801,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
...@@ -817,7 +819,7 @@ sim.getActiveSimAccountInfoList((err, data) => { ...@@ -817,7 +819,7 @@ sim.getActiveSimAccountInfoList((err, data) => {
## sim.getActiveSimAccountInfoList<sup>8+</sup> ## sim.getActiveSimAccountInfoList<sup>8+</sup>
getActiveSimAccountInfoList(): Promise<Array<IccAccountInfo\>>; getActiveSimAccountInfoList\(\): Promise\<Array\<IccAccountInfo\>\>;
Obtains the account information list of the active SIM card. This API uses a promise to return the result. Obtains the account information list of the active SIM card. This API uses a promise to return the result.
...@@ -840,8 +842,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -840,8 +842,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300004 | Do not have sim card. | | 8300004 | Do not have sim card. |
...@@ -860,7 +861,7 @@ promise.then(data => { ...@@ -860,7 +861,7 @@ promise.then(data => {
## sim.setDefaultVoiceSlotId<sup>7+</sup> ## sim.setDefaultVoiceSlotId<sup>7+</sup>
setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback<void\>): void setDefaultVoiceSlotId\(slotId: number, callback: AsyncCallback\<void\>\): void
Sets the default slot ID of the SIM card that provides voice services. This API uses an asynchronous callback to return the result. Sets the default slot ID of the SIM card that provides voice services. This API uses an asynchronous callback to return the result.
...@@ -884,6 +885,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -884,6 +885,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -903,7 +905,7 @@ sim.setDefaultVoiceSlotId(0, (err) => { ...@@ -903,7 +905,7 @@ sim.setDefaultVoiceSlotId(0, (err) => {
## sim.setDefaultVoiceSlotId<sup>7+</sup> ## sim.setDefaultVoiceSlotId<sup>7+</sup>
setDefaultVoiceSlotId(slotId: number): Promise\<void\> setDefaultVoiceSlotId\(slotId: number\): Promise\<void\>
Sets the default slot ID of the SIM card that provides voice services. This API uses a promise to return the result. Sets the default slot ID of the SIM card that provides voice services. This API uses a promise to return the result.
...@@ -932,6 +934,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -932,6 +934,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -953,7 +956,7 @@ promise.then(() => { ...@@ -953,7 +956,7 @@ promise.then(() => {
## sim.setShowName<sup>8+</sup> ## sim.setShowName<sup>8+</sup>
setShowName\(slotId: number, name: string, callback: AsyncCallback<void\>\): void setShowName\(slotId: number, name: string, callback: AsyncCallback\<void\>\): void
Sets a display name for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Sets a display name for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -978,6 +981,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -978,6 +981,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1026,6 +1030,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1026,6 +1030,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1047,7 +1052,7 @@ promise.then(() => { ...@@ -1047,7 +1052,7 @@ promise.then(() => {
## sim.getShowName<sup>8+</sup> ## sim.getShowName<sup>8+</sup>
getShowName(slotId: number, callback: AsyncCallback<string\>): void getShowName\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the name of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the name of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1071,6 +1076,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1071,6 +1076,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1089,7 +1095,7 @@ sim.getShowName(0, (err, data) => { ...@@ -1089,7 +1095,7 @@ sim.getShowName(0, (err, data) => {
## sim.getShowName<sup>8+</sup> ## sim.getShowName<sup>8+</sup>
getShowName(slotId: number): Promise<string\> getShowName\(slotId: number\): Promise\<string\>
Obtains the name of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the name of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1118,6 +1124,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1118,6 +1124,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1138,7 +1145,7 @@ promise.then(data => { ...@@ -1138,7 +1145,7 @@ promise.then(data => {
## sim.setShowNumber<sup>8+</sup> ## sim.setShowNumber<sup>8+</sup>
setShowNumber\(slotId: number, number: string, callback: AsyncCallback<void\>\): void setShowNumber\(slotId: number, number: string, callback: AsyncCallback\<void\>\): void
Sets a display number for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Sets a display number for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1163,6 +1170,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1163,6 +1170,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1212,6 +1220,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1212,6 +1220,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1233,7 +1242,7 @@ promise.then(() => { ...@@ -1233,7 +1242,7 @@ promise.then(() => {
## sim.getShowNumber<sup>8+</sup> ## sim.getShowNumber<sup>8+</sup>
getShowNumber(slotId: number, callback: AsyncCallback<string\>): void getShowNumber\(slotId: number, callback: AsyncCallback\<string\>): void
Obtains the display number of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the display number of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1257,6 +1266,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1257,6 +1266,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1275,7 +1285,7 @@ sim.getShowNumber(0, (err, data) => { ...@@ -1275,7 +1285,7 @@ sim.getShowNumber(0, (err, data) => {
## sim.getShowNumber<sup>8+</sup> ## sim.getShowNumber<sup>8+</sup>
getShowNumber(slotId: number): Promise<string\> getShowNumber\(slotId: number\): Promise\<string\>
Obtains the display number of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the display number of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1304,6 +1314,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1304,6 +1314,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1324,7 +1335,7 @@ promise.then(data => { ...@@ -1324,7 +1335,7 @@ promise.then(data => {
## sim.activateSim<sup>8+</sup> ## sim.activateSim<sup>8+</sup>
activateSim(slotId: number, callback: AsyncCallback<void\>): void activateSim\(slotId: number, callback: AsyncCallback\<void\>\): void
Activates a SIM card in a specified card slot. This API uses an asynchronous callback to return the result. Activates a SIM card in a specified card slot. This API uses an asynchronous callback to return the result.
...@@ -1348,6 +1359,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1348,6 +1359,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1366,7 +1378,7 @@ sim.activateSim(0, (err) => { ...@@ -1366,7 +1378,7 @@ sim.activateSim(0, (err) => {
## sim.activateSim<sup>8+</sup> ## sim.activateSim<sup>8+</sup>
activateSim(slotId: number): Promise\<void\> activateSim\(slotId: number\): Promise\<void\>
Activates the SIM card in the specified slot. This API uses a promise to return the result. Activates the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1395,6 +1407,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1395,6 +1407,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1415,7 +1428,7 @@ promise.then(() => { ...@@ -1415,7 +1428,7 @@ promise.then(() => {
## sim.deactivateSim<sup>8+</sup> ## sim.deactivateSim<sup>8+</sup>
deactivateSim(slotId: number, callback: AsyncCallback<void\>): void deactivateSim\(slotId: number, callback: AsyncCallback\<void\>\): void
Disables the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Disables the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1439,6 +1452,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1439,6 +1452,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1457,7 +1471,7 @@ sim.deactivateSim(0, (err) => { ...@@ -1457,7 +1471,7 @@ sim.deactivateSim(0, (err) => {
## sim.deactivateSim<sup>8+</sup> ## sim.deactivateSim<sup>8+</sup>
deactivateSim(slotId: number): Promise\<void\> deactivateSim\(slotId: number\): Promise\<void\>
Disables the SIM card in the specified slot. This API uses a promise to return the result. Disables the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1486,6 +1500,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1486,6 +1500,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1506,7 +1521,7 @@ promise.then(() => { ...@@ -1506,7 +1521,7 @@ promise.then(() => {
## sim.setLockState<sup>7+</sup> ## sim.setLockState<sup>7+</sup>
setLockState(slotId: number, options: LockInfo, callback: AsyncCallback<LockStatusResponse\>): void setLockState\(slotId: number, options: LockInfo, callback: AsyncCallback\<LockStatusResponse\>\): void
Sets the lock status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Sets the lock status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1531,6 +1546,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1531,6 +1546,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1555,7 +1571,7 @@ sim.setLockState(0, lockInfo, (err, data) => { ...@@ -1555,7 +1571,7 @@ sim.setLockState(0, lockInfo, (err, data) => {
## sim.setLockState<sup>7+</sup> ## sim.setLockState<sup>7+</sup>
setLockState(slotId: number, options: LockInfo): Promise<LockStatusResponse\> setLockState\(slotId: number, options: LockInfo\): Promise\<LockStatusResponse\>
Sets the lock status of the SIM card in the specified slot. This API uses a promise to return the result. Sets the lock status of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1585,6 +1601,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1585,6 +1601,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1611,7 +1628,7 @@ promise.then(data => { ...@@ -1611,7 +1628,7 @@ promise.then(data => {
## sim.getLockState<sup>8+</sup> ## sim.getLockState<sup>8+</sup>
getLockState(slotId: number, lockType: LockType, callback: AsyncCallback<LockState\>): void getLockState\(slotId: number, lockType: LockType, callback: AsyncCallback\<LockState\>\): void
Obtains the lock status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the lock status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1636,6 +1653,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1636,6 +1653,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1655,7 +1673,7 @@ sim.getLockState(0, 1, (err, data) => { ...@@ -1655,7 +1673,7 @@ sim.getLockState(0, 1, (err, data) => {
## sim.getLockState<sup>8+</sup> ## sim.getLockState<sup>8+</sup>
getLockState(slotId: number, lockType: LockType): Promise<LockState\> getLockState\(slotId: number, lockType: LockType\): Promise\<LockState\>
Obtains the lock status of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the lock status of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1685,6 +1703,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1685,6 +1703,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1706,7 +1725,7 @@ promise.then(data => { ...@@ -1706,7 +1725,7 @@ promise.then(data => {
## sim.alterPin<sup>7+</sup> ## sim.alterPin<sup>7+</sup>
alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback<LockStatusResponse\>): void alterPin\(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback\<LockStatusResponse\>\): void
Changes the PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Changes the PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1732,6 +1751,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1732,6 +1751,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1751,7 +1771,7 @@ sim.alterPin(0, "1234", "0000", (err, data) => { ...@@ -1751,7 +1771,7 @@ sim.alterPin(0, "1234", "0000", (err, data) => {
## sim.alterPin<sup>7+</sup> ## sim.alterPin<sup>7+</sup>
alterPin(slotId: number, newPin: string, oldPin: string): Promise<LockStatusResponse\>; alterPin\(slotId: number, newPin: string, oldPin: string\): Promise\<LockStatusResponse\>;
Changes the PIN of the SIM card in the specified slot. This API uses a promise to return the result. Changes the PIN of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1782,6 +1802,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1782,6 +1802,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1803,7 +1824,7 @@ promise.then(data => { ...@@ -1803,7 +1824,7 @@ promise.then(data => {
## sim.alterPin2<sup>8+</sup> ## sim.alterPin2<sup>8+</sup>
alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallback<LockStatusResponse\>): void alterPin2\(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallback\<LockStatusResponse\>\): void
Changes PIN 2 of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Changes PIN 2 of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1829,6 +1850,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1829,6 +1850,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1848,7 +1870,7 @@ sim.alterPin2(0, "1234", "0000", (err, data) => { ...@@ -1848,7 +1870,7 @@ sim.alterPin2(0, "1234", "0000", (err, data) => {
## sim.alterPin2<sup>8+</sup> ## sim.alterPin2<sup>8+</sup>
alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise<LockStatusResponse\> alterPin2\(slotId: number, newPin2: string, oldPin2: string\): Promise\<LockStatusResponse\>
Changes PIN 2 of the SIM card in the specified slot. This API uses a promise to return the result. Changes PIN 2 of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1879,6 +1901,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1879,6 +1901,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1900,7 +1923,7 @@ promise.then(data => { ...@@ -1900,7 +1923,7 @@ promise.then(data => {
## sim.unlockPin<sup>7+</sup> ## sim.unlockPin<sup>7+</sup>
unlockPin(slotId: number, pin: string, callback: AsyncCallback<LockStatusResponse\>): void unlockPin\(slotId: number, pin: string, callback: AsyncCallback\<LockStatusResponse\>\): void
Unlocks the PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Unlocks the PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1925,6 +1948,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1925,6 +1948,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1945,7 +1969,7 @@ sim.unlockPin(0, pin, (err, data) => { ...@@ -1945,7 +1969,7 @@ sim.unlockPin(0, pin, (err, data) => {
## sim.unlockPin<sup>7+</sup> ## sim.unlockPin<sup>7+</sup>
unlockPin(slotId: number, pin: string): Promise&lt;LockStatusResponse\> unlockPin\(slotId: number, pin: string\): Promise\<LockStatusResponse\>
Unlocks the PIN of the SIM card in the specified slot. This API uses a promise to return the result. Unlocks the PIN of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -1975,6 +1999,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1975,6 +1999,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1997,7 +2022,7 @@ promise.then(data => { ...@@ -1997,7 +2022,7 @@ promise.then(data => {
## sim.unlockPuk<sup>7+</sup> ## sim.unlockPuk<sup>7+</sup>
unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback<LockStatusResponse\>): void unlockPuk\(slotId: number, newPin: string, puk: string, callback: AsyncCallback\<LockStatusResponse\>\): void
Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2023,6 +2048,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2023,6 +2048,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2044,7 +2070,7 @@ sim.unlockPuk(0, newPin, puk, (err, data) => { ...@@ -2044,7 +2070,7 @@ sim.unlockPuk(0, newPin, puk, (err, data) => {
## sim.unlockPuk<sup>7+</sup> ## sim.unlockPuk<sup>7+</sup>
unlockPuk(slotId: number, newPin: string, puk: string): Promise&lt;LockStatusResponse\> unlockPuk\(slotId: number, newPin: string, puk: string\): Promise\<LockStatusResponse\>
Unlocks the PUK of the SIM card in the specified slot. This API uses a promise to return the result. Unlocks the PUK of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2075,6 +2101,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2075,6 +2101,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2098,9 +2125,9 @@ promise.then(data => { ...@@ -2098,9 +2125,9 @@ promise.then(data => {
## sim.unlockPin2<sup>8+</sup> ## sim.unlockPin2<sup>8+</sup>
unlockPin2(slotId: number, pin2: string, callback: AsyncCallback<LockStatusResponse\>): void unlockPin2\(slotId: number, pin2: string, callback: AsyncCallback\<LockStatusResponse\>\): void
Unlocks PIN 2 of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Unlocks the PIN of 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.
...@@ -2123,6 +2150,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2123,6 +2150,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2143,9 +2171,9 @@ sim.unlockPin2(0, pin2, (err, data) => { ...@@ -2143,9 +2171,9 @@ sim.unlockPin2(0, pin2, (err, data) => {
## sim.unlockPin2<sup>8+</sup> ## sim.unlockPin2<sup>8+</sup>
unlockPin2(slotId: number, pin2: string): Promise&lt;LockStatusResponse\> unlockPin2\(slotId: number, pin2: string\): Promise\<LockStatusResponse\>
Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to return the result. Unlocks the PIN of 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.
...@@ -2173,6 +2201,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2173,6 +2201,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2195,9 +2224,9 @@ promise.then(data => { ...@@ -2195,9 +2224,9 @@ promise.then(data => {
## sim.unlockPuk2<sup>8+</sup> ## sim.unlockPuk2<sup>8+</sup>
unlockPuk2(slotId: number, newPin2: string, puk2: string, callback: AsyncCallback<LockStatusResponse\>): void unlockPuk2\(slotId: number, newPin2: string, puk2: string, callback: AsyncCallback\<LockStatusResponse\>\): void
Unlocks PUK 2 of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Unlocks the PUK of 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.
...@@ -2242,9 +2271,9 @@ sim.unlockPuk2(0, newPin2, puk2, (err, data) => { ...@@ -2242,9 +2271,9 @@ sim.unlockPuk2(0, newPin2, puk2, (err, data) => {
## sim.unlockPuk2<sup>8+</sup> ## sim.unlockPuk2<sup>8+</sup>
unlockPuk2(slotId: number, newPin2: string, puk2: string): Promise&lt;LockStatusResponse\> unlockPuk2\(slotId: number, newPin2: string, puk2: string\): Promise\<LockStatusResponse\>
Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to return the result. Unlocks the PUK of 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.
...@@ -2316,7 +2345,7 @@ console.log("Result: "+ sim.getMaxSimCount()) ...@@ -2316,7 +2345,7 @@ console.log("Result: "+ sim.getMaxSimCount())
## sim.getSimIccId<sup>7+</sup> ## sim.getSimIccId<sup>7+</sup>
getSimIccId(slotId: number, callback: AsyncCallback<string\>): void getSimIccId\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the ICCID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the ICCID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2340,6 +2369,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2340,6 +2369,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2358,7 +2388,7 @@ sim.getSimIccId(0, (err, data) => { ...@@ -2358,7 +2388,7 @@ sim.getSimIccId(0, (err, data) => {
## sim.getSimIccId<sup>7+</sup> ## sim.getSimIccId<sup>7+</sup>
getSimIccId(slotId: number): Promise<string\> getSimIccId\(slotId: number\): Promise\<string\>
Obtains the ICCID of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the ICCID of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2387,6 +2417,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2387,6 +2417,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2407,7 +2438,7 @@ promise.then(data => { ...@@ -2407,7 +2438,7 @@ promise.then(data => {
## sim.getVoiceMailIdentifier<sup>8+</sup> ## sim.getVoiceMailIdentifier<sup>8+</sup>
getVoiceMailIdentifier(slotId: number, callback: AsyncCallback<string\>): void getVoiceMailIdentifier\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the voice mailbox alpha identifier of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the voice mailbox alpha identifier of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2431,6 +2462,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2431,6 +2462,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2449,7 +2481,7 @@ sim.getVoiceMailIdentifier(0, (err, data) => { ...@@ -2449,7 +2481,7 @@ sim.getVoiceMailIdentifier(0, (err, data) => {
## sim.getVoiceMailIdentifier<sup>8+</sup> ## sim.getVoiceMailIdentifier<sup>8+</sup>
getVoiceMailIdentifier(slotId: number): Promise<string\> getVoiceMailIdentifier\(slotId: number\): Promise\<string\>
Obtains the voice mailbox alpha identifier of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the voice mailbox alpha identifier of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2478,6 +2510,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2478,6 +2510,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2498,7 +2531,7 @@ promise.then(data => { ...@@ -2498,7 +2531,7 @@ promise.then(data => {
## sim.getVoiceMailNumber<sup>8+</sup> ## sim.getVoiceMailNumber<sup>8+</sup>
getVoiceMailNumber(slotId: number, callback: AsyncCallback<string\>): void getVoiceMailNumber\(slotId: number, callback: AsyncCallback\<string\>): void
Obtains the voice mailbox number of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the voice mailbox number of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2522,6 +2555,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2522,6 +2555,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2540,7 +2574,7 @@ sim.getVoiceMailNumber(0, (err, data) => { ...@@ -2540,7 +2574,7 @@ sim.getVoiceMailNumber(0, (err, data) => {
## sim.getVoiceMailNumber<sup>8+</sup> ## sim.getVoiceMailNumber<sup>8+</sup>
getVoiceMailNumber(slotId: number): Promise<string\> getVoiceMailNumber\(slotId: number\): Promise\<string\>
Obtains the voice mailbox number of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the voice mailbox number of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2569,6 +2603,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2569,6 +2603,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2590,7 +2625,7 @@ promise.then(data => { ...@@ -2590,7 +2625,7 @@ promise.then(data => {
## sim.setVoiceMailInfo<sup>8+</sup> ## sim.setVoiceMailInfo<sup>8+</sup>
setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback<void\>): void setVoiceMailInfo\(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback\<void\>\): void
Sets voice mailbox information for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Sets voice mailbox information for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2616,6 +2651,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2616,6 +2651,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2635,7 +2671,7 @@ sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err) => { ...@@ -2635,7 +2671,7 @@ sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err) => {
## sim.setVoiceMailInfo<sup>8+</sup> ## sim.setVoiceMailInfo<sup>8+</sup>
setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise<void\> setVoiceMailInfo\(slotId: number, mailName: string, mailNumber: string\): Promise\<void\>
Sets voice mailbox information for the SIM card in the specified slot. This API uses a promise to return the result. Sets voice mailbox information for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2666,6 +2702,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2666,6 +2702,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2687,7 +2724,7 @@ promise.then(() => { ...@@ -2687,7 +2724,7 @@ promise.then(() => {
## sim.getSimTelephoneNumber<sup>8+</sup> ## sim.getSimTelephoneNumber<sup>8+</sup>
getSimTelephoneNumber(slotId: number, callback: AsyncCallback<string\>): void getSimTelephoneNumber\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the MSISDN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the MSISDN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2711,6 +2748,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2711,6 +2748,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2729,7 +2767,7 @@ sim.getSimTelephoneNumber(0, (err, data) => { ...@@ -2729,7 +2767,7 @@ sim.getSimTelephoneNumber(0, (err, data) => {
## sim.getSimTelephoneNumber<sup>8+</sup> ## sim.getSimTelephoneNumber<sup>8+</sup>
getSimTelephoneNumber(slotId: number): Promise<string\> getSimTelephoneNumber\(slotId: number\): Promise\<string\>
Obtains the MSISDN of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the MSISDN of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2758,6 +2796,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2758,6 +2796,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2778,7 +2817,7 @@ promise.then(data => { ...@@ -2778,7 +2817,7 @@ promise.then(data => {
## sim.getSimGid1<sup>7+</sup> ## sim.getSimGid1<sup>7+</sup>
getSimGid1(slotId: number, callback: AsyncCallback<string\>): void getSimGid1\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the group identifier level 1 (GID1) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the group identifier level 1 (GID1) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2802,6 +2841,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2802,6 +2841,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2820,7 +2860,7 @@ sim.getSimGid1(0, (err, data) => { ...@@ -2820,7 +2860,7 @@ sim.getSimGid1(0, (err, data) => {
## sim.getSimGid1<sup>7+</sup> ## sim.getSimGid1<sup>7+</sup>
getSimGid1(slotId: number): Promise<string\> getSimGid1\(slotId: number\): Promise\<string\>
Obtains the GID1 of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the GID1 of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2849,6 +2889,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2849,6 +2889,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2869,7 +2910,7 @@ promise.then(data => { ...@@ -2869,7 +2910,7 @@ promise.then(data => {
## sim.getIMSI ## sim.getIMSI
getIMSI(slotId: number, callback: AsyncCallback<string\>): void getIMSI\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the international mobile subscriber identity (IMSI) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the international mobile subscriber identity (IMSI) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2893,6 +2934,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2893,6 +2934,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2911,7 +2953,7 @@ sim.getIMSI(0, (err, data) => { ...@@ -2911,7 +2953,7 @@ sim.getIMSI(0, (err, data) => {
## sim.getIMSI ## sim.getIMSI
getIMSI(slotId: number): Promise<string\> getIMSI\(slotId: number\): Promise\<string\>
Obtains the IMSI of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the IMSI of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -2940,6 +2982,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2940,6 +2982,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -2960,7 +3003,7 @@ promise.then(data => { ...@@ -2960,7 +3003,7 @@ promise.then(data => {
## sim.getOperatorConfigs<sup>8+</sup> ## sim.getOperatorConfigs<sup>8+</sup>
getOperatorConfigs(slotId: number, callback: AsyncCallback<Array<OperatorConfig\>>): void getOperatorConfigs\(slotId: number, callback: AsyncCallback\<Array\<OperatorConfig\>\>\): void
Obtains the carrier configuration of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the carrier configuration of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -2984,6 +3027,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -2984,6 +3027,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3001,7 +3045,7 @@ sim.getOperatorConfigs(0, (err, data) => { ...@@ -3001,7 +3045,7 @@ sim.getOperatorConfigs(0, (err, data) => {
## sim.getOperatorConfigs<sup>8+</sup> ## sim.getOperatorConfigs<sup>8+</sup>
getOperatorConfigs(slotId: number): Promise<Array<OperatorConfig\>> getOperatorConfigs\(slotId: number\): Promise\<Array\<OperatorConfig\>\>
Obtains the carrier configuration of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the carrier configuration of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3030,6 +3074,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3030,6 +3074,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3049,7 +3094,7 @@ promise.then(data => { ...@@ -3049,7 +3094,7 @@ promise.then(data => {
## sim.queryIccDiallingNumbers<sup>8+</sup> ## sim.queryIccDiallingNumbers<sup>8+</sup>
queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallback<Array<DiallingNumbersInfo\>>): void queryIccDiallingNumbers\(slotId: number, type: ContactType, callback: AsyncCallback\<Array\<DiallingNumbersInfo\>\>\): void
Queries contact numbers of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Queries contact numbers of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3074,6 +3119,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3074,6 +3119,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3093,7 +3139,7 @@ sim.queryIccDiallingNumbers(0, 1, (err, data) => { ...@@ -3093,7 +3139,7 @@ sim.queryIccDiallingNumbers(0, 1, (err, data) => {
## sim.queryIccDiallingNumbers<sup>8+</sup> ## sim.queryIccDiallingNumbers<sup>8+</sup>
queryIccDiallingNumbers(slotId: number, type: ContactType): Promise<Array<DiallingNumbersInfo\>> queryIccDiallingNumbers\(slotId: number, type: ContactType\): Promise\<Array\<DiallingNumbersInfo\>\>
Queries contact numbers of the SIM card in the specified slot. This API uses a promise to return the result. Queries contact numbers of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3123,6 +3169,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3123,6 +3169,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3144,7 +3191,7 @@ promise.then(data => { ...@@ -3144,7 +3191,7 @@ promise.then(data => {
## sim.addIccDiallingNumbers<sup>8+</sup> ## sim.addIccDiallingNumbers<sup>8+</sup>
addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback<void\>): void addIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void\>\): void
Adds contact numbers for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Adds contact numbers for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3170,6 +3217,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3170,6 +3217,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3194,7 +3242,7 @@ sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersIno ...@@ -3194,7 +3242,7 @@ sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersIno
## sim.addIccDiallingNumbers<sup>8+</sup> ## sim.addIccDiallingNumbers<sup>8+</sup>
addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise<void\> addIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo\): Promise\<void\>
Adds contact numbers for the SIM card in the specified slot. This API uses a promise to return the result. Adds contact numbers for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3225,6 +3273,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3225,6 +3273,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3250,7 +3299,7 @@ promise.then(() => { ...@@ -3250,7 +3299,7 @@ promise.then(() => {
## sim.delIccDiallingNumbers<sup>8+</sup> ## sim.delIccDiallingNumbers<sup>8+</sup>
delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback<void\>): void delIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void\>\): void
Deletes contact numbers from the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Deletes contact numbers from the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3276,6 +3325,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3276,6 +3325,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3301,7 +3351,7 @@ sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersIno ...@@ -3301,7 +3351,7 @@ sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersIno
## sim.delIccDiallingNumbers<sup>8+</sup> ## sim.delIccDiallingNumbers<sup>8+</sup>
delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise<void\> delIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo\): Promise\<void\>
Deletes contact numbers from the SIM card in the specified slot. This API uses a promise to return the result. Deletes contact numbers from the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3332,6 +3382,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3332,6 +3382,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3357,7 +3408,7 @@ promise.then(() => { ...@@ -3357,7 +3408,7 @@ promise.then(() => {
## sim.updateIccDiallingNumbers<sup>8+</sup> ## sim.updateIccDiallingNumbers<sup>8+</sup>
updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback<void\>): void updateIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void\>\): void
Updates contact numbers for the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Updates contact numbers for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3383,6 +3434,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3383,6 +3434,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3408,7 +3460,7 @@ sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbers ...@@ -3408,7 +3460,7 @@ sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbers
## sim.updateIccDiallingNumbers<sup>8+</sup> ## sim.updateIccDiallingNumbers<sup>8+</sup>
updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise<void\> updateIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo\): Promise\<void\>
Updates contact numbers for the SIM card in the specified slot. This API uses a promise to return the result. Updates contact numbers for the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3439,6 +3491,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3439,6 +3491,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3465,7 +3518,7 @@ promise.then(() => { ...@@ -3465,7 +3518,7 @@ promise.then(() => {
## sim.sendEnvelopeCmd<sup>8+</sup> ## sim.sendEnvelopeCmd<sup>8+</sup>
sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback<void\>): void sendEnvelopeCmd\(slotId: number, cmd: string, callback: AsyncCallback\<void\>\): void
Sends an envelope command to the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Sends an envelope command to the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3490,6 +3543,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3490,6 +3543,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3508,7 +3562,7 @@ sim.sendEnvelopeCmd(0, "ls", (err) => { ...@@ -3508,7 +3562,7 @@ sim.sendEnvelopeCmd(0, "ls", (err) => {
## sim.sendEnvelopeCmd<sup>8+</sup> ## sim.sendEnvelopeCmd<sup>8+</sup>
sendEnvelopeCmd(slotId: number, cmd: string): Promise<void\> sendEnvelopeCmd\(slotId: number, cmd: string\): Promise\<void\>
Sends an envelope command to the SIM card in the specified slot. This API uses a promise to return the result. Sends an envelope command to the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3538,6 +3592,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3538,6 +3592,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3558,7 +3613,7 @@ promise.then(() => { ...@@ -3558,7 +3613,7 @@ promise.then(() => {
## sim.sendTerminalResponseCmd<sup>8+</sup> ## sim.sendTerminalResponseCmd<sup>8+</sup>
sendTerminalResponseCmd(slotId: number, cmd: string, callback: AsyncCallback<void\>): void sendTerminalResponseCmd\(slotId: number, cmd: string, callback: AsyncCallback\<void\>\): void
Sends a terminal response command to the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Sends a terminal response command to the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3583,6 +3638,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3583,6 +3638,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3601,7 +3657,7 @@ sim.sendTerminalResponseCmd(0, "ls", (err) => { ...@@ -3601,7 +3657,7 @@ sim.sendTerminalResponseCmd(0, "ls", (err) => {
## sim.sendTerminalResponseCmd<sup>8+</sup> ## sim.sendTerminalResponseCmd<sup>8+</sup>
sendTerminalResponseCmd(slotId: number, cmd: string): Promise<void\> sendTerminalResponseCmd\(slotId: number, cmd: string\): Promise\<void\>
Sends a terminal response command to the SIM card in the specified slot. This API uses a promise to return the result. Sends a terminal response command to the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3631,6 +3687,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3631,6 +3687,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3652,7 +3709,7 @@ promise.then(() => { ...@@ -3652,7 +3709,7 @@ promise.then(() => {
## sim.unlockSimLock<sup>8+</sup> ## sim.unlockSimLock<sup>8+</sup>
unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback<LockStatusResponse\>): void unlockSimLock\(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback\<LockStatusResponse\>\): void
Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3677,6 +3734,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3677,6 +3734,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3700,7 +3758,7 @@ sim.unlockSimLock(0, persoLockInfo, (err, data) => { ...@@ -3700,7 +3758,7 @@ sim.unlockSimLock(0, persoLockInfo, (err, data) => {
## sim.unlockSimLock<sup>8+</sup> ## sim.unlockSimLock<sup>8+</sup>
unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise<LockStatusResponse\> unlockSimLock\(slotId: number, lockInfo: PersoLockInfo\): Promise\<LockStatusResponse\>
Unlocks the SIM card in the specified slot. This API uses a promise to return the result. Unlocks the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3730,6 +3788,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -3730,6 +3788,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -3755,7 +3814,7 @@ promise.then(data => { ...@@ -3755,7 +3814,7 @@ promise.then(data => {
## sim.getOpKey<sup>9+</sup> ## sim.getOpKey<sup>9+</sup>
getOpKey(slotId: number, callback: AsyncCallback<string\>): void getOpKey\(slotId: number, callback: AsyncCallback\<string\>): void
Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3800,7 +3859,7 @@ try { ...@@ -3800,7 +3859,7 @@ try {
## sim.getOpKey<sup>9+</sup> ## sim.getOpKey<sup>9+</sup>
getOpKey(slotId: number): Promise<string\> getOpKey\(slotId: number\): Promise\<string\>
Obtains the opkey of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the opkey of the SIM card in the specified slot. This API uses a promise to return the result.
...@@ -3844,7 +3903,7 @@ try { ...@@ -3844,7 +3903,7 @@ try {
## sim.getOpName<sup>9+</sup> ## sim.getOpName<sup>9+</sup>
getOpName(slotId: number, callback: AsyncCallback<string\>): void getOpName\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the OpName of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the OpName of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -3889,7 +3948,7 @@ try { ...@@ -3889,7 +3948,7 @@ try {
## sim.getOpName<sup>9+</sup> ## sim.getOpName<sup>9+</sup>
getOpName(slotId: number): Promise<string\> getOpName\(slotId: number\): Promise\<string\>
Obtains the OpName of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the OpName of the SIM card in the specified slot. This API uses a promise to return the result.
......
...@@ -14,7 +14,7 @@ import sms from '@ohos.telephony.sms'; ...@@ -14,7 +14,7 @@ import sms from '@ohos.telephony.sms';
## sms.createMessage ## sms.createMessage
createMessage\(pdu: Array&lt;number&gt;, specification: string, callback: AsyncCallback<ShortMessage\>\): void createMessage\(pdu: Array&lt;number&gt;, specification: string, callback: AsyncCallback\<ShortMessage\>\): void
Creates an SMS instance based on the protocol data unit (PDU) and specified SMS protocol. This API uses an asynchronous callback to return the result. Creates an SMS instance based on the protocol data unit (PDU) and specified SMS protocol. This API uses an asynchronous callback to return the result.
...@@ -28,6 +28,18 @@ Creates an SMS instance based on the protocol data unit (PDU) and specified SMS ...@@ -28,6 +28,18 @@ Creates an SMS instance based on the protocol data unit (PDU) and specified SMS
| specification | string | Yes | SMS protocol type. <br>- **3gpp**: GSM/UMTS/LTE SMS<br>- **3gpp2**: CDMA SMS| | specification | string | Yes | SMS protocol type. <br>- **3gpp**: GSM/UMTS/LTE SMS<br>- **3gpp2**: CDMA SMS|
| callback | AsyncCallback&lt;[ShortMessage](#shortmessage)&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[ShortMessage](#shortmessage)&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| 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
...@@ -42,7 +54,7 @@ sms.createMessage(pdu, specification, (err, data) => { ...@@ -42,7 +54,7 @@ sms.createMessage(pdu, specification, (err, data) => {
## sms.createMessage ## sms.createMessage
createMessage\(pdu: Array&lt;number&gt;, specification: string\): Promise<ShortMessage\> createMessage\(pdu: Array&lt;number&gt;, specification: string\): Promise\<ShortMessage\>
Creates an SMS instance based on the PDU and specified SMS protocol. This API uses a promise to return the result. Creates an SMS instance based on the PDU and specified SMS protocol. This API uses a promise to return the result.
...@@ -61,6 +73,18 @@ Creates an SMS instance based on the PDU and specified SMS protocol. This API us ...@@ -61,6 +73,18 @@ Creates an SMS instance based on the PDU and specified SMS protocol. This API us
| -------------------------------------------- | --------------------------------- | | -------------------------------------------- | --------------------------------- |
| Promise&lt;[ShortMessage](#shortmessage)&gt; | Promise used to return the result.| | Promise&lt;[ShortMessage](#shortmessage)&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| 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
...@@ -77,7 +101,7 @@ promise.then(data => { ...@@ -77,7 +101,7 @@ promise.then(data => {
## sms.sendMessage ## sms.sendMessage
sendMessage(options: SendMessageOptions): void sendMessage\(options: SendMessageOptions\): void
Sends an SMS message. Sends an SMS message.
...@@ -197,6 +221,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -197,6 +221,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -244,6 +269,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -244,6 +269,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -264,7 +290,7 @@ promise.then(() => { ...@@ -264,7 +290,7 @@ promise.then(() => {
## sms.setSmscAddr<sup>7+</sup> ## sms.setSmscAddr<sup>7+</sup>
setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback<void\>\): void setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback\<void\>\): void
Sets the short message service center (SMSC) address. This API uses an asynchronous callback to return the result. Sets the short message service center (SMSC) address. This API uses an asynchronous callback to return the result.
...@@ -289,6 +315,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -289,6 +315,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -338,6 +365,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -338,6 +365,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -360,7 +388,7 @@ promise.then(() => { ...@@ -360,7 +388,7 @@ promise.then(() => {
## sms.getSmscAddr<sup>7+</sup> ## sms.getSmscAddr<sup>7+</sup>
getSmscAddr\(slotId: number, callback: AsyncCallback<string\>\): void getSmscAddr\(slotId: number, callback: AsyncCallback\<string\>\): void
Obtains the SMSC address. This API uses an asynchronous callback to return the result. Obtains the SMSC address. This API uses an asynchronous callback to return the result.
...@@ -384,6 +412,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -384,6 +412,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -402,7 +431,7 @@ sms.getSmscAddr(slotId, (err, data) => { ...@@ -402,7 +431,7 @@ sms.getSmscAddr(slotId, (err, data) => {
## sms.getSmscAddr<sup>7+</sup> ## sms.getSmscAddr<sup>7+</sup>
getSmscAddr\(slotId: number\): Promise<string\> getSmscAddr\(slotId: number\): Promise\<string\>
Obtains the SMSC address. This API uses a promise to return the result. Obtains the SMSC address. This API uses a promise to return the result.
...@@ -431,6 +460,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -431,6 +460,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -451,7 +481,7 @@ promise.then(data => { ...@@ -451,7 +481,7 @@ promise.then(data => {
## sms.hasSmsCapability<sup>7+</sup> ## sms.hasSmsCapability<sup>7+</sup>
hasSmsCapability(): boolean hasSmsCapability\(\): boolean
Checks whether the current device can send and receive SMS messages. This API works in synchronous mode. Checks whether the current device can send and receive SMS messages. This API works in synchronous mode.
...@@ -470,7 +500,7 @@ console.log(`hasSmsCapability: ${JSON.stringify(result)}`); ...@@ -470,7 +500,7 @@ console.log(`hasSmsCapability: ${JSON.stringify(result)}`);
## sms.splitMessage<sup>8+</sup> ## sms.splitMessage<sup>8+</sup>
splitMessage(content: string, callback: AsyncCallback<Array<string\>>): void splitMessage\(content: string, callback: AsyncCallback\<Array\<string\>\>\): void
Splits an SMS message into multiple segments. This API uses an asynchronous callback to return the result. Splits an SMS message into multiple segments. This API uses an asynchronous callback to return the result.
...@@ -494,6 +524,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -494,6 +524,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -512,7 +543,7 @@ sms.splitMessage(content, (err, data) => { ...@@ -512,7 +543,7 @@ sms.splitMessage(content, (err, data) => {
## sms.splitMessage<sup>8+</sup> ## sms.splitMessage<sup>8+</sup>
splitMessage(content: string): Promise<Array<string\>> splitMessage\(content: string\): Promise\<Array\<string\>\>
Splits an SMS message into multiple segments. This API uses a promise to return the result. Splits an SMS message into multiple segments. This API uses a promise to return the result.
...@@ -541,6 +572,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -541,6 +572,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -561,7 +593,7 @@ promise.then(data => { ...@@ -561,7 +593,7 @@ promise.then(data => {
## sms.addSimMessage<sup>7+</sup> ## sms.addSimMessage<sup>7+</sup>
addSimMessage(options: SimMessageOptions, callback: AsyncCallback<void\>): void addSimMessage\(options: SimMessageOptions, callback: AsyncCallback\<void\>\): void
Adds a SIM message. This API uses an asynchronous callback to return the result. Adds a SIM message. This API uses an asynchronous callback to return the result.
...@@ -585,6 +617,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -585,6 +617,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -608,7 +641,7 @@ sms.addSimMessage(simMessageOptions, (err) => { ...@@ -608,7 +641,7 @@ sms.addSimMessage(simMessageOptions, (err) => {
## sms.addSimMessage<sup>7+</sup> ## sms.addSimMessage<sup>7+</sup>
addSimMessage(options: SimMessageOptions): Promise<void\> addSimMessage\(options: SimMessageOptions\): Promise\<void\>
Adds a SIM message. This API uses a promise to return the result. Adds a SIM message. This API uses a promise to return the result.
...@@ -637,6 +670,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -637,6 +670,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -662,7 +696,7 @@ promise.then(() => { ...@@ -662,7 +696,7 @@ promise.then(() => {
## sms.delSimMessage<sup>7+</sup> ## sms.delSimMessage<sup>7+</sup>
delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback<void\>): void delSimMessage\(slotId: number, msgIndex: number, callback: AsyncCallback\<void\>\): void
Deletes a SIM message. This API uses an asynchronous callback to return the result. Deletes a SIM message. This API uses an asynchronous callback to return the result.
...@@ -687,6 +721,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -687,6 +721,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -706,7 +741,7 @@ sms.delSimMessage(slotId, msgIndex, (err) => { ...@@ -706,7 +741,7 @@ sms.delSimMessage(slotId, msgIndex, (err) => {
## sms.delSimMessage<sup>7+</sup> ## sms.delSimMessage<sup>7+</sup>
delSimMessage(slotId: number, msgIndex: number): Promise<void\> delSimMessage\(slotId: number, msgIndex: number\): Promise\<void\>
Deletes a SIM message. This API uses a promise to return the result. Deletes a SIM message. This API uses a promise to return the result.
...@@ -736,6 +771,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -736,6 +771,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -757,7 +793,7 @@ promise.then(() => { ...@@ -757,7 +793,7 @@ promise.then(() => {
## sms.updateSimMessage<sup>7+</sup> ## sms.updateSimMessage<sup>7+</sup>
updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback<void\>): void updateSimMessage\(options: UpdateSimMessageOptions, callback: AsyncCallback\<void\>\): void
Updates a SIM message. This API uses an asynchronous callback to return the result. Updates a SIM message. This API uses an asynchronous callback to return the result.
...@@ -781,6 +817,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -781,6 +817,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -805,7 +842,7 @@ sms.updateSimMessage(updateSimMessageOptions, (err) => { ...@@ -805,7 +842,7 @@ sms.updateSimMessage(updateSimMessageOptions, (err) => {
## sms.updateSimMessage<sup>7+</sup> ## sms.updateSimMessage<sup>7+</sup>
updateSimMessage(options: UpdateSimMessageOptions): Promise<void\> updateSimMessage\(options: UpdateSimMessageOptions\): Promise\<void\>
Updates a SIM message. This API uses a promise to return the result. Updates a SIM message. This API uses a promise to return the result.
...@@ -834,6 +871,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -834,6 +871,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -860,7 +898,7 @@ promise.then(() => { ...@@ -860,7 +898,7 @@ promise.then(() => {
## sms.getAllSimMessages<sup>7+</sup> ## sms.getAllSimMessages<sup>7+</sup>
getAllSimMessages(slotId: number, callback: AsyncCallback<Array<SimShortMessage\>>): void getAllSimMessages\(slotId: number, callback: AsyncCallback\<Array\<SimShortMessage\>\>\): void
Obtains all SIM card messages. This API uses an asynchronous callback to return the result. Obtains all SIM card messages. This API uses an asynchronous callback to return the result.
...@@ -884,6 +922,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -884,6 +922,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -902,7 +941,7 @@ sms.getAllSimMessages(slotId, (err, data) => { ...@@ -902,7 +941,7 @@ sms.getAllSimMessages(slotId, (err, data) => {
## sms.getAllSimMessages<sup>7+</sup> ## sms.getAllSimMessages<sup>7+</sup>
getAllSimMessages(slotId: number): Promise<Array<SimShortMessage\>> getAllSimMessages\(slotId: number\): Promise\<Array\<SimShortMessage\>\>
Obtains all SIM card messages. This API uses a promise to return the result. Obtains all SIM card messages. This API uses a promise to return the result.
...@@ -931,6 +970,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -931,6 +970,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -951,7 +991,7 @@ promise.then(data => { ...@@ -951,7 +991,7 @@ promise.then(data => {
## sms.setCBConfig<sup>7+</sup> ## sms.setCBConfig<sup>7+</sup>
setCBConfig(options: CBConfigOptions, callback: AsyncCallback<void\>): void setCBConfig\(options: CBConfigOptions, callback: AsyncCallback\<void\>\): void
Sets the cell broadcast configuration. This API uses an asynchronous callback to return the result. Sets the cell broadcast configuration. This API uses an asynchronous callback to return the result.
...@@ -975,6 +1015,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -975,6 +1015,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -999,7 +1040,7 @@ sms.setCBConfig(cbConfigOptions, (err) => { ...@@ -999,7 +1040,7 @@ sms.setCBConfig(cbConfigOptions, (err) => {
## sms.setCBConfig<sup>7+</sup> ## sms.setCBConfig<sup>7+</sup>
setCBConfig(options: CBConfigOptions): Promise<void\> setCBConfig\(options: CBConfigOptions\): Promise\<void\>
Sets the cell broadcast configuration. This API uses a promise to return the result. Sets the cell broadcast configuration. This API uses a promise to return the result.
...@@ -1028,6 +1069,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1028,6 +1069,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1054,7 +1096,7 @@ promise.then(() => { ...@@ -1054,7 +1096,7 @@ promise.then(() => {
## sms.getSmsSegmentsInfo<sup>8+</sup> ## sms.getSmsSegmentsInfo<sup>8+</sup>
getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback<SmsSegmentsInfo\>): void getSmsSegmentsInfo\(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback\<SmsSegmentsInfo\>\): void
Obtains SMS message segment information. This API uses an asynchronous callback to return the result. Obtains SMS message segment information. This API uses an asynchronous callback to return the result.
...@@ -1077,6 +1119,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1077,6 +1119,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1095,7 +1138,7 @@ sms.getSmsSegmentsInfo(slotId, "message", false, (err, data) => { ...@@ -1095,7 +1138,7 @@ sms.getSmsSegmentsInfo(slotId, "message", false, (err, data) => {
## sms.getSmsSegmentsInfo<sup>8+</sup> ## sms.getSmsSegmentsInfo<sup>8+</sup>
getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise<SmsSegmentsInfo\> getSmsSegmentsInfo\(slotId: number, message: string, force7bit: boolean\): Promise\<SmsSegmentsInfo\>
Obtains SMS message segment information. This API uses a promise to return the result. Obtains SMS message segment information. This API uses a promise to return the result.
...@@ -1123,6 +1166,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1123,6 +1166,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1143,7 +1187,7 @@ promise.then(data => { ...@@ -1143,7 +1187,7 @@ promise.then(data => {
## sms.isImsSmsSupported<sup>8+</sup> ## sms.isImsSmsSupported<sup>8+</sup>
isImsSmsSupported(slotId: number, callback: AsyncCallback<boolean\>): void isImsSmsSupported\(slotId: number, callback: AsyncCallback\<boolean\>\): void
Checks whether SMS is supported on IMS. This API uses an asynchronous callback to return the result. Checks whether SMS is supported on IMS. This API uses an asynchronous callback to return the result.
...@@ -1164,6 +1208,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1164,6 +1208,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1182,7 +1227,7 @@ sms.isImsSmsSupported(slotId, (err, data) => { ...@@ -1182,7 +1227,7 @@ sms.isImsSmsSupported(slotId, (err, data) => {
## sms.isImsSmsSupported<sup>8+</sup> ## sms.isImsSmsSupported<sup>8+</sup>
isImsSmsSupported(slotId: number): Promise<boolean\> isImsSmsSupported\(slotId: number\): Promise\<boolean\>
This API uses an asynchronous callback to return the result. This API uses a promise to return the result. This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
...@@ -1208,6 +1253,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1208,6 +1253,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1228,7 +1274,7 @@ promise.then(data => { ...@@ -1228,7 +1274,7 @@ promise.then(data => {
## sms.getImsShortMessageFormat<sup>8+</sup> ## sms.getImsShortMessageFormat<sup>8+</sup>
getImsShortMessageFormat(callback: AsyncCallback<string\>): void getImsShortMessageFormat\(callback: AsyncCallback\<string\>\): void
Obtains the SMS format supported by the IMS. This API uses an asynchronous callback to return the result. Obtains the SMS format supported by the IMS. This API uses an asynchronous callback to return the result.
...@@ -1248,6 +1294,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1248,6 +1294,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -1265,7 +1312,7 @@ sms.getImsShortMessageFormat((err, data) => { ...@@ -1265,7 +1312,7 @@ sms.getImsShortMessageFormat((err, data) => {
## sms.getImsShortMessageFormat<sup>8+</sup> ## sms.getImsShortMessageFormat<sup>8+</sup>
getImsShortMessageFormat(): Promise<string\> getImsShortMessageFormat\(\): Promise\<string\>
Obtains the SMS format supported by the IMS. This API uses a promise to return the result. Obtains the SMS format supported by the IMS. This API uses a promise to return the result.
...@@ -1285,8 +1332,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -1285,8 +1332,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -1304,7 +1350,7 @@ promise.then(data => { ...@@ -1304,7 +1350,7 @@ promise.then(data => {
## sms.decodeMms<sup>8+</sup> ## sms.decodeMms<sup>8+</sup>
decodeMms(mmsFilePathName: string | Array<number\>, callback: AsyncCallback<MmsInformation\>): void decodeMms\(mmsFilePathName: string | Array\<number\>, callback: AsyncCallback\<MmsInformation\>\): void
Decodes MMS messages. This API uses an asynchronous callback to return the result. Decodes MMS messages. This API uses an asynchronous callback to return the result.
...@@ -1343,7 +1389,7 @@ sms.decodeMms(mmsFilePathName, (err, data) => { ...@@ -1343,7 +1389,7 @@ sms.decodeMms(mmsFilePathName, (err, data) => {
## sms.decodeMms<sup>8+</sup> ## sms.decodeMms<sup>8+</sup>
decodeMms(mmsFilePathName: string | Array<number\>): Promise<MmsInformation\> decodeMms\(mmsFilePathName: string | Array\<number\>\): Promise\<MmsInformation\>
Decodes MMS messages. This API uses a promise to return the result. Decodes MMS messages. This API uses a promise to return the result.
...@@ -1389,7 +1435,7 @@ promise.then(data => { ...@@ -1389,7 +1435,7 @@ promise.then(data => {
## sms.encodeMms<sup>8+</sup> ## sms.encodeMms<sup>8+</sup>
encodeMms(mms: MmsInformation, callback: AsyncCallback<Array<number\>>): void encodeMms\(mms: MmsInformation, callback: AsyncCallback\<Array\<number\>\>\): void
MMS message code. This API uses an asynchronous callback to return the result. MMS message code. This API uses an asynchronous callback to return the result.
...@@ -1436,7 +1482,7 @@ sms.encodeMms(mmsInformation, (err, data) => { ...@@ -1436,7 +1482,7 @@ sms.encodeMms(mmsInformation, (err, data) => {
## sms.encodeMms<sup>8+</sup> ## sms.encodeMms<sup>8+</sup>
encodeMms(mms: MmsInformation): Promise<Array<number\>> encodeMms\(mms: MmsInformation\): Promise\<Array\<number\>\>
MMS message code. This API uses a promise to return the result. MMS message code. This API uses a promise to return the result.
......
...@@ -12,7 +12,7 @@ The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSoc ...@@ -12,7 +12,7 @@ The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSoc
import socket from '@ohos.net.socket'; import socket from '@ohos.net.socket';
``` ```
## socket.constructUDPSocketInstance ## socket.constructUDPSocketInstance<sup>7+</sup>
constructUDPSocketInstance(): UDPSocket constructUDPSocketInstance(): UDPSocket
...@@ -32,19 +32,16 @@ Creates a **UDPSocket** object. ...@@ -32,19 +32,16 @@ Creates a **UDPSocket** object.
let udp = socket.constructUDPSocketInstance(); let udp = socket.constructUDPSocketInstance();
``` ```
## UDPSocket ## UDPSocket<sup>7+</sup>
Defines a **UDPSocket** connection. Before invoking UDPSocket APIs, you need to call [socket.constructUDPSocketInstance](#socketconstructudpsocketinstance) to create a **UDPSocket** object. Defines a **UDPSocket** connection. Before invoking UDPSocket APIs, you need to call [socket.constructUDPSocketInstance](#socketconstructudpsocketinstance) to create a **UDPSocket** object.
### bind ### bind<sup>7+</sup>
bind(address: NetAddress, callback: AsyncCallback\<void\>): void bind(address: NetAddress, callback: AsyncCallback\<void\>): void
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result. Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result.
> **NOTE**
> This API is used for the client to create a socket.
**Required permissions**: ohos.permission.INTERNET **Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetStack **System capability**: SystemCapability.Communication.NetStack
...@@ -67,7 +64,7 @@ Binds the IP address and port number. The port number can be specified or random ...@@ -67,7 +64,7 @@ Binds the IP address and port number. The port number can be specified or random
```js ```js
let udp = socket.constructUDPSocketInstance(); let udp = socket.constructUDPSocketInstance();
udp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => { udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
if (err) { if (err) {
console.log('bind fail'); console.log('bind fail');
return; return;
...@@ -76,15 +73,12 @@ udp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => { ...@@ -76,15 +73,12 @@ udp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => {
}) })
``` ```
### bind ### bind<sup>7+</sup>
bind(address: NetAddress): Promise\<void\> bind(address: NetAddress): Promise\<void\>
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result. Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result.
> **NOTE**
> This API is used for the client to create a socket.
**Required permissions**: ohos.permission.INTERNET **Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetStack **System capability**: SystemCapability.Communication.NetStack
...@@ -120,7 +114,7 @@ promise.then(() => { ...@@ -120,7 +114,7 @@ promise.then(() => {
}); });
``` ```
### send ### send<sup>7+</sup>
send(options: UDPSendOptions, callback: AsyncCallback\<void\>): void send(options: UDPSendOptions, callback: AsyncCallback\<void\>): void
...@@ -166,7 +160,7 @@ udp.send({ ...@@ -166,7 +160,7 @@ udp.send({
}) })
``` ```
### send ### send<sup>7+</sup>
send(options: UDPSendOptions): Promise\<void\> send(options: UDPSendOptions): Promise\<void\>
...@@ -216,7 +210,7 @@ promise.then(() => { ...@@ -216,7 +210,7 @@ promise.then(() => {
}); });
``` ```
### close ### close<sup>7+</sup>
close(callback: AsyncCallback\<void\>): void close(callback: AsyncCallback\<void\>): void
...@@ -245,7 +239,7 @@ udp.close(err => { ...@@ -245,7 +239,7 @@ udp.close(err => {
}) })
``` ```
### close ### close<sup>7+</sup>
close(): Promise\<void\> close(): Promise\<void\>
...@@ -273,7 +267,7 @@ promise.then(() => { ...@@ -273,7 +267,7 @@ promise.then(() => {
}); });
``` ```
### getState ### getState<sup>7+</sup>
getState(callback: AsyncCallback\<SocketStateBase\>): void getState(callback: AsyncCallback\<SocketStateBase\>): void
...@@ -318,7 +312,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { ...@@ -318,7 +312,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
}) })
``` ```
### getState ### getState<sup>7+</sup>
getState(): Promise\<SocketStateBase\> getState(): Promise\<SocketStateBase\>
...@@ -357,7 +351,7 @@ promise.then(err => { ...@@ -357,7 +351,7 @@ promise.then(err => {
}); });
``` ```
### setExtraOptions ### setExtraOptions<sup>7+</sup>
setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\<void\>): void setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\<void\>): void
...@@ -410,7 +404,7 @@ udp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => { ...@@ -410,7 +404,7 @@ udp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => {
}) })
``` ```
### setExtraOptions ### setExtraOptions<sup>7+</sup>
setExtraOptions(options: UDPExtraOptions): Promise\<void\> setExtraOptions(options: UDPExtraOptions): Promise\<void\>
...@@ -466,7 +460,7 @@ promise.then(() => { ...@@ -466,7 +460,7 @@ promise.then(() => {
}); });
``` ```
### on('message') ### on('message')<sup>7+</sup>
on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
...@@ -497,7 +491,7 @@ udp.on('message', value => { ...@@ -497,7 +491,7 @@ udp.on('message', value => {
}); });
``` ```
### off('message') ### off('message')<sup>7+</sup>
off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
...@@ -535,7 +529,7 @@ udp.off('message', callback); ...@@ -535,7 +529,7 @@ udp.off('message', callback);
udp.off('message'); udp.off('message');
``` ```
### on('listening' | 'close') ### on('listening' | 'close')<sup>7+</sup>
on(type: 'listening' | 'close', callback: Callback\<void\>): void on(type: 'listening' | 'close', callback: Callback\<void\>): void
...@@ -562,7 +556,7 @@ udp.on('close', () => { ...@@ -562,7 +556,7 @@ udp.on('close', () => {
}); });
``` ```
### off('listening' | 'close') ### off('listening' | 'close')<sup>7+</sup>
off(type: 'listening' | 'close', callback?: Callback\<void\>): void off(type: 'listening' | 'close', callback?: Callback\<void\>): void
...@@ -600,7 +594,7 @@ udp.off('close', callback2); ...@@ -600,7 +594,7 @@ udp.off('close', callback2);
udp.off('close'); udp.off('close');
``` ```
### on('error') ### on('error')<sup>7+</sup>
on(type: 'error', callback: ErrorCallback): void on(type: 'error', callback: ErrorCallback): void
...@@ -624,7 +618,7 @@ udp.on('error', err => { ...@@ -624,7 +618,7 @@ udp.on('error', err => {
}); });
``` ```
### off('error') ### off('error')<sup>7+</sup>
off(type: 'error', callback?: ErrorCallback): void off(type: 'error', callback?: ErrorCallback): void
...@@ -655,7 +649,7 @@ udp.off('error', callback); ...@@ -655,7 +649,7 @@ udp.off('error', callback);
udp.off('error'); udp.off('error');
``` ```
## NetAddress ## NetAddress<sup>7+</sup>
Defines the destination address. Defines the destination address.
...@@ -667,7 +661,7 @@ Defines the destination address. ...@@ -667,7 +661,7 @@ Defines the destination address.
| port | number | No | Port number. The value ranges from **0** to **65535**. If this parameter is not specified, the system randomly allocates a port. | | port | number | No | Port number. The value ranges from **0** to **65535**. If this parameter is not specified, the system randomly allocates a port. |
| family | number | No | Network protocol type.<br>- **1**: IPv4<br>- **2**: IPv6<br>The default value is **1**.| | family | number | No | Network protocol type.<br>- **1**: IPv4<br>- **2**: IPv6<br>The default value is **1**.|
## UDPSendOptions ## UDPSendOptions<sup>7+</sup>
Defines the parameters for sending data over the UDPSocket connection. Defines the parameters for sending data over the UDPSocket connection.
...@@ -678,7 +672,7 @@ Defines the parameters for sending data over the UDPSocket connection. ...@@ -678,7 +672,7 @@ Defines the parameters for sending data over the UDPSocket connection.
| data | string \| ArrayBuffer<sup>7+</sup> | Yes | Data to send. | | data | string \| ArrayBuffer<sup>7+</sup> | Yes | Data to send. |
| address | [NetAddress](#netaddress) | Yes | Destination address.| | address | [NetAddress](#netaddress) | Yes | Destination address.|
## UDPExtraOptions ## UDPExtraOptions<sup>7+</sup>
Defines other properties of the UDPSocket connection. Defines other properties of the UDPSocket connection.
...@@ -692,7 +686,7 @@ Defines other properties of the UDPSocket connection. ...@@ -692,7 +686,7 @@ Defines other properties of the UDPSocket connection.
| reuseAddress | boolean | No | Whether to reuse addresses. The default value is **false**. | | reuseAddress | boolean | No | Whether to reuse addresses. The default value is **false**. |
| socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms.| | socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms.|
## SocketStateBase ## SocketStateBase<sup>7+</sup>
Defines the status of the socket connection. Defines the status of the socket connection.
...@@ -704,7 +698,7 @@ Defines the status of the socket connection. ...@@ -704,7 +698,7 @@ Defines the status of the socket connection.
| isClose | boolean | Yes | Whether the connection is in the closed state.| | isClose | boolean | Yes | Whether the connection is in the closed state.|
| isConnected | boolean | Yes | Whether the connection is in the connected state.| | isConnected | boolean | Yes | Whether the connection is in the connected state.|
## SocketRemoteInfo ## SocketRemoteInfo<sup>7+</sup>
Defines information about the socket connection. Defines information about the socket connection.
...@@ -723,7 +717,7 @@ The UDP error code mapping is in the format of 2301000 + Linux kernel error code ...@@ -723,7 +717,7 @@ The UDP error code mapping is in the format of 2301000 + Linux kernel error code
For details about error codes, see [Socket Error Codes](../errorcodes/errorcode-net-socket.md). For details about error codes, see [Socket Error Codes](../errorcodes/errorcode-net-socket.md).
## socket.constructTCPSocketInstance ## socket.constructTCPSocketInstance<sup>7+</sup>
constructTCPSocketInstance(): TCPSocket constructTCPSocketInstance(): TCPSocket
...@@ -743,19 +737,16 @@ Creates a **TCPSocket** object. ...@@ -743,19 +737,16 @@ Creates a **TCPSocket** object.
let tcp = socket.constructTCPSocketInstance(); let tcp = socket.constructTCPSocketInstance();
``` ```
## TCPSocket ## TCPSocket<sup>7+</sup>
Defines a TCPSocket connection. Before invoking TCPSocket APIs, you need to call [socket.constructTCPSocketInstance](#socketconstructtcpsocketinstance) to create a **TCPSocket** object. Defines a TCPSocket connection. Before invoking TCPSocket APIs, you need to call [socket.constructTCPSocketInstance](#socketconstructtcpsocketinstance) to create a **TCPSocket** object.
### bind ### bind<sup>7+</sup>
bind(address: NetAddress, callback: AsyncCallback\<void\>): void bind(address: NetAddress, callback: AsyncCallback\<void\>): void
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result. Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result.
> **NOTE**
> This API is used for the client to create a socket.
**Required permissions**: ohos.permission.INTERNET **Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetStack **System capability**: SystemCapability.Communication.NetStack
...@@ -778,7 +769,7 @@ Binds the IP address and port number. The port number can be specified or random ...@@ -778,7 +769,7 @@ Binds the IP address and port number. The port number can be specified or random
```js ```js
let tcp = socket.constructTCPSocketInstance(); let tcp = socket.constructTCPSocketInstance();
tcp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => { tcp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => {
if (err) { if (err) {
console.log('bind fail'); console.log('bind fail');
return; return;
...@@ -787,15 +778,12 @@ tcp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => { ...@@ -787,15 +778,12 @@ tcp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => {
}) })
``` ```
### bind ### bind<sup>7+</sup>
bind(address: NetAddress): Promise\<void\> bind(address: NetAddress): Promise\<void\>
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result. Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result.
> **NOTE**
> This API is used for the client to create a socket.
**Required permissions**: ohos.permission.INTERNET **Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetStack **System capability**: SystemCapability.Communication.NetStack
...@@ -831,7 +819,7 @@ promise.then(() => { ...@@ -831,7 +819,7 @@ promise.then(() => {
}); });
``` ```
### connect ### connect<sup>7+</sup>
connect(options: TCPConnectOptions, callback: AsyncCallback\<void\>): void connect(options: TCPConnectOptions, callback: AsyncCallback\<void\>): void
...@@ -871,7 +859,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim ...@@ -871,7 +859,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim
}) })
``` ```
### connect ### connect<sup>7+</sup>
connect(options: TCPConnectOptions): Promise\<void\> connect(options: TCPConnectOptions): Promise\<void\>
...@@ -912,7 +900,7 @@ promise.then(() => { ...@@ -912,7 +900,7 @@ promise.then(() => {
}); });
``` ```
### send ### send<sup>7+</sup>
send(options: TCPSendOptions, callback: AsyncCallback\<void\>): void send(options: TCPSendOptions, callback: AsyncCallback\<void\>): void
...@@ -958,7 +946,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim ...@@ -958,7 +946,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim
}) })
``` ```
### send ### send<sup>7+</sup>
send(options: TCPSendOptions): Promise\<void\> send(options: TCPSendOptions): Promise\<void\>
...@@ -1010,7 +998,7 @@ promise1.then(() => { ...@@ -1010,7 +998,7 @@ promise1.then(() => {
}); });
``` ```
### close ### close<sup>7+</sup>
close(callback: AsyncCallback\<void\>): void close(callback: AsyncCallback\<void\>): void
...@@ -1045,7 +1033,7 @@ tcp.close(err => { ...@@ -1045,7 +1033,7 @@ tcp.close(err => {
}) })
``` ```
### close ### close<sup>7+</sup>
close(): Promise\<void\> close(): Promise\<void\>
...@@ -1079,7 +1067,7 @@ promise.then(() => { ...@@ -1079,7 +1067,7 @@ promise.then(() => {
}); });
``` ```
### getRemoteAddress ### getRemoteAddress<sup>7+</sup>
getRemoteAddress(callback: AsyncCallback\<NetAddress\>): void getRemoteAddress(callback: AsyncCallback\<NetAddress\>): void
...@@ -1120,7 +1108,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim ...@@ -1120,7 +1108,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim
}); });
``` ```
### getRemoteAddress ### getRemoteAddress<sup>7+</sup>
getRemoteAddress(): Promise\<NetAddress\> getRemoteAddress(): Promise\<NetAddress\>
...@@ -1163,7 +1151,7 @@ promise1.then(() => { ...@@ -1163,7 +1151,7 @@ promise1.then(() => {
}); });
``` ```
### getState ### getState<sup>7+</sup>
getState(callback: AsyncCallback\<SocketStateBase\>): void getState(callback: AsyncCallback\<SocketStateBase\>): void
...@@ -1204,7 +1192,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa ...@@ -1204,7 +1192,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa
}); });
``` ```
### getState ### getState<sup>7+</sup>
getState(): Promise\<SocketStateBase\> getState(): Promise\<SocketStateBase\>
...@@ -1247,7 +1235,7 @@ promise.then(() => { ...@@ -1247,7 +1235,7 @@ promise.then(() => {
}); });
``` ```
### setExtraOptions ### setExtraOptions<sup>7+</sup>
setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void\>): void setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void\>): void
...@@ -1299,7 +1287,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa ...@@ -1299,7 +1287,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa
}); });
``` ```
### setExtraOptions ### setExtraOptions<sup>7+</sup>
setExtraOptions(options: TCPExtraOptions): Promise\<void\> setExtraOptions(options: TCPExtraOptions): Promise\<void\>
...@@ -1358,7 +1346,7 @@ promise.then(() => { ...@@ -1358,7 +1346,7 @@ promise.then(() => {
}); });
``` ```
### on('message') ### on('message')<sup>7+</sup>
on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
...@@ -1389,7 +1377,7 @@ tcp.on('message', value => { ...@@ -1389,7 +1377,7 @@ tcp.on('message', value => {
}); });
``` ```
### off('message') ### off('message')<sup>7+</sup>
off(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void off(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
...@@ -1427,7 +1415,7 @@ tcp.off('message', callback); ...@@ -1427,7 +1415,7 @@ tcp.off('message', callback);
tcp.off('message'); tcp.off('message');
``` ```
### on('connect' | 'close') ### on('connect' | 'close')<sup>7+</sup>
on(type: 'connect' | 'close', callback: Callback\<void\>): void on(type: 'connect' | 'close', callback: Callback\<void\>): void
...@@ -1454,7 +1442,7 @@ tcp.on('close', () => { ...@@ -1454,7 +1442,7 @@ tcp.on('close', () => {
}); });
``` ```
### off('connect' | 'close') ### off('connect' | 'close')<sup>7+</sup>
off(type: 'connect' | 'close', callback?: Callback\<void\>): void off(type: 'connect' | 'close', callback?: Callback\<void\>): void
...@@ -1492,7 +1480,7 @@ tcp.off('close', callback2); ...@@ -1492,7 +1480,7 @@ tcp.off('close', callback2);
tcp.off('close'); tcp.off('close');
``` ```
### on('error') ### on('error')<sup>7+</sup>
on(type: 'error', callback: ErrorCallback): void on(type: 'error', callback: ErrorCallback): void
...@@ -1516,7 +1504,7 @@ tcp.on('error', err => { ...@@ -1516,7 +1504,7 @@ tcp.on('error', err => {
}); });
``` ```
### off('error') ### off('error')<sup>7+</sup>
off(type: 'error', callback?: ErrorCallback): void off(type: 'error', callback?: ErrorCallback): void
...@@ -1547,7 +1535,7 @@ tcp.off('error', callback); ...@@ -1547,7 +1535,7 @@ tcp.off('error', callback);
tcp.off('error'); tcp.off('error');
``` ```
## TCPConnectOptions ## TCPConnectOptions<sup>7+</sup>
Defines TCPSocket connection parameters. Defines TCPSocket connection parameters.
...@@ -1558,7 +1546,7 @@ Defines TCPSocket connection parameters. ...@@ -1558,7 +1546,7 @@ Defines TCPSocket connection parameters.
| address | [NetAddress](#netaddress) | Yes | Bound IP address and port number. | | address | [NetAddress](#netaddress) | Yes | Bound IP address and port number. |
| timeout | number | No | Timeout duration of the TCPSocket connection, in ms.| | timeout | number | No | Timeout duration of the TCPSocket connection, in ms.|
## TCPSendOptions ## TCPSendOptions<sup>7+</sup>
Defines the parameters for sending data over the TCPSocket connection. Defines the parameters for sending data over the TCPSocket connection.
...@@ -1569,7 +1557,7 @@ Defines the parameters for sending data over the TCPSocket connection. ...@@ -1569,7 +1557,7 @@ Defines the parameters for sending data over the TCPSocket connection.
| data | string\| ArrayBuffer<sup>7+</sup> | Yes | Data to send. | | data | string\| ArrayBuffer<sup>7+</sup> | Yes | Data to send. |
| encoding | string | No | Character encoding format. The options are as follows: **UTF-8**, **UTF-16BE**, **UTF-16LE**, **UTF-16**, **US-AECII**, and **ISO-8859-1**. The default value is **UTF-8**.| | encoding | string | No | Character encoding format. The options are as follows: **UTF-8**, **UTF-16BE**, **UTF-16LE**, **UTF-16**, **US-AECII**, and **ISO-8859-1**. The default value is **UTF-8**.|
## TCPExtraOptions ## TCPExtraOptions<sup>7+</sup>
Defines other properties of the TCPSocket connection. Defines other properties of the TCPSocket connection.
...@@ -1881,7 +1869,7 @@ promise.then(() => { ...@@ -1881,7 +1869,7 @@ promise.then(() => {
}); });
``` ```
### on('message') ### on('message')<sup>9+</sup>
on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;
...@@ -1912,7 +1900,7 @@ tls.on('message', value => { ...@@ -1912,7 +1900,7 @@ tls.on('message', value => {
}); });
``` ```
### off('message') ### off('message')<sup>9+</sup>
off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void
...@@ -1948,7 +1936,7 @@ tls.on('message', callback); ...@@ -1948,7 +1936,7 @@ tls.on('message', callback);
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. // You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
tls.off('message', callback); tls.off('message', callback);
``` ```
### on('connect' | 'close') ### on('connect' | 'close')<sup>9+</sup>
on(type: 'connect' | 'close', callback: Callback\<void\>): void on(type: 'connect' | 'close', callback: Callback\<void\>): void
...@@ -1975,7 +1963,7 @@ tls.on('close', () => { ...@@ -1975,7 +1963,7 @@ tls.on('close', () => {
}); });
``` ```
### off('connect' | 'close') ### off('connect' | 'close')<sup>9+</sup>
off(type: 'connect' | 'close', callback?: Callback\<void\>): void off(type: 'connect' | 'close', callback?: Callback\<void\>): void
...@@ -2012,7 +2000,7 @@ tls.on('close', callback2); ...@@ -2012,7 +2000,7 @@ tls.on('close', callback2);
tls.off('close', callback2); tls.off('close', callback2);
``` ```
### on('error') ### on('error')<sup>9+</sup>
on(type: 'error', callback: ErrorCallback): void on(type: 'error', callback: ErrorCallback): void
...@@ -2036,7 +2024,7 @@ tls.on('error', err => { ...@@ -2036,7 +2024,7 @@ tls.on('error', err => {
}); });
``` ```
### off('error') ### off('error')<sup>9+</sup>
off(type: 'error', callback?: ErrorCallback): void off(type: 'error', callback?: ErrorCallback): void
...@@ -2675,7 +2663,7 @@ Sends a message to the server after a TLSSocket connection is established. This ...@@ -2675,7 +2663,7 @@ Sends a message to the server after a TLSSocket connection is established. This
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2303501 | SSL is null. | | 2303501 | SSL is null. |
| 2303503 | Error in tls writing | | 2303503 | Error in tls writing. |
| 2303505 | Error occurred in the tls system call. | | 2303505 | Error occurred in the tls system call. |
| 2303506 | Error clearing tls connection. | | 2303506 | Error clearing tls connection. |
| 2300002 | System internal error. | | 2300002 | System internal error. |
...@@ -2712,7 +2700,7 @@ Sends a message to the server after a TLSSocket connection is established. This ...@@ -2712,7 +2700,7 @@ Sends a message to the server after a TLSSocket connection is established. This
| ------- | -------------------------------------------- | | ------- | -------------------------------------------- |
| 401 | Parameter error. | | 401 | Parameter error. |
| 2303501 | SSL is null. | | 2303501 | SSL is null. |
| 2303503 | Error in tls writing | | 2303503 | Error in tls writing. |
| 2303505 | Error occurred in the tls system call. | | 2303505 | Error occurred in the tls system call. |
| 2303506 | Error clearing tls connection. | | 2303506 | Error clearing tls connection. |
| 2300002 | System internal error. | | 2300002 | System internal error. |
...@@ -2846,7 +2834,3 @@ Enumerates TLS protocol versions. ...@@ -2846,7 +2834,3 @@ Enumerates TLS protocol versions.
Defines the certificate raw data. Defines the certificate raw data.
**System capability**: SystemCapability.Communication.NetStack **System capability**: SystemCapability.Communication.NetStack
| Type | Description |
| --------------------------------------------------------------------- | --------------------- |
|[cert.EncodingBlob](js-apis-cert.md#datablob) | Data and encoding format of the certificate.|
...@@ -16,7 +16,48 @@ import fetch from '@system.fetch'; ...@@ -16,7 +16,48 @@ import fetch from '@system.fetch';
## fetch.fetch<sup>3+</sup> ## fetch.fetch<sup>3+</sup>
fetch(Object): void fetch(options:{
/**
* Resource URL.
* @since 3
*/
url: string;
/**
* Request parameter, which can be of the string type or a JSON object.
* @since 3
*/
data?: string | object;
/**
* Request header, which accommodates all attributes of the request.
* @since 3
*/
header?: Object;
/**
* Request methods available: OPTIONS, GET, HEAD, POST, PUT, DELETE and TRACE. The default value is GET.
* @since 3
*/
method?: string;
/**
* The return type can be text, or JSON. By default, the return type is determined based on Content-Type in the header returned by the server.
* @since 3
*/
responseType?: string;
/**
* Called when the network data is obtained successfully.
* @since 3
*/
success?: (data: FetchResponse) => void;
/**
* Called when the network data fails to be obtained.
* @since 3
*/
fail?: (data: any, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
} ): void
Obtains data through a network. Obtains data through a network.
...@@ -43,7 +84,9 @@ Obtains data through a network. ...@@ -43,7 +84,9 @@ Obtains data through a network.
| Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.| | Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.|
| Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.| | Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.|
## FetchResponse ## FetchResponse<sup>3+</sup>
**System capability**: SystemCapability.Communication.NetStack
| Name| Type| Readable| Writable| Description| | Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- | | -------- | -------- | -------- | -------- | -------- |
......
...@@ -21,9 +21,25 @@ ohos.permission.GET_WIFI_INFO ...@@ -21,9 +21,25 @@ ohos.permission.GET_WIFI_INFO
ohos.permission.GET_NETWORK_INFO ohos.permission.GET_NETWORK_INFO
## network.getType ## network.getType<sup>3+</sup>
getType(Object): void getType(options?: {
/**
* Called when the network type is obtained.
* @since 3
*/
success?: (data: NetworkResponse) => void;
/**
* Called when the network type fails to be obtained.
* @since 3
*/
fail?: (data: any, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
}): void
Obtains the network type. Obtains the network type.
...@@ -61,9 +77,20 @@ export default { ...@@ -61,9 +77,20 @@ export default {
``` ```
## network.subscribe ## network.subscribe<sup>3+</sup>
subscribe(Object): void subscribe(options?:{
/**
* Called when the network connection state changes.
* @since 3
*/
success?: (data: NetworkResponse) => void;
/**
* Called when the listening fails.
* @since 3
*/
fail?: (data: any, code: number) => void;
}): void
Listens to the network connection state. If this method is called multiple times, the last call takes effect. Listens to the network connection state. If this method is called multiple times, the last call takes effect.
...@@ -101,7 +128,7 @@ export default { ...@@ -101,7 +128,7 @@ export default {
``` ```
## network.unsubscribe ## network.unsubscribe<sup>3+</sup>
unsubscribe(): void unsubscribe(): void
...@@ -120,7 +147,7 @@ export default { ...@@ -120,7 +147,7 @@ export default {
``` ```
## NetworkResponse ## NetworkResponse<sup>3+</sup>
**System capability**: SystemCapability.Communication.NetManager.Core **System capability**: SystemCapability.Communication.NetManager.Core
......
# @ohos.telephony.data (Cellular Data) # @ohos.telephony.data (Cellular Data)
The **data** module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled. The cellular data module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled.
>**NOTE** >**NOTE**
> >
...@@ -24,7 +24,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses an ...@@ -24,7 +24,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses an
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------------------------------ | | -------- | ----------------------- | ---- | ------------------------------------------ |
| callback | AsyncCallback\<number\> | Yes | Callback used to return the result.<br>**0**: card slot 1.<br>**1**: card slot 2.| | callback | AsyncCallback\<number\> | Yes | Callback used to return the result.<br>**0**: card slot 1<br>**1**: card slot 2|
**Example** **Example**
...@@ -46,7 +46,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses a p ...@@ -46,7 +46,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses a p
| Type | Description | | Type | Description |
| ----------------- | ------------------------------------------------------------ | | ----------------- | ------------------------------------------------------------ |
| Promise\<number\> | Promise used to return the result.<br>**0**: card slot 1.<br>**1**: card slot 2.| | Promise\<number\> | Promise used to return the result.<br>**0**: card slot 1<br>**1**: card slot 2|
**Example** **Example**
...@@ -71,7 +71,7 @@ Obtains the default SIM card used for mobile data synchronously. ...@@ -71,7 +71,7 @@ Obtains the default SIM card used for mobile data synchronously.
| Type | Description | | Type | Description |
| ------ | -------------------------------------------------- | | ------ | -------------------------------------------------- |
| number | Card slot ID.<br>**0**: card slot 1.<br>**1**: card slot 2.| | number | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|
**Example** **Example**
...@@ -87,7 +87,7 @@ Sets the default slot of the SIM card used for mobile data. This API uses an asy ...@@ -87,7 +87,7 @@ Sets the default slot of the SIM card used for mobile data. This API uses an asy
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -95,7 +95,7 @@ Sets the default slot of the SIM card used for mobile data. This API uses an asy ...@@ -95,7 +95,7 @@ Sets the default slot of the SIM card used for mobile data. This API uses an asy
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | SIM card slot ID. <br>**0**: card slot 1.<br>**1**: card slot 2.<br>**-1**: Clears the default configuration.| | slotId | number | Yes | SIM card slot ID. <br>**0**: card slot 1<br>**1**: card slot 2<br>**-1**: Clears the default configuration.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes** **Error codes**
...@@ -105,6 +105,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -105,6 +105,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -129,7 +130,7 @@ Sets the default slot of the SIM card used for mobile data. This API uses a prom ...@@ -129,7 +130,7 @@ Sets the default slot of the SIM card used for mobile data. This API uses a prom
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -137,7 +138,7 @@ Sets the default slot of the SIM card used for mobile data. This API uses a prom ...@@ -137,7 +138,7 @@ Sets the default slot of the SIM card used for mobile data. This API uses a prom
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | SIM card slot ID. <br>**0**: card slot 1.<br>**1**: card slot 2.<br>**-1**: Clears the default configuration.| | slotId | number | Yes | SIM card slot ID. <br>**0**: card slot 1<br>**1**: card slot 2<br>**-1**: Clears the default configuration.|
**Return value** **Return value**
...@@ -152,6 +153,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -152,6 +153,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -325,8 +327,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -325,8 +327,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -356,7 +356,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses a ...@@ -356,7 +356,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses 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\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.| | callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
**Error codes** **Error codes**
...@@ -394,7 +394,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses a ...@@ -394,7 +394,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses 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|
**Return value** **Return value**
...@@ -428,13 +428,13 @@ promise.then((data) => { ...@@ -428,13 +428,13 @@ promise.then((data) => {
## data.enableCellularData ## data.enableCellularData
enableCellularData(callback: AsyncCallback<void\>): void enableCellularData(callback: AsyncCallback\<void\>): void
Enables the cellular data service. This API uses an asynchronous callback to return the result. Enables the cellular data service. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -451,6 +451,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -451,6 +451,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -467,13 +468,13 @@ data.enableCellularData((err) => { ...@@ -467,13 +468,13 @@ data.enableCellularData((err) => {
## data.enableCellularData ## data.enableCellularData
enableCellularData(): Promise<void\> enableCellularData(): Promise\<void\>
Enables the cellular data service. This API uses a promise to return the result. Enables the cellular data service. 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.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -490,8 +491,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -490,8 +491,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -509,13 +509,13 @@ promise.then(() => { ...@@ -509,13 +509,13 @@ promise.then(() => {
## data.disableCellularData ## data.disableCellularData
disableCellularData(callback: AsyncCallback<void\>): void disableCellularData(callback: AsyncCallback\<void\>): void
Disables the cellular data service. This API uses an asynchronous callback to return the result. Disables the cellular data service. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -532,6 +532,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -532,6 +532,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -548,13 +549,13 @@ data.disableCellularData((err) => { ...@@ -548,13 +549,13 @@ data.disableCellularData((err) => {
## data.disableCellularData ## data.disableCellularData
disableCellularData(): Promise<void\> disableCellularData(): Promise\<void\>
Disables the cellular data service. This API uses a promise to return the result. Disables the cellular data service. 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.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -571,8 +572,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -571,8 +572,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 401 | Parameter error. | | 202 | Non-system applications use system APIs. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. | | 8300003 | System internal error. |
| 8300999 | Unknown error code. | | 8300999 | Unknown error code. |
...@@ -590,13 +590,13 @@ promise.then(() => { ...@@ -590,13 +590,13 @@ promise.then(() => {
## data.enableCellularDataRoaming ## data.enableCellularDataRoaming
enableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void enableCellularDataRoaming(slotId: number, callback: AsyncCallback\<void\>): void
Enables the cellular data roaming service. This API uses an asynchronous callback to return the result. Enables the cellular data roaming service. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -604,7 +604,7 @@ Enables the cellular data roaming service. This API uses an asynchronous callbac ...@@ -604,7 +604,7 @@ Enables the cellular data roaming service. This API uses an asynchronous callbac
| 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** **Error codes**
...@@ -614,6 +614,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -614,6 +614,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -630,13 +631,13 @@ data.enableCellularDataRoaming(0, (err) => { ...@@ -630,13 +631,13 @@ data.enableCellularDataRoaming(0, (err) => {
## data.enableCellularDataRoaming ## data.enableCellularDataRoaming
enableCellularDataRoaming(slotId: number): Promise<void\> enableCellularDataRoaming(slotId: number): Promise\<void\>
Enables the cellular data roaming service. This API uses a promise to return the result. Enables the cellular data roaming service. 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.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -644,7 +645,7 @@ Enables the cellular data roaming service. This API uses a promise to return the ...@@ -644,7 +645,7 @@ Enables the cellular data roaming service. This API uses a promise to return the
| 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|
**Return value** **Return value**
...@@ -659,6 +660,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -659,6 +660,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -678,13 +680,13 @@ promise.then(() => { ...@@ -678,13 +680,13 @@ promise.then(() => {
## data.disableCellularDataRoaming ## data.disableCellularDataRoaming
disableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void disableCellularDataRoaming(slotId: number, callback: AsyncCallback\<void\>): void
Disables the cellular data roaming service. This API uses an asynchronous callback to return the result. Disables the cellular data roaming service. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **System API**: This is a system API.
**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -692,7 +694,7 @@ Disables the cellular data roaming service. This API uses an asynchronous callba ...@@ -692,7 +694,7 @@ Disables the cellular data roaming service. This API uses an asynchronous callba
| 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** **Error codes**
...@@ -702,6 +704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -702,6 +704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
...@@ -718,13 +721,13 @@ data.disableCellularDataRoaming(0, (err) => { ...@@ -718,13 +721,13 @@ data.disableCellularDataRoaming(0, (err) => {
## data.disableCellularDataRoaming ## data.disableCellularDataRoaming
disableCellularDataRoaming(slotId: number): Promise<void\> disableCellularDataRoaming(slotId: number): Promise\<void\>
Disables the cellular data roaming service. This API uses a promise to return the result. Disables the cellular data roaming service. 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.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
**System capability**: SystemCapability.Telephony.CellularData **System capability**: SystemCapability.Telephony.CellularData
...@@ -732,7 +735,7 @@ Disables the cellular data roaming service. This API uses a promise to return th ...@@ -732,7 +735,7 @@ Disables the cellular data roaming service. This API uses a promise to return th
| 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|
**Return value** **Return value**
...@@ -747,6 +750,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r ...@@ -747,6 +750,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| ID| Error Message | | ID| Error Message |
| -------- | -------------------------------------------- | | -------- | -------------------------------------------- |
| 201 | Permission denied. | | 201 | Permission denied. |
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. | | 401 | Parameter error. |
| 8300001 | Invalid parameter value. | | 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. | | 8300002 | Operation failed. Cannot connect to service. |
......
...@@ -2,7 +2,8 @@ ...@@ -2,7 +2,8 @@
The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control. The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
> **NOTE**<br> > **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.
## Modules to Import ## Modules to Import
...@@ -29,9 +30,9 @@ Subscribes to thermal level changes. ...@@ -29,9 +30,9 @@ Subscribes to thermal level changes.
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md). For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4800101 | Operation failed. Cannot connect to service.| | 4800101 | If connecting to the service failed. |
**Example** **Example**
...@@ -58,15 +59,15 @@ Unsubscribes from thermal level changes. ...@@ -58,15 +59,15 @@ Unsubscribes from thermal level changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | ---------------------------------------------- | | -------- | -------------------- | ---- | ---------------------------------------------- |
| callback | Callback&lt;void&gt; | No | Callback used to return the result. No value is returned. If this parameter is not set, this API unsubscribes from all callbacks.| | callback | Callback&lt;void&gt; | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.|
**Error codes** **Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md). For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4800101 | Operation failed. Cannot connect to service.| | 4800101 | If connecting to the service failed. |
**Example** **Example**
...@@ -93,15 +94,15 @@ Obtains the current thermal level. ...@@ -93,15 +94,15 @@ Obtains the current thermal level.
| Type | Description | | Type | Description |
| ------------ | ------------ | | ------------ | ------------ |
| ThermalLevel | Thermal level obtained.| | ThermalLevel | Thermal level.|
**Error codes** **Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md). For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message | | ID | Error Message |
|---------|---------| |---------|---------|
| 4800101 | Operation failed. Cannot connect to service.| | 4800101 | If connecting to the service failed. |
**Example** **Example**
...@@ -118,8 +119,7 @@ try { ...@@ -118,8 +119,7 @@ try {
subscribeThermalLevel(callback: AsyncCallback&lt;ThermalLevel&gt;): void subscribeThermalLevel(callback: AsyncCallback&lt;ThermalLevel&gt;): void
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9).
> This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9) instead.
Subscribes to thermal level changes. Subscribes to thermal level changes.
...@@ -143,8 +143,7 @@ thermal.subscribeThermalLevel((level) => { ...@@ -143,8 +143,7 @@ thermal.subscribeThermalLevel((level) => {
unsubscribeThermalLevel(callback?: AsyncCallback\<void>): void unsubscribeThermalLevel(callback?: AsyncCallback\<void>): void
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9).
> This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9) instead.
Unsubscribes from thermal level changes. Unsubscribes from thermal level changes.
...@@ -154,7 +153,7 @@ Unsubscribes from thermal level changes. ...@@ -154,7 +153,7 @@ Unsubscribes from thermal level changes.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------------------------------------------- | | -------- | ------------------------- | ---- | ---------------------------------------------- |
| callback | AsyncCallback&lt;void&gt; | No | Callback used to return the result. No value is returned. If this parameter is not set, this API unsubscribes from all callbacks.| | callback | AsyncCallback&lt;void&gt; | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.|
**Example** **Example**
...@@ -168,8 +167,7 @@ thermal.unsubscribeThermalLevel(() => { ...@@ -168,8 +167,7 @@ thermal.unsubscribeThermalLevel(() => {
getThermalLevel(): ThermalLevel getThermalLevel(): ThermalLevel
> NOTE<br> > **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.getLevel](#thermalgetlevel9).
> This API is deprecated since API version 9. You are advised to use [thermal.getLevel](#thermalgetlevel9) instead.
Obtains the current thermal level. Obtains the current thermal level.
......
...@@ -67,7 +67,7 @@ ws.connect(defaultIpAddress, (err, value) => { ...@@ -67,7 +67,7 @@ ws.connect(defaultIpAddress, (err, value) => {
}); });
``` ```
## webSocket.createWebSocket ## webSocket.createWebSocket<sup>6+</sup>
createWebSocket(): WebSocket createWebSocket(): WebSocket
...@@ -87,11 +87,11 @@ Creates a WebSocket connection. You can use this API to create or close a WebSoc ...@@ -87,11 +87,11 @@ Creates a WebSocket connection. You can use this API to create or close a WebSoc
let ws = webSocket.createWebSocket(); let ws = webSocket.createWebSocket();
``` ```
## WebSocket ## WebSocket<sup>6+</sup>
Defines a **WebSocket** object. Before invoking WebSocket APIs, you need to call [webSocket.createWebSocket](#websocketcreatewebsocket) to create a **WebSocket** object. Defines a **WebSocket** object. Before invoking WebSocket APIs, you need to call [webSocket.createWebSocket](#websocketcreatewebsocket) to create a **WebSocket** object.
### connect ### connect<sup>6+</sup>
connect(url: string, callback: AsyncCallback\<boolean\>): void connect(url: string, callback: AsyncCallback\<boolean\>): void
...@@ -132,7 +132,7 @@ ws.connect(url, (err, value) => { ...@@ -132,7 +132,7 @@ ws.connect(url, (err, value) => {
}); });
``` ```
### connect ### connect<sup>6+</sup>
connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\<boolean\>): void connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\<boolean\>): void
...@@ -179,7 +179,7 @@ ws.connect(url, { ...@@ -179,7 +179,7 @@ ws.connect(url, {
}); });
``` ```
### connect ### connect<sup>6+</sup>
connect(url: string, options?: WebSocketRequestOptions): Promise\<boolean\> connect(url: string, options?: WebSocketRequestOptions): Promise\<boolean\>
...@@ -225,7 +225,7 @@ promise.then((value) => { ...@@ -225,7 +225,7 @@ promise.then((value) => {
}); });
``` ```
### send ### send<sup>6+</sup>
send(data: string | ArrayBuffer, callback: AsyncCallback\<boolean\>): void send(data: string | ArrayBuffer, callback: AsyncCallback\<boolean\>): void
...@@ -265,7 +265,7 @@ ws.connect(url, (err, value) => { ...@@ -265,7 +265,7 @@ ws.connect(url, (err, value) => {
}); });
``` ```
### send ### send<sup>6+</sup>
send(data: string | ArrayBuffer): Promise\<boolean\> send(data: string | ArrayBuffer): Promise\<boolean\>
...@@ -309,7 +309,7 @@ ws.connect(url, (err, value) => { ...@@ -309,7 +309,7 @@ ws.connect(url, (err, value) => {
}); });
``` ```
### close ### close<sup>6+</sup>
close(callback: AsyncCallback\<boolean\>): void close(callback: AsyncCallback\<boolean\>): void
...@@ -345,7 +345,7 @@ ws.close((err, value) => { ...@@ -345,7 +345,7 @@ ws.close((err, value) => {
}); });
``` ```
### close ### close<sup>6+</sup>
close(options: WebSocketCloseOptions, callback: AsyncCallback\<boolean\>): void close(options: WebSocketCloseOptions, callback: AsyncCallback\<boolean\>): void
...@@ -385,7 +385,7 @@ ws.close({ ...@@ -385,7 +385,7 @@ ws.close({
}); });
``` ```
### close ### close<sup>6+</sup>
close(options?: WebSocketCloseOptions): Promise\<boolean\> close(options?: WebSocketCloseOptions): Promise\<boolean\>
...@@ -429,7 +429,7 @@ promise.then((value) => { ...@@ -429,7 +429,7 @@ promise.then((value) => {
}); });
``` ```
### on('open') ### on('open')<sup>6+</sup>
on(type: 'open', callback: AsyncCallback\<Object\>): void on(type: 'open', callback: AsyncCallback\<Object\>): void
...@@ -453,7 +453,7 @@ ws.on('open', (err, value) => { ...@@ -453,7 +453,7 @@ ws.on('open', (err, value) => {
}); });
``` ```
### off('open') ### off('open')<sup>6+</sup>
off(type: 'open', callback?: AsyncCallback\<Object\>): void off(type: 'open', callback?: AsyncCallback\<Object\>): void
...@@ -483,7 +483,7 @@ ws.on('open', callback1); ...@@ -483,7 +483,7 @@ ws.on('open', callback1);
ws.off('open', callback1); ws.off('open', callback1);
``` ```
### on('message') ### on('message')<sup>6+</sup>
on(type: 'message', callback: AsyncCallback\<string | ArrayBuffer\>): void on(type: 'message', callback: AsyncCallback\<string | ArrayBuffer\>): void
...@@ -510,7 +510,7 @@ ws.on('message', (err, value) => { ...@@ -510,7 +510,7 @@ ws.on('message', (err, value) => {
}); });
``` ```
### off('message') ### off('message')<sup>6+</sup>
off(type: 'message', callback?: AsyncCallback\<string | ArrayBuffer\>): void off(type: 'message', callback?: AsyncCallback\<string | ArrayBuffer\>): void
...@@ -536,7 +536,7 @@ let ws = webSocket.createWebSocket(); ...@@ -536,7 +536,7 @@ let ws = webSocket.createWebSocket();
ws.off('message'); ws.off('message');
``` ```
### on('close') ### on('close')<sup>6+</sup>
on(type: 'close', callback: AsyncCallback\<{ code: number, reason: string }\>): void on(type: 'close', callback: AsyncCallback\<{ code: number, reason: string }\>): void
...@@ -560,7 +560,7 @@ ws.on('close', (err, value) => { ...@@ -560,7 +560,7 @@ ws.on('close', (err, value) => {
}); });
``` ```
### off('close') ### off('close')<sup>6+</sup>
off(type: 'close', callback?: AsyncCallback\<{ code: number, reason: string }\>): void off(type: 'close', callback?: AsyncCallback\<{ code: number, reason: string }\>): void
...@@ -585,7 +585,7 @@ let ws = webSocket.createWebSocket(); ...@@ -585,7 +585,7 @@ let ws = webSocket.createWebSocket();
ws.off('close'); ws.off('close');
``` ```
### on('error') ### on('error')<sup>6+</sup>
on(type: 'error', callback: ErrorCallback): void on(type: 'error', callback: ErrorCallback): void
...@@ -609,7 +609,7 @@ ws.on('error', (err) => { ...@@ -609,7 +609,7 @@ ws.on('error', (err) => {
}); });
``` ```
### off('error') ### off('error')<sup>6+</sup>
off(type: 'error', callback?: ErrorCallback): void off(type: 'error', callback?: ErrorCallback): void
......
# Screen Hopping Error Codes
> **NOTE**
>
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 20900001 Input Device Operation Failed
**Error Message**
Failed to operate the input device.
**Description**
This error code is reported if the screen hopping status is abnormal when the screen hopping API is called.
**Possible Cause**
1. When screen hopping is initiated, the local device is in the hopped state.
2. When screen hopping is disabled, the local device is in the free state.
3. When screen hopping is disabled, the local device is in the hopping state.
**Procedure**
1. When initiating screen hopping, make sure that the local device is not in the hopped state.
2. When disabling screen hopping, make sure that the local device is not in the free state.
3. When disabling screen hopping, make sure that the local device is not in the hopping state.
...@@ -115,7 +115,7 @@ The procedure is as follows: ...@@ -115,7 +115,7 @@ The procedure is as follows:
hidumper -s 3008 hidumper -s 3008
``` ```
9. Run the **hidumper -e** command to obtain the crash information generated by the FaultLoger module. 9. Run the **hidumper -e** command to obtain the crash information generated by the FaultLogger module.
``` ```
hidumper -e hidumper -e
...@@ -163,6 +163,22 @@ The procedure is as follows: ...@@ -163,6 +163,22 @@ The procedure is as follows:
``` ```
hidumper --mem [pid] hidumper --mem [pid]
``` ```
The following table describes the parameters in the first column of the command output when the PID of the process is specified.
| Name | Description|
|----------------|----|
| GL | GPU memory. |
| Graph | Graphics memory. |
| ark ts heap | Memory usage of the ArkTS heap. |
| guard | Memory occupied by the protection section. |
| native heap | Heap memory. |
| AnonPage other | Memory occupied by other pages that are not mapped to files. |
| stack | Stack memory. |
| .hap | Memory occupied by the application. |
| .db | Memory occupied by the **.db** files loaded by processes. |
| .so | Memory occupied by the **.so** dynamic library files loaded by processes. |
| .ttf | Memory occupied by the **.ttf** font files loaded by processes. |
| dev | Memory occupied by the files that are named with the **/dev** prefix and loaded by processes. |
| FilePage other | Memory occupied by other pages that are mapped to files. |
17. Run the **hidumper --zip** command to compress data to the **/data/dumper** directory. 17. Run the **hidumper --zip** command to compress data to the **/data/dumper** directory.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册