diff --git a/en/application-dev/reference/apis/js-apis-batteryStatistics.md b/en/application-dev/reference/apis/js-apis-batteryStatistics.md index 721a432caaf67116a6df882c0e8995e76b893a7e..8314dd92cfc15cdbc9ad8e1e232b3fab2b00380b 100644 --- a/en/application-dev/reference/apis/js-apis-batteryStatistics.md +++ b/en/application-dev/reference/apis/js-apis-batteryStatistics.md @@ -36,7 +36,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod | Code | Error Message | |---------|---------| -| 4600101 | Operation failed. Cannot connect to service.| +| 4600101 | If connecting to the service failed. | **Example** @@ -72,7 +72,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod | Code | Error Message | |---------|---------| -| 4600101 | Operation failed. Cannot connect to service.| +| 4600101 | If connecting to the service failed. | **Example** @@ -114,7 +114,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod | Code | Error Message | |---------|---------| -| 4600101 | Operation failed. Cannot connect to service.| +| 4600101 | If connecting to the service failed. | **Example** @@ -155,7 +155,7 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod | Code | Error Message | |---------|---------| -| 4600101 | Operation failed. Cannot connect to service.| +| 4600101 | If connecting to the service failed. | **Example** @@ -196,13 +196,13 @@ For details about the error codes, see [Thermal Manager Error Codes](../errorcod | Code | Error Message | |---------|---------| -| 4600101 | Operation failed. Cannot connect to service.| +| 4600101 | If connecting to the service failed. | **Example** ```js 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); } catch(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 | Code | Error Message | |---------|---------| -| 4600101 | Operation failed. Cannot connect to service.| +| 4600101 | If connecting to the service failed. | **Example** ```js 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); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); diff --git a/en/application-dev/reference/apis/js-apis-brightness.md b/en/application-dev/reference/apis/js-apis-brightness.md index bd003733a485c1601ac251697461e78b863976a8..e6af63700029738f388f41edb5d980b51a9f9614 100644 --- a/en/application-dev/reference/apis/js-apis-brightness.md +++ b/en/application-dev/reference/apis/js-apis-brightness.md @@ -22,7 +22,7 @@ Sets the screen brightness. **System API**: This is a system API. -**System capability**: SystemCapability.PowerManager.DisplayPowerManager +**System capability:** SystemCapability.PowerManager.DisplayPowerManager **Parameters** @@ -34,9 +34,9 @@ Sets the screen brightness. 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** diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md index 068a12cd46efce13b68a4fcf697306c4b5d8f256..6e037296389e26851c4374fea6db0a282129dafd 100644 --- a/en/application-dev/reference/apis/js-apis-call.md +++ b/en/application-dev/reference/apis/js-apis-call.md @@ -16,7 +16,7 @@ import call from '@ohos.telephony.call'; ## call.dialCall9+ -dialCall\(phoneNumber: string, callback: AsyncCallback\): void +dialCall\(phoneNumber: string, callback: AsyncCallback\\): void 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 | 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. | @@ -57,7 +58,7 @@ call.dialCall("138xxxxxxxx", (err) => { ## call.dialCall9+ -dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\): void +dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\\): void 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 | 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. | @@ -104,7 +106,7 @@ call.dialCall("138xxxxxxxx", { ## call.dialCall9+ -dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise +dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise\ 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 | Name | Type | Mandatory| Description | | ----------- | ----------------------------------- | ---- | -------------------------------------- | | 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.
If this parameter is not set, the following configuration is used by default. For details, see [DialCallOptions](#dialcalloptions9).
- **accountId**: 0 (card slot 1)
- **videoState**: voice call
- **dialScene**: common call
- **dialType**: carrier call | **Return value** @@ -134,6 +136,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -158,7 +161,7 @@ promise.then(() => { ## call.dial(deprecated) -dial\(phoneNumber: string, callback: AsyncCallback\): void +dial\(phoneNumber: string, callback: AsyncCallback\\): void Initiates a call. This API uses an asynchronous callback to return the result. @@ -188,7 +191,7 @@ call.dial("138xxxxxxxx", (err, data) => { ## call.dial(deprecated) -dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void +dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\\): void 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", { ## call.dial(deprecated) -dial\(phoneNumber: string, options?: DialOptions\): Promise +dial\(phoneNumber: string, options?: DialOptions\): Promise\ 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 => { ## call.makeCall7+ -makeCall(phoneNumber: string, callback: AsyncCallback\): void +makeCall\(phoneNumber: string, callback: AsyncCallback\\): void 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 => { ## call.makeCall7+ -makeCall(phoneNumber: string): Promise\ +makeCall\(phoneNumber: string\): Promise\ Launches the call screen and displays the dialed number. This API uses a promise to return the result. @@ -339,7 +342,7 @@ promise.then(() => { ## call.hasCall -hasCall\(callback: AsyncCallback\): void +hasCall\(callback: AsyncCallback\\): void 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) => { ## call.hasCall -hasCall\(\): Promise +hasCall\(\): Promise\ Checks whether a call is in progress. This API uses a promise to return the result. @@ -388,7 +391,7 @@ promise.then(data => { ## call.getCallState -getCallState\(callback: AsyncCallback\): void +getCallState\(callback: AsyncCallback\\): void Obtains the call status. This API uses an asynchronous callback to return the result. @@ -411,7 +414,7 @@ call.getCallState((err, data) => { ## call.getCallState -getCallState\(\): Promise +getCallState\(\): Promise\ Obtains the call status. This API uses a promise to return the result. @@ -436,7 +439,7 @@ promise.then(data => { ## call.hasVoiceCapability7+ -hasVoiceCapability(): boolean +hasVoiceCapability\(\): boolean Checks whether a device supports voice calls. @@ -455,7 +458,7 @@ console.log(`hasVoiceCapability: ${JSON.stringify(result)}`); ## call.isEmergencyPhoneNumber7+ -isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback\): void +isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback\\): void 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) => { ## call.isEmergencyPhoneNumber7+ -isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\): void +isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\\): 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. @@ -528,7 +531,7 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => { ## call.isEmergencyPhoneNumber7+ -isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise +isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise\ 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 => { ## call.formatPhoneNumber7+ -formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback\): void +formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback\\): void Formats a phone number. This API uses an asynchronous callback to return the result. @@ -609,7 +612,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => { ## call.formatPhoneNumber7+ -formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\): void +formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\\): void 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", { ## call.formatPhoneNumber7+ -formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise +formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise\ 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 => { ## call.formatPhoneNumberToE1647+ -formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: AsyncCallback\): void +formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: AsyncCallback\\): void 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) => { ## call.formatPhoneNumberToE1647+ -formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise +formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise\ 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 => { ## call.muteRinger8+ -muteRinger\(callback: AsyncCallback\): void +muteRinger\(callback: AsyncCallback\\): 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. @@ -808,6 +811,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -825,7 +829,7 @@ call.muteRinger((err) => { ## call.muteRinger8+ -muteRinger\(\): Promise +muteRinger\(\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -865,7 +870,7 @@ call.muteRinger().then(() => { ## call.answerCall9+ -answerCall\(callId: number, callback: AsyncCallback\): void +answerCall\(callId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -906,7 +912,7 @@ call.answerCall(1, (err) => { ## call.answerCall9+ -answerCall(callId?: number\): Promise +answerCall(callId?: number\): Promise\ 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 | | ------ | ------ | ---- | ------------------------------------------------------------ | -| 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.
If this parameter is not set, the latest ringing call will be connected.| **Return value** @@ -935,6 +941,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -954,7 +961,7 @@ call.answerCall(1).then(() => { ## call.answerCall9+ -answerCall\(callback: AsyncCallback\): void +answerCall\(callback: AsyncCallback\\): void 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 | 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. | @@ -994,7 +1002,7 @@ call.answerCall((err) => { ## call.hangUpCall9+ -hangUpCall\(callId: number, callback: AsyncCallback\): void +hangUpCall\(callId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1035,7 +1044,7 @@ call.hangUpCall(1, (err) => { ## call.hangUpCall9+ -hangUpCall\(callId?: number\): Promise +hangUpCall\(callId?: number\): Promise\ 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 | | ------ | ------ | ---- | ------------------------------------------------------------ | -| 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.
If this parameter is not set, the latest ongoing, dialed, or connected call will be ended.| **Return value** @@ -1064,6 +1073,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -1083,7 +1093,7 @@ call.hangUpCall(1).then(() => { ## call.hangUpCall9+ -hangUpCall\(callback: AsyncCallback\): void +hangUpCall\(callback: AsyncCallback\\): void 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 | 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. | @@ -1124,7 +1135,7 @@ call.hangUpCall((err) => { ## call.rejectCall9+ -rejectCall(callId: number, callback: AsyncCallback\): void +rejectCall\(callId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1166,7 +1178,7 @@ call.rejectCall(1, (err) => { ## call.rejectCall9+ -rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void +rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\\): void 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 | 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. | @@ -1211,7 +1224,7 @@ call.rejectCall(1, rejectMessageOptions, (err) => { ## call.rejectCall9+ -rejectCall(callId?: number, options?: RejectMessageOptions\): Promise +rejectCall\(callId?: number, options?: RejectMessageOptions\): Promise\ 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 | | ------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | -| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.| -| options | [RejectMessageOptions](#rejectmessageoptions7) | No | Options for the call rejection message. | +| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.
If this parameter is not set, the latest ringing call will be rejected.| +| 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** @@ -1241,6 +1254,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -1263,7 +1277,7 @@ call.reject(1, rejectMessageOptions).then(() => { ## call.rejectCall9+ -rejectCall\(callback: AsyncCallback\): void +rejectCall\(callback: AsyncCallback\\): void 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 | 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. | @@ -1303,7 +1318,7 @@ call.rejectCall((err) => { ## call.rejectCall9+ -rejectCall\(options: RejectMessageOptions, callback: AsyncCallback\): void +rejectCall\(options: RejectMessageOptions, callback: AsyncCallback\\): void 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 | 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. | @@ -1347,7 +1363,7 @@ call.rejectCall(rejectMessageOptions, (err) => { ## call.holdCall7+ -holdCall\(callId: number, callback: AsyncCallback\): void +holdCall\(callId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1388,7 +1405,7 @@ call.holdCall(1, (err) => { ## call.holdCall7+ -holdCall\(callId: number\): Promise +holdCall\(callId: number\): Promise\ 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 | 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. | @@ -1435,7 +1453,7 @@ call.holdCall(1).then(() => { ## call.unHoldCall7+ -unHoldCall\(callId: number, callback: AsyncCallback\): void +unHoldCall\(callId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1476,7 +1495,7 @@ call.unHoldCall(1, (err) => { ## call.unHoldCall7+ -unHoldCall\(callId: number\): Promise +unHoldCall\(callId: number\): Promise\ 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 | 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. | @@ -1523,7 +1543,7 @@ call.unHoldCall(1).then(() => { ## call.switchCall7+ -switchCall\(callId: number, callback: AsyncCallback\): void +switchCall\(callId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1564,7 +1585,7 @@ call.switchCall(1, (err) => { ## call.switchCall7+ -switchCall\(callId: number\): Promise +switchCall\(callId: number\): Promise\ 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 | 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. | @@ -1611,7 +1633,7 @@ call.switchCall(1).then(() => { ## call.combineConference7+ -combineConference\(callId: number, callback: AsyncCallback\): void +combineConference\(callId: number, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -1649,7 +1671,7 @@ call.combineConference(1, (err) => { ## call.combineConference7+ -combineConference\(callId: number\): Promise +combineConference\(callId: number\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -1693,7 +1715,7 @@ call.combineConference(1).then(() => { ## call.getMainCallId7+ -getMainCallId\(callId: number, callback: AsyncCallback\): void +getMainCallId\(callId: number, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -1732,7 +1754,7 @@ call.getMainCallId(1, (err, data) => { ## call.getMainCallId7+ -getMainCallId\(callId: number\): Promise +getMainCallId\(callId: number\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -1777,7 +1800,7 @@ promise.then(data => { ## call.getSubCallIdList7+ -getSubCallIdList\(callId: number, callback: AsyncCallback\>\): void +getSubCallIdList\(callId: number, callback: AsyncCallback\\>\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -1815,7 +1838,7 @@ call.getSubCallIdList(1, (err, data) => { ## call.getSubCallIdList7+ -getSubCallIdList\(callId: number\): Promise\> +getSubCallIdList\(callId: number\): Promise\\> 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -1860,7 +1883,7 @@ promise.then(data => { ## call.getCallIdListForConference7+ -getCallIdListForConference\(callId: number, callback: AsyncCallback>\): void +getCallIdListForConference\(callId: number, callback: AsyncCallback\\>\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -1898,7 +1921,7 @@ call.getCallIdListForConference(1, (err, data) => { ## call.getCallIdListForConference7+ -getCallIdListForConference\(callId: number\): Promise\> +getCallIdListForConference\(callId: number\): Promise\\> 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -1943,7 +1966,7 @@ promise.then(data => { ## call.getCallWaitingStatus7+ -getCallWaitingStatus\(slotId: number, callback: AsyncCallback\): void +getCallWaitingStatus\(slotId: number, callback: AsyncCallback\\): void 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 | 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** @@ -1984,7 +2007,7 @@ call.getCallWaitingStatus(0, (err, data) => { ## call.getCallWaitingStatus7+ -getCallWaitingStatus\(slotId: number\): Promise +getCallWaitingStatus\(slotId: number\): Promise\ 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 | 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** @@ -2032,7 +2055,7 @@ promise.then(data => { ## call.setCallWaiting7+ -setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback\): void +setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback\\): void 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 | 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** @@ -2074,7 +2097,7 @@ call.setCallWaiting(0, true, (err) => { ## call.setCallWaiting7+ -setCallWaiting\(slotId: number, activate: boolean\): Promise +setCallWaiting\(slotId: number, activate: boolean\): Promise\ 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 | 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** @@ -2122,7 +2145,7 @@ call.setCallWaiting(0, true).then(() => { ## call.startDTMF7+ -startDTMF\(callId: number, character: string, callback: AsyncCallback\): void +startDTMF\(callId: number, character: string, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -2161,7 +2184,7 @@ call.startDTMF(1, "0", (err) => { ## call.startDTMF7+ -startDTMF\(callId: number, character: string\): Promise +startDTMF\(callId: number, character: string\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -2206,7 +2229,7 @@ call.startDTMF(1, "0").then(() => { ## call.stopDTMF7+ -stopDTMF\(callId: number, callback: AsyncCallback\): void +stopDTMF\(callId: number, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -2244,7 +2267,7 @@ call.stopDTMF(1, (err) => { ## call.stopDTMF7+ -stopDTMF\(callId: number\): Promise +stopDTMF\(callId: number\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 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** @@ -2288,7 +2311,7 @@ call.stopDTMF(1).then(() => { ## call.isInEmergencyCall7+ -isInEmergencyCall\(callback: AsyncCallback\): void +isInEmergencyCall\(callback: AsyncCallback\\): void 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 | 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. | @@ -2328,7 +2352,7 @@ call.isInEmergencyCall((err, data) => { ## call.isInEmergencyCall7+ -isInEmergencyCall\(\): Promise +isInEmergencyCall\(\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -2370,7 +2393,7 @@ promise.then(data => { ## call.on('callDetailsChange')7+ -on\(type: 'callDetailsChange', callback: Callback\): void +on\(type: 'callDetailsChange', callback: Callback\\): void 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 | 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. | @@ -2410,7 +2434,7 @@ call.on('callDetailsChange', data => { ## call.on('callEventChange')8+ -on\(type: 'callEventChange', callback: Callback\): void +on\(type: 'callEventChange', callback: Callback\\): void 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 | 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. | @@ -2450,7 +2475,7 @@ call.on('callEventChange', data => { ## call.on('callDisconnectedCause')8+ -on\(type: 'callDisconnectedCause', callback: Callback): void +on\(type: 'callDisconnectedCause', callback: Callback\\): void 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 | 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. | @@ -2490,7 +2516,7 @@ call.on('callDisconnectedCause', data => { ## call.on('mmiCodeResult')9+ -on\(type: 'mmiCodeResult', callback: Callback\): void +on\(type: 'mmiCodeResult', callback: Callback\\): void 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 | 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. | @@ -2530,7 +2557,7 @@ call.on('mmiCodeResult', data => { ## call.off('callDetailsChange')7+ -off\(type: 'callDetailsChange', callback?: Callback\): void +off\(type: 'callDetailsChange', callback?: Callback\\): void 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 | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | ---------------------------------- | | 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** @@ -2554,6 +2581,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2570,7 +2598,7 @@ call.off('callDetailsChange', data => { ## call.off('callEventChange')8+ -off\(type: 'callEventChange', callback?: Callback\): void +off\(type: 'callEventChange', callback?: Callback\\): void 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 | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ---------------------------------- | | 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** @@ -2594,6 +2622,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2610,7 +2639,7 @@ call.off('callEventChange', data => { ## call.off('callDisconnectedCause')8+ -off\(type: 'callDisconnectedCause', callback?: Callback\): void +off\(type: 'callDisconnectedCause', callback?: Callback\\): void 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 | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------------------- | ---- | ------------------- | | 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** @@ -2634,6 +2663,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2650,7 +2680,7 @@ call.off('callDisconnectedCause', data => { ## call.off('mmiCodeResult')9+ -off\(type: 'mmiCodeResult', callback?: Callback\): void +off\(type: 'mmiCodeResult', callback?: Callback\\): void 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 | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ----------- | | 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** @@ -2674,6 +2704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2690,7 +2721,7 @@ call.off('mmiCodeResult', data => { ## call.isNewCallAllowed8+ -isNewCallAllowed\(callback: AsyncCallback\): void +isNewCallAllowed\(callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -2727,7 +2759,7 @@ call.isNewCallAllowed((err, data) => { ## call.isNewCallAllowed8+ -isNewCallAllowed\(\): Promise +isNewCallAllowed\(\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -2766,7 +2797,7 @@ promise.then(data => { ## call.separateConference8+ -separateConference\(callId: number, callback: AsyncCallback\): void +separateConference\(callId: number, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -2804,7 +2836,7 @@ call.separateConference(1, (err) => { ## call.separateConference8+ -separateConference\(callId: number\): Promise +separateConference\(callId: number\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -2848,7 +2881,7 @@ call.separateConference(1).then(() => { ## call.getCallRestrictionStatus8+ -getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback\): void +getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: AsyncCallback\\): void 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 | 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** @@ -2890,7 +2923,7 @@ call.getCallRestrictionStatus(0, 1, (err, data) => { ## call.getCallRestrictionStatus8+ -getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise +getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise\ 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 | 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** @@ -2939,7 +2972,7 @@ promise.then(data => { ## call.setCallRestriction8+ -setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\): void +setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\\): void 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 | 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** @@ -2986,7 +3019,7 @@ call.setCallRestriction(0, callRestrictionInfo, (err) => { ## call.setCallRestriction8+ -setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise +setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise\ 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 | 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** @@ -3039,7 +3072,7 @@ call.setCallRestriction(0, callRestrictionInfo).then(() => { ## call.getCallTransferInfo8+ -getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback\): void +getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCallback\\): void 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 | 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** @@ -3081,7 +3114,7 @@ call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY, (err, data ## call.getCallTransferInfo8+ -getCallTransferInfo\(slotId: number, type: CallTransferType): Promise +getCallTransferInfo\(slotId: number, type: CallTransferType\): Promise\ 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 | 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** @@ -3130,7 +3163,7 @@ promise.then(data => { ## call.setCallTransfer8+ -setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback\): void +setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback\\): void 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 | 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** @@ -3177,7 +3210,7 @@ call.setCallTransfer(0, callTransferInfo, (err) => { ## call.setCallTransfer8+ -setCallTransfer\(slotId: number, info: CallTransferInfo): Promise +setCallTransfer\(slotId: number, info: CallTransferInfo\): Promise\ 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 | 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** @@ -3230,7 +3263,7 @@ call.setCallTransfer(0, callTransferInfo).then(() => { ## call.isRinging8+ -isRinging\(callback: AsyncCallback\): void +isRinging\(callback: AsyncCallback\\): void 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 | 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. | @@ -3270,7 +3304,7 @@ call.isRinging((err, data) => { ## call.isRinging8+ -isRinging\(\): Promise +isRinging\(\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -3312,7 +3345,7 @@ promise.then(data => { ## call.setMuted8+ -setMuted\(callback: AsyncCallback\): void +setMuted\(callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3349,7 +3383,7 @@ call.setMuted((err) => { ## call.setMuted8+ -setMuted\(\): Promise +setMuted\(\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -3387,7 +3420,7 @@ call.setMuted().then(() => { ## call.cancelMuted8+ -cancelMuted(callback: AsyncCallback): void +cancelMuted\(callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3424,7 +3458,7 @@ call.cancelMuted((err) => { ## call.cancelMuted8+ -cancelMuted(): Promise +cancelMuted\(\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -3462,7 +3495,7 @@ call.cancelMuted().then(() => { ## call.setAudioDevice8+ -setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void +setAudioDevice\(device: AudioDevice, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3500,9 +3534,9 @@ call.setAudioDevice(1, (err) => { ## call.setAudioDevice9+ -setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\): void +setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\\): 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. @@ -3522,6 +3556,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3542,7 +3577,7 @@ call.setAudioDevice(1, audioDeviceOptions, (err) => { ## call.setAudioDevice9+ -setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise +setAudioDevice\(device: AudioDevice, options?: AudioDeviceOptions\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3590,7 +3626,7 @@ call.setAudioDevice(1, audioDeviceOptions).then(() => { ## call.joinConference8+ -joinConference(mainCallId: number, callNumberList: Array, callback: AsyncCallback): void +joinConference\(mainCallId: number, callNumberList: Array\, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3631,7 +3668,7 @@ call.joinConference(1, callNumberList, (err) => { ## call.joinConference8+ -joinConference(mainCallId: number, callNumberList: Array): Promise +joinConference\(mainCallId: number, callNumberList: Array\\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3679,7 +3717,7 @@ call.joinConference(1, callNumberList).then(() => { ## call.updateImsCallMode8+ -updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback): void +updateImsCallMode\(callId: number, mode: ImsCallMode, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3717,7 +3756,7 @@ call.updateImsCallMode(1, 1, (err) => { ## call.updateImsCallMode8+ -updateImsCallMode(callId: number, mode: ImsCallMode): Promise +updateImsCallMode\(callId: number, mode: ImsCallMode\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3762,7 +3802,7 @@ call.updateImsCallMode(1, 1).then(() => { ## call.enableImsSwitch8+ -enableImsSwitch(slotId: number, callback: AsyncCallback): void +enableImsSwitch\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -3802,7 +3843,7 @@ call.enableImsSwitch(0, (err) => { ## call.enableImsSwitch8+ -enableImsSwitch(slotId: number): Promise +enableImsSwitch\(slotId: number\): Promise\ 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 | 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. | @@ -3849,7 +3891,7 @@ call.enableImsSwitch(0).then(() => { ## call.disableImsSwitch8+ -disableImsSwitch(slotId: number, callback: AsyncCallback): void +disableImsSwitch\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -3889,7 +3932,7 @@ call.disableImsSwitch(0, (err) => { ## call.disableImsSwitch8+ -disableImsSwitch(slotId: number): Promise +disableImsSwitch\(slotId: number\): Promise\ 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 | 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. | @@ -3936,7 +3980,7 @@ call.disableImsSwitch(0).then(() => { ## call.isImsSwitchEnabled8+ -isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void +isImsSwitchEnabled\(slotId: number, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -3973,7 +4018,7 @@ call.isImsSwitchEnabled(0, (err, data) => { ## call.isImsSwitchEnabled8+ -isImsSwitchEnabled(slotId: number): Promise +isImsSwitchEnabled\(slotId: number\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -4024,11 +4070,11 @@ Provides an option for determining whether a call is a video call. | Name | Type | Mandatory| Description | | ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- | -| extras | boolean | No | Indication of a video call.
- **true**: video call
- **false** (default): voice call| -| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API. | -| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | -| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | -| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. | +| extras | boolean | No | Indication of a video call.
- **true**: video call
- **false** (default): voice call | +| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
| +| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. | +| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. | +| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. | ## DialCallOptions9+ @@ -4409,7 +4455,7 @@ Enumerates call transfer states. ## DisconnectedDetails9+ -Defines the cause of a call disconnection. +Defines the call disconnection cause. **System API**: This is a system API. @@ -4417,12 +4463,12 @@ Defines the cause of a call disconnection. | Name | Type | Mandatory| Description | | ------- | ------------------------------------------ | ---- | --------------- | -| reason | [DisconnectedReason](#disconnectedreason8) | Yes | Cause of the call disconnection. | -| message | string | Yes | Message indicating the call disconnection.| +| reason | [DisconnectedReason](#disconnectedreason8) | Yes | Call disconnection cause. | +| message | string | Yes | Call ending message.| ## DisconnectedReason8+ -Enumerates causes of call disconnection. +Enumerates call disconnection causes. **System API**: This is a system API. diff --git a/en/application-dev/reference/apis/js-apis-charger.md b/en/application-dev/reference/apis/js-apis-charger.md index 0b4f5dba51054c51fd2c74cc1867413340b9a687..4c5d43246672f37ea5cda135492ad71ed4f679da 100644 --- a/en/application-dev/reference/apis/js-apis-charger.md +++ b/en/application-dev/reference/apis/js-apis-charger.md @@ -17,6 +17,8 @@ import charger from '@ohos.charger'; Enumerates charging types. +**System API**: This is a system API. + **System capability**: SystemCapability.PowerManager.BatteryManager.Core | Name | Value | Description | diff --git a/en/application-dev/reference/apis/js-apis-cooperate.md b/en/application-dev/reference/apis/js-apis-cooperate.md index d63729a9dcf6a08133dd28f7cdabc6e63f0a4b6e..da39b72f0cae0702e82eb18b80e034f03c60936d 100644 --- a/en/application-dev/reference/apis/js-apis-cooperate.md +++ b/en/application-dev/reference/apis/js-apis-cooperate.md @@ -1,12 +1,12 @@ # @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** > -> - 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 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. ## Modules to Import @@ -66,7 +66,7 @@ Specifies whether to enable screen hopping. This API uses a promise to return th **Return value** -| Name | Description | +| Parameters | Description | | ------------------- | ------------------------------- | | Promise<void> | Promise used to return the result. | @@ -221,7 +221,7 @@ Stops screen hopping. This API uses a promise to return the result. | Name | Description | | -------- | ---------------------------- | -| Promise\ | Promise used to return the result. | +| Promise\ | Promise used to return the result. | **Example** @@ -287,7 +287,7 @@ Checks whether screen hopping is enabled. This API uses a promise to return the **Return value** -| Name | Description | +| Parameters | Description | | ------------------- | ------------------------------- | | 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 **Example** ```js +let deviceDescriptor = "descriptor"; try { inputDeviceCooperate.getState(deviceDescriptor).then((data) => { console.log(`Get the status success, data: ${JSON.stringify(data)}`); @@ -311,7 +312,7 @@ try { 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 @@ -340,7 +341,7 @@ try { off(type: 'cooperation', callback?: AsyncCallback\): void -Disables listening for screen hopping events. +Disables listening for screen hopping status change events. **System capability**: SystemCapability.MultimodalInput.Input.Cooperator @@ -388,7 +389,7 @@ Enumerates screen hopping event. **System capability**: SystemCapability.MultimodalInput.Input.Cooperator -| Name | Value | Description | +| Name | Value | Description | | -------- | --------- | ----------------- | | MSG_COOPERATE_INFO_START | 200 | Screen hopping starts. | | MSG_COOPERATE_INFO_SUCCESS | 201 | Screen hopping succeeds. | diff --git a/en/application-dev/reference/apis/js-apis-devicestatus-cooperate.md b/en/application-dev/reference/apis/js-apis-devicestatus-cooperate.md new file mode 100644 index 0000000000000000000000000000000000000000..cada3fc494deced44ecf150dae636786f167bb3a --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-devicestatus-cooperate.md @@ -0,0 +1,457 @@ +# @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<void>): 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<void> | 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<void> + +Prepares for screen hopping. This API uses a promise to return the result. + +**System capability**: SystemCapability.Msdp.DeviceStatus.Cooperate + +**Return value** + +| Parameters | Description | +| ------------------- | ------------------------------- | +| Promise<void> | 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<void>): 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<void> | 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<void>; + +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<void> | 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<void>): 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<void> | 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<void>; + +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<void> | 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<void>): 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<void> | 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<void>; + +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<void> | 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<boolean>): 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<boolean> | 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<boolean>; + +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<boolean> | 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<{ networkId: string, msg: CooperateMsg }>): 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<{ networkId: string, msg: [CooperateMsg](#cooperatemsg) }> | 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<void>): 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<void> | 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.| diff --git a/en/application-dev/reference/apis/js-apis-http.md b/en/application-dev/reference/apis/js-apis-http.md index c798d91a2cee8c4b750201cce4deef26bcc7bc40..9f49f9bb61eda42dfc3232ac545f6d080aa3758e 100644 --- a/en/application-dev/reference/apis/js-apis-http.md +++ b/en/application-dev/reference/apis/js-apis-http.md @@ -45,7 +45,8 @@ httpRequest.request( connectTimeout: 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. - 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) => { if (!err) { // data.result carries the HTTP response. Parse the response based on service requirements. @@ -68,7 +69,7 @@ httpRequest.request( > **NOTE** > If the data in **console.info()** contains a newline character, the data will be truncated. -## http.createHttp +## http.createHttp6+ createHttp(): HttpRequest @@ -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. -### request +### request6+ request(url: string, callback: AsyncCallback\):void @@ -116,14 +117,38 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | +| 2300001 | Unsupported protocol. | | 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. | +| 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. | +| 2300047 | Number of redirects hit maximum amount. | | 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. | > **NOTE** @@ -145,7 +170,7 @@ httpRequest.request("EXAMPLE_URL", (err, data) => { }); ``` -### request +### request6+ request(url: string, options: HttpRequestOptions, callback: AsyncCallback\):void @@ -168,7 +193,7 @@ Initiates an HTTP request containing specified options to a given URL. This API **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -231,7 +256,7 @@ httpRequest.request("EXAMPLE_URL", }); ``` -### request +### request6+ request(url: string, options? : HttpRequestOptions): Promise\ @@ -259,7 +284,7 @@ Initiates an HTTP request containing specified options to a given URL. This API **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -353,14 +378,38 @@ Initiates an HTTP request containing specified options to a given URL. This API **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | +| 2300001 | Unsupported protocol. | | 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. | +| 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. | +| 2300047 | Number of redirects hit maximum amount. | | 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. | > **NOTE** @@ -383,7 +432,7 @@ httpRequest.request2("EXAMPLE_URL", (err, data) => { request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): 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 @@ -399,7 +448,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -482,7 +531,7 @@ Initiates an HTTP request containing specified options to a given URL. This API **Error codes** -| Code | Error Message | +| ID | Error Message | |---------|-------------------------------------------------------| | 401 | Parameter error. | | 201 | Permission denied. | @@ -757,7 +806,7 @@ httpRequest.off('dataEnd'); ### on('dataProgress')10+ -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. @@ -802,7 +851,7 @@ Unregisters the observer for events indicating progress of receiving HTTP stream httpRequest.off('dataProgress'); ``` -## HttpRequestOptions +## HttpRequestOptions6+ 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 | readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms.
The value **0** indicates no timeout.| | connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. | | usingProtocol9+ | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. | -| usingProxy10+ | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.
- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.
- If **usingProxy** is of the **object** type, the specified network proxy is used. | +| usingProxy10+ | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.
- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.
- If **usingProxy** is of the **object** type, the specified network proxy is used. +| caPath10+ | 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 +## RequestMethod6+ Defines an HTTP request method. @@ -838,7 +888,7 @@ Defines an HTTP request method. | TRACE | "TRACE" | TRACE method. | | CONNECT | "CONNECT" | CONNECT method.| -## ResponseCode +## ResponseCode6+ 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. | | VERSION | 505 | "HTTP Version Not Supported." The server does not support the HTTP protocol version used in the request. | -## HttpResponse +## HttpResponse6+ Defines the response to an HTTP request. diff --git a/en/application-dev/reference/apis/js-apis-net-connection.md b/en/application-dev/reference/apis/js-apis-net-connection.md index 813d7c830bc37076654863fb7d8d17b1f039d14c..34705e77e7d0b1e4f2705faf4ae78e0526aad25c 100644 --- a/en/application-dev/reference/apis/js-apis-net-connection.md +++ b/en/application-dev/reference/apis/js-apis-net-connection.md @@ -11,7 +11,7 @@ The network connection management module provides basic network management capab import connection from '@ohos.net.connection' ``` -## connection.createNetConnection +## connection.createNetConnection8+ createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection @@ -46,7 +46,7 @@ let netConnectionCellular = connection.createNetConnection({ }) ``` -## connection.getDefaultNet +## connection.getDefaultNet8+ getDefaultNet(callback: AsyncCallback\): void @@ -79,7 +79,7 @@ connection.getDefaultNet(function (error, data) { }) ``` -## connection.getDefaultNet +## connection.getDefaultNet8+ getDefaultNet(): Promise\ @@ -444,7 +444,7 @@ connection.getDefaultNet().then(function (netHandle) { }) ``` -## connection.getAllNets +## connection.getAllNets8+ getAllNets(callback: AsyncCallback<Array<NetHandle>>): void @@ -477,7 +477,7 @@ connection.getAllNets(function (error, data) { }); ``` -## connection.getAllNets +## connection.getAllNets8+ getAllNets(): Promise<Array<NetHandle>> @@ -509,7 +509,7 @@ connection.getAllNets().then(function (data) { }); ``` -## connection.getConnectionProperties +## connection.getConnectionProperties8+ getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\): void @@ -547,7 +547,7 @@ connection.getDefaultNet().then(function (netHandle) { }) ``` -## connection.getConnectionProperties +## connection.getConnectionProperties8+ getConnectionProperties(netHandle: NetHandle): Promise\ @@ -589,7 +589,7 @@ connection.getDefaultNet().then(function (netHandle) { }) ``` -## connection.getNetCapabilities +## connection.getNetCapabilities8+ getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\): void @@ -627,7 +627,7 @@ connection.getDefaultNet().then(function (netHandle) { }) ``` -## connection.getNetCapabilities +## connection.getNetCapabilities8+ getNetCapabilities(netHandle: NetHandle): Promise\ @@ -734,7 +734,7 @@ connection.isDefaultNetMetered().then(function (data) { }) ``` -## connection.hasDefaultNet +## connection.hasDefaultNet8+ hasDefaultNet(callback: AsyncCallback\): void @@ -767,7 +767,7 @@ connection.hasDefaultNet(function (error, data) { }) ``` -## connection.hasDefaultNet +## connection.hasDefaultNet8+ hasDefaultNet(): Promise\ @@ -799,7 +799,7 @@ connection.hasDefaultNet().then(function (data) { }) ``` -## connection.enableAirplaneMode +## connection.enableAirplaneMode8+ enableAirplaneMode(callback: AsyncCallback\): void @@ -821,6 +821,7 @@ Enables the airplane mode. This API uses an asynchronous callback to return the | ID| Error Message | | ------- | ----------------------------- | +| 202 | Non-system applications use system APIs.| | 2100002 | Operation failed. Cannot connect to service.| | 2100003 | System internal error. | @@ -832,7 +833,7 @@ connection.enableAirplaneMode(function (error) { }) ``` -## connection.enableAirplaneMode +## connection.enableAirplaneMode8+ enableAirplaneMode(): Promise\ @@ -854,6 +855,7 @@ Enables the airplane mode. This API uses a promise to return the result. | ID| Error Message | | ------- | ----------------------------- | +| 202 | Non-system applications use system APIs.| | 2100002 | Operation failed. Cannot connect to service.| | 2100003 | System internal error. | @@ -865,7 +867,7 @@ connection.enableAirplaneMode().then(function (error) { }) ``` -## connection.disableAirplaneMode +## connection.disableAirplaneMode8+ disableAirplaneMode(callback: AsyncCallback\): void @@ -887,6 +889,7 @@ Disables the airplane mode. This API uses an asynchronous callback to return the | ID| Error Message | | ------- | ----------------------------- | +| 202 | Non-system applications use system APIs.| | 2100002 | Operation failed. Cannot connect to service.| | 2100003 | System internal error. | @@ -898,7 +901,7 @@ connection.disableAirplaneMode(function (error) { }) ``` -## connection.disableAirplaneMode +## connection.disableAirplaneMode8+ disableAirplaneMode(): Promise\ @@ -920,6 +923,7 @@ Disables the airplane mode. This API uses a promise to return the result. | ID| Error Message | | ------- | ----------------------------- | +| 202 | Non-system applications use system APIs.| | 2100002 | Operation failed. Cannot connect to service.| | 2100003 | System internal error. | @@ -931,7 +935,7 @@ connection.disableAirplaneMode().then(function (error) { }) ``` -## connection.reportNetConnected +## connection.reportNetConnected8+ reportNetConnected(netHandle: NetHandle, callback: AsyncCallback<void>): void @@ -968,7 +972,7 @@ connection.getDefaultNet().then(function (netHandle) { }); ``` -## connection.reportNetConnected +## connection.reportNetConnected8+ reportNetConnected(netHandle: NetHandle): Promise<void> @@ -1009,7 +1013,7 @@ connection.getDefaultNet().then(function (netHandle) { }); ``` -## connection.reportNetDisconnected +## connection.reportNetDisconnected8+ reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback<void>): void @@ -1046,7 +1050,7 @@ connection.getDefaultNet().then(function (netHandle) { }); ``` -## connection.reportNetDisconnected +## connection.reportNetDisconnected8+ reportNetDisconnected(netHandle: NetHandle): Promise<void> @@ -1087,7 +1091,7 @@ connection.getDefaultNet().then(function (netHandle) { }); ``` -## connection.getAddressesByName +## connection.getAddressesByName8+ getAddressesByName(host: string, callback: AsyncCallback\>): void @@ -1124,7 +1128,7 @@ connection.getAddressesByName(host, function (error, data) { }) ``` -## connection.getAddressesByName +## connection.getAddressesByName8+ getAddressesByName(host: string): Promise\> @@ -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 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 +### register8+ register(callback: AsyncCallback\): void @@ -1195,9 +1199,10 @@ Registers a listener for network status changes. | ID| Error Message | | ------- | ----------------------------- | | 201 | Permission denied. | +| 401 | Parameter error. | | 2100002 | Operation failed. Cannot connect to service.| | 2100003 | System internal error. | -| 2101008 | The callback is not exists. | +| 2101008 | The same callback exists. | | 2101022 | The number of requests exceeded the maximum. | **Example** @@ -1208,7 +1213,7 @@ netConnection.register(function (error) { }) ``` -### unregister +### unregister8+ unregister(callback: AsyncCallback\): void @@ -1226,9 +1231,11 @@ Unregisters the listener for network status changes. | ID| Error Message | | ------- | ----------------------------- | +| 201 | Permission denied.| +| 401 | Parameter error. | | 2100002 | Operation failed. Cannot connect to service.| | 2100003 | System internal error. | -| 2101007 | The same callback exists. | +| 2101007 | The callback is not exists. | **Example** @@ -1238,7 +1245,7 @@ netConnection.unregister(function (error) { }) ``` -### on('netAvailable') +### on('netAvailable')8+ on(type: 'netAvailable', callback: Callback\): void @@ -1277,7 +1284,7 @@ netCon.unregister(function (error) { }) ``` -### on('netBlockStatusChange') +### on('netBlockStatusChange')8+ on(type: 'netBlockStatusChange', callback: Callback<{ netHandle: NetHandle, blocked: boolean }>): void @@ -1316,7 +1323,7 @@ netCon.unregister(function (error) { }) ``` -### on('netCapabilitiesChange') +### on('netCapabilitiesChange')8+ on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void @@ -1355,7 +1362,7 @@ netCon.unregister(function (error) { }) ``` -### on('netConnectionPropertiesChange') +### on('netConnectionPropertiesChange')8+ on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void @@ -1395,7 +1402,7 @@ netCon.unregister(function (error) { }) ``` -### on('netLost') +### on('netLost')8+ on(type: 'netLost', callback: Callback\): void @@ -1434,7 +1441,7 @@ netCon.unregister(function (error) { }) ``` -### on('netUnavailable') +### on('netUnavailable')8+ on(type: 'netUnavailable', callback: Callback\): void @@ -1473,7 +1480,7 @@ netCon.unregister(function (error) { }) ``` -## NetHandle +## NetHandle8+ Defines the handle of the data network. @@ -1640,7 +1647,7 @@ connection.getDefaultNet().then((netHandle) => { }) ``` -### getAddressesByName +### getAddressesByName8+ getAddressesByName(host: string, callback: AsyncCallback\>): void @@ -1679,7 +1686,7 @@ connection.getDefaultNet().then(function (netHandle) { }) ``` -### getAddressesByName +### getAddressesByName8+ getAddressesByName(host: string): Promise\> @@ -1722,7 +1729,7 @@ connection.getDefaultNet().then(function (netHandle) { }) ``` -### getAddressByName +### getAddressByName8+ getAddressByName(host: string, callback: AsyncCallback\): void @@ -1761,7 +1768,7 @@ connection.getDefaultNet().then(function (netHandle) { }) ``` -### getAddressByName +### getAddressByName8+ getAddressByName(host: string): Promise\ @@ -1804,7 +1811,7 @@ connection.getDefaultNet().then(function (netHandle) { }) ``` -## NetCap +## NetCap8+ 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_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.| -## NetBearType +## NetBearType8+ Enumerates network types. @@ -1842,7 +1849,7 @@ Defines the global HTTP proxy configuration of the network. | port | number | No | Host port.| | exclusionList | Array | 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.
For example, the length of **baidu.com,zhihu.com** is 20 bytes.| -## NetSpecifier +## NetSpecifier8+ 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. | | 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 +## NetCapabilities8+ Defines the network capability set. @@ -1866,7 +1873,7 @@ Defines the network capability set. | networkCap | Array\<[NetCap](#netcap)> | No| Network capability. | | bearerTypes | Array\<[NetBearType](#netbeartype)> | Yes| Network type. | -## ConnectionProperties +## ConnectionProperties8+ 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).| | mtu | number | Yes|Maximum transmission unit (MTU). | -## RouteInfo +## RouteInfo8+ Defines network route information. @@ -1895,7 +1902,7 @@ Defines network route information. | hasGateway | boolean | Yes|Whether a gateway is present. | | isDefaultRoute | boolean | Yes|Whether the route is the default route.| -## LinkAddress +## LinkAddress8+ Defines network link information. @@ -1906,7 +1913,7 @@ Defines network link information. | address | [NetAddress](#netaddress) | Yes| Link address. | | prefixLength | number | Yes|Length of the link address prefix.| -## NetAddress +## NetAddress8+ Defines a network address. diff --git a/en/application-dev/reference/apis/js-apis-net-ethernet.md b/en/application-dev/reference/apis/js-apis-net-ethernet.md index 3a04cbb3a501fd64d8315b5c929beaf6c2407355..ec15531de49c13ab4b2c85b0da9eacf37400d195 100644 --- a/en/application-dev/reference/apis/js-apis-net-ethernet.md +++ b/en/application-dev/reference/apis/js-apis-net-ethernet.md @@ -11,7 +11,7 @@ The **ethernet** module provides wired network capabilities, which allow users t import ethernet from '@ohos.net.ethernet' ``` -## ethernet.setIfaceConfig +## ethernet.setIfaceConfig9+ setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\): void @@ -36,13 +36,15 @@ Sets the network interface configuration. This API uses an asynchronous callback | ID| Error Message | | ------- | ----------------------------------------| | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 2200001 | Invalid parameter value. | | 2200002 | Operation failed. Cannot connect to service.| | 2200003 | System internal error. | -| 2201005 | The device information does not exist. | -| 2201006 | Device disconnected. | -| 2201007 | Failed to write the user configuration. | +| 2201004 | Invalid Ethernet profile. | +| 2201005 | Device information does not exist. | +| 2201006 | Ethernet device not connected. | +| 2201007 | Ethernet failed to write user configuration information. | **Example** @@ -64,7 +66,7 @@ ethernet.setIfaceConfig("eth0", { }); ``` -## ethernet.setIfaceConfig +## ethernet.setIfaceConfig9+ setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\ @@ -94,13 +96,15 @@ Sets the network interface configuration. This API uses a promise to return the | ID| Error Message | | ------- | ----------------------------------------| | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 2200001 | Invalid parameter value. | | 2200002 | Operation failed. Cannot connect to service.| | 2200003 | System internal error. | -| 2201005 | The device information does not exist. | -| 2201006 | Device disconnected. | -| 2201007 | Failed to write the user configuration. | +| 2201004 | Invalid Ethernet profile. | +| 2201005 | Device information does not exist. | +| 2201006 | Ethernet device not connected. | +| 2201007 | Ethernet failed to write user configuration information. | **Example** @@ -120,7 +124,7 @@ ethernet.setIfaceConfig("eth0", { }); ``` -## ethernet.getIfaceConfig +## ethernet.getIfaceConfig9+ getIfaceConfig(iface: string, callback: AsyncCallback\): void @@ -144,11 +148,12 @@ Obtains the configuration of a network interface. This API uses an asynchronous | ID| Error Message | | ------- | ----------------------------------------| | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 2200001 | Invalid parameter value. | | 2200002 | Operation failed. Cannot connect to service.| | 2200003 | System internal error. | -| 2201005 | The device information does not exist. | +| 2201005 | Device information does not exist. | **Example** @@ -168,7 +173,7 @@ ethernet.getIfaceConfig("eth0", (error, value) => { }); ``` -## ethernet.getIfaceConfig +## ethernet.getIfaceConfig9+ getIfaceConfig(iface: string): Promise\ @@ -197,11 +202,12 @@ Obtains the configuration of a network interface. This API uses a promise to ret | ID| Error Message | | ------- | ----------------------------------------| | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 2200001 | Invalid parameter value. | | 2200002 | Operation failed. Cannot connect to service.| | 2200003 | System internal error. | -| 2201005 | The device information does not exist. | +| 2201005 | Device information does not exist. | **Example** @@ -219,7 +225,7 @@ ethernet.getIfaceConfig("eth0").then((data) => { }); ``` -## ethernet.isIfaceActive +## ethernet.isIfaceActive9+ isIfaceActive(iface: string, callback: AsyncCallback\): void @@ -243,11 +249,12 @@ Checks whether a network interface is active. This API uses an asynchronous call | ID| Error Message | | ------- | ----------------------------------------| | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 2200001 | Invalid parameter value. | | 2200002 | Operation failed. Cannot connect to service.| | 2200003 | System internal error. | -| 2201005 | The device information does not exist. | +| 2201005 | Device information does not exist. | **Example** @@ -261,7 +268,7 @@ ethernet.isIfaceActive("eth0", (error, value) => { }); ``` -## ethernet.isIfaceActive +## ethernet.isIfaceActive9+ isIfaceActive(iface: string): Promise\ @@ -290,11 +297,12 @@ Checks whether a network interface is active. This API uses a promise to return | ID| Error Message | | ------- | ----------------------------------------| | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 2200001 | Invalid parameter value. | | 2200002 | Operation failed. Cannot connect to service.| | 2200003 | System internal error. | -| 2201005 | The device information does not exist. | +| 2201005 | Device information does not exist. | **Example** @@ -306,7 +314,7 @@ ethernet.isIfaceActive("eth0").then((data) => { }); ``` -## ethernet.getAllActiveIfaces +## ethernet.getAllActiveIfaces9+ getAllActiveIfaces(callback: AsyncCallback\>): void @@ -329,6 +337,7 @@ Obtains the list of all active network interfaces. This API uses an asynchronous | ID| Error Message | | ------- | ----------------------------------------| | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 2200002 | Operation failed. Cannot connect to service.| | 2200003 | System internal error. | @@ -347,7 +356,7 @@ ethernet.getAllActiveIfaces((error, value) => { }); ``` -## ethernet.getAllActiveIfaces +## ethernet.getAllActiveIfaces9+ getAllActiveIfaces(): Promise\> @@ -370,6 +379,7 @@ Obtains the list of all active network interfaces. This API uses a promise to re | ID| Error Message | | ------- | ----------------------------------------| | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 2200002 | Operation failed. Cannot connect to service.| | 2200003 | System internal error. | @@ -403,21 +413,19 @@ Registers an observer for NIC hot swap events. This API uses an asynchronous cal | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | | type | string | Yes | Event type. The value is **interfaceStateChange**.| -| callback | Callback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.
**iface**: NIC name.
**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.
**iface**: NIC name.
**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.| **Error codes** | ID| Error Message | | ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 202 | Applicable only to system applications. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | **Example** ```js -ethernet.on('interfaceStateChange', (data) => { - console.log('on interfaceSharingStateChange: ' + JSON.stringify(data.iface) + JSON.stringify(data.active)); + ethernet.on('interfaceStateChange', (data) => { + console.log('on interfaceSharingStateChange: ' + JSON.stringify(data)); }); ``` @@ -438,15 +446,13 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | | type | string | Yes | Event type. The value is **interfaceStateChange**.| -| callback | Callback\<{ iface: string, active: boolean }> | No | Callback used to return the result.
**iface**: NIC name.
**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.
**iface**: NIC name.
**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.| **Error codes** | ID| Error Message | | ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 202 | Applicable only to system applications. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | **Example** @@ -454,7 +460,7 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous ethernet.off('interfaceStateChange'); ``` -## InterfaceConfiguration +## InterfaceConfiguration9+ 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.| | 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 +## IPSetMode9+ Defines the configuration mode of the Ethernet connection. diff --git a/en/application-dev/reference/apis/js-apis-net-mdns.md b/en/application-dev/reference/apis/js-apis-net-mdns.md index 2190dbe59ceca1336096944b8203826263c5294e..c84b3ae6dce748f686f50f001fa18fd13b78049d 100644 --- a/en/application-dev/reference/apis/js-apis-net-mdns.md +++ b/en/application-dev/reference/apis/js-apis-net-mdns.md @@ -11,7 +11,7 @@ Multicast DNS (mDNS) provides functions such as adding, removing, discovering, a import mdns from '@ohos.net.mdns' ``` -## mdns.addLocalService +## mdns.addLocalService10+ addLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void @@ -100,7 +100,7 @@ mdns.addLocalService(context, localServiceInfo, function (error, data) { }); ``` -## mdns.addLocalService +## mdns.addLocalService10+ addLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ @@ -192,7 +192,7 @@ mdns.addLocalService(context, localServiceInfo).then(function (data) { }); ``` -## mdns.removeLocalService +## mdns.removeLocalService10+ removeLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void @@ -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. | | 2100003 | System internal error. | | 2204002 | Callback not found. | -| 2204008 | Service instance duplicated. | +| 2204008 | Service instance not found. | | 2204010 | Send packet failed. | > **NOTE** @@ -281,7 +281,7 @@ mdns.removeLocalService(context, localServiceInfo, function (error, data) { }); ``` -## mdns.removeLocalService +## mdns.removeLocalService10+ removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ @@ -310,7 +310,7 @@ Removes an mDNS service. This API uses a promise to return the result. | 2100002 | Operation failed. Cannot connect to service. | | 2100003 | System internal error. | | 2204002 | Callback not found. | -| 2204008 | Service instance duplicated. | +| 2204008 | Service instance not found. | | 2204010 | Send packet failed. | > **NOTE** @@ -373,7 +373,7 @@ mdns.removeLocalService(context, localServiceInfo).then(function (data) { }); ``` -## mdns.createDiscoveryService +## mdns.createDiscoveryService10+ createDiscoveryService(context: Context, serviceType: string): DiscoveryService @@ -423,7 +423,7 @@ let serviceType = "_print._tcp"; let discoveryService = mdns.createDiscoveryService(context, serviceType); ``` -## mdns.resolveLocalService +## mdns.resolveLocalService10+ resolveLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void @@ -512,7 +512,7 @@ mdns.resolveLocalService(context, localServiceInfo, function (error, data) { }); ``` -## mdns.resolveLocalService +## mdns.resolveLocalService10+ resolveLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ @@ -603,11 +603,11 @@ mdns.resolveLocalService(context, localServiceInfo).then(function (data) { console.log(JSON.stringify(data)); }); ``` -## DiscoveryService +## DiscoveryService10+ Defines a **DiscoveryService** object for discovering mDNS services of the specified type. -### startSearchingMDNS +### startSearchingMDNS10+ startSearchingMDNS(): void @@ -644,7 +644,7 @@ let discoveryService = mdns.createDiscoveryService(context, serviceType); discoveryService.startSearchingMDNS(); ``` -### stopSearchingMDNS +### stopSearchingMDNS10+ stopSearchingMDNS(): void @@ -681,7 +681,7 @@ let discoveryService = mdns.createDiscoveryService(context, serviceType); discoveryService.stopSearchingMDNS(); ``` -### on('discoveryStart') +### on('discoveryStart')10+ on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void @@ -710,7 +710,7 @@ discoveryService.on('discoveryStart', (data) => { discoveryService.stopSearchingMDNS(); ``` -### on('discoveryStop') +### on('discoveryStop')10+ on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void @@ -739,7 +739,7 @@ discoveryService.on('discoveryStop', (data) => { discoveryService.stopSearchingMDNS(); ``` -### on('serviceFound') +### on('serviceFound')10+ on(type: 'serviceFound', callback: Callback\): void @@ -768,7 +768,7 @@ discoveryService.on('serviceFound', (data) => { discoveryService.stopSearchingMDNS(); ``` -### on('serviceLost') +### on('serviceLost')10+ on(type: 'serviceLost', callback: Callback\): void @@ -797,7 +797,7 @@ discoveryService.on('serviceLost', (data) => { discoveryService.stopSearchingMDNS(); ``` -## LocalServiceInfo +## LocalServiceInfo10+ 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. | | serviceAttribute | serviceAttribute\<[ServiceAttribute](#serviceattribute)> | No| mDNS service attribute information. | -## ServiceAttribute +## ServiceAttribute10+ Defines the mDNS service attribute information. diff --git a/en/application-dev/reference/apis/js-apis-net-sharing.md b/en/application-dev/reference/apis/js-apis-net-sharing.md index 0cda70aa2939c0da8f5aec7875d75bb48d309120..49796b225c56a3ff08a1ae51e986d4860b3edb77 100644 --- a/en/application-dev/reference/apis/js-apis-net-sharing.md +++ b/en/application-dev/reference/apis/js-apis-net-sharing.md @@ -12,7 +12,7 @@ The **sharing** module allows you to share your device's Internet connection wit import sharing from '@ohos.net.sharing' ``` -## sharing.isSharingSupported +## sharing.isSharingSupported9+ isSharingSupported(callback: AsyncCallback\): void @@ -48,7 +48,7 @@ sharing.isSharingSupported((error, data) => { }); ``` -## sharing.isSharingSupported +## sharing.isSharingSupported9+ isSharingSupported(): Promise\ @@ -85,7 +85,7 @@ sharing.isSharingSupported().then(data => { }); ``` -## sharing.isSharing +## sharing.isSharing9+ isSharing(callback: AsyncCallback\): void @@ -108,8 +108,10 @@ Checks whether network sharing is in progress. This API uses an asynchronous cal | ID| Error Message | | ------- | -------------------------------------------- | | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 2200002 | Operation failed. Cannot connect to service. | | 2200003 | System internal error. | +| 2202011 | Cannot get network sharing configuration. | **Example** @@ -120,7 +122,7 @@ sharing.isSharing((error, data) => { }); ``` -## sharing.isSharing +## sharing.isSharing9+ isSharing(): Promise\ @@ -143,8 +145,10 @@ Checks whether network sharing is in progress. This API uses a promise to return | ID| Error Message | | ------- | -------------------------------------------- | | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 2200002 | Operation failed. Cannot connect to service. | | 2200003 | System internal error. | +| 2202011 | Cannot get network sharing configuration. | **Example** @@ -156,7 +160,7 @@ sharing.isSharing().then(data => { }); ``` -## sharing.startSharing +## sharing.startSharing9+ startSharing(type: SharingIfaceType, callback: AsyncCallback\): void @@ -201,7 +205,7 @@ sharing.startSharing(SHARING_WIFI, (error) => { }); ``` -## sharing.startSharing +## sharing.startSharing9+ startSharing(type: SharingIfaceType): Promise\ @@ -253,7 +257,7 @@ sharing.startSharing(SHARING_WIFI).then(() => { }); ``` -## sharing.stopSharing +## sharing.stopSharing9+ stopSharing(type: SharingIfaceType, callback: AsyncCallback\): void @@ -277,10 +281,12 @@ Stops network sharing of a specified type. This API uses an asynchronous callbac | ID| Error Message | | ------- | -------------------------------------------- | | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 2200001 | Invalid parameter value. | | 2200002 | Operation failed. Cannot connect to service. | | 2200003 | System internal error. | +| 2202004 | Try to share an unavailable iface. | | 2202005 | WiFi sharing failed. | | 2202006 | Bluetooth sharing failed. | | 2202011 | Cannot get network sharing configuration. | @@ -296,7 +302,7 @@ sharing.stopSharing(SHARING_WIFI, (error) => { }); ``` -## sharing.stopSharing +## sharing.stopSharing9+ stopSharing(type: SharingIfaceType): Promise\ @@ -325,10 +331,12 @@ Stops network sharing of a specified type. This API uses a promise to return the | ID| Error Message | | ------- | -------------------------------------------- | | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 2200001 | Invalid parameter value. | | 2200002 | Operation failed. Cannot connect to service. | | 2200003 | System internal error. | +| 2202004 | Try to share an unavailable iface. | | 2202005 | WiFi sharing failed. | | 2202006 | Bluetooth sharing failed. | | 2202011 | Cannot get network sharing configuration. | @@ -346,7 +354,7 @@ sharing.stopSharing(SHARING_WIFI).then(() => { }); ``` -## sharing.getStatsRxBytes +## sharing.getStatsRxBytes9+ getStatsRxBytes(callback: AsyncCallback\): void @@ -381,7 +389,7 @@ sharing.getStatsRxBytes((error, data) => { }); ``` -## sharing.getStatsRxBytes +## sharing.getStatsRxBytes9+ getStatsRxBytes(): Promise\ @@ -417,7 +425,7 @@ sharing.getStatsRxBytes().then(data => { }); ``` -## sharing.getStatsTxBytes +## sharing.getStatsTxBytes9+ getStatsTxBytes(callback: AsyncCallback\): void @@ -452,7 +460,7 @@ sharing.getStatsTxBytes((error, data) => { }); ``` -## sharing.getStatsTxBytes +## sharing.getStatsTxBytes9+ getStatsTxBytes(): Promise\ @@ -488,7 +496,7 @@ sharing.getStatsTxBytes().then(data => { }); ``` -## sharing.getStatsTotalBytes +## sharing.getStatsTotalBytes9+ getStatsTotalBytes(callback: AsyncCallback\): void @@ -523,7 +531,7 @@ sharing.getStatsTotalBytes((error, data) => { }); ``` -## sharing.getStatsTotalBytes +## sharing.getStatsTotalBytes9+ getStatsTotalBytes(): Promise\ @@ -559,7 +567,7 @@ sharing.getStatsTotalBytes().then(data => { }); ``` -## sharing.getSharingIfaces +## sharing.getSharingIfaces9+ getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\>): void @@ -600,7 +608,7 @@ sharing.getSharingIfaces(SHARING_BLUETOOTH, (error, data) => { }); ``` -## sharing.getSharingIfaces +## sharing.getSharingIfaces9+ getSharingIfaces(state: SharingIfaceState): Promise\> @@ -647,7 +655,7 @@ sharing.getSharingIfaces(SHARING_BLUETOOTH).then(data => { }); ``` -## sharing.getSharingState +## sharing.getSharingState9+ getSharingState(type: SharingIfaceType, callback: AsyncCallback\): void @@ -688,7 +696,7 @@ sharing.getSharingState(SHARING_WIFI, (error, data) => { }); ``` -## sharing.getSharingState +## sharing.getSharingState9+ getSharingState(type: SharingIfaceType): Promise\ @@ -735,7 +743,7 @@ sharing.getSharingState(SHARING_WIFI).then(data => { }); ``` -## sharing.getSharableRegexes +## sharing.getSharableRegexes9+ getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\>): void @@ -776,7 +784,7 @@ sharing.getSharableRegexes(SHARING_WIFI, (error, data) => { }); ``` -## sharing.getSharableRegexes +## sharing.getSharableRegexes9+ getSharableRegexes(type: SharingIfaceType): Promise\> @@ -823,7 +831,7 @@ sharing.getSharableRegexes(SHARING_WIFI).then(data => { }); ``` -## sharing.on('sharingStateChange') +## sharing.on('sharingStateChange')9+ on(type: 'sharingStateChange', callback: Callback\): void @@ -846,8 +854,7 @@ Subscribes to network sharing state changes. This API uses an asynchronous callb | ID| Error Message | | ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | **Example** @@ -857,7 +864,7 @@ sharing.on('sharingStateChange', (data) => { }); ``` -## sharing.off('sharingStateChange') +## sharing.off('sharingStateChange')9+ off(type: 'sharingStateChange', callback?: Callback\): void @@ -880,8 +887,7 @@ Unsubscribes from network sharing state changes. This API uses an asynchronous c | ID| Error Message | | ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | **Example** @@ -891,7 +897,7 @@ sharing.off('sharingStateChange', (data) => { }); ``` -## sharing.on('interfaceSharingStateChange') +## sharing.on('interfaceSharingStateChange')9+ on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void @@ -915,8 +921,7 @@ Subscribes to network sharing state changes of a specified NIC. This API uses an | ID| Error Message | | ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | **Example** @@ -926,7 +931,7 @@ sharing.on('interfaceSharingStateChange', (data) => { }); ``` -## sharing.off('interfaceSharingStateChange') +## sharing.off('interfaceSharingStateChange')9+ off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void @@ -950,8 +955,7 @@ Unsubscribes from network sharing status changes of a specified NIC. This API us | ID| Error Message | | ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | **Example** @@ -961,7 +965,7 @@ sharing.off('interfaceSharingStateChange', (data) => { }); ``` -## sharing.on('sharingUpstreamChange') +## sharing.on('sharingUpstreamChange')9+ on(type: 'sharingUpstreamChange', callback: Callback\): void @@ -984,8 +988,7 @@ Subscribes to upstream network changes. This API uses an asynchronous callback t | ID| Error Message | | ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | **Example** @@ -995,7 +998,7 @@ sharing.on('sharingUpstreamChange', (data) => { }); ``` -## sharing.off('sharingUpstreamChange') +## sharing.off('sharingUpstreamChange')9+ off(type: 'sharingUpstreamChange', callback?: Callback\): void @@ -1018,8 +1021,7 @@ Unsubscribes from upstream network changes. This API uses an asynchronous callba | ID| Error Message | | ------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | **Example** @@ -1029,7 +1031,7 @@ sharing.off('sharingUpstreamChange', (data) => { }); ``` -## SharingIfaceState +## SharingIfaceState9+ 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_ERROR | 3 | An error occurred during network sharing.| -## SharingIfaceType +## SharingIfaceType9+ Enumerates the network sharing types of an NIC. diff --git a/en/application-dev/reference/apis/js-apis-observer.md b/en/application-dev/reference/apis/js-apis-observer.md index b0e30e22190f5242d16e4be0b815bcf4c4109f30..81a8b7bc6859f69bb6543e18600fd46296bb818c 100644 --- a/en/application-dev/reference/apis/js-apis-observer.md +++ b/en/application-dev/reference/apis/js-apis-observer.md @@ -15,7 +15,7 @@ import observer from '@ohos.telephony.observer'; ## observer.on('networkStateChange') -on\(type: \'networkStateChange\', callback: Callback\): void; +on\(type: \'networkStateChange\', callback: Callback\\): void; 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 => { ## observer.on('networkStateChange') -on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback\): void; +on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback\\): 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. @@ -94,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data => { ## observer.off('networkStateChange') -off\(type: \'networkStateChange\', callback?: Callback\): void; +off\(type: \'networkStateChange\', callback?: Callback\\): void; 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 | 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).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -133,7 +137,7 @@ observer.off('networkStateChange'); ## observer.on('signalInfoChange') -on\(type: \'signalInfoChange\', callback: Callback\>): void; +on\(type: \'signalInfoChange\', callback: Callback\\>): void; Registers an observer for signal status change events. This API uses an asynchronous callback to return the execution result. @@ -144,15 +148,14 @@ Registers an observer for signal status change events. This API uses an asynchro | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | | type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | -| callback | Callback\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +| callback | Callback\\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| **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. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -170,7 +173,7 @@ observer.on('signalInfoChange', data => { ## observer.on('signalInfoChange') -on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback\>): void; +on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback\\>): 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. @@ -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**. | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| callback | Callback\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +| callback | Callback\\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| **Error codes** @@ -190,7 +193,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r | ID| Error Message | | -------- | -------------------------------------------- | -| 201 | Permission denied. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -208,7 +210,7 @@ observer.on('signalInfoChange', {slotId: 0}, data => { ## observer.off('signalInfoChange') -off\(type: \'signalInfoChange\', callback?: Callback\>): void; +off\(type: \'signalInfoChange\', callback?: Callback\\>): void; 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 | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | -| callback | Callback\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +| callback | Callback\\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| **Error codes** @@ -251,7 +253,7 @@ observer.off('signalInfoChange'); ## observer.on('cellInfoChange')8+ -on\(type: \'cellInfoChange\', callback: Callback\): void; +on\(type: \'cellInfoChange\', callback: Callback\\>\): void; Registers an observer for cell information change events. This API uses an asynchronous callback to return the result. @@ -263,16 +265,19 @@ Registers an observer for cell information change events. This API uses an async **Parameters** -| Name | Type | Mandatory| Description | -| -------- | --------------------------------------------------------- | ---- |------------------------------------------------------------| -| 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.| +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------- | ---- |------------------------------------------| +| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**.| +| callback | Callback\\> | 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 | | -------- | -------------------------------------------- | | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -290,7 +295,7 @@ observer.on('cellInfoChange', data => { ## observer.on('cellInfoChange')8+ -on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback\): void; +on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback\\>\): 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. @@ -302,17 +307,20 @@ Registers an observer for signal status change events of the SIM card in the spe **Parameters** -| Name| Type | Mandatory| Description | -| ------ |--------------------------------------------------| ---- |------------------------------------------------------------| -| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | Yes | Callback used to return the result.| +| Name| Type | Mandatory| Description | +| ------ |--------------------------------------------------| ---- |--------------------------------------------| +| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**.| +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| callback | Callback\\> | 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 | | -------- | -------------------------------------------- | | 201 | Permission denied. | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -330,7 +338,7 @@ observer.on('cellInfoChange', {slotId: 0}, data => { ## observer.off('cellInfoChange')8+ -off\(type: \'cellInfoChange\', callback?: Callback\): void; +off\(type: \'cellInfoChange\', callback?: Callback\\>\): void; 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 | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | 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\\> | 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 | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | diff --git a/en/application-dev/reference/apis/js-apis-power.md b/en/application-dev/reference/apis/js-apis-power.md index f98e56905a7671f4b0a0cb616d6ab64c198116f7..04967480dfd6469eea02de987f0be83a71f6fc9d 100644 --- a/en/application-dev/reference/apis/js-apis-power.md +++ b/en/application-dev/reference/apis/js-apis-power.md @@ -1,4 +1,4 @@ -# @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. @@ -36,7 +36,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes | ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -72,7 +72,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes | ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -98,7 +98,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes | ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -133,7 +133,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes | ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -161,7 +161,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes | ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -193,7 +193,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes | ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -231,7 +231,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes | ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -275,7 +275,7 @@ For details about the error codes, see [Power Manager Error Codes](../errorcodes | ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-radio.md b/en/application-dev/reference/apis/js-apis-radio.md index 15c1fc484dd8987dd26c9229beeb200ba8a711e9..92ed924f94e29a4ca66f0176622e45817b4420b3 100644 --- a/en/application-dev/reference/apis/js-apis-radio.md +++ b/en/application-dev/reference/apis/js-apis-radio.md @@ -103,7 +103,7 @@ promise.then(data => { ## radio.getNetworkState -getNetworkState\(callback: AsyncCallback\): void +getNetworkState\(callback: AsyncCallback\\): void Obtains the network status. This API uses an asynchronous callback to return the result. @@ -141,7 +141,7 @@ radio.getNetworkState((err, data) => { ## radio.getNetworkState -getNetworkState\(slotId: number, callback: AsyncCallback\): void +getNetworkState\(slotId: number, callback: AsyncCallback\\): void Obtains the network status. This API uses an asynchronous callback to return the result. @@ -181,7 +181,7 @@ radio.getNetworkState(slotId, (err, data) => { ## radio.getNetworkState -getNetworkState\(slotId?: number\): Promise +getNetworkState\(slotId?: number\): Promise\ Obtains the network status. This API uses a promise to return the result. @@ -229,7 +229,7 @@ promise.then(data => { ## radio.getNetworkSelectionMode -getNetworkSelectionMode\(slotId: number, callback: AsyncCallback\): void +getNetworkSelectionMode\(slotId: number, callback: AsyncCallback\\): void 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) => { ## radio.getNetworkSelectionMode -getNetworkSelectionMode\(slotId: number\): Promise +getNetworkSelectionMode\(slotId: number\): Promise\ 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 => { ## radio.getISOCountryCodeForNetwork7+ -getISOCountryCodeForNetwork\(slotId: number, callback: AsyncCallback\): void +getISOCountryCodeForNetwork\(slotId: number, callback: AsyncCallback\\): 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. @@ -348,7 +348,7 @@ radio.getISOCountryCodeForNetwork(slotId, (err, data) => { ## radio.getISOCountryCodeForNetwork7+ -getISOCountryCodeForNetwork\(slotId: number\): Promise +getISOCountryCodeForNetwork\(slotId: number\): Promise\ 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 | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback\ | Yes | Callback invoked to return the result.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -445,7 +445,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r | ID| Error Message | | -------- | -------------------------------------------- | -| 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -464,7 +463,7 @@ promise.then(data => { ## radio.getSignalInformation7+ -getSignalInformation\(slotId: number, callback: AsyncCallback\>\): void +getSignalInformation\(slotId: number, callback: AsyncCallback\\>\): 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. @@ -501,7 +500,7 @@ radio.getSignalInformation(slotId, (err, data) => { ## radio.getSignalInformation7+ -getSignalInformation\(slotId: number\): Promise\> +getSignalInformation\(slotId: number\): Promise\\> 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); ## radio.isRadioOn7+ -isRadioOn\(callback: AsyncCallback\): void +isRadioOn\(callback: AsyncCallback\\): void 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) => { ## radio.isRadioOn7+ -isRadioOn\(slotId: number, callback: AsyncCallback\): void +isRadioOn\(slotId: number, callback: AsyncCallback\\): 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. @@ -732,7 +731,7 @@ radio.isRadioOn(slotId, (err, data) => { ## radio.isRadioOn7+ -isRadioOn\(slotId?: number\): Promise +isRadioOn\(slotId?: number\): Promise\ 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 => { ## radio.getOperatorName7+ -getOperatorName\(slotId: number, callback: AsyncCallback\): void +getOperatorName\(slotId: number, callback: AsyncCallback\\): void 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) => { ## radio.getOperatorName7+ -getOperatorName\(slotId: number\): Promise +getOperatorName\(slotId: number\): Promise\ 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 => { ## radio.setPrimarySlotId8+ -setPrimarySlotId(slotId: number, callback: AsyncCallback): void +setPrimarySlotId\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -933,6 +933,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -954,7 +955,7 @@ promise.then(() => { ## radio.getIMEI8+ -getIMEI(callback: AsyncCallback): void +getIMEI\(callback: AsyncCallback\\): void 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 | 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. | @@ -994,9 +996,9 @@ radio.getIMEI((err, data) => { ## radio.getIMEI8+ -getIMEI(slotId: number, callback: AsyncCallback): void +getIMEI\(slotId: number, callback: AsyncCallback\\): 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. @@ -1018,6 +1020,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -1036,7 +1039,7 @@ radio.getIMEI(slotId, (err, data) => { ## radio.getIMEI8+ -getIMEI(slotId?: number): Promise +getIMEI\(slotId?: number\): Promise\ 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 | 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. | @@ -1085,7 +1089,7 @@ promise.then(data => { ## radio.getMEID8+ -getMEID(callback: AsyncCallback): void +getMEID\(callback: AsyncCallback\\): void 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 | 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. | @@ -1125,9 +1130,9 @@ radio.getMEID((err, data) => { ## radio.getMEID8+ -getMEID(slotId: number, callback: AsyncCallback): void +getMEID\(slotId: number, callback: AsyncCallback\\): 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. @@ -1149,6 +1154,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -1167,7 +1173,7 @@ radio.getMEID(slotId, (err, data) => { ## radio.getMEID8+ -getMEID(slotId?: number): Promise +getMEID\(slotId?: number\): Promise\ 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 | 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. | @@ -1216,7 +1223,7 @@ promise.then(data => { ## radio.getUniqueDeviceId8+ -getUniqueDeviceId(callback: AsyncCallback): void +getUniqueDeviceId\(callback: AsyncCallback\\): void 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 | 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. | @@ -1256,9 +1264,9 @@ radio.getUniqueDeviceId((err, data) => { ## radio.getUniqueDeviceId8+ -getUniqueDeviceId(slotId: number, callback: AsyncCallback): void +getUniqueDeviceId\(slotId: number, callback: AsyncCallback\\): 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. @@ -1280,6 +1288,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -1298,7 +1307,7 @@ radio.getUniqueDeviceId(slotId, (err, data) => { ## radio.getUniqueDeviceId8+ -getUniqueDeviceId(slotId?: number): Promise +getUniqueDeviceId\(slotId?: number\): Promise\ 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 | 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. | @@ -1347,7 +1357,7 @@ promise.then(data => { ## radio.sendUpdateCellLocationRequest8+ -sendUpdateCellLocationRequest\(callback: AsyncCallback\): void +sendUpdateCellLocationRequest\(callback: AsyncCallback\\): void 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 | 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. | @@ -1386,7 +1397,7 @@ radio.sendUpdateCellLocationRequest((err) => { ## radio.sendUpdateCellLocationRequest8+ -sendUpdateCellLocationRequest\(slotId: number, callback: AsyncCallback\): void +sendUpdateCellLocationRequest\(slotId: number, callback: AsyncCallback\\): 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. @@ -1410,6 +1421,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -1427,7 +1439,7 @@ radio.sendUpdateCellLocationRequest(slotId, (err) => { ## radio.sendUpdateCellLocationRequest8+ -sendUpdateCellLocationRequest\(slotId?: number): Promise +sendUpdateCellLocationRequest\(slotId?: number\): Promise\ 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 | 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. | @@ -1475,7 +1488,7 @@ radio.sendUpdateCellLocationRequest(slotId).then(() => { ## radio.getCellInformation8+ -getCellInformation(callback: AsyncCallback>): void +getCellInformation\(callback: AsyncCallback\\>\): void 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 | 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. | @@ -1515,7 +1529,7 @@ radio.getCellInformation((err, data) => { ## radio.getCellInformation8+ -getCellInformation(slotId: number, callback: AsyncCallback\>): void +getCellInformation\(slotId: number, callback: AsyncCallback\\>\): void 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 | 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. | @@ -1557,7 +1572,7 @@ radio.getCellInformation(slotId, (err, data) => { ## radio.getCellInformation8+ -getCellInformation(slotId?: number): Promise\> +getCellInformation\(slotId?: number\): Promise\\> 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 | 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. | @@ -1606,7 +1622,7 @@ promise.then(data => { ## radio.setNetworkSelectionMode -setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCallback\): void +setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCallback\\): void 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 | 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. | @@ -1658,7 +1675,7 @@ radio.setNetworkSelectionMode(networkSelectionModeOptions, (err) => { ## radio.setNetworkSelectionMode -setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise +setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise\ 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 | 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. | @@ -1718,7 +1736,7 @@ promise.then(() => { ## radio.getNetworkSearchInformation -getNetworkSearchInformation\(slotId: number, callback: AsyncCallback\): void +getNetworkSearchInformation\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1758,7 +1777,7 @@ radio.getNetworkSearchInformation(0, (err, data) => { ## radio.getNetworkSearchInformation -getNetworkSearchInformation\(slotId: number\): Promise +getNetworkSearchInformation\(slotId: number\): Promise\ 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 | 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. | @@ -1806,7 +1826,7 @@ promise.then(data => { ## radio.getNrOptionMode8+ -getNrOptionMode(callback: AsyncCallback): void +getNrOptionMode\(callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1843,7 +1864,7 @@ radio.getNrOptionMode((err, data) => { ## radio.getNrOptionMode8+ -getNrOptionMode(slotId: number, callback: AsyncCallback): void +getNrOptionMode\(slotId: number, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1882,7 +1904,7 @@ radio.getNrOptionMode(slotId, (err, data) => { ## radio.getNrOptionMode8+ -getNrOptionMode(slotId?: number): Promise +getNrOptionMode\(slotId?: number\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1928,7 +1951,7 @@ promise.then(data => { ## radio.turnOnRadio7+ -turnOnRadio(callback: AsyncCallback): void +turnOnRadio\(callback: AsyncCallback\\): void 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 | 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. | @@ -1968,7 +1992,7 @@ radio.turnOnRadio((err) => { ## radio.turnOnRadio7+ -turnOnRadio(slotId: number, callback: AsyncCallback): void +turnOnRadio\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -2010,7 +2035,7 @@ radio.turnOnRadio(slotId, (err) => { ## radio.turnOnRadio7+ -turnOnRadio(slotId?: number): Promise +turnOnRadio(slotId?: number): Promise\ 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 | 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. | @@ -2058,7 +2084,7 @@ radio.turnOnRadio(slotId).then(() => { ## radio.turnOffRadio7+ -turnOffRadio(callback: AsyncCallback): void +turnOffRadio\(callback: AsyncCallback\\): void 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 | 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. | @@ -2098,7 +2125,7 @@ radio.turnOffRadio((err) => { ## radio.turnOffRadio7+ -turnOffRadio(slotId: number, callback: AsyncCallback): void +turnOffRadio\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -2140,7 +2168,7 @@ radio.turnOffRadio(slotId, (err) => { ## radio.turnOffRadio7+ -turnOffRadio(slotId?: number): Promise +turnOffRadio\(slotId?: number\): Promise\ 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 | 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. | @@ -2188,7 +2217,7 @@ radio.turnOffRadio(slotId).then(() => { ## radio.setPreferredNetwork8+ -setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\): void +setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\\): void 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 | 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. | @@ -2230,7 +2260,7 @@ radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_M ## radio.setPreferredNetwork8+ -setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise +setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode\): Promise\ 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 | 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. | @@ -2279,7 +2310,7 @@ radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_M ## radio.getPreferredNetwork8+ -getPreferredNetwork\(slotId: number, callback: AsyncCallback\): void +getPreferredNetwork\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -2319,7 +2351,7 @@ radio.getPreferredNetwork(0, (err, data) => { ## radio.getPreferredNetwork8+ -getPreferredNetwork(slotId: number): Promise +getPreferredNetwork\(slotId: number\): Promise\ 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 | 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. | @@ -2367,7 +2400,7 @@ promise.then(data => { ## radio.getImsRegInfo9+ -getImsRegInfo(slotId: number, imsType: ImsServiceType, callback: AsyncCallback): void +getImsRegInfo\(slotId: number, imsType: ImsServiceType, callback: AsyncCallback\\): 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. @@ -2392,6 +2425,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2408,7 +2442,7 @@ radio.getImsRegInfo(0, radio.ImsServiceType.TYPE_VIDEO, (err, data) => { ## radio.getImsRegInfo9+ -getImsRegInfo(slotId: number, imsType: ImsServiceType): Promise +getImsRegInfo\(slotId: number, imsType: ImsServiceType\): Promise\ 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 | 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. | @@ -2457,7 +2492,7 @@ promise.then(data => { ## radio.on('imsRegStateChange')9+ -on(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: Callback): void +on\(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: Callback\\): void 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 | 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. | @@ -2499,7 +2535,7 @@ radio.on('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { ## radio.off('imsRegStateChange')9+ -off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback?: Callback): void +off\(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback?: Callback\\): void 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 | type | string | Yes | IMS registration status changes. | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | 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** @@ -2525,6 +2561,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2539,6 +2576,101 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { }); ``` + +## radio.getBasebandVersion10+ + +getBasebandVersion\(slotId: number, callback: AsyncCallback\\): 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.
- **0**: card slot 1
- **1**: card slot 2| +| callback | AsyncCallback\ | 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.getBasebandVersion10+ + +getBasebandVersion\(slotId: number\): Promise\ + +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.
- **0**: card slot 1
- **1**: card slot 2| + +**Return value** + +| Type | Description | +| ----------------- | -------------------------------------- | +| Promise\ | 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 Enumerates radio access technologies. diff --git a/en/application-dev/reference/apis/js-apis-resource-manager.md b/en/application-dev/reference/apis/js-apis-resource-manager.md index 76d9a3456aaa7c24beb2f57aee57e6106f4957fa..a1b98717279f99d9e15c5018fcf41bb28d30c6a5 100644 --- a/en/application-dev/reference/apis/js-apis-resource-manager.md +++ b/en/application-dev/reference/apis/js-apis-resource-manager.md @@ -1,6 +1,6 @@ # @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** > @@ -13,7 +13,7 @@ The Resource Manager module provides APIs to obtain information about applicatio 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. 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. | Name | Value | Description | | -------------------- | ---- | ---- | -| DEVICE_TYPE_PHONE | 0x00 | Phone | -| DEVICE_TYPE_TABLET | 0x01 | Tablet | -| DEVICE_TYPE_CAR | 0x02 | Head unit | -| DEVICE_TYPE_PC | 0x03 | PC | -| DEVICE_TYPE_TV | 0x04 | TV | -| DEVICE_TYPE_WEARABLE | 0x06 | Wearable | +| DEVICE_TYPE_PHONE | 0x00 | Phone. | +| DEVICE_TYPE_TABLET | 0x01 | Tablet. | +| DEVICE_TYPE_CAR | 0x02 | Head unit. | +| DEVICE_TYPE_PC | 0x03 | PC. | +| DEVICE_TYPE_TV | 0x04 | TV. | +| DEVICE_TYPE_WEARABLE | 0x06 | Wearable. | ## ScreenDensity @@ -253,7 +253,7 @@ Defines the descriptor of the raw file. | 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. | | length | number | Yes | No| Length of the raw file. | @@ -278,7 +278,7 @@ Defines the capability of accessing application resources. > **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**. @@ -343,10 +343,10 @@ Obtains the string corresponding to the specified resource ID. This API uses a p | --------------------- | ----------- | | Promise<string> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -382,10 +382,10 @@ Obtains the string corresponding to the specified resource object. This API uses | resource | [Resource](#resource9) | Yes | Resource object. | | callback | AsyncCallback<string> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -434,10 +434,10 @@ Obtains the string corresponding to the specified resource object. This API uses | --------------------- | ---------------- | | Promise<string> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -478,10 +478,10 @@ Obtains the string array corresponding to the specified resource ID. This API us | resId | number | Yes | Resource ID. | | callback | AsyncCallback<Array<string>> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -524,10 +524,10 @@ Obtains the string array corresponding to the specified resource ID. This API us | ---------------------------------- | ------------- | | Promise<Array<string>> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -562,10 +562,10 @@ Obtains the string array corresponding to the specified resource object. This AP | resource | [Resource](#resource9) | Yes | Resource object. | | callback | AsyncCallback<Array<string>> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -612,10 +612,10 @@ Obtains the string array corresponding to the specified resource object. This AP | ---------------------------------- | ------------------ | | Promise<Array<string>> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -640,7 +640,6 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` - ### getMediaContent9+ getMediaContent(resId: number, callback: AsyncCallback<Uint8Array>): void @@ -656,10 +655,10 @@ Obtains the content of the media file corresponding to the specified resource ID | resId | number | Yes | Resource ID. | | callback | AsyncCallback<Uint8Array> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -680,6 +679,45 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaContent10+ + +getMediaContent(resId: number, density: number, callback: AsyncCallback<Uint8Array>): 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<Uint8Array> | 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}.`) + } + ``` ### getMediaContent9+ @@ -701,10 +739,10 @@ Obtains the content of the media file corresponding to the specified resource ID | ------------------------- | -------------- | | Promise<Uint8Array> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -723,6 +761,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaContent10+ + +getMediaContent(resId: number, density: number): Promise<Uint8Array> + +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<Uint8Array> | 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}.`) + } + ``` + ### getMediaContent9+ getMediaContent(resource: Resource, callback: AsyncCallback<Uint8Array>): void @@ -738,10 +819,10 @@ Obtains the content of the media file corresponding to the specified resource ob | resource | [Resource](#resource9) | Yes | Resource object. | | callback | AsyncCallback<Uint8Array> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -767,6 +848,51 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaContent10+ + +getMediaContent(resource: Resource, density: number, callback: AsyncCallback<Uint8Array>): 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<Uint8Array> | 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}.`) + } + ``` + ### getMediaContent9+ getMediaContent(resource: Resource): Promise<Uint8Array> @@ -787,10 +913,10 @@ Obtains the content of the media file corresponding to the specified resource ob | ------------------------- | ------------------- | | Promise<Uint8Array> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -814,6 +940,53 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaContent10+ + +getMediaContent(resource: Resource, density: number): Promise<Uint8Array> + +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<Uint8Array> | 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}.`) + } + ``` ### getMediaContentBase649+ @@ -830,10 +1003,10 @@ Obtains the Base64 code of the image corresponding to the specified resource ID. | resId | number | Yes | Resource ID. | | callback | AsyncCallback<string> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -854,6 +1027,45 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaContentBase6410+ + +getMediaContentBase64(resId: number, density: number, callback: AsyncCallback<string>): 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<string> | 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}.`) + } + ``` ### getMediaContentBase649+ @@ -875,10 +1087,10 @@ Obtains the Base64 code of the image corresponding to the specified resource ID. | --------------------- | -------------------- | | Promise<string> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -894,7 +1106,50 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco }); } catch (error) { console.error(`promise getMediaContentBase64 failed, error code: ${error.code}, message: ${error.message}.`) - } + } + ``` + +### getMediaContentBase6410+ + +getMediaContentBase64(resId: number, density: number): Promise<string> + +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<string> | 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}.`) + } ``` ### getMediaContentBase649+ @@ -912,10 +1167,10 @@ Obtains the Base64 code of the image corresponding to the specified resource obj | resource | [Resource](#resource9) | Yes | Resource object. | | callback | AsyncCallback<string> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -941,6 +1196,51 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaContentBase6410+ + +getMediaContentBase64(resource: Resource, density: number, callback: AsyncCallback<string>): 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<string> | 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}.`) + } + ``` + ### getMediaContentBase649+ getMediaContentBase64(resource: Resource): Promise<string> @@ -961,10 +1261,10 @@ Obtains the Base64 code of the image corresponding to the specified resource obj | --------------------- | ------------------------- | | Promise<string> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -988,6 +1288,53 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaContentBase6410+ + +getMediaContentBase64(resource: Resource, density: number): Promise<string> + +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<string> | 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 @@ -1117,10 +1464,10 @@ Obtains the singular-plural string corresponding to the specified resource ID ba | num | number | Yes | Number. | | callback | AsyncCallback<string> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -1164,10 +1511,10 @@ Obtains the singular-plural string corresponding to the specified resource ID ba | --------------------- | ------------------------- | | Promise<string> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -1203,10 +1550,10 @@ Obtains the singular-plural string corresponding to the specified resource objec | num | number | Yes | Number. | | callback | AsyncCallback<string> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -1255,10 +1602,10 @@ Obtains the singular-plural string corresponding to the specified resource objec | --------------------- | ------------------------------ | | Promise<string> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -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. | | callback | AsyncCallback<Uint8Array> | 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** +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. | @@ -1343,10 +1690,10 @@ Obtains the content of the raw file in the **resources/rawfile** directory. This | ------------------------- | ----------- | | Promise<Uint8Array> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -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. | | callback | AsyncCallback<[RawFileDescriptor](#rawfiledescriptor8)> | 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** +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. | @@ -1425,10 +1772,10 @@ Obtains the descriptor of the raw file in the **resources/rawfile** directory. T | ---------------------------------------- | ------------------- | | Promise<[RawFileDescriptor](#rawfiledescriptor8)> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -1448,6 +1795,86 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco }; ``` +### getRawFileList10+ + +getRawFileList(path: string, callback: AsyncCallback<Array\>): 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<Array\> | 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}.`) + } + + ``` + +### getRawFileList10+ + +getRawFileList(path: string): Promise<Array\> + +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<Array\> | 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}.`) + } + ``` + ### closeRawFileDescriptor8+ closeRawFileDescriptor(path: string, callback: AsyncCallback<void>): void @@ -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.| | callback | AsyncCallback<void> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001005 | The resource not found by path. | @@ -1563,10 +1990,10 @@ Closes the descriptor of the raw file in the **resources/rawfile** directory. Th | ------------------- | ---- | | Promise<void> | Promise that returns no value.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -1614,10 +2041,10 @@ Obtains the string corresponding to the specified resource name. This API uses a | resName | string | Yes | Resource name. | | callback | AsyncCallback<string> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001003 | If the resName invalid. | @@ -1658,12 +2085,12 @@ Obtains the string corresponding to the specified resource name. This API uses a | Type | Description | | --------------------- | ---------- | -| Promise<string> | String corresponding to the resource name.| - -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). +| Promise<string> | 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. | @@ -1698,10 +2125,10 @@ Obtains the string array corresponding to the specified resource name. This API | resName | string | Yes | Resource name. | | callback | AsyncCallback<Array<string>> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001003 | If the resName invalid. | @@ -1743,10 +2170,10 @@ Obtains the string array corresponding to the specified resource name. This API | ---------------------------------- | ------------ | | Promise<Array<string>> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -1781,15 +2208,14 @@ Obtains the content of the media file corresponding to the specified resource ID | resName | string | Yes | Resource name. | | callback | AsyncCallback<Uint8Array> | 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** +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. | -| 9001006 | If the resource re-ref too much. | **Example** ```ts @@ -1806,6 +2232,46 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaByName10+ + +getMediaByName(resName: string, density: number, callback: AsyncCallback<Uint8Array>): 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<Uint8Array> | 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}.`) + } + ``` + ### getMediaByName9+ getMediaByName(resName: string): Promise<Uint8Array> @@ -1826,15 +2292,14 @@ Obtains the content of the media file corresponding to the specified resource na | ------------------------- | ------------- | | Promise<Uint8Array> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | -| 9001006 | If the resource re-ref too much. | **Example** ```ts @@ -1849,6 +2314,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaByName10+ + +getMediaByName(resName: string, density: number): Promise<Uint8Array> + +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<Uint8Array> | 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}.`) + } + ``` + ### getMediaBase64ByName9+ getMediaBase64ByName(resName: string, callback: AsyncCallback<string>): void @@ -1864,15 +2372,14 @@ Obtains the Base64 code of the image corresponding to the specified resource nam | resName | string | Yes | Resource name. | | callback | AsyncCallback<string> | 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** +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. | -| 9001006 | If the resource re-ref too much. | **Example** ```ts @@ -1889,6 +2396,46 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaBase64ByName10+ + +getMediaBase64ByName(resName: string, density: number, callback: AsyncCallback<string>): 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<string> | 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}.`) + } + ``` + ### getMediaBase64ByName9+ getMediaBase64ByName(resName: string): Promise<string> @@ -1909,15 +2456,14 @@ Obtains the Base64 code of the image corresponding to the specified resource nam | --------------------- | ------------------- | | Promise<string> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | -| 9001006 | If the resource re-ref too much. | **Example** ```ts @@ -1932,6 +2478,49 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getMediaBase64ByName10+ + +getMediaBase64ByName(resName: string, density: number): Promise<string> + +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<string> | 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}.`) + } + ``` + ### getPluralStringByName9+ getPluralStringByName(resName: string, num: number, callback: AsyncCallback<string>): void @@ -1948,10 +2537,10 @@ Obtains the plural string corresponding to the specified resource name based on | num | number | Yes | Number. | | callback | AsyncCallback<string> | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001003 | If the resName invalid. | @@ -1995,10 +2584,10 @@ Obtains the plural string corresponding to the specified resource name based on | --------------------- | ---------------------- | | Promise<string> | Promise used to return the result.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -2036,12 +2625,12 @@ Obtains the string corresponding to the specified resource ID. This API returns | Type | Description | | ------ | ----------- | -| string | Promise used to return the result.| - -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). +| string | String corresponding to the specified resource ID.| **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. | @@ -2078,10 +2667,10 @@ Obtains the string corresponding to the specified resource ID and formats the st | ------ | ---------------------------- | | string | Formatted string.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -2116,12 +2705,12 @@ Obtains the string corresponding to the specified resource object. This API retu | Type | Description | | ------ | ---------------- | -| string | Promise used to return the result.| - -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). +| string | String corresponding to the specified resource object.| **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. | @@ -2163,10 +2752,10 @@ Obtains the string corresponding to the specified resource object and formats th | ------ | ---------------------------- | | string | Formatted string.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -2208,10 +2797,10 @@ Obtains the string corresponding to the specified resource name. This API return | ------ | ---------- | | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001003 | If the resName invalid. | @@ -2248,10 +2837,10 @@ Obtains the string corresponding to the specified resource name and formats the | ------ | ---------------------------- | | string | Formatted string.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -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.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -2326,10 +2915,10 @@ Obtains the Boolean result corresponding to the specified resource object. This | ------- | ----------------- | | 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** +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + | ID| Error Message| | -------- | ---------------------------------------- | | 9001001 | If the resId invalid. | @@ -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.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -2407,12 +2996,12 @@ Obtains the integer or float value corresponding to the specified resource ID. T | 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.| - -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). +| 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.| **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. | @@ -2452,12 +3041,12 @@ Obtains the integer or float value corresponding to the specified resource objec | 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.| - -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). +| 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.| **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. | @@ -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.| -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). - **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. | @@ -2542,12 +3131,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc | Type | Description | | ------ | ---------- | -| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| - -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the specified resource ID.| **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. | @@ -2571,7 +3160,7 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco 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 @@ -2586,12 +3175,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc | Type | Description | | ------- | ----------------- | -| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| - -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the specified resource ID.| **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. | @@ -2635,12 +3224,12 @@ Obtains the **DrawableDescriptor** object corresponding to the specified resourc | Type | Description | | ------ | --------- | -| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| - -For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the specified resource ID.| **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. | @@ -2666,7 +3255,7 @@ getString(resId: number, callback: AsyncCallback<string>): void 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 @@ -2697,7 +3286,7 @@ getString(resId: number): Promise<string> 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 @@ -2731,7 +3320,7 @@ getStringArray(resId: number, callback: AsyncCallback<Array<string>> 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 @@ -2762,7 +3351,7 @@ getStringArray(resId: number): Promise<Array<string>> 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 @@ -2796,7 +3385,7 @@ getMedia(resId: number, callback: AsyncCallback<Uint8Array>): void 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 @@ -2827,7 +3416,7 @@ getMedia(resId: number): Promise<Uint8Array> 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 @@ -2861,7 +3450,7 @@ getMediaBase64(resId: number, callback: AsyncCallback<string>): void 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 @@ -2892,7 +3481,7 @@ getMediaBase64(resId: number): Promise<string> 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 @@ -2926,7 +3515,7 @@ getPluralString(resId: number, num: number): Promise<string> 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 @@ -2961,7 +3550,7 @@ getPluralString(resId: number, num: number, callback: AsyncCallback<string> 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 @@ -2993,7 +3582,7 @@ getRawFile(path: string, callback: AsyncCallback<Uint8Array>): void 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 @@ -3024,7 +3613,7 @@ getRawFile(path: string): Promise<Uint8Array> 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 @@ -3058,7 +3647,7 @@ getRawFileDescriptor(path: string, callback: AsyncCallback<RawFileDescriptor& 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 @@ -3090,7 +3679,7 @@ getRawFileDescriptor(path: string): Promise<RawFileDescriptor> 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 diff --git a/en/application-dev/reference/apis/js-apis-runninglock.md b/en/application-dev/reference/apis/js-apis-runninglock.md index e25ca6bcb1381a41f8491fcb8c50b2e65e5929e1..4d72733c02f607fd17f29f2c4402f059bfee981f 100644 --- a/en/application-dev/reference/apis/js-apis-runninglock.md +++ b/en/application-dev/reference/apis/js-apis-runninglock.md @@ -1,8 +1,9 @@ -# @ohos.runningLock (Runninglock) +# @ohos.runningLock (Running Lock) The **runningLock** module provides APIs for creating, querying, holding, and releasing running locks. -> **NOTE**
+> **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. ## Modules to Import @@ -15,7 +16,7 @@ import runningLock from '@ohos.runningLock'; 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 @@ -25,7 +26,7 @@ Checks whether a specified type of **RunningLock** is supported. | ------ | ----------------------------------- | ---- | -------------------- | | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object.| -**Return value** +**Return Value** | Type | Description | | ------- | --------------------------------------- | @@ -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). -| Code | Error Message | +| ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -72,9 +73,9 @@ Creates a **RunningLock** object. 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** @@ -105,7 +106,7 @@ Creates a **RunningLock** object. | name | string | Yes | Name of the **RunningLock** object. | | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.| -**Return value** +**Return Value** | Type | Description | | ------------------------------------------ | ------------------------------------ | @@ -115,9 +116,9 @@ Creates a **RunningLock** object. 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** @@ -135,10 +136,9 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND) isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback<boolean>): void -> NOTE
-> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9). -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 @@ -147,7 +147,7 @@ Checks whether a specified type of **RunningLock** is supported. This API uses a | Name | Type | Mandatory| Description | | -------- | ----------------------------------- | ---- | ------------------------------------------------------------ | | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object. | -| callback | AsyncCallback<boolean> | 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<boolean> | 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** @@ -165,10 +165,9 @@ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND, ( isRunningLockTypeSupported(type: RunningLockType): Promise<boolean> -> NOTE
-> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9). -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 @@ -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.| -**Return value** +**Return Value** | Type | Description | | ---------------------- | ---------------------------------------------------- | @@ -200,8 +199,7 @@ runningLock.isRunningLockTypeSupported(runningLock.RunningLockType.BACKGROUND) createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback<RunningLock>): void -> NOTE
-> This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9). Creates a **RunningLock** object. @@ -233,8 +231,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B createRunningLock(name: string, type: RunningLockType): Promise<RunningLock> -> NOTE
-> This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [runningLock.create](#runninglockcreate9). Creates a **RunningLock** object. @@ -249,7 +246,7 @@ Creates a **RunningLock** object. | name | string | Yes | Name of the **RunningLock** object. | | type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object to be created.| -**Return value** +**Return Value** | Type | Description | | ------------------------------------------ | ------------------------------------ | @@ -269,7 +266,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B ## RunningLock -Represents a **RunningLock** object. +Defines a **RunningLock** object. ### hold9+ @@ -291,9 +288,9 @@ Locks and holds a **RunningLock** object. 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** @@ -327,9 +324,9 @@ Releases a **RunningLock** object. 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** @@ -357,7 +354,7 @@ Checks the hold status of the **Runninglock** object. **System capability:** SystemCapability.PowerManager.PowerManager.Core -**Return value** +**Return Value** | Type | Description | | ------- | ------------------------------------------------------------ | @@ -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). -| Code | Error Message | +| ID | Error Message | |---------|---------| -| 4900101 | Operation failed. Cannot connect to service.| +| 4900101 | If connecting to the service failed. | **Example** @@ -393,8 +390,7 @@ runningLock.create('running_lock_test', runningLock.RunningLockType.BACKGROUND) lock(timeout: number): void -> NOTE
-> This API is deprecated since API version 9. You are advised to use [RunningLock.hold](#hold9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [RunningLock.hold](#hold9). Locks and holds a **RunningLock** object. @@ -425,8 +421,7 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B unlock(): void -> NOTE
-> This API is deprecated since API version 9. You are advised to use [RunningLock.unhold](#unhold9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [RunningLock.unhold](#unhold9). Releases a **RunningLock** object. @@ -451,14 +446,13 @@ runningLock.createRunningLock('running_lock_test', runningLock.RunningLockType.B isUsed(): boolean -> NOTE
-> This API is deprecated since API version 9. You are advised to use [RunningLock.isHolding](#isholding9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [RunningLock.isHolding](#isholding9). Checks the hold status of the **Runninglock** object. **System capability:** SystemCapability.PowerManager.PowerManager.Core -**Return value** +**Return Value** | Type | Description | | ------- | ------------------------------------------------------------ | | boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.| diff --git a/en/application-dev/reference/apis/js-apis-sim.md b/en/application-dev/reference/apis/js-apis-sim.md index 6736cc90eca295e17310c295409a781f679db7d4..08700a85bd5bab7b6bc8a0e190f5376602eeb462 100644 --- a/en/application-dev/reference/apis/js-apis-sim.md +++ b/en/application-dev/reference/apis/js-apis-sim.md @@ -1,6 +1,6 @@ -# @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** > @@ -15,7 +15,7 @@ import sim from '@ohos.telephony.sim'; ## sim.isSimActive7+ -isSimActive\(slotId: number, callback: AsyncCallback\): void +isSimActive\(slotId: number, callback: AsyncCallback\\): void 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) => { ## sim.isSimActive7+ -isSimActive\(slotId: number\): Promise +isSimActive\(slotId: number\): Promise\ 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 => { ## sim.getDefaultVoiceSlotId7+ -getDefaultVoiceSlotId\(callback: AsyncCallback\): void +getDefaultVoiceSlotId\(callback: AsyncCallback\\): void 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) => { ## sim.getDefaultVoiceSlotId7+ -getDefaultVoiceSlotId\(\): Promise +getDefaultVoiceSlotId\(\): Promise\ 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 => { ## sim.hasOperatorPrivileges7+ -hasOperatorPrivileges(slotId: number, callback: AsyncCallback\): void +hasOperatorPrivileges\(slotId: number, callback: AsyncCallback\\): void 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) => { ## sim.hasOperatorPrivileges7+ -hasOperatorPrivileges(slotId: number): Promise +hasOperatorPrivileges\(slotId: number\): Promise\ 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 => { ## sim.getISOCountryCodeForSim -getISOCountryCodeForSim\(slotId: number, callback: AsyncCallback\): void +getISOCountryCodeForSim\(slotId: number, callback: AsyncCallback\\): void 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) => { ## sim.getISOCountryCodeForSim -getISOCountryCodeForSim\(slotId: number\): Promise +getISOCountryCodeForSim\(slotId: number\): Promise\ 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 => { ## sim.getSimOperatorNumeric -getSimOperatorNumeric\(slotId: number, callback: AsyncCallback\): void +getSimOperatorNumeric\(slotId: number, callback: AsyncCallback\\): 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. @@ -316,7 +316,7 @@ sim.getSimOperatorNumeric(0, (err, data) => { ## sim.getSimOperatorNumeric -getSimOperatorNumeric\(slotId: number\): Promise +getSimOperatorNumeric\(slotId: number\): Promise\ 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 => { ## sim.getSimSpn -getSimSpn\(slotId: number, callback: AsyncCallback\): void +getSimSpn\(slotId: number, callback: AsyncCallback\\): 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. @@ -398,7 +398,7 @@ sim.getSimSpn(0, (err, data) => { ## sim.getSimSpn -getSimSpn\(slotId: number\): Promise +getSimSpn\(slotId: number\): Promise\ 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 => { ## sim.getSimState -getSimState\(slotId: number, callback: AsyncCallback\): void +getSimState\(slotId: number, callback: AsyncCallback\\): void 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) => { ## sim.getSimState -getSimState\(slotId: number\): Promise +getSimState\(slotId: number\): Promise\ 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 => { ## sim.getCardType7+ -getCardType\(slotId: number, callback: AsyncCallback\): void +getCardType\(slotId: number, callback: AsyncCallback\\): void 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) => { ## sim.getCardType7+ -getCardType\(slotId: number\): Promise +getCardType\(slotId: number\): Promise\ 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 => { ## sim.hasSimCard7+ -hasSimCard\(slotId: number, callback: AsyncCallback\): void +hasSimCard\(slotId: number, callback: AsyncCallback\\): void 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) => { ## sim.hasSimCard7+ -hasSimCard\(slotId: number\): Promise +hasSimCard\(slotId: number\): Promise\ 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 => { ## sim.getSimAccountInfo7+ -getSimAccountInfo(slotId: number, callback: AsyncCallback): void +getSimAccountInfo\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -726,7 +727,7 @@ sim.getSimAccountInfo(0, (err, data) => { ## sim.getSimAccountInfo7+ -getSimAccountInfo(slotId: number): Promise +getSimAccountInfo\(slotId: number\): Promise\ 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 | 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. | @@ -776,7 +778,7 @@ promise.then(data => { ## sim.getActiveSimAccountInfoList8+ -getActiveSimAccountInfoList(callback: AsyncCallback>): void +getActiveSimAccountInfoList\(callback: AsyncCallback\\>\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | -| 401 | Parameter error. | +| 202 | Non-system applications use system APIs. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | @@ -817,7 +819,7 @@ sim.getActiveSimAccountInfoList((err, data) => { ## sim.getActiveSimAccountInfoList8+ -getActiveSimAccountInfoList(): Promise>; +getActiveSimAccountInfoList\(\): Promise\\>; 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 | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300004 | Do not have sim card. | @@ -860,7 +861,7 @@ promise.then(data => { ## sim.setDefaultVoiceSlotId7+ -setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback): void +setDefaultVoiceSlotId\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -903,7 +905,7 @@ sim.setDefaultVoiceSlotId(0, (err) => { ## sim.setDefaultVoiceSlotId7+ -setDefaultVoiceSlotId(slotId: number): Promise\ +setDefaultVoiceSlotId\(slotId: number\): Promise\ 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 | 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. | @@ -953,7 +956,7 @@ promise.then(() => { ## sim.setShowName8+ -setShowName\(slotId: number, name: string, callback: AsyncCallback\): void +setShowName\(slotId: number, name: string, callback: AsyncCallback\\): void 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 | 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. | @@ -1026,6 +1030,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -1047,7 +1052,7 @@ promise.then(() => { ## sim.getShowName8+ -getShowName(slotId: number, callback: AsyncCallback): void +getShowName\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1089,7 +1095,7 @@ sim.getShowName(0, (err, data) => { ## sim.getShowName8+ -getShowName(slotId: number): Promise +getShowName\(slotId: number\): Promise\ 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 | 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. | @@ -1138,7 +1145,7 @@ promise.then(data => { ## sim.setShowNumber8+ -setShowNumber\(slotId: number, number: string, callback: AsyncCallback\): void +setShowNumber\(slotId: number, number: string, callback: AsyncCallback\\): void 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 | 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. | @@ -1212,6 +1220,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -1233,7 +1242,7 @@ promise.then(() => { ## sim.getShowNumber8+ -getShowNumber(slotId: number, callback: AsyncCallback): void +getShowNumber\(slotId: number, callback: AsyncCallback\): void 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 | 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. | @@ -1275,7 +1285,7 @@ sim.getShowNumber(0, (err, data) => { ## sim.getShowNumber8+ -getShowNumber(slotId: number): Promise +getShowNumber\(slotId: number\): Promise\ 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 | 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. | @@ -1324,7 +1335,7 @@ promise.then(data => { ## sim.activateSim8+ -activateSim(slotId: number, callback: AsyncCallback): void +activateSim\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1366,7 +1378,7 @@ sim.activateSim(0, (err) => { ## sim.activateSim8+ -activateSim(slotId: number): Promise\ +activateSim\(slotId: number\): Promise\ 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 | 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. | @@ -1415,7 +1428,7 @@ promise.then(() => { ## sim.deactivateSim8+ -deactivateSim(slotId: number, callback: AsyncCallback): void +deactivateSim\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -1457,7 +1471,7 @@ sim.deactivateSim(0, (err) => { ## sim.deactivateSim8+ -deactivateSim(slotId: number): Promise\ +deactivateSim\(slotId: number\): Promise\ 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 | 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. | @@ -1506,7 +1521,7 @@ promise.then(() => { ## sim.setLockState7+ -setLockState(slotId: number, options: LockInfo, callback: AsyncCallback): void +setLockState\(slotId: number, options: LockInfo, callback: AsyncCallback\\): void 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 | 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. | @@ -1555,7 +1571,7 @@ sim.setLockState(0, lockInfo, (err, data) => { ## sim.setLockState7+ -setLockState(slotId: number, options: LockInfo): Promise +setLockState\(slotId: number, options: LockInfo\): Promise\ 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 | 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. | @@ -1611,7 +1628,7 @@ promise.then(data => { ## sim.getLockState8+ -getLockState(slotId: number, lockType: LockType, callback: AsyncCallback): void +getLockState\(slotId: number, lockType: LockType, callback: AsyncCallback\\): void 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 | 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. | @@ -1655,7 +1673,7 @@ sim.getLockState(0, 1, (err, data) => { ## sim.getLockState8+ -getLockState(slotId: number, lockType: LockType): Promise +getLockState\(slotId: number, lockType: LockType\): Promise\ 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 | 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. | @@ -1706,7 +1725,7 @@ promise.then(data => { ## sim.alterPin7+ -alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback): void +alterPin\(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback\\): void 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 | 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. | @@ -1751,7 +1771,7 @@ sim.alterPin(0, "1234", "0000", (err, data) => { ## sim.alterPin7+ -alterPin(slotId: number, newPin: string, oldPin: string): Promise; +alterPin\(slotId: number, newPin: string, oldPin: string\): Promise\; 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 | 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. | @@ -1803,7 +1824,7 @@ promise.then(data => { ## sim.alterPin28+ -alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallback): void +alterPin2\(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallback\\): void 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 | 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. | @@ -1848,7 +1870,7 @@ sim.alterPin2(0, "1234", "0000", (err, data) => { ## sim.alterPin28+ -alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise +alterPin2\(slotId: number, newPin2: string, oldPin2: string\): Promise\ 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 | 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. | @@ -1900,7 +1923,7 @@ promise.then(data => { ## sim.unlockPin7+ -unlockPin(slotId: number, pin: string, callback: AsyncCallback): void +unlockPin\(slotId: number, pin: string, callback: AsyncCallback\\): void 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 | 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. | @@ -1945,7 +1969,7 @@ sim.unlockPin(0, pin, (err, data) => { ## sim.unlockPin7+ -unlockPin(slotId: number, pin: string): Promise<LockStatusResponse\> +unlockPin\(slotId: number, pin: string\): Promise\ 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 | 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. | @@ -1997,7 +2022,7 @@ promise.then(data => { ## sim.unlockPuk7+ -unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback): void +unlockPuk\(slotId: number, newPin: string, puk: string, callback: AsyncCallback\\): void 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 | 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. | @@ -2044,7 +2070,7 @@ sim.unlockPuk(0, newPin, puk, (err, data) => { ## sim.unlockPuk7+ -unlockPuk(slotId: number, newPin: string, puk: string): Promise<LockStatusResponse\> +unlockPuk\(slotId: number, newPin: string, puk: string\): Promise\ 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 | 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. | @@ -2098,9 +2125,9 @@ promise.then(data => { ## sim.unlockPin28+ -unlockPin2(slotId: number, pin2: string, callback: AsyncCallback): void +unlockPin2\(slotId: number, pin2: string, callback: AsyncCallback\\): 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. @@ -2123,6 +2150,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2143,9 +2171,9 @@ sim.unlockPin2(0, pin2, (err, data) => { ## sim.unlockPin28+ -unlockPin2(slotId: number, pin2: string): Promise<LockStatusResponse\> +unlockPin2\(slotId: number, pin2: string\): Promise\ -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. @@ -2173,6 +2201,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2195,9 +2224,9 @@ promise.then(data => { ## sim.unlockPuk28+ -unlockPuk2(slotId: number, newPin2: string, puk2: string, callback: AsyncCallback): void +unlockPuk2\(slotId: number, newPin2: string, puk2: string, callback: AsyncCallback\\): 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. @@ -2242,9 +2271,9 @@ sim.unlockPuk2(0, newPin2, puk2, (err, data) => { ## sim.unlockPuk28+ -unlockPuk2(slotId: number, newPin2: string, puk2: string): Promise<LockStatusResponse\> +unlockPuk2\(slotId: number, newPin2: string, puk2: string\): Promise\ -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. @@ -2316,7 +2345,7 @@ console.log("Result: "+ sim.getMaxSimCount()) ## sim.getSimIccId7+ -getSimIccId(slotId: number, callback: AsyncCallback): void +getSimIccId\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -2358,7 +2388,7 @@ sim.getSimIccId(0, (err, data) => { ## sim.getSimIccId7+ -getSimIccId(slotId: number): Promise +getSimIccId\(slotId: number\): Promise\ 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 | 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. | @@ -2407,7 +2438,7 @@ promise.then(data => { ## sim.getVoiceMailIdentifier8+ -getVoiceMailIdentifier(slotId: number, callback: AsyncCallback): void +getVoiceMailIdentifier\(slotId: number, callback: AsyncCallback\\): 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. @@ -2431,6 +2462,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2449,7 +2481,7 @@ sim.getVoiceMailIdentifier(0, (err, data) => { ## sim.getVoiceMailIdentifier8+ -getVoiceMailIdentifier(slotId: number): Promise +getVoiceMailIdentifier\(slotId: number\): Promise\ 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 | 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. | @@ -2498,7 +2531,7 @@ promise.then(data => { ## sim.getVoiceMailNumber8+ -getVoiceMailNumber(slotId: number, callback: AsyncCallback): void +getVoiceMailNumber\(slotId: number, callback: AsyncCallback\): void 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 | 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. | @@ -2540,7 +2574,7 @@ sim.getVoiceMailNumber(0, (err, data) => { ## sim.getVoiceMailNumber8+ -getVoiceMailNumber(slotId: number): Promise +getVoiceMailNumber\(slotId: number\): Promise\ 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 | 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. | @@ -2590,7 +2625,7 @@ promise.then(data => { ## sim.setVoiceMailInfo8+ -setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback): void +setVoiceMailInfo\(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback\\): void 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 | 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. | @@ -2635,7 +2671,7 @@ sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err) => { ## sim.setVoiceMailInfo8+ -setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise +setVoiceMailInfo\(slotId: number, mailName: string, mailNumber: string\): Promise\ 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 | 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. | @@ -2687,7 +2724,7 @@ promise.then(() => { ## sim.getSimTelephoneNumber8+ -getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void +getSimTelephoneNumber\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -2729,7 +2767,7 @@ sim.getSimTelephoneNumber(0, (err, data) => { ## sim.getSimTelephoneNumber8+ -getSimTelephoneNumber(slotId: number): Promise +getSimTelephoneNumber\(slotId: number\): Promise\ 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 | 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. | @@ -2778,7 +2817,7 @@ promise.then(data => { ## sim.getSimGid17+ -getSimGid1(slotId: number, callback: AsyncCallback): void +getSimGid1\(slotId: number, callback: AsyncCallback\\): 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. @@ -2802,6 +2841,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2820,7 +2860,7 @@ sim.getSimGid1(0, (err, data) => { ## sim.getSimGid17+ -getSimGid1(slotId: number): Promise +getSimGid1\(slotId: number\): Promise\ 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 | 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. | @@ -2869,7 +2910,7 @@ promise.then(data => { ## sim.getIMSI -getIMSI(slotId: number, callback: AsyncCallback): void +getIMSI\(slotId: number, callback: AsyncCallback\\): 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. @@ -2893,6 +2934,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -2911,7 +2953,7 @@ sim.getIMSI(0, (err, data) => { ## sim.getIMSI -getIMSI(slotId: number): Promise +getIMSI\(slotId: number\): Promise\ 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 | 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. | @@ -2960,7 +3003,7 @@ promise.then(data => { ## sim.getOperatorConfigs8+ -getOperatorConfigs(slotId: number, callback: AsyncCallback>): void +getOperatorConfigs\(slotId: number, callback: AsyncCallback\\>\): void 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 | 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. | @@ -3001,7 +3045,7 @@ sim.getOperatorConfigs(0, (err, data) => { ## sim.getOperatorConfigs8+ -getOperatorConfigs(slotId: number): Promise> +getOperatorConfigs\(slotId: number\): Promise\\> 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 | 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. | @@ -3049,7 +3094,7 @@ promise.then(data => { ## sim.queryIccDiallingNumbers8+ -queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallback>): void +queryIccDiallingNumbers\(slotId: number, type: ContactType, callback: AsyncCallback\\>\): void 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 | 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. | @@ -3093,7 +3139,7 @@ sim.queryIccDiallingNumbers(0, 1, (err, data) => { ## sim.queryIccDiallingNumbers8+ -queryIccDiallingNumbers(slotId: number, type: ContactType): Promise> +queryIccDiallingNumbers\(slotId: number, type: ContactType\): Promise\\> 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 | 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. | @@ -3144,7 +3191,7 @@ promise.then(data => { ## sim.addIccDiallingNumbers8+ -addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void +addIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\\): void 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 | 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. | @@ -3194,7 +3242,7 @@ sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersIno ## sim.addIccDiallingNumbers8+ -addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise +addIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo\): Promise\ 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 | 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. | @@ -3250,7 +3299,7 @@ promise.then(() => { ## sim.delIccDiallingNumbers8+ -delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void +delIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\\): void 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 | 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. | @@ -3301,7 +3351,7 @@ sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersIno ## sim.delIccDiallingNumbers8+ -delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise +delIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo\): Promise\ 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 | 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. | @@ -3357,7 +3408,7 @@ promise.then(() => { ## sim.updateIccDiallingNumbers8+ -updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback): void +updateIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\\): void 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 | 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. | @@ -3408,7 +3460,7 @@ sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbers ## sim.updateIccDiallingNumbers8+ -updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise +updateIccDiallingNumbers\(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo\): Promise\ 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 | 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. | @@ -3465,7 +3518,7 @@ promise.then(() => { ## sim.sendEnvelopeCmd8+ -sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback): void +sendEnvelopeCmd\(slotId: number, cmd: string, callback: AsyncCallback\\): void 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 | 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. | @@ -3508,7 +3562,7 @@ sim.sendEnvelopeCmd(0, "ls", (err) => { ## sim.sendEnvelopeCmd8+ -sendEnvelopeCmd(slotId: number, cmd: string): Promise +sendEnvelopeCmd\(slotId: number, cmd: string\): Promise\ 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 | 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. | @@ -3558,7 +3613,7 @@ promise.then(() => { ## sim.sendTerminalResponseCmd8+ -sendTerminalResponseCmd(slotId: number, cmd: string, callback: AsyncCallback): void +sendTerminalResponseCmd\(slotId: number, cmd: string, callback: AsyncCallback\\): void 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 | 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. | @@ -3601,7 +3657,7 @@ sim.sendTerminalResponseCmd(0, "ls", (err) => { ## sim.sendTerminalResponseCmd8+ -sendTerminalResponseCmd(slotId: number, cmd: string): Promise +sendTerminalResponseCmd\(slotId: number, cmd: string\): Promise\ 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 | 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. | @@ -3652,7 +3709,7 @@ promise.then(() => { ## sim.unlockSimLock8+ -unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback): void +unlockSimLock\(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback\\): void 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 | 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. | @@ -3700,7 +3758,7 @@ sim.unlockSimLock(0, persoLockInfo, (err, data) => { ## sim.unlockSimLock8+ -unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise +unlockSimLock\(slotId: number, lockInfo: PersoLockInfo\): Promise\ 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 | 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. | @@ -3755,7 +3814,7 @@ promise.then(data => { ## sim.getOpKey9+ -getOpKey(slotId: number, callback: AsyncCallback): void +getOpKey\(slotId: number, callback: AsyncCallback\): void 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 { ## sim.getOpKey9+ -getOpKey(slotId: number): Promise +getOpKey\(slotId: number\): Promise\ 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 { ## sim.getOpName9+ -getOpName(slotId: number, callback: AsyncCallback): void +getOpName\(slotId: number, callback: AsyncCallback\\): void 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 { ## sim.getOpName9+ -getOpName(slotId: number): Promise +getOpName\(slotId: number\): Promise\ Obtains the OpName of the SIM card in the specified slot. This API uses a promise to return the result. diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md index 464f34595cc67c5051524d2f7f6ef0753bede543..b959988ba1c900b0ef4273ec6773a504076c76a6 100644 --- a/en/application-dev/reference/apis/js-apis-sms.md +++ b/en/application-dev/reference/apis/js-apis-sms.md @@ -14,7 +14,7 @@ import sms from '@ohos.telephony.sms'; ## sms.createMessage -createMessage\(pdu: Array<number>, specification: string, callback: AsyncCallback\): void +createMessage\(pdu: Array<number>, specification: string, callback: AsyncCallback\\): 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. @@ -28,6 +28,18 @@ Creates an SMS instance based on the protocol data unit (PDU) and specified SMS | specification | string | Yes | SMS protocol type.
- **3gpp**: GSM/UMTS/LTE SMS
- **3gpp2**: CDMA SMS| | callback | AsyncCallback<[ShortMessage](#shortmessage)> | 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** ```js @@ -42,7 +54,7 @@ sms.createMessage(pdu, specification, (err, data) => { ## sms.createMessage -createMessage\(pdu: Array<number>, specification: string\): Promise +createMessage\(pdu: Array<number>, specification: string\): Promise\ 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 | -------------------------------------------- | --------------------------------- | | Promise<[ShortMessage](#shortmessage)> | 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** ```js @@ -77,7 +101,7 @@ promise.then(data => { ## sms.sendMessage -sendMessage(options: SendMessageOptions): void +sendMessage\(options: SendMessageOptions\): void Sends an SMS message. @@ -197,6 +221,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -244,6 +269,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -264,7 +290,7 @@ promise.then(() => { ## sms.setSmscAddr7+ -setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback\): void +setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback\\): void 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 | 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. | @@ -338,6 +365,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -360,7 +388,7 @@ promise.then(() => { ## sms.getSmscAddr7+ -getSmscAddr\(slotId: number, callback: AsyncCallback\): void +getSmscAddr\(slotId: number, callback: AsyncCallback\\): void 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 | 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. | @@ -402,7 +431,7 @@ sms.getSmscAddr(slotId, (err, data) => { ## sms.getSmscAddr7+ -getSmscAddr\(slotId: number\): Promise +getSmscAddr\(slotId: number\): Promise\ 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 | 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. | @@ -451,7 +481,7 @@ promise.then(data => { ## sms.hasSmsCapability7+ -hasSmsCapability(): boolean +hasSmsCapability\(\): boolean 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)}`); ## sms.splitMessage8+ -splitMessage(content: string, callback: AsyncCallback>): void +splitMessage\(content: string, callback: AsyncCallback\\>\): void 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 | 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. | @@ -512,7 +543,7 @@ sms.splitMessage(content, (err, data) => { ## sms.splitMessage8+ -splitMessage(content: string): Promise> +splitMessage\(content: string\): Promise\\> 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 | 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. | @@ -561,7 +593,7 @@ promise.then(data => { ## sms.addSimMessage7+ -addSimMessage(options: SimMessageOptions, callback: AsyncCallback): void +addSimMessage\(options: SimMessageOptions, callback: AsyncCallback\\): void 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 | 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. | @@ -608,7 +641,7 @@ sms.addSimMessage(simMessageOptions, (err) => { ## sms.addSimMessage7+ -addSimMessage(options: SimMessageOptions): Promise +addSimMessage\(options: SimMessageOptions\): Promise\ 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 | 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. | @@ -662,7 +696,7 @@ promise.then(() => { ## sms.delSimMessage7+ -delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback): void +delSimMessage\(slotId: number, msgIndex: number, callback: AsyncCallback\\): void 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 | 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. | @@ -706,7 +741,7 @@ sms.delSimMessage(slotId, msgIndex, (err) => { ## sms.delSimMessage7+ -delSimMessage(slotId: number, msgIndex: number): Promise +delSimMessage\(slotId: number, msgIndex: number\): Promise\ 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 | 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. | @@ -757,7 +793,7 @@ promise.then(() => { ## sms.updateSimMessage7+ -updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback): void +updateSimMessage\(options: UpdateSimMessageOptions, callback: AsyncCallback\\): void 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 | 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. | @@ -805,7 +842,7 @@ sms.updateSimMessage(updateSimMessageOptions, (err) => { ## sms.updateSimMessage7+ -updateSimMessage(options: UpdateSimMessageOptions): Promise +updateSimMessage\(options: UpdateSimMessageOptions\): Promise\ 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 | 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. | @@ -860,7 +898,7 @@ promise.then(() => { ## sms.getAllSimMessages7+ -getAllSimMessages(slotId: number, callback: AsyncCallback>): void +getAllSimMessages\(slotId: number, callback: AsyncCallback\\>\): void 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 | 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. | @@ -902,7 +941,7 @@ sms.getAllSimMessages(slotId, (err, data) => { ## sms.getAllSimMessages7+ -getAllSimMessages(slotId: number): Promise> +getAllSimMessages\(slotId: number\): Promise\\> 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 | 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. | @@ -951,7 +991,7 @@ promise.then(data => { ## sms.setCBConfig7+ -setCBConfig(options: CBConfigOptions, callback: AsyncCallback): void +setCBConfig\(options: CBConfigOptions, callback: AsyncCallback\\): void 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 | 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. | @@ -999,7 +1040,7 @@ sms.setCBConfig(cbConfigOptions, (err) => { ## sms.setCBConfig7+ -setCBConfig(options: CBConfigOptions): Promise +setCBConfig\(options: CBConfigOptions\): Promise\ 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 | 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. | @@ -1054,7 +1096,7 @@ promise.then(() => { ## sms.getSmsSegmentsInfo8+ -getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback): void +getSmsSegmentsInfo\(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1095,7 +1138,7 @@ sms.getSmsSegmentsInfo(slotId, "message", false, (err, data) => { ## sms.getSmsSegmentsInfo8+ -getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise +getSmsSegmentsInfo\(slotId: number, message: string, force7bit: boolean\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1143,7 +1187,7 @@ promise.then(data => { ## sms.isImsSmsSupported8+ -isImsSmsSupported(slotId: number, callback: AsyncCallback): void +isImsSmsSupported\(slotId: number, callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1182,7 +1227,7 @@ sms.isImsSmsSupported(slotId, (err, data) => { ## sms.isImsSmsSupported8+ -isImsSmsSupported(slotId: number): Promise +isImsSmsSupported\(slotId: number\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1228,7 +1274,7 @@ promise.then(data => { ## sms.getImsShortMessageFormat8+ -getImsShortMessageFormat(callback: AsyncCallback): void +getImsShortMessageFormat\(callback: AsyncCallback\\): void 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 | ID| Error Message | | -------- | -------------------------------------------- | +| 202 | Non-system applications use system APIs. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1265,7 +1312,7 @@ sms.getImsShortMessageFormat((err, data) => { ## sms.getImsShortMessageFormat8+ -getImsShortMessageFormat(): Promise +getImsShortMessageFormat\(\): Promise\ 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 | ID| Error Message | | -------- | -------------------------------------------- | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -1304,7 +1350,7 @@ promise.then(data => { ## sms.decodeMms8+ -decodeMms(mmsFilePathName: string | Array, callback: AsyncCallback): void +decodeMms\(mmsFilePathName: string | Array\, callback: AsyncCallback\\): void Decodes MMS messages. This API uses an asynchronous callback to return the result. @@ -1343,7 +1389,7 @@ sms.decodeMms(mmsFilePathName, (err, data) => { ## sms.decodeMms8+ -decodeMms(mmsFilePathName: string | Array): Promise +decodeMms\(mmsFilePathName: string | Array\\): Promise\ Decodes MMS messages. This API uses a promise to return the result. @@ -1389,7 +1435,7 @@ promise.then(data => { ## sms.encodeMms8+ -encodeMms(mms: MmsInformation, callback: AsyncCallback>): void +encodeMms\(mms: MmsInformation, callback: AsyncCallback\\>\): void MMS message code. This API uses an asynchronous callback to return the result. @@ -1436,7 +1482,7 @@ sms.encodeMms(mmsInformation, (err, data) => { ## sms.encodeMms8+ -encodeMms(mms: MmsInformation): Promise> +encodeMms\(mms: MmsInformation\): Promise\\> MMS message code. This API uses a promise to return the result. diff --git a/en/application-dev/reference/apis/js-apis-socket.md b/en/application-dev/reference/apis/js-apis-socket.md index b03d07b806884ffccbba82cea8eedc88c89fdf3b..9c743577ac99adfdddc58613515b32cbc4dc46e2 100644 --- a/en/application-dev/reference/apis/js-apis-socket.md +++ b/en/application-dev/reference/apis/js-apis-socket.md @@ -12,7 +12,7 @@ The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSoc import socket from '@ohos.net.socket'; ``` -## socket.constructUDPSocketInstance +## socket.constructUDPSocketInstance7+ constructUDPSocketInstance(): UDPSocket @@ -32,19 +32,16 @@ Creates a **UDPSocket** object. let udp = socket.constructUDPSocketInstance(); ``` -## UDPSocket +## UDPSocket7+ Defines a **UDPSocket** connection. Before invoking UDPSocket APIs, you need to call [socket.constructUDPSocketInstance](#socketconstructudpsocketinstance) to create a **UDPSocket** object. -### bind +### bind7+ bind(address: NetAddress, callback: AsyncCallback\): 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. -> **NOTE** -> This API is used for the client to create a socket. - **Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -67,7 +64,7 @@ Binds the IP address and port number. The port number can be specified or random ```js 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) { console.log('bind fail'); return; @@ -76,15 +73,12 @@ udp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => { }) ``` -### bind +### bind7+ bind(address: NetAddress): Promise\ 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 **System capability**: SystemCapability.Communication.NetStack @@ -120,7 +114,7 @@ promise.then(() => { }); ``` -### send +### send7+ send(options: UDPSendOptions, callback: AsyncCallback\): void @@ -166,7 +160,7 @@ udp.send({ }) ``` -### send +### send7+ send(options: UDPSendOptions): Promise\ @@ -216,7 +210,7 @@ promise.then(() => { }); ``` -### close +### close7+ close(callback: AsyncCallback\): void @@ -245,7 +239,7 @@ udp.close(err => { }) ``` -### close +### close7+ close(): Promise\ @@ -273,7 +267,7 @@ promise.then(() => { }); ``` -### getState +### getState7+ getState(callback: AsyncCallback\): void @@ -318,7 +312,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { }) ``` -### getState +### getState7+ getState(): Promise\ @@ -357,7 +351,7 @@ promise.then(err => { }); ``` -### setExtraOptions +### setExtraOptions7+ setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\): void @@ -410,7 +404,7 @@ udp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => { }) ``` -### setExtraOptions +### setExtraOptions7+ setExtraOptions(options: UDPExtraOptions): Promise\ @@ -466,7 +460,7 @@ promise.then(() => { }); ``` -### on('message') +### on('message')7+ on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void @@ -497,7 +491,7 @@ udp.on('message', value => { }); ``` -### off('message') +### off('message')7+ off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void @@ -535,7 +529,7 @@ udp.off('message', callback); udp.off('message'); ``` -### on('listening' | 'close') +### on('listening' | 'close')7+ on(type: 'listening' | 'close', callback: Callback\): void @@ -562,7 +556,7 @@ udp.on('close', () => { }); ``` -### off('listening' | 'close') +### off('listening' | 'close')7+ off(type: 'listening' | 'close', callback?: Callback\): void @@ -600,7 +594,7 @@ udp.off('close', callback2); udp.off('close'); ``` -### on('error') +### on('error')7+ on(type: 'error', callback: ErrorCallback): void @@ -624,7 +618,7 @@ udp.on('error', err => { }); ``` -### off('error') +### off('error')7+ off(type: 'error', callback?: ErrorCallback): void @@ -655,7 +649,7 @@ udp.off('error', callback); udp.off('error'); ``` -## NetAddress +## NetAddress7+ 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. | | family | number | No | Network protocol type.
- **1**: IPv4
- **2**: IPv6
The default value is **1**.| -## UDPSendOptions +## UDPSendOptions7+ 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 \| ArrayBuffer7+ | Yes | Data to send. | | address | [NetAddress](#netaddress) | Yes | Destination address.| -## UDPExtraOptions +## UDPExtraOptions7+ 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**. | | socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms.| -## SocketStateBase +## SocketStateBase7+ 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.| | isConnected | boolean | Yes | Whether the connection is in the connected state.| -## SocketRemoteInfo +## SocketRemoteInfo7+ 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 For details about error codes, see [Socket Error Codes](../errorcodes/errorcode-net-socket.md). -## socket.constructTCPSocketInstance +## socket.constructTCPSocketInstance7+ constructTCPSocketInstance(): TCPSocket @@ -743,19 +737,16 @@ Creates a **TCPSocket** object. let tcp = socket.constructTCPSocketInstance(); ``` -## TCPSocket +## TCPSocket7+ Defines a TCPSocket connection. Before invoking TCPSocket APIs, you need to call [socket.constructTCPSocketInstance](#socketconstructtcpsocketinstance) to create a **TCPSocket** object. -### bind +### bind7+ bind(address: NetAddress, callback: AsyncCallback\): 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. -> **NOTE** -> This API is used for the client to create a socket. - **Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -778,7 +769,7 @@ Binds the IP address and port number. The port number can be specified or random ```js 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) { console.log('bind fail'); return; @@ -787,15 +778,12 @@ tcp.bind({ address: '192.168.xx.xxx', port: xxxx, family: 1 }, err => { }) ``` -### bind +### bind7+ bind(address: NetAddress): Promise\ 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 **System capability**: SystemCapability.Communication.NetStack @@ -831,7 +819,7 @@ promise.then(() => { }); ``` -### connect +### connect7+ connect(options: TCPConnectOptions, callback: AsyncCallback\): void @@ -871,7 +859,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim }) ``` -### connect +### connect7+ connect(options: TCPConnectOptions): Promise\ @@ -912,7 +900,7 @@ promise.then(() => { }); ``` -### send +### send7+ send(options: TCPSendOptions, callback: AsyncCallback\): void @@ -958,7 +946,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim }) ``` -### send +### send7+ send(options: TCPSendOptions): Promise\ @@ -1010,7 +998,7 @@ promise1.then(() => { }); ``` -### close +### close7+ close(callback: AsyncCallback\): void @@ -1045,7 +1033,7 @@ tcp.close(err => { }) ``` -### close +### close7+ close(): Promise\ @@ -1079,7 +1067,7 @@ promise.then(() => { }); ``` -### getRemoteAddress +### getRemoteAddress7+ getRemoteAddress(callback: AsyncCallback\): void @@ -1120,7 +1108,7 @@ tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, family: 1 }, tim }); ``` -### getRemoteAddress +### getRemoteAddress7+ getRemoteAddress(): Promise\ @@ -1163,7 +1151,7 @@ promise1.then(() => { }); ``` -### getState +### getState7+ getState(callback: AsyncCallback\): void @@ -1204,7 +1192,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa }); ``` -### getState +### getState7+ getState(): Promise\ @@ -1247,7 +1235,7 @@ promise.then(() => { }); ``` -### setExtraOptions +### setExtraOptions7+ setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\): void @@ -1299,7 +1287,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa }); ``` -### setExtraOptions +### setExtraOptions7+ setExtraOptions(options: TCPExtraOptions): Promise\ @@ -1358,7 +1346,7 @@ promise.then(() => { }); ``` -### on('message') +### on('message')7+ on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void @@ -1389,7 +1377,7 @@ tcp.on('message', value => { }); ``` -### off('message') +### off('message')7+ off(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void @@ -1427,7 +1415,7 @@ tcp.off('message', callback); tcp.off('message'); ``` -### on('connect' | 'close') +### on('connect' | 'close')7+ on(type: 'connect' | 'close', callback: Callback\): void @@ -1454,7 +1442,7 @@ tcp.on('close', () => { }); ``` -### off('connect' | 'close') +### off('connect' | 'close')7+ off(type: 'connect' | 'close', callback?: Callback\): void @@ -1492,7 +1480,7 @@ tcp.off('close', callback2); tcp.off('close'); ``` -### on('error') +### on('error')7+ on(type: 'error', callback: ErrorCallback): void @@ -1516,7 +1504,7 @@ tcp.on('error', err => { }); ``` -### off('error') +### off('error')7+ off(type: 'error', callback?: ErrorCallback): void @@ -1547,7 +1535,7 @@ tcp.off('error', callback); tcp.off('error'); ``` -## TCPConnectOptions +## TCPConnectOptions7+ Defines TCPSocket connection parameters. @@ -1558,7 +1546,7 @@ Defines TCPSocket connection parameters. | address | [NetAddress](#netaddress) | Yes | Bound IP address and port number. | | timeout | number | No | Timeout duration of the TCPSocket connection, in ms.| -## TCPSendOptions +## TCPSendOptions7+ 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\| ArrayBuffer7+ | 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**.| -## TCPExtraOptions +## TCPExtraOptions7+ Defines other properties of the TCPSocket connection. @@ -1881,7 +1869,7 @@ promise.then(() => { }); ``` -### on('message') +### on('message')9+ on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void; @@ -1912,7 +1900,7 @@ tls.on('message', value => { }); ``` -### off('message') +### off('message')9+ off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void @@ -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. tls.off('message', callback); ``` -### on('connect' | 'close') +### on('connect' | 'close')9+ on(type: 'connect' | 'close', callback: Callback\): void @@ -1975,7 +1963,7 @@ tls.on('close', () => { }); ``` -### off('connect' | 'close') +### off('connect' | 'close')9+ off(type: 'connect' | 'close', callback?: Callback\): void @@ -2012,7 +2000,7 @@ tls.on('close', callback2); tls.off('close', callback2); ``` -### on('error') +### on('error')9+ on(type: 'error', callback: ErrorCallback): void @@ -2036,7 +2024,7 @@ tls.on('error', err => { }); ``` -### off('error') +### off('error')9+ off(type: 'error', callback?: ErrorCallback): void @@ -2675,7 +2663,7 @@ Sends a message to the server after a TLSSocket connection is established. This | ------- | -------------------------------------------- | | 401 | Parameter error. | | 2303501 | SSL is null. | -| 2303503 | Error in tls writing | +| 2303503 | Error in tls writing. | | 2303505 | Error occurred in the tls system call. | | 2303506 | Error clearing tls connection. | | 2300002 | System internal error. | @@ -2712,7 +2700,7 @@ Sends a message to the server after a TLSSocket connection is established. This | ------- | -------------------------------------------- | | 401 | Parameter error. | | 2303501 | SSL is null. | -| 2303503 | Error in tls writing | +| 2303503 | Error in tls writing. | | 2303505 | Error occurred in the tls system call. | | 2303506 | Error clearing tls connection. | | 2300002 | System internal error. | @@ -2846,7 +2834,3 @@ Enumerates TLS protocol versions. Defines the certificate raw data. **System capability**: SystemCapability.Communication.NetStack - -| Type | Description | -| --------------------------------------------------------------------- | --------------------- | -|[cert.EncodingBlob](js-apis-cert.md#datablob) | Data and encoding format of the certificate.| diff --git a/en/application-dev/reference/apis/js-apis-system-fetch.md b/en/application-dev/reference/apis/js-apis-system-fetch.md index 6144d903c19116e693841e5f4a55840aac43e68b..96bc642f5214e48b09df204a314bd694677a77f4 100644 --- a/en/application-dev/reference/apis/js-apis-system-fetch.md +++ b/en/application-dev/reference/apis/js-apis-system-fetch.md @@ -16,7 +16,48 @@ import fetch from '@system.fetch'; ## fetch.fetch3+ -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. @@ -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 | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.| -## FetchResponse +## FetchResponse3+ + +**System capability**: SystemCapability.Communication.NetStack | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | diff --git a/en/application-dev/reference/apis/js-apis-system-network.md b/en/application-dev/reference/apis/js-apis-system-network.md index 5fe6e782edc352c4d49377b4e8d9a4343d8435a6..232c2be8d60b3b893fbebc1119b7d9e807d80ddf 100644 --- a/en/application-dev/reference/apis/js-apis-system-network.md +++ b/en/application-dev/reference/apis/js-apis-system-network.md @@ -21,9 +21,25 @@ ohos.permission.GET_WIFI_INFO ohos.permission.GET_NETWORK_INFO -## network.getType - -getType(Object): void +## network.getType3+ + +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. @@ -61,9 +77,20 @@ export default { ``` -## network.subscribe +## network.subscribe3+ -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. @@ -101,7 +128,7 @@ export default { ``` -## network.unsubscribe +## network.unsubscribe3+ unsubscribe(): void @@ -120,7 +147,7 @@ export default { ``` -## NetworkResponse +## NetworkResponse3+ **System capability**: SystemCapability.Communication.NetManager.Core diff --git a/en/application-dev/reference/apis/js-apis-telephony-data.md b/en/application-dev/reference/apis/js-apis-telephony-data.md index a7a1338277a9b05840122488abb6553fd9b86e84..4b234fb7c765a888a037d1034856225d069e5bb3 100644 --- a/en/application-dev/reference/apis/js-apis-telephony-data.md +++ b/en/application-dev/reference/apis/js-apis-telephony-data.md @@ -1,6 +1,6 @@ # @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** > @@ -24,7 +24,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses an | Name | Type | Mandatory| Description | | -------- | ----------------------- | ---- | ------------------------------------------ | -| callback | AsyncCallback\ | Yes | Callback used to return the result.
**0**: card slot 1.
**1**: card slot 2.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.
**0**: card slot 1
**1**: card slot 2| **Example** @@ -46,7 +46,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses a p | Type | Description | | ----------------- | ------------------------------------------------------------ | -| Promise\ | Promise used to return the result.
**0**: card slot 1.
**1**: card slot 2.| +| Promise\ | Promise used to return the result.
**0**: card slot 1
**1**: card slot 2| **Example** @@ -71,7 +71,7 @@ Obtains the default SIM card used for mobile data synchronously. | Type | Description | | ------ | -------------------------------------------------- | -| number | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| +| number | Card slot ID.
**0**: card slot 1
**1**: card slot 2| **Example** @@ -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. -**Required permissions**: ohos.permission.SET_TELEPHONY_STATE +**Required permission**: ohos.permission.SET_TELEPHONY_STATE **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 | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | SIM card slot ID.
**0**: card slot 1.
**1**: card slot 2.
**-1**: Clears the default configuration.| +| slotId | number | Yes | SIM card slot ID.
**0**: card slot 1
**1**: card slot 2
**-1**: Clears the default configuration.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Error codes** @@ -105,6 +105,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -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. -**Required permissions**: ohos.permission.SET_TELEPHONY_STATE +**Required permission**: ohos.permission.SET_TELEPHONY_STATE **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 | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | SIM card slot ID.
**0**: card slot 1.
**1**: card slot 2.
**-1**: Clears the default configuration.| +| slotId | number | Yes | SIM card slot ID.
**0**: card slot 1
**1**: card slot 2
**-1**: Clears the default configuration.| **Return value** @@ -152,6 +153,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -325,8 +327,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -356,7 +356,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | Name | Type | Mandatory| Description | | -------- | ------------------------ | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2. | +| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2 | | callback | AsyncCallback\ | Yes | Callback used to return the result.
**true**: Roaming is enabled for the cellular data service.
**false**: Roaming is disabled for the cellular data service.| **Error codes** @@ -394,7 +394,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| **Return value** @@ -428,13 +428,13 @@ promise.then((data) => { ## data.enableCellularData -enableCellularData(callback: AsyncCallback): void +enableCellularData(callback: AsyncCallback\): void Enables the cellular data service. This API uses an asynchronous callback to return the result. **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 @@ -451,6 +451,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -467,13 +468,13 @@ data.enableCellularData((err) => { ## data.enableCellularData -enableCellularData(): Promise +enableCellularData(): Promise\ Enables the cellular data service. This API uses a promise to return the result. **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 @@ -490,8 +491,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -509,13 +509,13 @@ promise.then(() => { ## data.disableCellularData -disableCellularData(callback: AsyncCallback): void +disableCellularData(callback: AsyncCallback\): void Disables the cellular data service. This API uses an asynchronous callback to return the result. **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 @@ -532,6 +532,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -548,13 +549,13 @@ data.disableCellularData((err) => { ## data.disableCellularData -disableCellularData(): Promise +disableCellularData(): Promise\ Disables the cellular data service. This API uses a promise to return the result. **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 @@ -571,8 +572,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | +| 202 | Non-system applications use system APIs. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -590,13 +590,13 @@ promise.then(() => { ## data.enableCellularDataRoaming -enableCellularDataRoaming(slotId: number, callback: AsyncCallback): void +enableCellularDataRoaming(slotId: number, callback: AsyncCallback\): void Enables the cellular data roaming service. This API uses an asynchronous callback to return the result. **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 @@ -604,7 +604,7 @@ Enables the cellular data roaming service. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Error codes** @@ -614,6 +614,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -630,13 +631,13 @@ data.enableCellularDataRoaming(0, (err) => { ## data.enableCellularDataRoaming -enableCellularDataRoaming(slotId: number): Promise +enableCellularDataRoaming(slotId: number): Promise\ Enables the cellular data roaming service. This API uses a promise to return the result. **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 @@ -644,7 +645,7 @@ Enables the cellular data roaming service. This API uses a promise to return the | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| **Return value** @@ -659,6 +660,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -678,13 +680,13 @@ promise.then(() => { ## data.disableCellularDataRoaming -disableCellularDataRoaming(slotId: number, callback: AsyncCallback): void +disableCellularDataRoaming(slotId: number, callback: AsyncCallback\): void Disables the cellular data roaming service. This API uses an asynchronous callback to return the result. **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 @@ -692,7 +694,7 @@ Disables the cellular data roaming service. This API uses an asynchronous callba | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Error codes** @@ -702,6 +704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | @@ -718,13 +721,13 @@ data.disableCellularDataRoaming(0, (err) => { ## data.disableCellularDataRoaming -disableCellularDataRoaming(slotId: number): Promise +disableCellularDataRoaming(slotId: number): Promise\ Disables the cellular data roaming service. This API uses a promise to return the result. **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 @@ -732,7 +735,7 @@ Disables the cellular data roaming service. This API uses a promise to return th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| **Return value** @@ -747,6 +750,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r | 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. | diff --git a/en/application-dev/reference/apis/js-apis-thermal.md b/en/application-dev/reference/apis/js-apis-thermal.md index 5291826d6fab799eb0684753379399562772f4cf..d9914d9c865911380d57548e94d068956e690ec9 100644 --- a/en/application-dev/reference/apis/js-apis-thermal.md +++ b/en/application-dev/reference/apis/js-apis-thermal.md @@ -2,7 +2,8 @@ The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control. -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. ## Modules to Import @@ -29,9 +30,9 @@ Subscribes to thermal level changes. 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** @@ -58,15 +59,15 @@ Unsubscribes from thermal level changes. | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ---------------------------------------------- | -| callback | Callback<void> | 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<void> | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.| **Error codes** 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** @@ -93,15 +94,15 @@ Obtains the current thermal level. | Type | Description | | ------------ | ------------ | -| ThermalLevel | Thermal level obtained.| +| ThermalLevel | Thermal level.| **Error codes** 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** @@ -118,8 +119,7 @@ try { subscribeThermalLevel(callback: AsyncCallback<ThermalLevel>): void -> NOTE
-> This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9). Subscribes to thermal level changes. @@ -143,8 +143,7 @@ thermal.subscribeThermalLevel((level) => { unsubscribeThermalLevel(callback?: AsyncCallback\): void -> NOTE
-> This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9). Unsubscribes from thermal level changes. @@ -154,7 +153,7 @@ Unsubscribes from thermal level changes. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------------------------------------------- | -| callback | AsyncCallback<void> | 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<void> | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.| **Example** @@ -168,8 +167,7 @@ thermal.unsubscribeThermalLevel(() => { getThermalLevel(): ThermalLevel -> NOTE
-> This API is deprecated since API version 9. You are advised to use [thermal.getLevel](#thermalgetlevel9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [thermal.getLevel](#thermalgetlevel9). Obtains the current thermal level. diff --git a/en/application-dev/reference/apis/js-apis-webSocket.md b/en/application-dev/reference/apis/js-apis-webSocket.md index dba171b9da058a60c3dde3b4c96e9476b27dba77..bca3349825d366afd8b3e1c8f15d9b373fce3ff1 100644 --- a/en/application-dev/reference/apis/js-apis-webSocket.md +++ b/en/application-dev/reference/apis/js-apis-webSocket.md @@ -67,7 +67,7 @@ ws.connect(defaultIpAddress, (err, value) => { }); ``` -## webSocket.createWebSocket +## webSocket.createWebSocket6+ createWebSocket(): WebSocket @@ -87,11 +87,11 @@ Creates a WebSocket connection. You can use this API to create or close a WebSoc let ws = webSocket.createWebSocket(); ``` -## WebSocket +## WebSocket6+ Defines a **WebSocket** object. Before invoking WebSocket APIs, you need to call [webSocket.createWebSocket](#websocketcreatewebsocket) to create a **WebSocket** object. -### connect +### connect6+ connect(url: string, callback: AsyncCallback\): void @@ -132,7 +132,7 @@ ws.connect(url, (err, value) => { }); ``` -### connect +### connect6+ connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\): void @@ -179,7 +179,7 @@ ws.connect(url, { }); ``` -### connect +### connect6+ connect(url: string, options?: WebSocketRequestOptions): Promise\ @@ -225,7 +225,7 @@ promise.then((value) => { }); ``` -### send +### send6+ send(data: string | ArrayBuffer, callback: AsyncCallback\): void @@ -265,7 +265,7 @@ ws.connect(url, (err, value) => { }); ``` -### send +### send6+ send(data: string | ArrayBuffer): Promise\ @@ -309,7 +309,7 @@ ws.connect(url, (err, value) => { }); ``` -### close +### close6+ close(callback: AsyncCallback\): void @@ -345,7 +345,7 @@ ws.close((err, value) => { }); ``` -### close +### close6+ close(options: WebSocketCloseOptions, callback: AsyncCallback\): void @@ -385,7 +385,7 @@ ws.close({ }); ``` -### close +### close6+ close(options?: WebSocketCloseOptions): Promise\ @@ -429,7 +429,7 @@ promise.then((value) => { }); ``` -### on('open') +### on('open')6+ on(type: 'open', callback: AsyncCallback\): void @@ -453,7 +453,7 @@ ws.on('open', (err, value) => { }); ``` -### off('open') +### off('open')6+ off(type: 'open', callback?: AsyncCallback\): void @@ -483,7 +483,7 @@ ws.on('open', callback1); ws.off('open', callback1); ``` -### on('message') +### on('message')6+ on(type: 'message', callback: AsyncCallback\): void @@ -510,7 +510,7 @@ ws.on('message', (err, value) => { }); ``` -### off('message') +### off('message')6+ off(type: 'message', callback?: AsyncCallback\): void @@ -536,7 +536,7 @@ let ws = webSocket.createWebSocket(); ws.off('message'); ``` -### on('close') +### on('close')6+ on(type: 'close', callback: AsyncCallback\<{ code: number, reason: string }\>): void @@ -560,7 +560,7 @@ ws.on('close', (err, value) => { }); ``` -### off('close') +### off('close')6+ off(type: 'close', callback?: AsyncCallback\<{ code: number, reason: string }\>): void @@ -585,7 +585,7 @@ let ws = webSocket.createWebSocket(); ws.off('close'); ``` -### on('error') +### on('error')6+ on(type: 'error', callback: ErrorCallback): void @@ -609,7 +609,7 @@ ws.on('error', (err) => { }); ``` -### off('error') +### off('error')6+ off(type: 'error', callback?: ErrorCallback): void diff --git a/en/application-dev/reference/errorcodes/errorcode-devicestatus.md b/en/application-dev/reference/errorcodes/errorcode-devicestatus.md new file mode 100644 index 0000000000000000000000000000000000000000..08d37f6fc9bc63b691638a73b84ba24205898e0a --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-devicestatus.md @@ -0,0 +1,27 @@ +# 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. diff --git a/en/device-dev/subsystems/subsys-dfx-hidumper.md b/en/device-dev/subsystems/subsys-dfx-hidumper.md index 5c6bc09ecf931c46bb458e6d1c19111431bf0ddb..bd1c46cdd275fc17d2858d9d2d2c65acd67633ee 100644 --- a/en/device-dev/subsystems/subsys-dfx-hidumper.md +++ b/en/device-dev/subsystems/subsys-dfx-hidumper.md @@ -115,7 +115,7 @@ The procedure is as follows: 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 @@ -163,6 +163,22 @@ The procedure is as follows: ``` 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.