diff --git a/en/application-dev/internationalization/i18n-guidelines.md b/en/application-dev/internationalization/i18n-guidelines.md index 8218f2561376c4119f66be0175c5c9ea16c7d024..e78bdb6437b26b8a30ee23f9fdec380087297b33 100644 --- a/en/application-dev/internationalization/i18n-guidelines.md +++ b/en/application-dev/internationalization/i18n-guidelines.md @@ -6,7 +6,7 @@ The [intl](intl-guidelines.md) module provides basic i18n capabilities through t ## Obtaining and Setting i18n Information -The system provides APIs to configure information such as the system language, preferred language, country or region, 24-hour clock, and local digit switch. +The following table lists the APIs used to configure information such as the system language, preferred language, country or region, 24-hour clock, and use of local digits. ### Available APIs @@ -30,15 +30,15 @@ The system provides APIs to configure information such as the system language, p | System | getPreferredLanguageList()9+ | Obtains the preferred language list. | | System | getFirstPreferredLanguage()9+ | Obtains the first language in the preferred language list. | | System | getAppPreferredLanguage()9+ | Obtains the preferred language of an application. | -| System | setUsingLocalDigit(flag: boolean)9+ | Sets whether to enable the local digit switch. | -| System | getUsingLocalDigit()9+ | Checks whether the local digit switch is turned on. | +| System | setUsingLocalDigit(flag: boolean)9+ | Specifies whether to enable use of local digits. | +| System | getUsingLocalDigit()9+ | Checks whether use of local digits is enabled. | | | isRTL(locale:string):boolean9+ | Checks whether the locale uses a right-to-left (RTL) language.| ### How to Develop 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Obtain and set the system language. @@ -51,7 +51,7 @@ The system provides APIs to configure information such as the system language, p I18n.System.setSystemLanguage("en"); // Set the system language to en. let language = I18n.System.getSystemLanguage(); // language = "en" } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -65,7 +65,7 @@ The system provides APIs to configure information such as the system language, p I18n.System.setSystemRegion("CN"); // Set the system country to CN. let region = I18n.System.getSystemRegion(); // region = "CN" } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -79,7 +79,7 @@ The system provides APIs to configure information such as the system language, p I18n.System.setSystemLocale("zh-Hans-CN"); // Set the system locale to zh-Hans-CN. let locale = I18n.System.getSystemLocale(); // locale = "zh-Hans-CN" } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -92,7 +92,7 @@ The system provides APIs to configure information such as the system language, p let rtl = I18n.isRTL("zh-CN"); // rtl = false rtl = I18n.isRTL("ar"); // rtl = true } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -106,7 +106,7 @@ The system provides APIs to configure information such as the system language, p I18n.System.set24HourClock(true); let hourClock = I18n.System.is24HourClock(); // hourClock = true } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -121,7 +121,7 @@ The system provides APIs to configure information such as the system language, p let sentenceCase = false; let localizedLanguage = I18n.System.getDisplayLanguage(language, locale, sentenceCase); // localizedLanguage = "English" } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -136,7 +136,7 @@ The system provides APIs to configure information such as the system language, p let sentenceCase = false; let localizedCountry = I18n.System.getDisplayCountry(country, locale, sentenceCase); // localizedCountry = "U.S." } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -150,7 +150,7 @@ The system provides APIs to configure information such as the system language, p let languageList = I18n.System.getSystemLanguages(); // languageList = ["en-Latn-US", "zh-Hans"] let countryList = I18n.System.getSystemCountries("zh"); // countryList = ["ZW", "YT", ..., "CN", "DE"], 240 countries and regions in total } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -162,7 +162,7 @@ The system provides APIs to configure information such as the system language, p try { let isSuggest = I18n.System.isSuggested("zh", "CN"); // isSuggest = true } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -182,7 +182,7 @@ The system provides APIs to configure information such as the system language, p let firstPreferredLanguage = I18n.System.getFirstPreferredLanguage(); // firstPreferredLanguage = "en-GB" let appPreferredLanguage = I18n.System.getAppPreferredLanguage(); // Set the preferred language of the application to en-GB if the application contains en-GB resources. } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -190,14 +190,14 @@ The system provides APIs to configure information such as the system language, p Call **setUsingLocalDigit** to enable the local digit switch. (This is a system API and can be called only by system applications with the UPDATE_CONFIGURATION permission.) Call **getUsingLocalDigit** to check whether the local digit switch is enabled. - Currently, the local digit switch applies only to the following languages: "ar", "as", "bn", "fa", "mr", "my", "ne", and "ur". + Currently, use of local digits is supported only for the following languages: **ar**, **as**, **bn**, **fa**, **mr**, **my**, **ne**, **ur**. ```js try { I18n.System.setUsingLocalDigit(true); // Enable the local digit switch. let status = I18n.System.getUsingLocalDigit(); // status = true } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -220,14 +220,14 @@ try { | Calendar | getMinimalDaysInFirstWeek():number8+ | Obtains the minimum number of days in the first week of a year. | | Calendar | setMinimalDaysInFirstWeek(value:number): void8+ | Sets the minimum number of days in the first week of a year. | | Calendar | getDisplayName(locale:string):string8+ | Obtains the localized display of the **Calendar** object. | -| Calendar | isWeekend(date?:Date):boolean8+ | Checks whether the specified date in this **Calendar** object is a weekend. | +| Calendar | isWeekend(date?:Date):boolean8+ | Checks whether a given date is a weekend in the calendar. | ### How to Develop 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiate a **Calendar** object. @@ -254,7 +254,7 @@ try { Call **set** to set the year, month, day, hour, minute, and second for the **Calendar** object. ```js - calendar.set(2021, 12, 21, 6, 0, 0) + calendar.set(2021, 12, 21, 6, 0, 0); ``` 5. Set and obtain the time zone for the **Calendar** object. @@ -317,7 +317,7 @@ try { 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiate a **PhoneNumberFormat** object. @@ -359,7 +359,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Convert a measurement unit. @@ -393,7 +393,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiates an **IndexUtil** object. @@ -418,7 +418,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. Call **addLocale** to add the alphabet index of a new locale to the current index list. ```js - indexUtil.addLocale("ar") + indexUtil.addLocale("ar"); ``` 5. Obtain the index of a string. @@ -454,7 +454,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiate a **BreakIterator** object. @@ -462,7 +462,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc Call **getLineInstance** to instantiate a **BreakIterator** object. ```js - let locale = "en-US" + let locale = "en-US"; let breakIterator = I18n.getLineInstance(locale); ``` @@ -531,7 +531,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiate the **TimeZone** object, and obtain the time zone information. @@ -592,7 +592,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Obtains the transliterator ID list. @@ -637,7 +637,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Check the input character has a certain attribute. @@ -719,7 +719,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Check the sequence of year, month, and day in a date. diff --git a/en/application-dev/internationalization/intl-guidelines.md b/en/application-dev/internationalization/intl-guidelines.md index 609af84500cecb0ce5bda8409216b6957182885f..15ad682b5a1334ceb069a381e5407528c383a114 100644 --- a/en/application-dev/internationalization/intl-guidelines.md +++ b/en/application-dev/internationalization/intl-guidelines.md @@ -25,7 +25,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiates a **Locale** object. @@ -100,7 +100,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **DateTimeFormat** object. @@ -170,7 +170,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **NumberFormat** object. @@ -195,7 +195,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug ```js let options = {compactDisplay: "short", notation: "compact"}; let numberFormat = new Intl.NumberFormat("zh-CN", options); - let number = 1234.5678 + let number = 1234.5678; let formatResult = numberFormat.format(number); // formatResult = "1235" ``` @@ -229,7 +229,7 @@ Users in different regions have different requirements for string sorting. [Coll Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **Collator** object. @@ -290,7 +290,7 @@ According to grammars in certain languages, the singular or plural form of a nou Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **PluralRules** object. @@ -313,7 +313,7 @@ According to grammars in certain languages, the singular or plural form of a nou ```js let pluralRules = new Intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"}); - let number = 1234.5678 + let number = 1234.5678; let categoryResult = pluralRules.select(number); // categoryResult = "other" ``` @@ -338,7 +338,7 @@ According to grammars in certain languages, the singular or plural form of a nou Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **RelativeTimeFormat** object. @@ -362,7 +362,7 @@ According to grammars in certain languages, the singular or plural form of a nou ```js let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); let number = 2; - let unit = "year" + let unit = "year"; let formatResult = relativeTimeFormat.format(number, unit); // 2 years later ``` @@ -373,7 +373,7 @@ According to grammars in certain languages, the singular or plural form of a nou ```js let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); let number = 2; - let unit = "year" + let unit = "year"; let formatPartsResult = relativeTimeFormat.formatToParts(number, unit); // formatPartsResult = [{"type": "integer", "value": "2", "unit": "year"}, {"type":"literal", "value": "years later"}] ``` @@ -390,6 +390,4 @@ According to grammars in certain languages, the singular or plural form of a nou The following sample is provided to help you better understand how to develop internationalization capabilities: --[`International`: Internationalization (JS) (API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/International) - --[`International`: Internationalization (ArkTS) (API8) (Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/common/International) +-[`International`: Internationalization (ArkTS) (API9) (Full SDK)] (https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Internationalnation/International) diff --git a/en/application-dev/reference/apis/js-apis-battery-info.md b/en/application-dev/reference/apis/js-apis-battery-info.md index 6231cab50066c32fcbed5bfaf11def7838b0329e..4e4a654f4f314d0447c3cf5bd32c6f7f550affc8 100644 --- a/en/application-dev/reference/apis/js-apis-battery-info.md +++ b/en/application-dev/reference/apis/js-apis-battery-info.md @@ -30,10 +30,10 @@ Describes battery information. | batteryTemperature | number | Yes | No | Battery temperature of the device, in unit of 0.1°C. | | isBatteryPresent7+ | boolean | Yes | No | Whether the battery is supported or present. | | batteryCapacityLevel9+ | [BatteryCapacityLevel](#batterycapacitylevel9) | Yes | No | Battery level of the device. | -| estimatedRemainingChargeTime9+ | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. **System API**: This is a system API. | -| totalEnergy9+ | number | Yes | No | Total battery capacity of the device, in unit of mAh. **System API**: This is a system API. | -| nowCurrent9+ | number | Yes | No | Battery current of the device, in unit of mA. **System API**: This is a system API. | -| remainingEnergy9+ | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. **System API**: This is a system API.| +| estimatedRemainingChargeTime9+ | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. This is a system API. | +| totalEnergy9+ | number | Yes | No | Total battery capacity of the device, in unit of mAh. This is a system API. | +| nowCurrent9+ | number | Yes | No | Battery current of the device, in unit of mA. This is a system API. | +| remainingEnergy9+ | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. This is a system API.| ## BatteryPluggedType diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md index 0ccd49a5dc2a8b8e3577b7614f8219573de7cf7d..6b6222abe96a415e28290892f8e6a215c1e98478 100644 --- a/en/application-dev/reference/apis/js-apis-call.md +++ b/en/application-dev/reference/apis/js-apis-call.md @@ -4,32 +4,32 @@ The **call** module provides call management functions, including making calls, To subscribe to the call status, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange). ->**NOTE**
+>**NOTE** +> >The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version. - ## Modules to Import ```js import call from '@ohos.telephony.call'; ``` -## call.dial +## call.dial(deprecated) dial\(phoneNumber: string, callback: AsyncCallback\): void Initiates a call. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------- | ---- | -------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure | +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------- | ---- | --------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -40,23 +40,23 @@ call.dial("138xxxxxxxx", (err, data) => { ``` -## call.dial +## call.dial(deprecated) dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void -Initiates a call based on the specified options. This API uses an asynchronous callback to return the result. +Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ---------------------------- | ---- | --------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure | +| phoneNumber | string | Yes | Phone number. | +| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -69,28 +69,28 @@ call.dial("138xxxxxxxx", { ``` -## call.dial +## call.dial(deprecated) dial\(phoneNumber: string, options?: DialOptions\): Promise -Initiates a call based on the specified options. This API uses a promise to return the result. +Initiates a call. You can set call options as needed. This API uses a promise to return the result. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | -------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | +| phoneNumber | string | Yes | Phone number. | +| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call.| **Return value** -| Type | Description | -| ---------------------- | ---------------------------------------------------------------- | -| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure | +| Type | Description | +| ---------------------- | ------------------------------------------------------------ | +| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -105,6 +105,142 @@ promise.then(data => { }); ``` + +## call.dialCall9+ + +dialCall\(phoneNumber: string, callback: AsyncCallback\): void + +Initiates a call. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------- | ---- | --------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +call.dialCall("138xxxxxxxx", (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.dialCall9+ + +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. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ----------------------------------- | ---- | ------------------------------------ | +| phoneNumber | string | Yes | Phone number. | +| options | [DialCallOptions](#dialcalloptions9)| Yes | Call options, which carry other configuration information of the call. | +| callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +call.dialCall("138xxxxxxxx", { + accountId: 0, + videoState: 0, + dialScene: 0, + dialType: 0, +}, (err, data) => { + console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +}); +``` + + +## call.dialCall9+ + +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. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ----------------------------------- | ---- | -------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| options | [DialCallOptions](#dialcalloptions9)| No | Call option, which indicates whether the call is a voice call or video call.| + +**Return value** + +| Type | Description | +| ---------------------- | ------------------------------------------------------------ | +| Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +try { + call.dialCall('138xxxxxxxx'); + console.log(`dialCall success, promise: data->${JSON.stringify(data)}`); +} catch (error) { + console.log(`dialCall fail, promise: err->${JSON.stringify(error)}`); +} +``` + + ## call.makeCall7+ makeCall(phoneNumber: string, callback: AsyncCallback\): void @@ -115,16 +251,27 @@ Launches the call screen and displays the dialed number. This API uses an asynch **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------------------------- | ---- | ------------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | 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 -call.makeCall("138xxxxxxxx", err => { - console.log(`makeCall callback: err->${JSON.stringify(err)}`); +call.makeCall("138xxxxxxxx", err => { + console.log(`makeCall callback: err->${JSON.stringify(err)}`); }); ``` @@ -139,24 +286,35 @@ Launches the call screen and displays the dialed number. This API uses a promise **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------- | -| phoneNumber | string | Yes | Phone number. | +| phoneNumber | string | Yes | Phone number.| **Return value** | Type | Description | | ------------------- | --------------------------------- | -| Promise<void> | Promise used to return the result. | +| Promise<void> | 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 -let promise = call.makeCall("138xxxxxxxx"); -promise.then(() => { - console.log(`makeCall success`); -}).catch(err => { - console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`); +let promise = call.makeCall("138xxxxxxxx"); +promise.then(() => { + console.log(`makeCall success`); +}).catch(err => { + console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -170,9 +328,9 @@ Checks whether a call is in progress. This API uses an asynchronous callback to **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result.
- **true**: A call is in progress.
- **false**: No call is in progress. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result.
- **true**: A call is in progress.
- **false**: No call is in progress.| **Example** @@ -195,7 +353,7 @@ Checks whether a call is in progress. This API uses a promise to return the resu | Type | Description | | ---------------------- | --------------------------------------- | -| Promise<boolean> | Promise used to return the result. | +| Promise<boolean> | Promise used to return the result.| **Example** @@ -219,9 +377,9 @@ Obtains the call status. This API uses an asynchronous callback to return the re **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ------------------------------------ | -| callback | AsyncCallback<[CallState](#callstate)> | Yes | Callback used to return the result. | +| callback | AsyncCallback<[CallState](#callstate)> | Yes | Callback used to return the result.| **Example** @@ -244,7 +402,7 @@ Obtains the call status. This API uses a promise to return the result. | Type | Description | | -------------------------------------- | --------------------------------------- | -| Promise<[CallState](#callstate)> | Promise used to return the result. | +| Promise<[CallState](#callstate)> | Promise used to return the result.| **Example** @@ -269,7 +427,7 @@ Checks whether a device supports voice calls. | Type | Description | | ------- | ------------------------------------------------------------ | -| boolean | - **true**: The device supports voice calls.
- **false**: The device does not support voice calls. | +| boolean | - **true**: The device supports voice calls.
- **false**: The device does not support voice calls.| ```js let result = call.hasVoiceCapability(); @@ -286,10 +444,21 @@ Checks whether the called number is an emergency number. This API uses an asynch **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ---------------------------- | ---- | ------------------------------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. - **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number.| + +**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** @@ -304,17 +473,28 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => { isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\): void -Checks whether the called number is an emergency number based on the specified phone number options. This API uses an asynchronous callback to return the result. +Checks whether the called number is an emergency number based on the phone number. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number options. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. | +| Name | Type | Mandatory| Description | +| ----------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ | +| phoneNumber | string | Yes | Phone number. | +| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. - **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number.| + +**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** @@ -329,22 +509,33 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => { isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise -Checks whether the called number is an emergency number based on the specified phone number options. This API uses a promise to return the result. +Checks whether the called number is an emergency number based on the phone number. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------------- | ---- | -------------- | | phoneNumber | string | Yes | Phone number. | -| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number options. | +| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number.| **Return value** | Type | Description | | ---------------------- | --------------------------------------------------- | -| Promise<boolean> | Promise used to return the result. | +| Promise<boolean> | 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** @@ -369,10 +560,21 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | ------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| callback | AsyncCallback<string> | 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** @@ -386,7 +588,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => { formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\): void -Formats a phone number based on the specified formatting options. This API uses an asynchronous callback to return the result. +Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result. A formatted phone number is a standard numeric string, for example, 555 0100. @@ -394,11 +596,22 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------- | ---- | ------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. | +| callback | AsyncCallback<string> | 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** @@ -415,7 +628,7 @@ call.formatPhoneNumber("138xxxxxxxx", { formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise -Formats a phone number based on the specified formatting options. This API uses a promise to return the result. +Formats a phone number based on specified formatting options. This API uses a promise to return the result. A formatted phone number is a standard numeric string, for example, 555 0100. @@ -423,16 +636,27 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------- | ---- | ---------------------- | | phoneNumber | string | Yes | Phone number. | -| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. | +| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code.| **Return value** | Type | Description | | --------------------- | ------------------------------------------- | -| Promise<string> | Promise used to return the result. | +| Promise<string> | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -459,11 +683,22 @@ The phone number must match the specified country code. For example, for a China **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | ----------------------------------------------------- | | phoneNumber | string | Yes | Phone number. | | countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| callback | AsyncCallback<string> | 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** @@ -488,16 +723,27 @@ All country codes are supported. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------------------------------------- | | phoneNumber | string | Yes | Phone number. | -| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. | +| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported.| **Return value** | Type | Description | | --------------------- | ------------------------------------------------------------ | -| Promise<string> | Promise used to return the result. | +| Promise<string> | Promise used to return the result.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -514,9 +760,9 @@ promise.then(data => { muteRinger\(callback: AsyncCallback\): void -Mutes the ringtone while it is playing. This API uses an asynchronous callback to return the result. +Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -528,6 +774,17 @@ This is a system API. | ----------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | 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 @@ -541,9 +798,9 @@ call.muteRinger((err, data) => { muteRinger\(\): Promise -Mutes the ringtone while it is playing. This API uses a promise to return the result. +Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -555,6 +812,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -566,13 +835,14 @@ promise.then(data => { }); ``` -## call.answer7+ -answer\(callId: number, callback: AsyncCallback\): void +## call.answerCall7+ + +answerCall\(callId: number, callback: AsyncCallback\): void -Answers a call based on the specified call ID. This API uses an asynchronous callback to return the result. +Answers a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -585,22 +855,34 @@ This is a system API. | callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.answer(1, (err, data) => { +call.answerCall(1, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.answer7+ +## call.answerCall7+ -answer(callId?: number\): Promise +answerCall(callId?: number\): Promise -Answers a call based on the specified call ID. This API uses a promise to return the result. +Answers a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -618,24 +900,37 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 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 promise = call.answer(1); +let promise = call.answerCall(1); promise.then(data => { - console.log(`answer success, promise: data->${JSON.stringify(data)}`); + console.log(`answerCall success, promise: data->${JSON.stringify(data)}`); }).catch(err => { - console.error(`answer fail, promise: err->${JSON.stringify(err)}`); + console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.hangup7+ -hangup\(callId: number, callback: AsyncCallback\): void +## call.answerCall9+ -Ends a call. This API uses an asynchronous callback to return the result. +answerCall\(callback: AsyncCallback\): void + +Answers a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -645,25 +940,36 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------- | -| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.hangup(1, (err, data) => { +call.answerCall((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.answer9+ +## call.hangUpCall7+ -answer\(callback: AsyncCallback\): void +hangUpCall\(callId: number, callback: AsyncCallback\): void -Answers a call.This API uses an asynchronous callback to return the result. +Ends a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -673,24 +979,37 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.answer((err, data) => { +call.hangUpCall(1, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.hangup7+ +## call.hangUpCall7+ -hangup\(callId?: number\): Promise +hangUpCall\(callId?: number\): Promise -Ends a call based on the specified call ID. This API uses a promise to return the result. +Ends a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -708,24 +1027,37 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 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 promise = call.hangup(1); +let promise = call.hangUpCall(1); promise.then(data => { - console.log(`hangup success, promise: data->${JSON.stringify(data)}`); + console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`); }).catch(err => { - console.error(`hangup fail, promise: err->${JSON.stringify(err)}`); + console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.hangup9+ -hangup\(callback: AsyncCallback\): void +## call.hangUpCall9+ + +hangUpCall\(callback: AsyncCallback\): void Ends a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -737,22 +1069,35 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + + **Example** ```js -call.hangup((err, data) => { +call.hangUpCall((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.reject7+ +## call.rejectCall7+ -reject(callId: number, callback: AsyncCallback\): void +rejectCall(callId: number, callback: AsyncCallback\): void -Rejects a call based on the specified call ID. This API uses an asynchronous callback to return the result. +Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -765,22 +1110,35 @@ This is a system API. | callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.reject(1, (err, data) => { +call.rejectCall(1, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.reject7+ -reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void +## call.rejectCall7+ + +rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void -Rejects a call based on the specified call ID and options. This API uses an asynchronous callback to return the result. +Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -794,25 +1152,37 @@ This is a system API. | options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message. | | callback | AsyncCallback<void> | 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. | +| 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 rejectMessageOptions={ messageContent: "Unknown number blocked" } -call.reject(1, rejectMessageOptions, (err, data) => { +call.rejectCall(1, rejectMessageOptions, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.reject7+ +## call.rejectCall7+ -reject(callId?: number, options?: RejectMessageOptions\): Promise +rejectCall(callId?: number, options?: RejectMessageOptions\): Promise -Rejects a call based on the specified call ID and options. This API uses a promise to return the result. +Rejects a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -831,28 +1201,40 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 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 rejectMessageOptions={ messageContent: "Unknown number blocked" } -let promise = call.reject(1, rejectMessageOptions); +let promise = call.rejectCall(1, rejectMessageOptions); promise.then(data => { - console.log(`reject success, promise: data->${JSON.stringify(data)}`); + console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`); }).catch(err => { - console.error(`reject fail, promise: err->${JSON.stringify(err)}`); + console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.reject9+ +## call.rejectCall9+ -reject\(callback: AsyncCallback\): void +rejectCall\(callback: AsyncCallback\): void Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -864,22 +1246,34 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| -**Example:** +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** ```js -call.reject((err, data) => { +call.rejectCall((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.reject9+ +## call.rejectCall9+ -reject\(options: RejectMessageOptions, callback: AsyncCallback\): void +rejectCall\(options: RejectMessageOptions, callback: AsyncCallback\): void Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -892,13 +1286,25 @@ This is a system API. | options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | -**Example:** +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** ```js let rejectMessageOptions={ messageContent: "Unknown number blocked" } -call.reject(rejectMessageOptions, (err, data) => { +call.rejectCall(rejectMessageOptions, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -910,7 +1316,7 @@ 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. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -923,6 +1329,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -938,7 +1356,7 @@ holdCall\(callId: number\): Promise Holds a call based on the specified call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -956,6 +1374,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -973,7 +1403,7 @@ 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. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -986,6 +1416,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1001,7 +1443,7 @@ unHoldCall\(callId: number\): Promise Unholds a call based on the specified call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1019,6 +1461,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1036,7 +1490,7 @@ switchCall\(callId: number, callback: AsyncCallback\): void Switches a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1049,6 +1503,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1064,7 +1530,7 @@ switchCall\(callId: number\): Promise Switches a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1082,6 +1548,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1099,7 +1577,7 @@ combineConference\(callId: number, callback: AsyncCallback\): void Combines two calls into a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1110,6 +1588,17 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | 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 @@ -1125,7 +1614,7 @@ combineConference\(callId: number\): Promise Combines two calls into a conference call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1141,6 +1630,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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 @@ -1158,7 +1658,7 @@ getMainCallId\(callId: number, callback: AsyncCallback\): void Obtains the main call ID. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1169,6 +1669,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<number> | 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 @@ -1184,7 +1696,7 @@ getMainCallId\(callId: number\): Promise Obtains the main call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1200,6 +1712,17 @@ This is a system API. | ------------------- | ------------------------------- | | Promise<void> | 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 @@ -1217,7 +1740,7 @@ getSubCallIdList\(callId: number, callback: AsyncCallback\>\): vo Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1228,6 +1751,17 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback\> | 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 @@ -1243,7 +1777,7 @@ getSubCallIdList\(callId: number\): Promise\> Obtains the list of subcall IDs. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1259,6 +1793,17 @@ This is a system API. | ----------------------------- | ----------------------------------- | | Promise<Array> | 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 @@ -1276,7 +1821,7 @@ getCallIdListForConference\(callId: number, callback: AsyncCallback> | 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 @@ -1302,7 +1858,7 @@ getCallIdListForConference\(callId: number\): Promise\> Obtains the list of call IDs in a conference. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1318,6 +1874,17 @@ This is a system API. | ----------------------------- | --------------------------------------- | | Promise<Array> | 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 @@ -1335,7 +1902,7 @@ getCallWaitingStatus\(slotId: number, callback: AsyncCallback- **0**: card slot 1
- **1**: card slot 2 | -| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.

- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| + +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -1363,7 +1942,7 @@ getCallWaitingStatus\(slotId: number\): Promise Obtains the call waiting status. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -1381,6 +1960,18 @@ This is a system API. | ------------------------------------------------------- | ------------------------------------------------------------ | | Promise<[CallWaitingStatus](#callwaitingstatus7)> | Promise used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1398,7 +1989,7 @@ setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback- **false**: Disable call waiting.
- **true**: Enable call waiting.| | callback | AsyncCallback | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1427,7 +2030,7 @@ setCallWaiting\(slotId: number, activate: boolean\): Promise Sets the call waiting switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1446,6 +2049,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1461,9 +2076,9 @@ promise.then(data => { startDTMF\(callId: number, character: string, callback: AsyncCallback\): void -Enables dual-tone multifrequency (DTMF). This API uses an asynchronous callback to return the result. +Enables DTMF. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1475,6 +2090,17 @@ This is a system API. | character | string | Yes | DTMF code. | | callback | AsyncCallback | 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 @@ -1490,7 +2116,7 @@ startDTMF\(callId: number, character: string\): Promise Enables DTMF. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1507,6 +2133,17 @@ This is a system API. | ------------------- | ----------------------- | | Promise<void> | 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 @@ -1524,7 +2161,7 @@ stopDTMF\(callId: number, callback: AsyncCallback\): void Stops DTMF. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1535,6 +2172,17 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | 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 @@ -1550,7 +2198,7 @@ stopDTMF\(callId: number\): Promise Stops DTMF. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1566,6 +2214,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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 @@ -1583,7 +2242,7 @@ isInEmergencyCall\(callback: AsyncCallback\): void Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1595,6 +2254,18 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1610,7 +2281,7 @@ isInEmergencyCall\(\): Promise Checks whether a call is an emergency call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1622,6 +2293,18 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1639,7 +2322,7 @@ on\(type: 'callDetailsChange', callback: Callback\): void Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1652,6 +2335,18 @@ This is a system API. | type | string | Yes | Call details change during a call.| | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1666,7 +2361,7 @@ on\(type: 'callEventChange', callback: Callback\): void Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1679,6 +2374,18 @@ This is a system API. | type | string | Yes | Call event change during a call.| | callback | Callback<[CallEventOptions](#calleventoptions8)> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1693,7 +2400,7 @@ on\(type: 'callDisconnectedCause', callback: Callback): vo Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1706,6 +2413,18 @@ This is a system API. | type | string | Yes | Cause of the call disconnection.| | callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1720,7 +2439,7 @@ on\(type: 'mmiCodeResult', callback: Callback\): void Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1733,6 +2452,18 @@ This is a system API. | type | string | Yes | Man-machine interface (MMI) code result.| | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1747,7 +2478,7 @@ off\(type: 'callDetailsChange', callback?: Callback\): vo Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1757,9 +2488,21 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | ---------------------------------- | -| type | string | Yes | Unsubscription from call details changes when a call ends.| +| type | string | Yes | IMS registration status changes.| | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 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 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1774,7 +2517,7 @@ off\(type: 'callEventChange', callback?: Callback\): void Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1787,6 +2530,18 @@ This is a system API. | type | string | Yes | Unsubscription from call event changes when a call ends.| | callback | Callback<[CallEventOptions](#calleventoptions8)> | 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 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1801,7 +2556,7 @@ off\(type: 'callDisconnectedCause', callback?: Callback\): Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1814,6 +2569,18 @@ This is a system API. | type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.| | callback | Callback**<**[DisconnectedDetails](#disconnecteddetails9)> | 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 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1828,7 +2595,7 @@ off\(type: 'mmiCodeResult', callback?: Callback\): void Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1841,6 +2608,18 @@ This is a system API. | type | 'mmiCodeResult' | Yes | MMI code result.| | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 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 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1855,7 +2634,7 @@ isNewCallAllowed\(callback: AsyncCallback\): void Checks whether a new call is allowed. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1865,6 +2644,17 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | 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 @@ -1880,7 +2670,7 @@ isNewCallAllowed\(\): Promise Checks whether a new call is allowed. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1890,6 +2680,17 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | 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 @@ -1905,9 +2706,9 @@ promise.then(data => { separateConference\(callId: number, callback: AsyncCallback\): void -Separates a conference call. This API uses an asynchronous callback to return the result. +Separates calls from a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1918,6 +2719,17 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | 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 @@ -1931,9 +2743,9 @@ call.separateConference(1, (err, data) => { separateConference\(callId: number\): Promise -Separates a conference call. This API uses a promise to return the result. +Separates calls from a conference call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1949,6 +2761,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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 @@ -1966,7 +2789,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: A Obtains the call restriction status. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -1980,6 +2803,18 @@ This is a system API. | type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. | | callback | AsyncCallback<[RestrictionStatus](#restrictionstatus8)> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1995,7 +2830,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise Sets the call restriction status. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2084,6 +2943,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2106,7 +2977,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCall Obtains call transfer information. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -2120,10 +2991,22 @@ This is a system API. | type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. | | callback | AsyncCallback<[CallTransferResult](#calltransferresult8)> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.getCallTransferInfo(0, callTransferTyp, (err, data) => { +call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2135,7 +3018,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType): Promise Sets call transfer information. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2224,6 +3131,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2246,7 +3165,7 @@ isRinging\(callback: AsyncCallback\): void Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2258,6 +3177,18 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2273,7 +3204,7 @@ isRinging\(\): Promise Checks whether the ringtone is playing. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2285,6 +3216,18 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2302,7 +3245,7 @@ setMuted\(callback: AsyncCallback\): void Sets call muting. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2312,6 +3255,17 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | 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 @@ -2327,7 +3281,7 @@ setMuted\(\): Promise Sets call muting. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2337,6 +3291,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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 @@ -2354,7 +3319,7 @@ cancelMuted(callback: AsyncCallback): void Cancels call muting. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2364,6 +3329,17 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | 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 @@ -2379,7 +3355,7 @@ cancelMuted(): Promise Cancels call muting. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2389,6 +3365,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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 @@ -2400,13 +3387,13 @@ promise.then(data => { }); ``` -## call.setAudioDevice9+ +## call.setAudioDevice8+ setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void Sets the audio device for a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2417,6 +3404,17 @@ This is a system API. | device | [AudioDevice](#audiodevice8) | Yes | Audio device.| | callback | AsyncCallback<void> | 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 @@ -2432,7 +3430,7 @@ setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: Asyn Sets the audio device for a call based on the specified options. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2444,6 +3442,17 @@ This is a system API. | options | [AudioDeviceOptions](#audiodeviceoptions9) | Yes | Audio device parameters.| | callback | AsyncCallback<void> | 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 @@ -2456,13 +3465,13 @@ call.setAudioDevice(1, audioDeviceOptions, (err, data) => { ``` -## call.setAudioDevice8+ +## call.setAudioDevice9+ 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. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2479,6 +3488,17 @@ This is a system API. | ------------------- | ------------------------------- | | Promise<void> | 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 @@ -2499,7 +3519,7 @@ joinConference(mainCallId: number, callNumberList: Array, callback: Asy Joins a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2511,6 +3531,17 @@ This is a system API. | callNumberList | Array | Yes | List of call numbers.| | callback | AsyncCallback<void> | 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 @@ -2528,7 +3559,7 @@ joinConference(mainCallId: number, callNumberList: Array): Promise Updates the IMS call mode. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2608,6 +3661,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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 @@ -2625,7 +3689,7 @@ enableImsSwitch(slotId: number, callback: AsyncCallback): void Enables the IMS switch. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2638,6 +3702,18 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2652,7 +3728,7 @@ enableImsSwitch(slotId: number): Promise Enables the IMS switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2670,6 +3746,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2687,7 +3775,7 @@ disableImsSwitch(slotId: number, callback: AsyncCallback): void Disables the IMS switch. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2700,6 +3788,18 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2714,7 +3814,7 @@ disableImsSwitch(slotId: number): Promise Disables the IMS switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2732,6 +3832,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2749,7 +3861,7 @@ isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2760,6 +3872,17 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | 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 @@ -2774,7 +3897,7 @@ isImsSwitchEnabled(slotId: number): Promise Checks whether the IMS switch is enabled. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2790,6 +3913,17 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | 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 @@ -2801,20 +3935,32 @@ promise.then(data => { }); ``` - ## DialOptions -Defines the dialup options. +Provides an option for determining whether a call is a video call. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | -| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ | +| 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. | +| 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. | + +## DialCallOptions9+ + +Defines options for initiating a call. + +**System capability**: SystemCapability.Telephony.CallManager + +| Name | Type | Mandatory| Description | +| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ | +| accountId 9+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API.| +| videoState 9+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | +| dialScene 9+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | +| dialType 9+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. | ## CallState @@ -2827,33 +3973,33 @@ Enumerates call states. | CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. | | CALL_STATE_IDLE | 0 | No call is in progress. | | CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. | -| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting. | +| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.| ## EmergencyNumberOptions7+ -Defines options for determining whether a number is an emergency number. +Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot. **System capability**: SystemCapability.Telephony.CallManager -| Name| Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------------- | | slotId | number | No | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| ## NumberFormatOptions7+ -Defines the number formatting options. +Provides an option for number formatting. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------------------------------------------------------- | -| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**. | +| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.| ## ImsCallMode8+ Enumerates IMS call modes. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2869,23 +4015,23 @@ This is a system API. Enumerates audio devices. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager | Name | Value | Description | | -------------------- | ---- | ------------ | -| DEVICE_EARPIECE | 0 | Earpiece. | -| DEVICE_SPEAKER | 1 | Speaker.| -| DEVICE_WIRED_HEADSET | 2 | Wired headset.| +| DEVICE_EARPIECE | 0 | Headset device. | +| DEVICE_SPEAKER | 1 | Speaker device.| +| DEVICE_WIRED_HEADSET | 2 | Wired headset device.| | DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. | -| DEVICE_MIC | 4 | Microphone. | +| DEVICE_MIC | 4 | Microphone device| ## CallRestrictionType8+ Enumerates call restriction types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2904,7 +4050,7 @@ This is a system API. Defines the call transfer information. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2915,14 +4061,14 @@ This is a system API. | settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.| | startHour9+ | number | No | Hour in the start time.| | startMinute9+ | number | No | Minute in the start time.| -| endHour9+ | number | No | Hour in the end time.| +| endHour9+ | number | No | Minute in the end time.| | endMinute9+ | number | No | Minute in the end time.| ## CallTransferType8+ Enumerates call transfer types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2937,7 +4083,7 @@ This is a system API. Enumerates call transfer setting types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2952,11 +4098,11 @@ This is a system API. Defines the call attribute options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------------- | ---------------------------------------- | ---- | -------------- | | accountNumber | string | Yes | Account number. | | speakerphoneOn | boolean | Yes | Speakerphone on.| @@ -2973,7 +4119,7 @@ This is a system API. Enumerates conference states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2988,7 +4134,7 @@ This is a system API. Enumerates call types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3001,9 +4147,9 @@ This is a system API. ## VideoStateType7+ -Enumerates video state types. +Video state type. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3016,7 +4162,7 @@ This is a system API. Enumerates detailed call states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3036,11 +4182,11 @@ This is a system API. Defines the call restriction information. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ------------ | | type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type.| | password | string | Yes | Password. | @@ -3050,7 +4196,7 @@ This is a system API. Enumerates call restriction modes. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3063,11 +4209,11 @@ This is a system API. Defines the call event options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------- | ------------------------------------------ | ---- | -------------- | | eventId | [CallAbilityEventId](#callabilityeventid8) | Yes | Call ability event ID.| @@ -3075,7 +4221,7 @@ This is a system API. Enumerates call ability event IDs. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3088,7 +4234,7 @@ This is a system API. Enumerates dialup scenarios. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3102,7 +4248,7 @@ This is a system API. Enumerates dialup types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3116,11 +4262,11 @@ This is a system API. Defines options for the call rejection message. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | ------ | ---- | -------- | | messageContent | string | Yes | Message content.| @@ -3128,7 +4274,7 @@ This is a system API. Defines the call transfer result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3138,14 +4284,14 @@ This is a system API. | number | string | Yes | Call transfer number. | | startHour9+ | number | Yes | Hour in the start time.| | startMinute9+ | number | Yes | Minute in the start time.| -| endHour9+ | number | Yes | Hour in the end time.| +| endHour9+ | number | Yes | Minute in the end time.| | endMinute9+ | number | Yes | Minute in the end time.| ## CallWaitingStatus7+ Enumerates call waiting states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3158,7 +4304,7 @@ This is a system API. Enumerates call restriction states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3171,7 +4317,7 @@ This is a system API. Enumerates call transfer states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3184,7 +4330,7 @@ This is a system API. Defines the cause of a call disconnection. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3197,7 +4343,7 @@ This is a system API. Enumerates causes of call disconnection. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3287,7 +4433,7 @@ This is a system API. Defines the MMI code result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3298,9 +4444,9 @@ This is a system API. ## MmiCodeResult9+ -Enumerates MMI code results. +Defines the MMI code result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3313,7 +4459,7 @@ This is a system API. Defines audio device options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager diff --git a/en/application-dev/reference/apis/js-apis-charger.md b/en/application-dev/reference/apis/js-apis-charger.md new file mode 100644 index 0000000000000000000000000000000000000000..0b4f5dba51054c51fd2c74cc1867413340b9a687 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-charger.md @@ -0,0 +1,30 @@ +# @ohos.charger (Charging Type) + +The **charger** module enumerates charging types. + +> **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. + + +## Modules to Import + +```js +import charger from '@ohos.charger'; +``` + +## ChargeType + +Enumerates charging types. + +**System capability**: SystemCapability.PowerManager.BatteryManager.Core + +| Name | Value | Description | +| -------- | ---- | ----------------- | +| NONE | 0 | Unknown charging type. | +| WIRED_NORMAL | 1 | Wired normal charging.| +| WIRED_QUICK | 2 | Wired fast charging. | +| WIRED_SUPER_QUICK | 3 | Wired super fast charging.| +| WIRELESS_NORMAL | 4 | Wireless normal charging.| +| WIRELESS_QUICK | 5 | Wireless fast charging.| +| WIRELESS_SUPER_QUICK | 6 | Wireless super fast charging.| diff --git a/en/application-dev/reference/apis/js-apis-hichecker.md b/en/application-dev/reference/apis/js-apis-hichecker.md index 1a6339e406c98eb2dfd81239da3e852bcb4afe47..4d6d81f15430a456eb60f54e1b650df5ef112dbe 100644 --- a/en/application-dev/reference/apis/js-apis-hichecker.md +++ b/en/application-dev/reference/apis/js-apis-hichecker.md @@ -46,11 +46,11 @@ Adds one or more rules. HiChecker detects unexpected operations or gives feedbac ```js try { // Add a rule. - hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG);} + hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // Add multiple rules. - hichecker.addCheckRule( - hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); -catch (err) { + // hichecker.addCheckRule( + // hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); +} catch (err) { console.error(`code: ${err.code}, message: ${err.message}`); } ``` @@ -76,9 +76,9 @@ try { // Remove a rule. hichecker.removeCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // Remove multiple rules. - hichecker.removeCheckRule( - hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); -catch (err) { + // hichecker.removeCheckRule( + // hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); +} catch (err) { console.error(`code: ${err.code}, message: ${err.message}`); } ``` @@ -113,7 +113,7 @@ try { // Check whether the added rule exists in the collection of added rules. hichecker.containsCheckRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // return true; hichecker.containsCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // return false; -catch (err) { +} catch (err) { console.error(`code: ${err.code}, message: ${err.message}`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-hidebug.md b/en/application-dev/reference/apis/js-apis-hidebug.md index 189d855e894451790976eee2c3816cf17ae950b9..364938ddfa2864850a1335cb886f41e3de2c1a9c 100644 --- a/en/application-dev/reference/apis/js-apis-hidebug.md +++ b/en/application-dev/reference/apis/js-apis-hidebug.md @@ -297,7 +297,7 @@ import hidebug from '@ohos.hidebug' try { hidebug.startJsCpuProfiling("cpu_profiling"); - ... + // ... hidebug.stopJsCpuProfiling(); } catch (error) { console.info(error.code) @@ -326,7 +326,7 @@ import hidebug from '@ohos.hidebug' try { hidebug.startJsCpuProfiling("cpu_profiling"); - ... + // ... hidebug.stopJsCpuProfiling(); } catch (error) { console.info(error.code) diff --git a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md index 86e09db17bda0e6efa68bbeeb973a26f4a4ff467..2960e201db397e160dfc5cca7e1c729beebcb6a4 100644 --- a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md +++ b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md @@ -1,8 +1,9 @@ # @ohos.hiviewdfx.hiAppEvent (Application Event Logging) -The **hiAppEvent** module provides application event-related functions, including flushing application events to a disk, querying and clearing application events, and customizing application event logging configuration. +This module provides application event-related functions, including flushing application events to a disk, querying and clearing application events, and customizing application event logging configuration. -> **NOTE**
+> **NOTE** +> > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. @@ -447,27 +448,27 @@ Enumerates event types. | BEHAVIOR | 4 | Behavior event.| -## Event +## event Provides constants that define the names of all predefined events. **System capability**: SystemCapability.HiviewDFX.HiAppEvent -| Name | Type | Readable| Writable| Description | -| ------------------------- | ------ | ---- | ---- | -------------------- | -| USER_LOGIN | string | Yes | No | User login event. | -| USER_LOGOUT | string | Yes | No | User logout event. | -| DISTRIBUTED_SERVICE_START | string | Yes | No | Distributed service startup event.| +| Name | Type | Description | +| ------------------------- | ------ | -------------------- | +| USER_LOGIN | string | User login event. | +| USER_LOGOUT | string | User logout event. | +| DISTRIBUTED_SERVICE_START | string | Distributed service startup event.| -## Param +## param Provides constants that define the names of all predefined event parameters. **System capability**: SystemCapability.HiviewDFX.HiAppEvent -| Name | Type | Readable| Writable| Description | -| ------------------------------- | ------ | ---- | ---- | ------------------ | -| USER_ID | string | Yes | No | Custom user ID. | -| DISTRIBUTED_SERVICE_NAME | string | Yes | No | Distributed service name. | -| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Yes | No | Distributed service instance ID.| +| Name | Type | Description | +| ------------------------------- | ------ | ------------------ | +| USER_ID | string | Custom user ID. | +| DISTRIBUTED_SERVICE_NAME | string | Distributed service name. | +| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Distributed service instance ID.| diff --git a/en/application-dev/reference/apis/js-apis-i18n.md b/en/application-dev/reference/apis/js-apis-i18n.md index 02cebd741ce26bd61dd4a4282efcf2cc6d89ad08..2a85da3460cf4dff87a3076686a8b31ae136f65a 100644 --- a/en/application-dev/reference/apis/js-apis-i18n.md +++ b/en/application-dev/reference/apis/js-apis-i18n.md @@ -1,12 +1,12 @@ # @ohos.i18n (Internationalization) - The **i18n** module provides system-related or enhanced i18n capabilities, such as locale management, phone number formatting, and calendar, through supplementary i18n APIs that are not defined in ECMA 402. -The [intl](js-apis-intl.md) module provides basic i18n capabilities through the standard i18n APIs defined in ECMA 402. It works with the i18n module to provide a complete suite of i18n capabilities. + This module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402. +The [Intl](js-apis-intl.md) module provides basic I18N capabilities through the standard I18N APIs defined in ECMA 402. It works with the I18N module to provide a complete suite of I18N capabilities. > **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. > -> - This module provides system-related or enhanced i18n capabilities, such as locale management, phone number formatting, and calendar, through supplementary i18n APIs that are not defined in ECMA 402. For details about the basic i18n capabilities, see [intl](js-apis-intl.md). +> - This module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402. For details about the basic I18N capabilities, see [Intl](js-apis-intl.md). ## Modules to Import @@ -42,7 +42,7 @@ Obtains the localized script for the specified country. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -81,7 +81,7 @@ Obtains the localized script for the specified language. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -112,7 +112,7 @@ Obtains the list of system languages. For details about languages, see [Instanti **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -149,7 +149,7 @@ Obtains the list of countries and regions supported for the specified language. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -187,7 +187,7 @@ Checks whether the system language matches the specified region. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -218,7 +218,7 @@ Obtains the system language. For details about languages, see [Instantiating the **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -239,7 +239,7 @@ static setSystemLanguage(language: string): void Sets the system language. Currently, this API does not support real-time updating of the system language. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -253,7 +253,7 @@ Sets the system language. Currently, this API does not support real-time updatin **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -284,7 +284,7 @@ Obtains the system region. For details about system regions, see [Instantiating **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -305,7 +305,7 @@ static setSystemRegion(region: string): void Sets the system region. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -319,7 +319,7 @@ Sets the system region. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -350,7 +350,7 @@ Obtains the system locale. For details about system locales, see [Instantiating **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -371,7 +371,7 @@ static setSystemLocale(locale: string): void Sets the system locale. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -385,7 +385,7 @@ Sets the system locale. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -416,7 +416,7 @@ Checks whether the 24-hour clock is used. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -437,7 +437,7 @@ static set24HourClock(option: boolean): void Sets the 24-hour clock. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -451,7 +451,7 @@ Sets the 24-hour clock. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -473,7 +473,7 @@ static addPreferredLanguage(language: string, index?: number): void Adds a preferred language to the specified position on the preferred language list. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -488,7 +488,7 @@ Adds a preferred language to the specified position on the preferred language li **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -512,7 +512,7 @@ static removePreferredLanguage(index: number): void Deletes a preferred language from the specified position on the preferred language list. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -526,7 +526,7 @@ Deletes a preferred language from the specified position on the preferred langua **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -547,7 +547,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static getPreferredLanguageList(): Array<string> -Obtains the preferred language list. +Obtains the list of preferred languages. **System capability**: SystemCapability.Global.I18n @@ -555,11 +555,11 @@ Obtains the preferred language list. | Type | Description | | ------------------- | --------- | -| Array<string> | Preferred language list.| +| Array<string> | List of preferred languages.| **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -590,7 +590,7 @@ Obtains the first language in the preferred language list. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -621,7 +621,7 @@ Obtains the preferred language of an application. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -642,7 +642,7 @@ static setUsingLocalDigit(flag: boolean): void Specifies whether to enable use of local digits. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -652,11 +652,11 @@ Specifies whether to enable use of local digits. | Name | Type | Mandatory | Description | | ---- | ------- | ---- | ------------------------------- | -| flag | boolean | Yes | Whether to enable the local digit switch. The value **true** means to enable the local digit switch, and the value **false** indicates the opposite.| +| flag | boolean | Yes | Whether to turn on the local digit switch. The value **true** means to turn on the local digit switch, and the value **false** indicates the opposite.| **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -687,7 +687,7 @@ Checks whether use of local digits is enabled. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -1059,7 +1059,7 @@ Creates a **PhoneNumberFormat** object. | Name | Type | Mandatory | Description | | ------- | ---------------------------------------- | ---- | ---------------- | | country | string | Yes | Country or region to which the phone number to be formatted belongs.| -| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. | +| options | [PhoneNumberFormatOptions](#phonenumberformatoptions9) | No | Options of the **PhoneNumberFormat** object. | **Example** ```js @@ -1149,7 +1149,7 @@ Obtains the home location of a phone number. ``` -## PhoneNumberFormatOptions8+ +## PhoneNumberFormatOptions9+ Defines the options for this PhoneNumberFormat object. @@ -1194,7 +1194,7 @@ Creates an **IndexUtil** object. **Example** ```js - let indexUtil= I18n.getInstance("zh-CN"); + let indexUtil = I18n.getInstance("zh-CN"); ``` @@ -1267,7 +1267,7 @@ Obtains the index of a text object. **Example** ```js - let indexUtil= I18n.getInstance("zh-CN"); + let indexUtil = I18n.getInstance("zh-CN"); let index = indexUtil.getIndex("hi"); // index = "H" ``` @@ -1382,7 +1382,7 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi **Example** ```js - let iterator = i18n.getLineInstance("en"); + let iterator = I18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); let firstPos = iterator.first(); // firstPos = 0 ``` @@ -1689,7 +1689,7 @@ Obtains the list of time zone city IDs supported by the system. static getCityDisplayName(cityID: string, locale: string): string -Obtains the localized representation of a time zone city in the specified locale. +Obtains the localized display of a time zone city in the specified locale. **System capability**: SystemCapability.Global.I18n @@ -2363,7 +2363,7 @@ This API is supported since API version 8 and is deprecated since API version 9. getPreferredLanguageList(): Array<string> -Obtains the preferred language list. +Obtains the list of preferred languages. This API is supported since API version 8 and is deprecated since API version 9. You are advised to use [System.getPreferredLanguageList](#getpreferredlanguagelist9) instead. @@ -2373,7 +2373,7 @@ This API is supported since API version 8 and is deprecated since API version 9. | Type | Description | | ------------------- | --------- | -| Array<string> | Preferred language list.| +| Array<string> | List of preferred languages.| **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-intl.md b/en/application-dev/reference/apis/js-apis-intl.md index d4f3449adae43eed9b19236aec0d0308feed89e8..22b2225382e82166356b37003483c7c27a1400e0 100644 --- a/en/application-dev/reference/apis/js-apis-intl.md +++ b/en/application-dev/reference/apis/js-apis-intl.md @@ -1,6 +1,6 @@ # @ohos.intl (Internationalization) -The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402. + The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402. The [i18n](js-apis-i18n.md) module provides enhanced i18n capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the intl module to provide a complete suite of i18n capabilities. > **NOTE** @@ -48,9 +48,9 @@ Creates a **Locale** object. **Example** ```js // The default constructor uses the current system locale to create a Locale object. - let locale = new Intl.Locale() + let locale = new Intl.Locale(); // Return the current system locale. - let localeID = locale.toString() + let localeID = locale.toString(); ``` @@ -67,13 +67,13 @@ Creates a **Locale** object. | Name | Type | Mandatory | Description | | -------------------- | -------------------------------- | ---- | ---------------------------- | | locale | string | Yes | A string containing locale information, including the language, optional script, and region. For details about the international standards and combination modes for the language, script, and country or region, see [intl Development](../../internationalization/intl-guidelines.md#setting-locale-information).| -| options9+ | [LocaleOptions](#localeoptions6) | No | Options for creating the **Locale** object. | +| options9+ | [LocaleOptions](#localeoptions9) | No | Options for creating the **Locale** object. | **Example** ```js // Create a Locale object named zh-CN. - let locale = new Intl.Locale("zh-CN") - let localeID = locale.toString() // localeID = "zh-CN" + let locale = new Intl.Locale("zh-CN"); + let localeID = locale.toString(); // localeID = "zh-CN" ``` @@ -159,7 +159,7 @@ Minimizes information of the **Locale** object. If the script and locale informa ``` -## LocaleOptions6+ +## LocaleOptions9+ Represents the locale options. @@ -206,7 +206,7 @@ Creates a **DateTimeOptions** object for the specified locale. | Name | Type | Mandatory | Description | | -------------------- | ------------------------------------ | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [DateTimeOptions](#datetimeoptions6) | No | Options for creating a **DateTimeFormat** object. | +| options9+ | [DateTimeOptions](#datetimeoptions9) | No | Options for creating a **DateTimeFormat** object. | **Example** ```js @@ -298,7 +298,7 @@ Obtains the formatting options for **DateTimeFormat** object. | Type | Description | | ------------------------------------ | ----------------------------- | -| [DateTimeOptions](#datetimeoptions6) | Formatting options for **DateTimeFormat** objects.| +| [DateTimeOptions](#datetimeoptions9) | Formatting options for **DateTimeFormat** objects.| **Example** ```js @@ -310,7 +310,7 @@ Obtains the formatting options for **DateTimeFormat** object. ``` -## DateTimeOptions6+ +## DateTimeOptions9+ Provides the options for the **DateTimeFormat** object. @@ -370,7 +370,7 @@ Creates a **NumberFormat** object for the specified locale. | Name | Type | Mandatory | Description | | -------------------- | -------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [NumberOptions](#numberoptions6) | No | Options for creating a **NumberFormat** object. | +| options9+ | [NumberOptions](#numberoptions9) | No | Options for creating a **NumberFormat** object. | **Example** ```js @@ -420,7 +420,7 @@ Obtains the options of the **NumberFormat** object. | Type | Description | | -------------------------------- | --------------------------- | -| [NumberOptions](#numberoptions6) | Formatting options for **NumberFormat** objects.| +| [NumberOptions](#numberoptions9) | Formatting options for **NumberFormat** objects.| **Example** @@ -429,11 +429,11 @@ Obtains the options of the **NumberFormat** object. // Obtain the options of the NumberFormat object. let options = numfmt.resolvedOptions(); let style = options.style; // style = decimal - let notation = options.notation // notation = scientific + let notation = options.notation; // notation = scientific ``` -## NumberOptions6+ +## NumberOptions9+ Defines the device capability. @@ -493,7 +493,7 @@ Creates a **Collator** object. | Name | Type | Mandatory | Description | | -------------------- | ------------------------------------ | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [CollatorOptions](#collatoroptions8) | No | Options for creating a **Collator** object. | +| options9+ | [CollatorOptions](#collatoroptions9) | No | Options for creating a **Collator** object. | **Example** ```js @@ -544,7 +544,7 @@ Returns properties reflecting the locale and collation options of a **Collator** | Type | Description | | ------------------------------------ | ----------------- | -| [CollatorOptions](#collatoroptions8) | Properties of the **Collator** object.| +| [CollatorOptions](#collatoroptions9) | Properties of the **Collator** object.| **Example** ```js @@ -552,11 +552,11 @@ Returns properties reflecting the locale and collation options of a **Collator** // Obtain the options of the Collator object. let options = collator.resolvedOptions(); let usage = options.usage; // usage = "sort" - let ignorePunctuation = options.ignorePunctuation // ignorePunctuation = true + let ignorePunctuation = options.ignorePunctuation; // ignorePunctuation = true ``` -## CollatorOptions8+ +## CollatorOptions9+ Represents the properties of a **Collator** object. @@ -604,7 +604,7 @@ Creates a **PluralRules** object to obtain the singular-plural type of numbers. | Name | Type | Mandatory | Description | | -------------------- | ---------------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [PluralRulesOptions](#pluralrulesoptions8) | No | Options for creating a **PluralRules** object. | +| options9+ | [PluralRulesOptions](#pluralrulesoptions9) | No | Options for creating a **PluralRules** object. | **Example** ```js @@ -631,7 +631,7 @@ Obtains a string that represents the singular-plural type of the specified numbe | Type | Description | | ------ | ---------------------------------------- | -| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**.| +| string | Singular-plural type. The value can be any of the following: **zero**, **one**, **two**, **few**, **many**, **others**.| **Example** ```js @@ -647,7 +647,7 @@ Obtains a string that represents the singular-plural type of the specified numbe ``` -## PluralRulesOptions8+ +## PluralRulesOptions9+ Represents the properties of a **PluralRules** object. @@ -695,7 +695,7 @@ Creates a **RelativeTimeFormat** object. | Name | Type | Mandatory | Description | | -------------------- | ---------------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | No | Options for creating a **RelativeTimeFormat** object. | +| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions9) | No | Options for creating a **RelativeTimeFormat** object. | **Example** ```js @@ -787,7 +787,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects. ``` -## RelativeTimeFormatInputOptions8+ +## RelativeTimeFormatInputOptions9+ Represents the properties of a **RelativeTimeFormat** object. diff --git a/en/application-dev/reference/apis/js-apis-observer.md b/en/application-dev/reference/apis/js-apis-observer.md index ae5b7999bd7e579179920a73fcaea6116890ff70..2d56d02d2ec4e0f2117266569cb5bfd905f1b338 100644 --- a/en/application-dev/reference/apis/js-apis-observer.md +++ b/en/application-dev/reference/apis/js-apis-observer.md @@ -9,7 +9,7 @@ The **observer** module provides event subscription management functions. You ca ## Modules to Import -```js +``` import observer from '@ohos.telephony.observer' ``` @@ -17,7 +17,7 @@ import observer from '@ohos.telephony.observer' on\(type: \'networkStateChange\', callback: Callback\): void; -Registers an observer for network status change events. This API uses an asynchronous callback to return the result. +Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -30,6 +30,18 @@ Registers an observer for network status change events. This API uses an asynchr | type | string | Yes | Network status change event. | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | 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 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -43,7 +55,7 @@ observer.on('networkStateChange', data =>{ 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 result. +Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -54,9 +66,21 @@ Registers an observer for network status change events of the SIM card in the sp | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | type | string | Yes | Network status change event. | -| 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 | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | 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 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -70,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data =>{ off\(type: \'networkStateChange\', callback?: Callback\): void; -Unregisters the observer for network status change events. This API uses an asynchronous callback to return the result. +Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -85,6 +109,14 @@ Unregisters the observer for network status change events. This API uses an asyn | type | string | Yes | Network status change event. | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| +| 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 @@ -101,7 +133,7 @@ observer.off('networkStateChange'); on\(type: \'signalInfoChange\', callback: Callback\>): void; -Registers an observer for signal status change events. This API uses an asynchronous callback to return the result. +Registers an observer for signal status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -109,9 +141,21 @@ Registers an observer for signal status change events. This API uses an asynchro | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Signal status change event. | +| type | string | Yes | Signal information change event. | | 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 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -125,7 +169,7 @@ observer.on('signalInfoChange', data =>{ 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 result. +Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -133,10 +177,22 @@ Registers an observer for signal status change events of the SIM card in the spe | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | -| type | string | Yes | Signal status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| type | string | Yes | Signal information change event. | +| 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).| +**Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -150,7 +206,7 @@ observer.on('signalInfoChange', {slotId: 0}, data =>{ off\(type: \'signalInfoChange\', callback?: Callback\>): void; -Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the result. +Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -162,9 +218,20 @@ Unregisters the observer for signal status change events. This API uses an async | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Signal status change event. | +| type | string | Yes | Signal information change event. | | callback | Callback\> | No | 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 | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -182,7 +249,7 @@ observer.off('signalInfoChange'); on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: string }\>): void; -Registers an observer for call status change events. This API uses an asynchronous callback to return the result. +Registers an observer for call status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -193,6 +260,17 @@ Registers an observer for call status change events. This API uses an asynchrono | type | string | Yes | Call status change event. | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**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 @@ -206,7 +284,7 @@ observer.on('callStateChange', value =>{ on(type: 'callStateChange', options: { slotId: number }, callback: Callback<{ state:CallState, number: string }>): void; -Registers an observer for call status change events. This API uses an asynchronous callback to return the result. +Registers an observer for call status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -215,9 +293,20 @@ Registers an observer for call status change events. This API uses an asynchrono | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | Call status change event. | -| 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 | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**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 @@ -231,7 +320,7 @@ observer.on('callStateChange', {slotId: 0}, value =>{ off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: string }>): void; -Unregisters the observer for call status change events. This API uses an asynchronous callback to return the result. +Unregisters the observer for call status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -246,6 +335,17 @@ Unregisters the observer for call status change events. This API uses an asynchr | type | string | Yes | Call status change event. | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | No | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**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 @@ -263,7 +363,7 @@ observer.off('callStateChange'); on\(type: 'cellularDataConnectionStateChange', callback: Callback\<{ state: DataConnectState, network: RatType}\>\): void; -Registers an observer for connection status change events of the cellular data connection.This API uses an asynchronous callback to return the result. +Registers an observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -271,9 +371,20 @@ Registers an observer for connection status change events of the cellular data c | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data connection. | +| type | string | Yes | Connection status change event of the cellular data link. | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| +**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 @@ -287,7 +398,7 @@ observer.on('cellularDataConnectionStateChange', value =>{ on\(type: 'cellularDataConnectionStateChange', options: { slotId: number }, callback: Callback\<{ state: DataConnectState, network: RatType }\>\): void; -Registers an observer for connection status change events of the cellular data connection over the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Registers an observer for connection status change events of the cellular data link over the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -295,10 +406,21 @@ Registers an observer for connection status change events of the cellular data c | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data connection. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| type | string | Yes | Connection status change event of the cellular data link. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | Yes | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| +**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 @@ -312,7 +434,7 @@ observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{ off\(type: 'cellularDataConnectionStateChange', callback?: Callback\<{ state: DataConnectState, network: RatType}\>\): void; -Unregisters the observer for connection status change events of the cellular data connection.This API uses an asynchronous callback to return the result. +Unregisters the observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result. >**NOTE** > @@ -324,9 +446,20 @@ Unregisters the observer for connection status change events of the cellular dat | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data connection. | +| type | string | Yes | Connection status change event of the cellular data link. | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | No | Callback used to return the result. For details, see [DataConnectState](js-apis-telephony-data.md#dataconnectstate) and [RadioTechnology](js-apis-radio.md#radiotechnology).| +**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 @@ -355,6 +488,17 @@ Registers an observer for the uplink and downlink data flow status change events | type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**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 @@ -377,9 +521,20 @@ Registers an observer for the uplink and downlink data flow status change events | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | -| 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 | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**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 @@ -408,6 +563,17 @@ Unregisters the observer for the uplink and downlink data flow status change eve | type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | No | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**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 @@ -436,6 +602,17 @@ Registers an observer for SIM card status change events. This API uses an asynch | type | string | Yes | SIM card status change event. | | callback | Callback\<[SimStateData](#simstatedata7)\> | 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 @@ -458,9 +635,20 @@ Registers an observer for status change events of the SIM card in the specified | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | SIM card status change event. | -| 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 | Callback\<[SimStateData](#simstatedata7)\> | 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 @@ -489,6 +677,17 @@ Unregisters the observer for SIM card status change events. This API uses an asy | type | string | Yes | SIM card status change event. | | callback | Callback\<[SimStateData](#simstatedata7)\> | 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 | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -531,8 +730,8 @@ Enumerates SIM card types and states. **System capability**: SystemCapability.Telephony.StateRegistry -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| type | [CardType](js-apis-sim.md#cardtype) | Yes| SIM card type. For details, see [CardType](js-apis-sim.md#cardtype).| -| state | [SimState](js-apis-sim.md#simstate) | Yes| SIM card status. For details, see [SimState](js-apis-sim.md#simstate).| -| reason8+ | [LockReason](#lockreason8) | Yes| SIM card lock type.| +| Name | Type | Mandatory| Description | +| ------------------- | ----------------------------------- | ---- | -------------------------------------------------------- | +| type | [CardType](js-apis-sim.md#cardtype) | Yes | SIM card type. For details, see [CardType](js-apis-sim.md#cardtype).| +| state | [SimState](js-apis-sim.md#simstate) | Yes | SIM card status. For details, see [SimState](js-apis-sim.md#simstate).| +| reason8+ | [LockReason](#lockreason8) | Yes | SIM card lock type. | diff --git a/en/application-dev/reference/apis/js-apis-radio.md b/en/application-dev/reference/apis/js-apis-radio.md index e004b48719c7204e420ba9acb40580907c09b6ec..1df1b8d7dd61ca1c5a92b65c1557aed3697a36e0 100644 --- a/en/application-dev/reference/apis/js-apis-radio.md +++ b/en/application-dev/reference/apis/js-apis-radio.md @@ -10,7 +10,7 @@ The **radio** module provides basic network search management functions. You can ## Modules to Import ``` -import radio from '@ohos.telephony.radio' +import radio from '@ohos.telephony.radio'; ``` ## radio.getRadioTech @@ -45,7 +45,7 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified ```js let slotId = 0; -radio.getRadioTech(slotId, (err, data) =>{ +radio.getRadioTech(slotId, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -127,7 +127,7 @@ Obtains the network status. This API uses an asynchronous callback to return the **Example** ```js -radio.getNetworkState((err, data) =>{ +radio.getNetworkState((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2464,7 +2464,7 @@ Defines the signal strength. | --------------- | --------------------------- | ---- | ------------------ | | signalType | [NetworkType](#networktype) | Yes | Signal strength type.| | signalLevel | number | Yes | Signal strength level.| -| dBm9+| number | Yes | Network signal strength. | +| dBm9+| number | Yes | Signal strength, in dBm. | ## NetworkType diff --git a/en/application-dev/reference/apis/js-apis-runninglock.md b/en/application-dev/reference/apis/js-apis-runninglock.md index bddad259f782ca6ece549da06ab6ae4e69bbc441..e25ca6bcb1381a41f8491fcb8c50b2e65e5929e1 100644 --- a/en/application-dev/reference/apis/js-apis-runninglock.md +++ b/en/application-dev/reference/apis/js-apis-runninglock.md @@ -482,7 +482,7 @@ Enumerates the types of **RunningLock** objects. **System capability:** SystemCapability.PowerManager.PowerManager.Core -| Name | Value | Description | -| ------------------------ | ---- | -------------------------------------- | -| BACKGROUND | 1 | A lock that prevents the system from hibernating when the screen is off. | -| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen.| +| Name | Value | Description | +| --------------------------------- | ---- | ------------------------------------------------------------ | +| BACKGROUND(deprecated) | 1 | A lock that prevents the system from hibernating when the screen is off.
**NOTE**
This parameter is supported since API version 7 and deprecated since API version 10.| +| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen. | diff --git a/en/application-dev/reference/apis/js-apis-sim.md b/en/application-dev/reference/apis/js-apis-sim.md index 0c0243c3dbe85939b1da5623baac1b3137926e15..f8d5e0d75a5425fcade12cd6f8f90e8cc5ee720a 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 Management) +# @ohos.telephony.sim (SIM) -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. +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. >**NOTE** > @@ -121,7 +121,7 @@ promise.then(data => { 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. +Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -132,6 +132,17 @@ Checks whether the application (caller) has been granted the operator permission | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -144,7 +155,7 @@ sim.hasOperatorPrivileges(0, (err, data) => { hasOperatorPrivileges(slotId: number): Promise -Checks whether the application (caller) has been granted the carrier permission. This API uses a promise to return the result. +Checks whether the application (caller) has been granted the operator permission. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -160,6 +171,17 @@ Checks whether the application (caller) has been granted the carrier permission. | :----------------- | :---------------------------------------------------------- | | Promise\ | Promise used to return the result. The value **true** indicates that the application (caller) has been granted the carrier permission, and the value **false** indicates the opposite.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -184,7 +206,18 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use | 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. which is an ISO country code, for example, **CN** (China).| +| callback | AsyncCallback\ | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).| + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** @@ -215,6 +248,17 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use | ----------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the result, which is an ISO country code, for example, **CN** (China).| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -231,7 +275,7 @@ promise.then(data => { 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. +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. **System capability**: SystemCapability.Telephony.CoreService @@ -242,6 +286,17 @@ Obtains the public land mobile network (PLMN) ID of the SIM card in the specifie | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -271,6 +326,17 @@ Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promi | ----------------- | ------------------------------------------------ | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -287,7 +353,7 @@ promise.then(data => { 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. +Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -298,6 +364,17 @@ Obtains the service provider name (SPN) of the SIM card in the specified slot. T | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -311,7 +388,7 @@ sim.getSimSpn(0, (err, data) => { getSimSpn\(slotId: number\): Promise -Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -327,6 +404,17 @@ Obtains the SPN of the SIM card in the specified slot. This API uses a promise t | ----------------- | ----------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -343,7 +431,7 @@ promise.then(data => { getSimState\(slotId: number, callback: AsyncCallback\): void -Obtains the status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the state of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -354,6 +442,17 @@ Obtains the status of the SIM card in the specified slot. This API uses an async | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[SimState](#simstate)\> | Yes | Callback used to return the result. For details, see [SimState](#simstate). | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -367,7 +466,7 @@ sim.getSimState(0, (err, data) => { getSimState\(slotId: number\): Promise -Obtains the status of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains the state of the SIM card in the specified slot. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -383,6 +482,17 @@ Obtains the status of the SIM card in the specified slot. This API uses a promis | -------------------------------- | ------------------------------------------ | | Promise\<[SimState](#simstate)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -409,6 +519,17 @@ Obtains the type of the SIM card in the specified slot. This API uses an asynchr | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[CardType](#cardtype7)\> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -438,6 +559,17 @@ Obtains the type of the SIM card in the specified slot. This API uses a promise | ----------------- | ------------------------------------------------------------ | | Promise\<[CardType](#cardtype7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -465,6 +597,17 @@ Checks whether the SIM card in the specified slot is installed. This API uses an | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -494,6 +637,17 @@ Checks whether the SIM card in the specified slot is installed. This API uses a | --------------------- | ---------------------------------- | | Promise<boolean> | Promise used to return the result. The value **true** indicates that the SIM card in the specified slot is installed, and the value **false** indicates the opposite.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -509,7 +663,7 @@ promise.then(data => { getSimAccountInfo(slotId: number, callback: AsyncCallback): void -Obtains account information of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains SIM card account information. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -524,6 +678,19 @@ Obtains account information of the SIM card in the specified slot. This API uses | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[IccAccountInfo](#iccaccountinfo7)\> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -537,7 +704,7 @@ sim.getSimAccountInfo(0, (err, data) => { getSimAccountInfo(slotId: number): Promise -Obtains account information of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains SIM card account information. This API uses a promise to return the result. **System API**: This is a system API. @@ -557,6 +724,19 @@ Obtains account information of the SIM card in the specified slot. This API uses | -------------------------------------------- | ------------------------------------------ | | Promise<[IccAccountInfo](#iccaccountinfo7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -586,6 +766,18 @@ Obtains the account information list of the active SIM card. This API uses an as | -------- | ----------------------------------------------------------- | ---- | ---------- | | callback | AsyncCallback\\> | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -613,6 +805,18 @@ Obtains the account information list of the active SIM card. This API uses a pro | ---------------------------------------------------- | ---------------------------------------------- | | Promise\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -643,6 +847,19 @@ Sets the default slot ID of the SIM card that provides voice services. This API | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: Clears the default configuration.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js @@ -676,6 +893,19 @@ Sets the default slot ID of the SIM card that provides voice services. This API | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js @@ -707,6 +937,18 @@ Sets a display name for the SIM card in the specified slot. This API uses an asy | name | string | Yes | SIM card name. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -741,6 +983,18 @@ Sets a display name for the SIM card in the specified slot. This API uses a prom | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -772,6 +1026,18 @@ Obtains the name of the SIM card in the specified slot. This API uses an asynchr | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -805,6 +1071,18 @@ Obtains the name of the SIM card in the specified slot. This API uses a promise | --------------------- | -------------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -836,6 +1114,18 @@ Sets a display number for the SIM card in the specified slot. This API uses an a | number | string | Yes | SIM card number. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -871,6 +1161,18 @@ Sets a display number for the SIM card in the specified slot. This API uses a pr | -------------- | ------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -902,6 +1204,18 @@ Obtains the display number of the SIM card in the specified slot. This API uses | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -935,6 +1249,18 @@ Obtains the display number of the SIM card in the specified slot. This API uses | --------------------- | --------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -950,7 +1276,7 @@ promise.then(data => { activateSim(slotId: number, callback: AsyncCallback): void -Activates the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Activates a SIM card in a specified card slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -965,6 +1291,18 @@ Activates the SIM card in the specified slot. This API uses an asynchronous call | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -998,6 +1336,18 @@ Activates the SIM card in the specified slot. This API uses a promise to return | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1013,7 +1363,7 @@ promise.then(data => { deactivateSim(slotId: number, callback: AsyncCallback): void -Deactivates the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Disables the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1028,6 +1378,18 @@ Deactivates the SIM card in the specified slot. This API uses an asynchronous ca | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1041,7 +1403,7 @@ sim.deactivateSim(0, (err, data) => { deactivateSim(slotId: number): Promise\ -Deactivates the SIM card in the specified slot. This API uses a promise to return the result. +Disables the SIM card in the specified slot. This API uses a promise to return the result. **System API**: This is a system API. @@ -1061,6 +1423,18 @@ Deactivates the SIM card in the specified slot. This API uses a promise to retur | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1090,7 +1464,20 @@ Sets the lock status of the SIM card in the specified slot. This API uses an asy | -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. | -| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- **lockType**: [LockType](#locktype8)
- **password**: string
- **state**: [LockState](#lockstate8) | +| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- lockType: [LockType](#locktype8)
- password: string
- state: [LockState](#lockstate8) | + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -1123,7 +1510,7 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom | Name | Type | Mandatory| Description | | ------- | ---------------------- | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- **lockType**: [LockType](#locktype8)
- **password**: string
- **state**: [LockState](#lockstate8) | +| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- lockType: [LockType](#locktype8)
- password: string
- state: [LockState](#lockstate8) | **Return value** @@ -1131,6 +1518,19 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom | ---------------------------------------------------- | -------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1167,6 +1567,19 @@ Obtains the lock status of the SIM card in the specified slot. This API uses an | callback | AsyncCallback\<[LockState](#lockstate8)\> | Yes | Callback used to return the result. | | options | [LockType](#locktype8) | Yes | Lock type.
- **1**: PIN lock
- **2**: PIN 2 lock| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1201,6 +1614,19 @@ Obtains the lock status of the SIM card in the specified slot. This API uses a p | ---------------------------------- | -------------------------------------------- | | Promise<[LockState](#lockstate8)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1233,6 +1659,19 @@ Changes the PIN of the SIM card in the specified slot. This API uses an asynchro | newPin | string | Yes | New PIN. | | oldPin | string | Yes | Old PIN. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1268,6 +1707,19 @@ Changes the PIN of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | --------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1300,6 +1752,19 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses an asynchrono | newPin2 | string | Yes | New PIN. | | oldPin2 | string | Yes | Old PIN. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1335,6 +1800,19 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses a promise to | ---------------------------------------------------- | --------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1350,7 +1828,7 @@ promise.then(data => { unlockPin(slotId: number, pin: string, callback: AsyncCallback): void -Unlocks PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Unlocks the PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1366,6 +1844,19 @@ Unlocks PIN of the SIM card in the specified slot. This API uses an asynchronous | pin | string | Yes | PIN of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1401,6 +1892,19 @@ Unlocks the PIN of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1415,7 +1919,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. @@ -1434,6 +1938,19 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchro | puk | string | Yes | PUK of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1471,6 +1988,19 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1501,9 +2031,22 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses an asynchrono | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| pin2 | string | Yes | PIN 2 of the SIM card. | +| pin2 | string | Yes | PIN of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1531,7 +2074,7 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| pin2 | string | Yes | PIN 2 of the SIM card. | +| pin2 | string | Yes | PIN of the SIM card. | **Return value** @@ -1539,6 +2082,19 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to | ----------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1569,9 +2125,22 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses an asynchrono | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | newPin2 | string | Yes | New PIN 2. | -| puk2 | string | Yes | PUK 2 of the SIM card. | +| puk2 | string | Yes | PUK of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1601,7 +2170,7 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to | ------- | ------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | newPin2 | string | Yes | New PIN 2. | -| puk2 | string | Yes | PUK 2 of the SIM card. | +| puk2 | string | Yes | PUK of the SIM card. | **Return value** @@ -1609,6 +2178,19 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1646,7 +2228,7 @@ console.log("Result: "+ sim.getMaxSimCount()) getSimIccId(slotId: number, callback: AsyncCallback): void -Obtains the IC card identity (ICCID) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the ICCID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1661,6 +2243,18 @@ Obtains the IC card identity (ICCID) of the SIM card in the specified slot. This | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1694,6 +2288,18 @@ Obtains the ICCID of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1724,6 +2330,18 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1757,6 +2375,18 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot | ---------------- | ------------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1787,6 +2417,18 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1820,6 +2462,18 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API | ---------------- | ------------------------------------------------ | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1831,6 +2485,7 @@ promise.then(data => { }); ``` + ## sim.setVoiceMailInfo8+ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback): void @@ -1852,6 +2507,19 @@ Sets voice mailbox information for the SIM card in the specified slot. This API | mailNumber | string | Yes | Voice mailbox number. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1887,6 +2555,19 @@ Sets voice mailbox information for the SIM card in the specified slot. This API | -------------- | ----------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1902,7 +2583,7 @@ promise.then(data => { getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void -Obtains the mobile subscriber ISDN number (MSISDN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the MSISDN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1917,6 +2598,18 @@ Obtains the mobile subscriber ISDN number (MSISDN) of the SIM card in the specif | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1950,6 +2643,18 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses a promis | ---------------- | -------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1980,6 +2685,18 @@ Obtains the group identifier level 1 (GID1) of the SIM card in the specified slo | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2013,6 +2730,18 @@ Obtains the GID1 of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2043,6 +2772,18 @@ Obtains the international mobile subscriber identity (IMSI) of the SIM card in t | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2076,6 +2817,18 @@ Obtains the IMSI of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2106,6 +2859,18 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2139,6 +2904,18 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP | --------------------------------------------------- | ----------------------------- | | Promise> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2167,8 +2944,21 @@ Queries contact numbers of the SIM card in the specified slot. This API uses an | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | -| callback | AsyncCallback> | Yes | Callback used to return the result. | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING| +| callback | AsyncCallback> | Yes | Callback used to return the result. | + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2196,13 +2986,26 @@ Queries contact numbers of the SIM card in the specified slot. This API uses a p | Name| Type | Mandatory| Description | | ------ | ----------- | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING| **Return value** | Type | Description | | ------------------------------------------------------------ | ------------------------------ | -| Promise> | Promise used to return the result.| +| Promise> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2236,6 +3039,19 @@ Adds contact numbers for the SIM card in the specified slot. This API uses an as | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2274,7 +3090,20 @@ Adds contact numbers for the SIM card in the specified slot. This API uses a pro | Type | Description | | -------------- | --------------------------- | -| Promise | Promise used to return the result.| +| Promise | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2312,12 +3141,27 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", - number: "138xxxxxxxx" + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); @@ -2349,7 +3193,20 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a | Type | Description | | -------------- | --------------------------- | -| Promise | Promise used to return the result.| +| Promise | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2387,12 +3244,27 @@ Updates contact numbers for the SIM card in the specified slot. This API uses an | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", - number: "138xxxxxxxx" + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); @@ -2426,14 +3298,26 @@ Updates contact numbers for the SIM card in the specified slot. This API uses a | -------------- | ----------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", number: "138xxxxxxxx", - recordNumber: 123, - pin2: "1234" + recordNumber: 123 }; let promise = sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); promise.then(data => { @@ -2461,7 +3345,19 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a | -------- | -------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | cmd | string | Yes | Envelope command. | -| callback | AsyncCallback | Yes | Yes | +| callback | AsyncCallback | Yes | Callback used to return the result. | + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** @@ -2497,6 +3393,18 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a | -------------- | --------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2525,9 +3433,21 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| cmd | string | Yes | Command | +| cmd | string | Yes | Envelope command. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2554,7 +3474,7 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| cmd | string | Yes | Command | +| cmd | string | Yes | Envelope command. | **Return value** @@ -2562,6 +3482,18 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | -------------- | --------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2573,11 +3505,12 @@ promise.then(data => { }); ``` + ## sim.unlockSimLock8+ 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. +Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -2593,6 +3526,19 @@ Unlocks the SIM card in the specified slot. This API uses an asynchronous callba | lockInfo | [PersoLockInfo](#persolockinfo8) | Yes | Personalized lock information. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2610,7 +3556,7 @@ sim.unlockSimLock(0, persoLockInfo, (err, data) => { unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise -Unlocks the SIM card in the specified slot. This API uses a promise to return the result. +Unlocks the SIM card in the specified slot. This API uses a promise to return the result. **System API**: This is a system API. @@ -2631,6 +3577,19 @@ Unlocks the SIM card in the specified slot. This API uses a promise to return th | ---------------------------------------------------- | ------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2652,8 +3611,6 @@ 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. -**System API**: This is a system API. - **System capability**: SystemCapability.Telephony.CoreService **Parameters** @@ -2661,14 +3618,34 @@ Obtains the opkey of the SIM card in the specified slot. This API uses an asynch | 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. | +| callback | AsyncCallback | Yes | Callback used to return the result. | + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** ```js -sim.getOpKey(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); +try { + sim.getOpKey(0, (err, data) => { + if (err) { + console.log("getOpKey failed, err: " + JSON.stringify(err)); + } else { + console.log('getOpKey successfully, data: ' + JSON.stringify(data)); + } + }); +} catch (err) { + console.log("getOpKey err: " + JSON.stringify(err)); +} ``` @@ -2692,15 +3669,27 @@ Obtains the opkey of the SIM card in the specified slot. This API uses a promise | ---------------- | ----------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = sim.getOpKey(0); -promise.then(data => { +try { + let data = sim.getOpKey(0); console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.log(`getOpKey failed, promise: err->${JSON.stringify(err)}`); -}); +} catch (error) { + console.log(`getOpKey failed, promise: err->${JSON.stringify(error)}`); +} ``` ## sim.getOpName9+ @@ -2718,12 +3707,32 @@ Obtains the OpName of the SIM card in the specified slot. This API uses an async | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -sim.getOpName(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); +try { + sim.getOpName(0, (err, data) => { + if (err) { + console.log("getOpName failed, err: " + JSON.stringify(err)); + } else { + console.log('getOpName successfully, data: ' + JSON.stringify(data)); + } + }); +} catch (err) { + console.log("getOpName err: " + JSON.stringify(err)); +} ``` @@ -2747,15 +3756,27 @@ Obtains the OpName of the SIM card in the specified slot. This API uses a promis | ---------------- | ------------------------------------------ | | Promise | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = sim.getOpName(0); -promise.then(data => { +try { + let data = sim.getOpName(0); console.log(`getOpName success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.log(`getOpName failed, promise: err->${JSON.stringify(err)}`); -}); +} catch (error) { + console.log(`getOpName failed, promise: err->${JSON.stringify(error)}`); +} ``` ## SimState @@ -2781,16 +3802,16 @@ Enumerates SIM card types. | Name| Value| Description| | ----- | ----- | ----- | -|UNKNOWN_CARD | -1 | Unknown| -|SINGLE_MODE_SIM_CARD | 10 | Single-card (SIM)| -|SINGLE_MODE_USIM_CARD | 20 | Single-card (USIM)| -|SINGLE_MODE_RUIM_CARD | 30 | Single-card (RUIM)| -|DUAL_MODE_CG_CARD | 40 | Dual-card (CDMA+GSM)| -|CT_NATIONAL_ROAMING_CARD | 41 | China Telecom internal roaming card| -|CU_DUAL_MODE_CARD | 42 | China Unicom dual-mode card| -|DUAL_MODE_TELECOM_LTE_CARD | 43 | China Telecom dual-mode LTE card| -|DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM)| -|SINGLE_MODE_ISIM_CARD8+ | 60 | Single-card (ISIM)| +|UNKNOWN_CARD | -1 | Unknown type.| +|SINGLE_MODE_SIM_CARD | 10 | Single-card (SIM).| +|SINGLE_MODE_USIM_CARD | 20 | Single-card (USIM).| +|SINGLE_MODE_RUIM_CARD | 30 | Single-card (RUIM).| +|DUAL_MODE_CG_CARD | 40 | Dual-card (CDMA+GSM).| +|CT_NATIONAL_ROAMING_CARD | 41 | China Telecom internal roaming card.| +|CU_DUAL_MODE_CARD | 42 | China Unicom dual-mode card.| +|DUAL_MODE_TELECOM_LTE_CARD | 43 | China Telecom dual-mode LTE card.| +|DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM).| +|SINGLE_MODE_ISIM_CARD8+ | 60 | Single-card (ISIM).| ## LockType8+ @@ -2841,30 +3862,30 @@ Enumerates personalized lock types. ## LockStatusResponse7+ -Defines the lock status response. +Defines the personalized lock information. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| result | number | Yes | Operation result. | -| remain?: number | number | Yes | Remaining attempts (can be null).| +| Name | Type | Mandatory| Description | +| --------------- | ------ | ---- | --------------------- | +| result | number | Yes | Operation result. | +| remain?: number | number | No | Remaining attempts (can be null).| ## LockInfo8+ -Defines the lock information. +Defines the personalized lock information. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| lockType | [LockType](#locktype8) | Yes | Lock type.| -| password | string | Yes | Password. | -| state | [LockState](#lockstate8) | Yes | Lock state.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------ | ---- | -------- | +| lockType | [LockType](#locktype8) | Yes | Lock type.| +| password | string | Yes | Password. | +| state | [LockState](#lockstate8) | Yes | Lock state.| ## PersoLockInfo8+ @@ -2874,10 +3895,10 @@ Defines the personalized lock information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.| -| password | string | Yes | Password. | +| Name | Type | Mandatory| Description | +| -------- | -------------------------------- | ---- | ------------- | +| lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.| +| password | string | Yes | Password. | ## IccAccountInfo7+ @@ -2887,15 +3908,15 @@ Defines the ICC account information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| simId | number | Yes | SIM card ID. | -| slotIndex | number | Yes | Card slot ID. | -| isEsim | boolean | Yes | Whether the SIM card is an eSim card.| -| isActive | boolean | Yes | Whether the card is activated. | -| iccId | string | Yes | ICCID number. | -| showName | string | Yes | SIM card display name. | -| showNumber | string | Yes | SIM card display number. | +| Name | Type | Mandatory| Description | +| ---------- | ------- | ---- | ---------------- | +| simId | number | Yes | SIM card ID. | +| slotIndex | number | Yes | Card slot ID. | +| isEsim | boolean | Yes | Whether the SIM card is an eSim card.| +| isActive | boolean | Yes | Whether the card is activated. | +| iccId | string | Yes | ICCID number. | +| showName | string | Yes | SIM card display name. | +| showNumber | string | Yes | SIM card display number. | ## OperatorConfig8+ @@ -2905,10 +3926,10 @@ Defines the carrier configuration. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| field | string | Yes | Field. | -| value | string | Yes | Value. | +| Name | Type | Mandatory| Description| +| ----- | ------ | ---- | ---- | +| field | string | Yes | Field.| +| value | string | Yes | Value. | ## DiallingNumbersInfo8+ @@ -2918,12 +3939,12 @@ Defines the contact number information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| alphaTag | string | Yes | Alpha tag. | -| number | string | Yes | Contact number. | -| recordNumber | number | Yes | Record number.| -| pin2 | string | Yes | PIN 2.| +| Name | Type | Mandatory| Description | +| ------------ | ------ | ---- | ---------- | +| alphaTag | string | Yes | Tag. | +| number | string | Yes | Call transfer number. | +| recordNumber | number | Yes | Record number.| +| pin2 | string | Yes | PIN 2.| ## ContactType8+ @@ -2934,7 +3955,7 @@ Enumerates contact types. **System capability**: SystemCapability.Telephony.CoreService | Name | Value | Description | -| -------------- | ---- | ---------- | +| --------------- | ---- | ---------- | | GENERAL_CONTACT | 1 | Common contact number.| | FIXED_DIALING | 2 | Fixed dialing number. | @@ -2946,8 +3967,8 @@ Enumerates carrier configuration keys. **System capability**: SystemCapability.Telephony.CoreService -| Name | Value | Description | -| ------------------------------------------------------- | ---------------------------------------------------- | -------------------- | +| Name | Value | Description | +| ------------------------------------------------------- | ------------------------------------------------------ | -------------------- | | KEY_VOICE_MAIL_NUMBER_STRING | "voice_mail_number_string" | Voice mailbox number. | | KEY_IMS_SWITCH_ON_BY_DEFAULT_BOOL | "ims_switch_on_by_default_bool" | Fixed dialing number. | | KEY_HIDE_IMS_SWITCH_BOOL | "hide_ims_switch_bool" | Whether to hide the IMS switch. | @@ -2960,7 +3981,7 @@ Enumerates carrier configuration keys. | KEY_IMS_PREFER_FOR_EMERGENCY_BOOL | "ims_prefer_for_emergency_bool" | IMS preferences for emergency. | | KEY_CALL_WAITING_SERVICE_CLASS_INT | "call_waiting_service_class_int" | Call waiting service. | | KEY_CALL_TRANSFER_VISIBILITY_BOOL | "call_transfer_visibility_bool" | Call transfer visibility. | -| KEY_IMS_CALL_DISCONNECT_REASONINFO_MAPPING_STRING_ARRAY | "ims_call_disconnect_reasoninfo_mapping_string_array" | List of IMS call disconnection reasons.| +| KEY_IMS_CALL_DISCONNECT_REASON_INFO_MAPPING_STRING_ARRAY| "ims_call_disconnect_reason_info_mapping_string_array" | List of IMS call disconnection reasons.| | KEY_FORCE_VOLTE_SWITCH_ON_BOOL | "force_volte_switch_on_bool" | Whether to forcibly turn on VoLTE. | | KEY_ENABLE_OPERATOR_NAME_CUST_BOOL | "enable_operator_name_cust_bool" | Whether to display the carrier name.| | KEY_OPERATOR_NAME_CUST_STRING | "operator_name_cust_string" | Carrier name. | diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md index 901e3b258b7aa73530935baa81a6366f7aa50e65..c3a1f35f5140514d466ae481876fe1114c2b43e8 100644 --- a/en/application-dev/reference/apis/js-apis-sms.md +++ b/en/application-dev/reference/apis/js-apis-sms.md @@ -16,7 +16,7 @@ import sms from '@ohos.telephony.sms'; createMessage\(pdu: Array<number>, specification: string, callback: AsyncCallback\): void -Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. This API uses an asynchronous callback to return the result. +Creates an SMS instance based on the protocol data unit (PDU) and specified SMS protocol. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -44,7 +44,7 @@ sms.createMessage(pdu, specification, (err, data) => { createMessage\(pdu: Array<number>, specification: string\): Promise -Creates an SMS message instance based on the PDU and the specified SMS protocol. This API uses a promise to return the result. +Creates an SMS instance based on the PDU and specified SMS protocol. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -81,7 +81,7 @@ sendMessage(options: SendMessageOptions): void Sends an SMS message. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -114,7 +114,7 @@ sms.sendMessage(options); getDefaultSmsSlotId\(callback: AsyncCallback<number>\): void -Obtains the default slot of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. +Obtains the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -122,7 +122,7 @@ Obtains the default slot of the SIM card used to send SMS messages. This API use | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ---------------------------------------- | -| callback | AsyncCallback<number> | Yes | Callback used to return the result.
- **0**: card slot 1
- **1**: card slot 2| +| callback | AsyncCallback<number> | Yes | Callback used to return the result.
- **0**: card slot 1
- **1**: card slot 2| **Example** @@ -137,7 +137,7 @@ sms.getDefaultSmsSlotId((err, data) => { getDefaultSmsSlotId\(\): Promise<number> -Obtains the default slot of the SIM card used to send SMS messages. This API uses a promise to return the result. +Obtains the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -162,11 +162,11 @@ promise.then(data => { setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback<void>\): void -Sets the default slot of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. +Sets the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.SmsMms @@ -174,9 +174,21 @@ Sets the default slot of the SIM card used to send SMS messages. This API uses a | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: clearing 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<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -190,11 +202,11 @@ sms.setDefaultSmsSlotId(0, (err, data) => { setDefaultSmsSlotId\(slotId: number\): Promise<void> -Sets the default slot of the SIM card used to send SMS messages. This API uses a promise to return the result. +Sets the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.SmsMms @@ -202,13 +214,25 @@ Sets the default slot of the SIM card used to send SMS messages. This API uses a | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: clearing 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** -| Type | Description | -| -------------- | ------------------------------- | -| Promise\ | Promise used to return the result. | +| Type | Description | +| --------------- | ------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** @@ -229,7 +253,7 @@ Sets the short message service center (SMSC) address. This API uses an asynchron **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -241,6 +265,17 @@ Sets the short message service center (SMSC) address. This API uses an asynchron | smscAddr | string | Yes | SMSC address. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -260,7 +295,7 @@ Sets the SMSC address. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -277,6 +312,17 @@ Sets the SMSC address. This API uses a promise to return the result. | ------------------- | ------------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -299,7 +345,7 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r **System API**: This is a system API. -**Required permission**: ohos.permission.GET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -310,6 +356,17 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -328,7 +385,7 @@ Obtains the SMSC address. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.GET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -344,6 +401,17 @@ Obtains the SMSC address. This API uses a promise to return the result. | --------------------- | --------------------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -360,7 +428,7 @@ promise.then(data => { hasSmsCapability(): boolean -Checks whether the current device can send and receive SMS messages. This API returns the result synchronously. +Checks whether the current device can send and receive SMS messages. This API works in synchronous mode. **System capability**: SystemCapability.Telephony.SmsMms @@ -383,7 +451,7 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call **System API**: This is a system API. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -394,6 +462,17 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call | content | string | Yes | SMS message content. The value cannot be null.| | callback | AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -412,7 +491,7 @@ Splits an SMS message into multiple segments. This API uses a promise to return **System API**: This is a system API. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -428,6 +507,17 @@ Splits an SMS message into multiple segments. This API uses a promise to return | ----------------------- | ----------------------------------- | | Promise> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -448,7 +538,7 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -459,6 +549,17 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. | options | [SimMessageOptions](#simmessageoptions7) | Yes | SIM message options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -482,7 +583,7 @@ Adds a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -498,6 +599,17 @@ Adds a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -523,7 +635,7 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -535,6 +647,17 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu | msgIndex | number | Yes | Message index. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -554,7 +677,7 @@ Deletes a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -571,6 +694,17 @@ Deletes a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -592,7 +726,7 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -603,6 +737,17 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu | options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | Yes | SIM message updating options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -627,7 +772,7 @@ Updates a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -643,6 +788,17 @@ Updates a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -669,7 +825,7 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -680,6 +836,17 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -698,7 +865,7 @@ Obtains all SIM card messages. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -714,6 +881,17 @@ Obtains all SIM card messages. This API uses a promise to return the result. | ------------------------------------------------------- | ---------------------------------- | | PromiseArray<[SimShortMessage](#simshortmessage7)\>> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -734,7 +912,7 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -745,6 +923,17 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to | options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -769,7 +958,7 @@ Sets the cell broadcast configuration. This API uses a promise to return the res **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -785,6 +974,17 @@ Sets the cell broadcast configuration. This API uses a promise to return the res | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -820,7 +1020,17 @@ Obtains SMS message segment information. This API uses an asynchronous callback | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | message | string | Yes | SMS message. | | force7bit | boolean | Yes | Whether to use 7-bit coding. | -| callback | | Yes | Callback used to return the result. | +| callback | AsyncCallback<[SmsSegmentsInfo](#smssegmentsinfo8)> | Yes | Callback used to return the result. | + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -847,14 +1057,24 @@ Obtains SMS message segment information. This API uses a promise to return the r | Name | Type | Mandatory| Description | | --------- | ------- | ---- | ----------------------------------------- | | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| message | string | Yes | Message | +| message | string | Yes | SMS message. | | force7bit | boolean | Yes | Whether to use 7-bit coding. | **Return value** | Type | Description | | ------------------------------------------------------- | ----------------------------- | -| | Promise used to return the result.| +| Promise<[SmsSegmentsInfo](#smssegmentsinfo8)> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -885,6 +1105,16 @@ Checks whether SMS is supported on IMS. This API uses an asynchronous callback t | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -899,7 +1129,7 @@ sms.isImsSmsSupported(slotId, (err, data) => { isImsSmsSupported(slotId: number): Promise -Checks whether SMS is supported on IMS. This API uses a promise to return the result. +This API uses an asynchronous callback to return the result. This API uses a promise to return the result. **System API**: This is a system API. @@ -917,6 +1147,16 @@ Checks whether SMS is supported on IMS. This API uses a promise to return the re | ---------------------- | ----------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -945,6 +1185,17 @@ Obtains the SMS format supported by the IMS. This API uses an asynchronous callb | -------- | --------------------------- | ---- | ---------- | | callback | AsyncCallback<string> | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -970,6 +1221,17 @@ Obtains the SMS format supported by the IMS. This API uses a promise to return t | --------------------- | -------------------------- | | Promise<string> | Promise used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -998,6 +1260,16 @@ Decodes MMS messages. This API uses an asynchronous callback to return the resul | mmsFilePathName | string \|Array | Yes | MMS message file path.| | callback | AsyncCallback<[MmsInformation](#mmsinformation8)> | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1030,6 +1302,16 @@ Decodes MMS messages. This API uses a promise to return the result. | --------------------------------------------------------- | --------------------------- | | Promise<<[MmsInformation](#mmsinformation8)>> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1046,7 +1328,7 @@ promise.then(data => { encodeMms(mms: MmsInformation, callback: AsyncCallback>): void -Encodes MMS messages. This API uses an asynchronous callback to return the result. +MMS message code. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1059,6 +1341,16 @@ Encodes MMS messages. This API uses an asynchronous callback to return the resul | mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.| | callback | AsyncCallback<Array> | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1081,7 +1373,7 @@ sms.encodeMms(mmsInformation, (err, data) => { encodeMms(mms: MmsInformation): Promise> -Encodes MMS messages. This API uses a promise to return the result. +MMS message code. This API uses a promise to return the result. **System API**: This is a system API. @@ -1099,6 +1391,16 @@ Encodes MMS messages. This API uses a promise to return the result. | ----------------------------- | ----------------------------------- | | Promise<Array> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1125,19 +1427,19 @@ Defines an SMS message instance. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| hasReplyPath | boolean | Yes |Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.
**TP-Reply-Path**: The device returns a response based on the SMSC that sends the SMS message.| -| isReplaceMessage | boolean | Yes |Whether the received SMS message is a **replace short message**. The default value is **false**.
For details, see section 9.2.3.9 in **3GPP TS 23.040**.| -| isSmsStatusReportMessage | boolean | Yes |Whether the received SMS message is an SMS delivery status report. The default value is **false**.
**SMS-Status-Report**: a message sent from the SMSC to the mobile station to show the SMS message delivery status.| -| messageClass | [ShortMessageClass](#shortmessageclass) | Yes | SMS message type. | -| pdu | Array<number> | Yes | PDU in the SMS message. | -| protocolId | number | Yes | Protocol identifier used for delivering the SMS message. | -| scAddress | string | Yes | SMSC address. | -| scTimestamp | number | Yes | SMSC timestamp. | -| status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.| -| visibleMessageBody | string | Yes | SMS message body. | -| visibleRawAddress | string | Yes | Sender address. | +| Name | Type | Mandatory| Description | +| ------------------------ | --------------------------------------- | ---- | ------------------------------------------------------------ | +| hasReplyPath | boolean | Yes | Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.
TP-Reply-Path: The device returns a response based on the SMSC that sends the SMS message. | +| isReplaceMessage | boolean | Yes | Whether the received SMS message is a **replace short message**. The default value is **false**.
For details, see section 9.2.3.9 in **3GPP TS 23.040**.| +| isSmsStatusReportMessage | boolean | Yes | Whether the received SMS message is an SMS delivery report. The default value is **false**.
SMS delivery report: a message sent from the SMSC to show the current status of the SMS message you delivered.| +| messageClass | [ShortMessageClass](#shortmessageclass) | Yes | Enumerates SMS message types. | +| pdu | Array<number> | Yes | PDU in the SMS message. | +| protocolId | number | Yes | Protocol identifier used for delivering the SMS message. | +| scAddress | string | Yes | SMSC address. | +| scTimestamp | number | Yes | SMSC timestamp. | +| status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.| +| visibleMessageBody | string | Yes | SMS message body. | +| visibleRawAddress | string | Yes | Sender address. | ## ShortMessageClass @@ -1161,7 +1463,7 @@ Provides the options (including callbacks) for sending an SMS message. For examp **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Slot ID of the SIM card used for sending SMS messages.
- **0**: card slot 1
- **1**: card slot 2 | | destinationHost | string | Yes | Destination address of the SMS message. | @@ -1178,22 +1480,22 @@ Provides the callback for the SMS message sending result. It consists of three p **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------- | ---- | ------------------------------------------------------------ | +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------- | ---- | ----------------------------------------------------------------------------------------- | | isLastPart | boolean | No | Whether this SMS message is the last part of a long SMS message. The value **true** indicates that this SMS message is the last part of a long SMS message, and value **false** indicates the opposite. The default value is **false**.| -| result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. | -| url | string | Yes | URI for storing the sent SMS message. | +| result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. | +| url | string | Yes | URI for storing the sent SMS message. | ## IDeliveryShortMessageCallback -Provides the callback for the SMS message delivery report. +Provides the callback for the SMS message delivery report. **System capability**: SystemCapability.Telephony.SmsMms | Name| Type | Mandatory| Description | -| ------ | ------------------- | ---- | -------------- | -| pdu | Array<number> | Yes | SMS message delivery report.| +| ---- | ------------------- | ---- | -------------- | +| pdu | Array<number> | Yes | SMS message delivery report.| ## SendSmsResult @@ -1209,7 +1511,6 @@ Enumerates SMS message sending results. | SEND_SMS_FAILURE_RADIO_OFF | 2 | Failed to send the SMS message because the modem is shut down. | | SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | Failed to send the SMS message because the network is unavailable or SMS message sending or receiving is not supported.| - ## MmsInformation8+ Defines the MMS message information. @@ -1218,10 +1519,10 @@ Defines the MMS message information. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | -| ----------- | ------------------------------------------------------------ | ---- | --------- | -| messageType | [MessageType](#messagetype8) | Yes | Message type. | -| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8)| Yes | PDU header type.| +| Name | Type | Mandatory| Description | +| ----------- | ------------------------------------------------------------ | ---- | ---------- | +| messageType | [MessageType](#messagetype8) | Yes | Message type.| +| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8) | Yes | PDU header type.| | attachment | Array<[MmsAttachment](#mmsattachment8)\> | No | Attachment. | ## MmsSendReq8+ @@ -1232,13 +1533,13 @@ Defines an MMS message sending request. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | ------------------------------------ | ---- | ------------ | | from | [MmsAddress](#mmsaddress8) | Yes | MMS message source. | | transactionId | string | Yes | Transaction ID. | | contentType | string | Yes | Content type. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | -| to | Array<[MmsAddress](#mmsaddress8)\> | No | Address to which the message is sent. | +| to | Array<[MmsAddress](#mmsaddress8)\> | No | Destination address. | | date | number | No | Date. | | cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | | bcc | Array<[MmsAddress](#mmsaddress8)\> | No | Blind carbon copy. | @@ -1258,7 +1559,7 @@ Defines the MMS message sending configuration. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | responseState | number | Yes | Response status.| | transactionId | string | Yes | Transaction ID. | @@ -1273,7 +1574,7 @@ Defines an MMS notification index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | messageClass | number | Yes | Message class. | @@ -1281,7 +1582,7 @@ Defines an MMS notification index. | expiry | number | Yes | Expiration. | | contentLocation | string | Yes | Content location.| | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | -| from | [MmsAddress](#mmsaddress8) | No | Source. | +| from | [MmsAddress](#mmsaddress8) | No | Source address. | | subject | string | No | Subject. | | deliveryReport | number | No | Status report.| | contentClass | number | No | Content class. | @@ -1294,7 +1595,7 @@ Defines an MMS confirmation index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | @@ -1308,15 +1609,15 @@ Defines the MMS message retrieval configuration. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | ------------------------------------ | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | messageId | string | Yes | Message ID. | | date | number | Yes | Date. | | contentType | string | Yes | Content type.| -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent. | -| version | [MmsVersionType](#mmsversiontype8) | Yes | Version | -| from | [MmsAddress](#mmsaddress8) | No | Source. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | +| from | [MmsAddress](#mmsaddress8) | No | Source address. | | cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | | subject | string | No | Subject. | | priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. | @@ -1333,16 +1634,15 @@ Defines the original MMS message reading index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------- | ---------------------------------- | ---- | -------- | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | messageId | string | Yes | Message ID. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent. | -| from | [MmsAddress](#mmsaddress8) | Yes | Source. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | | date | number | Yes | Date. | | readStatus | number | Yes | Read status.| - ## MmsReadRecInd8+ Defines the MMS message reading index. @@ -1351,16 +1651,15 @@ Defines the MMS message reading index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------- | ---------------------------------- | ---- | -------- | -| version | [MmsVersionType](#mmsversiontype8) | Yes | Version | +| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | messageId | string | Yes | Message ID. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination. | -| from | [MmsAddress](#mmsaddress8) | Yes | Source. | -| readStatus | number | Yes | Read state.| +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | +| readStatus | number | Yes | Read status.| | date | number | No | Date. | - ## MmsAttachment8+ Defines the attachment of an MMS message. @@ -1369,7 +1668,7 @@ Defines the attachment of an MMS message. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ----------------------- | ------------------------------------ | ---- | ------------------ | | contentId | string | Yes | Content ID. | | contentLocation | string | Yes | Content location. | @@ -1378,7 +1677,7 @@ Defines the attachment of an MMS message. | contentType | string | Yes | Content type. | | isSmil | boolean | Yes | Whether the synchronized multimedia integration language is used.| | path | string | No | Path. | -| inBuff | Array | No | In the buffer | +| inBuff | Array | No | Whether the message is in the buffer. | | fileName | string | No | File name. | | charset | [MmsCharSets](#mmscharsets8) | No | Character set. | @@ -1390,20 +1689,20 @@ Defines an MMSC address. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------- | ---------------------------- | ---- | ------ | -| address | string | Yes | MMSC address. | +| address | string | Yes | Network address. | | charset | [MmsCharSets](#mmscharsets8) | Yes | Character set.| ## MessageType8+ -Enumerates message types. +Message type. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ------------------------- | ---- | -------------------- | | TYPE_MMS_SEND_REQ | 128 | MMS message sending request. | | TYPE_MMS_SEND_CONF | 129 | MMS message sending configuration. | @@ -1423,7 +1722,7 @@ Enumerates MMS message priorities. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ---------- | ---- | -------------- | | MMS_LOW | 128 | Low priority. | | MMS_NORMAL | 129 | Normal priority.| @@ -1437,7 +1736,7 @@ Enumerates MMS versions. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | --------------- | ---- | ----------- | | MMS_VERSION_1_0 | 0x10 | MMS version 1_0.| | MMS_VERSION_1_1 | 0x11 | MMS version 1_1.| @@ -1452,7 +1751,7 @@ Enumerates MMS character sets. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | --------------- | ------ | ------------------- | | BIG5 | 0X07EA | BIG5 format. | | ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2 format.| @@ -1477,7 +1776,7 @@ Enumerates disposition types. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ---------- | ---- | -------- | | FROM_DATA | 0 | Data source.| | ATTACHMENT | 1 | Attachment. | @@ -1491,7 +1790,7 @@ Enumerates report types. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description| +| Name | Value | Description| | ------- | ---- | ---- | | MMS_YES | 128 | YES | | MMS_NO | 129 | NO | @@ -1504,7 +1803,7 @@ Defines the cell broadcast configuration options. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | -------------------- | ---- | ------------ | | slotId | number | Yes | Card slot ID. | | enable | boolean | Yes | Whether to enable cell broadcast. | @@ -1520,7 +1819,7 @@ Defines the SIM message status. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ------------------------- | ---- | --------------------------- | | SIM_MESSAGE_STATUS_FREE | 0 | Free state. | | SIM_MESSAGE_STATUS_READ | 1 | Read state. | @@ -1530,13 +1829,13 @@ Defines the SIM message status. ## RanType7+ -Enumerates RAN types. +RAN type. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description| +| Name | Value | Description| | --------- | ---- | ---- | | TYPE_GSM | 1 | GSM | | TYPE_CDMA | 2 | CMDA | @@ -1549,7 +1848,7 @@ Enumerates SMS encoding schemes. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | -------------------- | ---- | ------------ | | SMS_ENCODING_UNKNOWN | 0 | Unknown code.| | SMS_ENCODING_7BIT | 1 | 7-digit code. | @@ -1564,12 +1863,12 @@ Defines the SIM message options. **System capability**: SystemCapability.Telephony.SmsMms -| Name| Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------ | -------------------------------------- | ---- | -------------- | | slotId | number | Yes | Card slot ID. | | smsc | string | Yes | Short message service center.| | pdu | string | Yes | Protocol data unit. | -| status | [SimMessageStatus](#simmessagestatus7) | Yes | Message status. | +| status | [SimMessageStatus](#simmessagestatus7) | Yes | Status. | ## UpdateSimMessageOptions7+ @@ -1579,7 +1878,7 @@ Defines the updating SIM message options. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------- | -------------------------------------- | ---- | -------------- | | slotId | number | Yes | Card slot ID. | | msgIndex | number | Yes | Message index. | @@ -1595,7 +1894,7 @@ Defines a SIM message. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | -------------------------------------- | ---- | ------------- | | shortMessage | [ShortMessage](#shortmessage) | Yes | SMS message. | | simMessageStatus | [SimMessageStatus](#simmessagestatus7) | Yes | SIM message status.| @@ -1609,12 +1908,12 @@ Defines an MMS message delivery index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------- | ---------------------------------- | ---- | ------ | | messageId | string | Yes | Message ID.| | date | number | Yes | Date. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent.| -| status | number | Yes | Status. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address.| +| status | number | Yes | Status | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | ## MmsRespInd8+ @@ -1625,10 +1924,10 @@ Defines an MMS response index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Event ID. | -| status | number | Yes | Status. | +| status | number | Yes | Status | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | reportAllowed | [ReportType](#reporttype8) | No | Report allowed.| @@ -1640,7 +1939,7 @@ Defines the SMS message segment information. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------------- | ---------------------------------------- | ---- | ------------ | | splitCount | number | Yes | Split count. | | encodeCount | number | Yes | Encoding count. | 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 f1c9ad362175bd709d27bc4c7aec0059b413221e..4521aa0eac78b15b8c5644b53aac44fc59b2f648 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** > @@ -85,7 +85,7 @@ setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\): v Sets the default slot of the SIM card used for mobile data. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -98,6 +98,19 @@ This is a system API. | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js @@ -112,7 +125,7 @@ setDefaultCellularDataSlotId(slotId: number): Promise\ Sets the default slot of the SIM card used for mobile data. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -130,6 +143,19 @@ This is a system API. | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js @@ -251,6 +277,17 @@ Checks whether the cellular data service is enabled. This API uses an asynchrono | -------- | ------------------------ | ---- | ------------------------------------------------------------ | | callback | AsyncCallback\ | Yes | Callback used to return the result.
**true**: The cellular data service is enabled.
**false**: The cellular data service is disabled.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -275,6 +312,17 @@ Checks whether the cellular data service is enabled. This API uses a promise to | ------------------ | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.
**true**: The cellular data service is enabled.
**false**: The cellular data service is disabled.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -303,6 +351,17 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -333,6 +392,17 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | ------------------ | ------------------------------------------------------------ | | Promise\ | Promise 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -350,7 +420,7 @@ enableCellularData(callback: AsyncCallback): void Enables the cellular data service. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -362,6 +432,17 @@ This is a system API. | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -376,7 +457,7 @@ enableCellularData(): Promise Enables the cellular data service. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -388,6 +469,17 @@ This is a system API. | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -405,7 +497,7 @@ disableCellularData(callback: AsyncCallback): void Disables the cellular data service. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -417,6 +509,17 @@ This is a system API. | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -431,7 +534,7 @@ disableCellularData(): Promise Disables the cellular data service. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -443,6 +546,17 @@ This is a system API. | --------------- | --------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -460,7 +574,7 @@ enableCellularDataRoaming(slotId: number, callback: AsyncCallback): void Enables the cellular data roaming service. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -473,6 +587,17 @@ This is a system API. | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -487,7 +612,7 @@ enableCellularDataRoaming(slotId: number): Promise Enables the cellular data roaming service. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -505,6 +630,17 @@ This is a system API. | --------------- | ------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -522,7 +658,7 @@ disableCellularDataRoaming(slotId: number, callback: AsyncCallback): void Disables the cellular data roaming service. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -535,6 +671,17 @@ This is a system API. | 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** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -549,7 +696,7 @@ disableCellularDataRoaming(slotId: number): Promise Disables the cellular data roaming service. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -567,6 +714,17 @@ This is a system API. | --------------- | ------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js diff --git a/en/application-dev/reference/errorcodes/errorcode-telephony.md b/en/application-dev/reference/errorcodes/errorcode-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..f90efffed3589a42344d27fcbbf641872e295a96 --- /dev/null +++ b/en/application-dev/reference/errorcodes/errorcode-telephony.md @@ -0,0 +1,172 @@ +# Telephony Error Codes + +## 8300001 Input Parameter Value Out of Range + +**Error Message** + +The input parameter value is out of range. + +**Description** + +This error code is reported if the value of the input parameter (for example, **slotId**) is not within the valid range. In this case, the API call will fail and the corresponding operation cannot be performed. + +**Cause** + +The input parameter value is invalid. + +**Solution** + +Enter a valid parameter value. + + + +## 8300002 Service Connection Error + +**Error Message** + +Operation failed. Cannot connect to service. + +**Description** + +This error code is reported if the attempt to connect to a service fails. + +**Cause** + +Service startup or IPC connection has failed. + +**Solution** + +Operation error. Try again later. + + + +## 8300003 System Internal Error + +**Error Message** + +System internal error. + +**Description** + +This error code is reported if an internal error has occurred. + +**Cause** + +The possible cause is that data read/write has failed because the network is abnormal. + +**Solution** + +Operation error. Try again later. + + +## 8300004 SIM Card Not Detected + +**Error Message** + +Do not have sim card. + +**Description** + +This error code is reported if no SIM card is detected. + +**Cause** + +No SIM card is inserted or the SIM card is not properly inserted. + +**Solution** + +Insert the SIM card or remove and insert the SIM card again. + + +## 8300999 Unknown Error + +**Error Message** + +Unknown error code. + +**Description** + +This error code is reported if an unknown error occurs. + +**Cause** + +An unexpected error occurs in the system. The possible cause is that error codes of the bottom layer are not within the processing range. + +**Solution** + +Operation error. Try again later. + + +## 8301001 SIM Card Not Activated + +**Error Message** + +SIM card is not activated. + +**Description** + +This error code is reported if the SIM card is not activated. + +**Cause** + +The SIM card is not activated. + +**Solution** + +Activate the SIM card. + + +## 8301002 Failed to Read or Update SIM Card Data + +**Error Message** + +SIM card operation error. + +**Description** + +This error code is reported if the attempt to read or update SIM card data has failed. + +**Cause** + +The SIM card does not support the operation, or the SIM card is damaged. + +**Solution** + +Contact the SIM card supplier, or replace the SIM card. + + +## 8301003 Incorrect SIM Card Configuration + +**Error Message** + +Operator config error. + +**Description** + +This error code is reported if the SIM card configuration is incorrect. + +**Cause** + +The configuration file delivered with the SIM card is not properly preconfigured. + +**Solution** + +Check whether the correct SIM card is inserted. + +## 8401001 Failed to Connect to the UT + +**Error Message** + +UT is not connected. + +**Description** + +This error code is reported if the UT is not connected. + +**Cause** + +The current carrier does not support sending of UT requests over a Wi-Fi network, but the mobile phone is connected to the Wi-Fi network. + +**Solution** + +Disconnect the Wi-Fi connection, and send a new UT request. diff --git a/en/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md b/en/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md index 9b8204bc76167f4287c9e9f09e8a5a6ebfc9fea1..c74833145c8213f6df04bc5a9ca29e63df9671ce 100644 --- a/en/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md +++ b/en/device-dev/subsystems/subsys-dfx-hisysevent-logging-config.md @@ -1,94 +1,108 @@ -# HiSysEvent Logging Configuration +# HiSysEvent Logging Configuration -## Overview -If HiSysEvent logging is required for a component, you need to define a YAML file and [configure the YAML file path](#section123181432175135) in the **bundle.json** file. During compilation, the OpenHarmony compilation framework will use the Python compilation script to parse and verify all the YAML files configured in the **bundle.json** file. On completion, the compilation framework will summarize the configuration information in the YAML files and convert the information into a JSON file named **hisysevent.def**. After that, the compilation framework will put the JSON file to a specified path as the basis for the system to determine whether to log system events. +## Overview -### Basic Concepts + +### Function Introduction + +If HiSysEvent logging is required for a component, you need to define a YAML file and [configure the YAML file path](#configuring-the-yaml-file-path) in the **bundle.json** file. During compilation, the OpenHarmony compilation framework will use the Python compilation script to parse and verify all the YAML files configured in the **bundle.json** file. On completion, the compilation framework will summarize the configuration information in the YAML files and convert the information into a JSON file named **hisysevent.def**. After that, the compilation framework will put the JSON file to a specified path as the basis for the system to determine whether to log system events. + + +### Basic Concepts Understanding the following concepts would be helpful for you in configuring HiSysEvent logging. -- Event domain - Represents the domain to which an event belongs. It is specified by the **domain** field in the YAML file. For details, see [domain](#section123181432175123) in the example YAML file. +- Event domain
Represents the domain to which an event belongs. It is specified by the **domain** field in the YAML file. For details, see [domain](#example) in the example YAML file. -- Event name - Indicates the events in an event domain. For details, see [EVENT\_NAMEA/EVENT\_NAMEB](#section123181432175123) in the example YAML file. +- Event name
Indicates the events in an event domain. For details, see [EVENT\_NAMEA/EVENT\_NAMEB](#example) in the example YAML file. -- Parameter - Defines the key values in an event name. For details, see [__BASE/NAME1/NAME2](#section123181432175123) in the example YAML file. +- Parameter
Defines the key values in an event name. For details, see [__BASE/NAME1/NAME2](#example) in the example YAML file. -### Constraints +### Constraints + +Constraints on the event domain, event name, and parameter - Each YAML file can contain only one event domain, and the domain name cannot be the same as that defined in other YAML files. - Zero or more event names can be defined for one event domain. The event names in the same event domain must be unique. -- Multiple parameters can be defined for one event name. The parameters in the same event name must be unique. There must be one and only one parameter named **\__BASE** in each event name. See Table 1 for the fields of this parameter and Table 2 for the fields of other custom parameters. - - **Table 1** Fields in the \__BASE parameter +- Multiple parameters can be defined for one event name. The parameters in the same event name must be unique. There must be only one parameter named **__BASE** in each event name. See Table 1 for the fields of this parameter and Table 2 for the fields of other custom parameters. + **Table 1** Fields in the \__BASE parameter + + | Field| Description| + | -------- | -------- | + | type | Event type. This field is mandatory.
Value:
- FAULT: fault
- STATISTIC: statistics
- SECURITY: security
- BEHAVIOR: user behavior| + | level | Event level. This field is mandatory.
Value:
- CRITICAL: critical
- MINOR: minor| + | tag | Event tag. This field is mandatory.
Rule:
- You can define a maximum of five tags, separated with a space.
- A single tag can contain a maximum of 16 characters, including a to z, A to Z, and 0 to 9.| + | desc | Event name. This field is mandatory.
Rule:
The description contains 3 to 128 characters, including a to z, A to Z, 0 to 9, and underscores (_).| + + **Table 2** Description of custom parameters + | Field| Description| - | ----- | ----- | - | type | Indicates the type of the event. This field is mandatory.

Value:
  • **FAULT**: fault
  • **STATISTIC**: statistics
  • **SECURITY**: security
  • **BEHAVIOR**: user behavior
| - | level | Indicates the level of the event. This field is mandatory.

Value:
  • **CRITICAL**: critical
  • **MINOR**: minor
| - | tag | Indicates the tag of the event. This field is mandatory.

Rule:
  • You can define a maximum of five tags separated with a space.
  • A single tag can contain a maximum of 16 characters, including a to z, A to Z, and 0 to 9.
| - | desc | Describes the event name. This field is mandatory.

Rule:
  • The description contains 3 to 128 characters, including a to z, A to Z, 0 to 9, and underscores (_).
| + | -------- | -------- | + | type | Parameter type. This field is mandatory.
Value:
- BOOL
- INT8
- UINT8
- INT16
- UINT16
- INT32
- UINT32
- INT64
- UINT64
- FLOAT
- DOUBLE
- STRING | + | arrsize | Length of the parameter of the array type. This field is optional.
Value:
1-100| + | desc | Parameter description. This field is mandatory.
Rule:
The description contains 3 to 128 characters, including a to z, A to Z, 0 to 9, and underscores (_).| - **Table 2** Description of custom parameters - | Field| Description| - | ----- | ----- | - | type | Indicates the type of a parameter. This field is mandatory.

Value:
  • BOOL
  • UINT8
  • UINT16
  • INT32
  • UINT32
  • UINT64
  • FLOAT
  • DOUBLE
  • STRING
| - | arrsize | Specifies the length of the parameter of the array type. This field is optional.

Value range:
  • 1-100
| - | desc | Describes the parameter. This field is mandatory.

Rule:
  • The description contains 3 to 128 characters, including a to z, A to Z, 0 to 9, and underscores (_).
| +## Writing a YAML File + + +### Writing Rules + +- Event domain naming rules: + - The name must start with a letter and can contain only uppercase letters, digits, and underscores (_). + - The name contains 1 to 16 characters. -## Writing a YAML File +- Event naming rules: + - The name must start with a letter and can contain only uppercase letters, digits, and underscores (_). + - The name contains 1 to 32 characters. + - The number of internal event names in an event domain cannot exceed 4096. -### Writing Rules +- Parameter naming rules: + - The name must start with a letter and can contain only uppercase letters, digits, and underscores (_). + - The name contains 1 to 32 characters. + - The number of parameters in an event domain cannot exceed 128. -- Event domain naming rules: - - The name must start with a letter and can contain only uppercase letters, digits, and underscores (_). - - The name contains 1 to 16 characters. -- Event naming rules: - - The name must start with a letter and can contain only uppercase letters, digits, and underscores (_). - - The name contains 1 to 32 characters. - - The number of internal event names in an event domain cannot exceed 4096. -- Parameter naming rules: - - The name must start with a letter and can contain only uppercase letters, digits, and underscores (_). - - The name contains 1 to 32 characters. - - The number of parameters in an event domain cannot exceed 128. -### Example +### Example -- In the example YAML file, the event domain name is **MODULEA**. The event domain contains two events named **EVENT\_NAMEA** and **EVENT\_NAMEB**. -- **EVENT\_NAMEA** is defined as a critical event of the fault type. The event contains the **NAME1** parameter of the string type, the **NAME2** parameter of the string type, and the **NAME3** parameter of the unsigned short integer type. Therefore, you can perform [real-time subscription](subsys-dfx-hisysevent-listening.md) to the event based on the event domain **MODULEA** and event name **EVENT\_NAMEA**. -- **EVENT\_NAMEB** is defined as a general event of the statistics type. The event contains the **NAME1** parameter of the unsigned short integer type and the **NAME2** parameter of the integer type. Because two event tags named **tag1** and **tag2** are defined for **EVENT\_NAMEB** in the **\__BASE** parameter, you can perform [real-time subscription](subsys-dfx-hisysevent-listening.md) to the event based on the event domain **MODULEA** and event name **EVENT\_NAMEB**, or based on the event tag. +- In the example YAML file, the event domain name is **MODULEA**. The event domain contains two events named **EVENT_NAMEA** and **EVENT_NAMEB**. - ``` - ########################################## - # HiSysEvent definition for MODULEA - ########################################## +- **EVENT\_NAMEA** is defined as a critical event of the fault type. The event contains the **NAME1** parameter of the string type, the **NAME2** parameter of the string type, and the **NAME3** parameter of the unsigned short integer type. Therefore, you can perform [real-time subscription](../subsystems/subsys-dfx-hisysevent-listening.md) to the event based on the event domain **MODULEA** and event name **EVENT\_NAMEA**. - domain: MODULEA +- **EVENT\_NAMEB** is defined as a general event of the statistics type. The event contains the **NAME1** parameter of the unsigned short integer type and the **NAME2** parameter of the integer type. Because two event tags named **tag1** and **tag2** are defined for **EVENT\_NAMEB** in the **\__BASE** parameter, you can perform [real-time subscription](../subsystems/subsys-dfx-hisysevent-listening.md) to the event based on the event domain **MODULEA** and event name **EVENT\_NAMEB**, or based on the event tag. + + ``` + ########################################## + # the hisysevent definition for module a # + ########################################## + + domain: MODULEA + + EVENT_NAMEA: + __BASE: {type: FAULT, level: CRITICAL, desc: event name a} + NAME1: {type: STRING, desc: name1} + NAME2: {type: STRING, desc: name2} + NAME3: {type: UINT16, desc: name3} + + EVENT_NAMEB: + __BASE: {type: STATISTIC, level: MINOR, tag: tag1 tag2, desc: event name b} + NAME1: {type: UINT16, desc: name1} + NAME2: {type: INT32, desc: name2} + ``` - EVENT_NAMEA: - __BASE: {type: FAULT, level: CRITICAL, desc: event name a} - NAME1: {type: STRING, desc: name1} - NAME2: {type: STRING, desc: name2} - NAME3: {type: UINT16, desc: name3} - EVENT_NAMEB: - __BASE: {type: STATISTIC, level: MINOR, tag: tag1 tag2, desc: event name b} - NAME1: {type: UINT16, desc: name1} - NAME2: {type: INT32, desc: name2} - ``` +## Verifying the YAML File -## Verifying the YAML File -### Configuring the YAML File Path +### Configuring the YAML File Path + +In the **bundle.json** file, use the **hisysevent_config** attribute to specify the YAML file path. -In the **bundle.json** file, use the ```hisysevent_config``` attribute to specify the YAML file path. ``` { @@ -131,45 +145,47 @@ In the **bundle.json** file, use the ```hisysevent_config``` attribute to specif } ``` ->![](../public_sys-resources/icon-note.gif) **Note:** ->The YAML file can be placed in any directory of the component project as needed. You only need to specify the path in the **bundle.json** file. - -### Compiling the YAML File - -- Perform full compilation. - - During full compilation of the system, the configuration in the YAML files of all components are summarized. After the compilation is complete, the **hisysevent.def** file will be generated in the specified directory. +> **NOTE**
+> The YAML file can be placed in any directory of the component project as needed. You only need to specify the path in the **bundle.json** file. - ``` - cd absolute path of the project's root directory - ./build --product-name - ``` - - To obtain the **hisysevent.def** file generated after full compilation, run the following command: +### Compiling YAML Files - ``` - cd absolute path of the project's root directory - find out -name hisysevent.def -type f - ``` +- Perform full compilation. + - During full compilation of the system, the configurations in the YAML files of all components are summarized. After the compilation is complete, the **hisysevent.def** file will be generated in the specified directory. + + ``` + cd *absolute path of the project's root directory* + ./build --product-name + ``` -- Single-file compilation: + - To obtain the **hisysevent.def** file generated after full compilation, run the following commands: + + ``` + cd absolute path of the project's root directory + find out -name hisysevent.def -type f + ``` - You can also compile the YAML file of a single component by running the following commands: +- Single-file compilation: + You can also compile the YAML file of a single component by running the following commands: - ``` - cd absolute path of the project's root directory - ./build/ohos/hisysevent/gen_def_from_all_yaml.py --yaml-list --def-path - ``` + + ``` + cd absolute path of the project's root directory + ./build/ohos/hisysevent/gen_def_from_all_yaml.py --yaml-list --def-path + ``` - **Table 3** Parameters for single-file compilation + **Table 3** Parameters for single-file compilation + + | Option| Description| + | -------- | -------- | + | --yaml-list | Paths of the YAML files to be compiled. If there are multiple YAML file paths, separate each of them with a space.| + | --def-path | Path of the **hisysevent.def** file generated after compilation.| - | Parameter| Description| - | ------ | ------ | - | --yaml-list | Specifies the paths of the YAML files to be compiled. If there are multiple YAML file paths, separate each of them with a space.| - | --def-path | Specifies the path of the **hisysevent.def** file generated after compilation.| -### Logging and Querying Events +### Logging and Querying Events -1. Push the **hisysevent.def** file to the **/system/etc/hiview/** directory of the device by using the [hdc_std tool](subsys-toolchain-hdc-guide.md). +1. Push the **hisysevent.def** file to the **/system/etc/hiview/** directory of the device by using the [hdc_std tool](../subsystems/subsys-toolchain-hdc-guide.md). -2. Trigger logging of the custom system events in the YAML file. Then, run [hisysevent -l](subsys-dfx-hisysevent-tool.md) to query historical system events to find out if the logging of the custom system events is successful. +2. Trigger logging of the custom system events in the YAML file. Then, run [hisysevent -l](../subsystems/subsys-dfx-hisysevent-tool.md) to query historical system events to find out if the logging of the custom system events is successful. diff --git a/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-power.md b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-power.md new file mode 100644 index 0000000000000000000000000000000000000000..c4506242ea6b189ec9a403e0b5ce85d2490f1b34 --- /dev/null +++ b/en/release-notes/changelogs/OpenHarmony_4.0.3.2/changelogs-power.md @@ -0,0 +1,82 @@ +# Power Subsystem Changelog + +## cl.powermgr.1 CommonEventBatteryChangedCode API Change + +Changed the **CommonEventBatteryChangedCode** enum class in [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) as follows: + +- Changed the class name to **CommonEventBatteryChangedKey**. +- Deleted **EXTRA_MAX_CURRENT**, **EXTRA_MAX_VOLTAGE**, and **EXTRA_CHARGE_COUNTER**. +- Changed the enum value type from numeric to string. + +#### Change Impact + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +#### Key API/Component Changes + +Before change: + +| Name | Value | Description | +| -------------------- | ---- | -------------------------------------------------- | +| EXTRA_SOC | 0 | Remaining battery level in percentage. | +| EXTRA_VOLTAGE | 1 | Battery voltage of the device. | +| EXTRA_TEMPERATURE | 2 | Battery temperature of the device. | +| EXTRA_HEALTH_STATE | 3 | Battery health status of the device. | +| EXTRA_PLUGGED_TYPE | 4 | Type of the charger connected to the device. | +| EXTRA_MAX_CURRENT | 5 | Maximum battery current of the device. | +| EXTRA_MAX_VOLTAGE | 6 | Maximum battery voltage of the device. | +| EXTRA_CHARGE_STATE | 7 | Battery charging status of the device. | +| EXTRA_CHARGE_COUNTER | 8 | Number of battery charging times of the device. | +| EXTRA_PRESENT | 9 | Whether the battery is supported by the device or installed.| +| EXTRA_TECHNOLOGY | 10 | Battery technology of the device. | +| EXTRA_CAPACITY_LEVEL | 11 | Battery level of the device. | + +After change: + +| Name | Value | Description | +| -------------------- | --------------- | -------------------------------------------------- | +| EXTRA_SOC | "soc" | Remaining battery level in percentage. | +| EXTRA_CHARGE_STATE | "chargeState" | Battery charging status of the device. | +| EXTRA_HEALTH_STATE | "healthState" | Battery health status of the device. | +| EXTRA_PLUGGED_TYPE | "pluggedType" | Type of the charger connected to the device. | +| EXTRA_VOLTAGE | "voltage" | Battery voltage of the device. | +| EXTRA_TECHNOLOGY | "technology" | Battery technology of the device. | +| EXTRA_TEMPERATURE | "temperature" | Battery temperature of the device. | +| EXTRA_PRESENT | "present" | Whether the battery is supported by the device or installed.| +| EXTRA_CAPACITY_LEVEL | "capacityLevel" | Battery level of the device. | + +#### Adaptation Guide + +For details, see the API reference of the [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) API. +## cl.powermgr.2 estimatedRemainingChargeTime API Change + +Changed the **estimatedRemainingChargeTime** API in [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) to a system API. + +#### Change Impact + +The JS API needs to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected. + +#### Adaptation Guide + +For details, see the API reference of the [@ohos.batteryInfo](../../../application-dev/reference/apis/js-apis-battery-info.md) API. + +## cl.powermgr.3 System Common Event Behavior Change + +The following common events are provided in the battery information through [@ohos.commonEventManager (common event module)](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/apis/js-apis-commonEventManager.md): + +- COMMON_EVENT_BATTERY_LOW: common event for low battery level. It includes the remaining battery in percentage. +- COMMON_EVENT_BATTERY_OKAY: common event for normal battery level. It includes the remaining battery in percentage. +- COMMON_EVENT_POWER_CONNECTED: common event for connection to an external power supply. It includes the type of the power supply to which the device is connected. +- COMMON_EVENT_POWER_DISCONNECTED: common event for disconnection from an external power supply. It includes the type of the power supply from which the device is disconnected. +- COMMON_EVENT_CHARGING: common event for starting of battery charging. It includes the battery charging status. +- COMMON_EVENT_DISCHARGING: common event for ending of battery charging. It includes the battery charging status. + +Changed the method of obtaining data from common events from **CommonEventData.data** to **CommonEventData.code**. + +#### Change Impact + +The application developed based on earlier versions needs to adapt the method for obtaining common events in the battery information. Otherwise, the original service logic will be affected. + +#### Adaptation Guide + +For details, see the API reference of the [@ohos.commonEventManager (Common Event Manager)](../../../application-dev/reference/apis/js-apis-commonEventManager.md) API.