提交 46192880 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 d4cfd309
...@@ -6,7 +6,7 @@ The [intl](intl-guidelines.md) module provides basic i18n capabilities through t ...@@ -6,7 +6,7 @@ The [intl](intl-guidelines.md) module provides basic i18n capabilities through t
## Obtaining and Setting i18n Information ## 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 ### Available APIs
...@@ -30,15 +30,15 @@ The system provides APIs to configure information such as the system language, p ...@@ -30,15 +30,15 @@ The system provides APIs to configure information such as the system language, p
| System | getPreferredLanguageList()<sup>9+</sup> | Obtains the preferred language list. | | System | getPreferredLanguageList()<sup>9+</sup> | Obtains the preferred language list. |
| System | getFirstPreferredLanguage()<sup>9+</sup> | Obtains the first language in the preferred language list. | | System | getFirstPreferredLanguage()<sup>9+</sup> | Obtains the first language in the preferred language list. |
| System | getAppPreferredLanguage()<sup>9+</sup> | Obtains the preferred language of an application. | | System | getAppPreferredLanguage()<sup>9+</sup> | Obtains the preferred language of an application. |
| System | setUsingLocalDigit(flag: boolean)<sup>9+</sup> | Sets whether to enable the local digit switch. | | System | setUsingLocalDigit(flag: boolean)<sup>9+</sup> | Specifies whether to enable use of local digits. |
| System | getUsingLocalDigit()<sup>9+</sup> | Checks whether the local digit switch is turned on. | | System | getUsingLocalDigit()<sup>9+</sup> | Checks whether use of local digits is enabled. |
| | isRTL(locale:string):boolean<sup>9+</sup> | Checks whether the locale uses a right-to-left (RTL) language.| | | isRTL(locale:string):boolean<sup>9+</sup> | Checks whether the locale uses a right-to-left (RTL) language.|
### How to Develop ### How to Develop
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Obtain and set the system language. 2. Obtain and set the system language.
...@@ -51,7 +51,7 @@ The system provides APIs to configure information such as the system language, p ...@@ -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. I18n.System.setSystemLanguage("en"); // Set the system language to en.
let language = I18n.System.getSystemLanguage(); // language = "en" let language = I18n.System.getSystemLanguage(); // language = "en"
} catch(error) { } 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 ...@@ -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. I18n.System.setSystemRegion("CN"); // Set the system country to CN.
let region = I18n.System.getSystemRegion(); // region = "CN" let region = I18n.System.getSystemRegion(); // region = "CN"
} catch(error) { } 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 ...@@ -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. I18n.System.setSystemLocale("zh-Hans-CN"); // Set the system locale to zh-Hans-CN.
let locale = I18n.System.getSystemLocale(); // locale = "zh-Hans-CN" let locale = I18n.System.getSystemLocale(); // locale = "zh-Hans-CN"
} catch(error) { } 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 ...@@ -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 let rtl = I18n.isRTL("zh-CN"); // rtl = false
rtl = I18n.isRTL("ar"); // rtl = true rtl = I18n.isRTL("ar"); // rtl = true
} catch(error) { } 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 ...@@ -106,7 +106,7 @@ The system provides APIs to configure information such as the system language, p
I18n.System.set24HourClock(true); I18n.System.set24HourClock(true);
let hourClock = I18n.System.is24HourClock(); // hourClock = true let hourClock = I18n.System.is24HourClock(); // hourClock = true
} catch(error) { } 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 ...@@ -121,7 +121,7 @@ The system provides APIs to configure information such as the system language, p
let sentenceCase = false; let sentenceCase = false;
let localizedLanguage = I18n.System.getDisplayLanguage(language, locale, sentenceCase); // localizedLanguage = "English" let localizedLanguage = I18n.System.getDisplayLanguage(language, locale, sentenceCase); // localizedLanguage = "English"
} catch(error) { } 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 ...@@ -136,7 +136,7 @@ The system provides APIs to configure information such as the system language, p
let sentenceCase = false; let sentenceCase = false;
let localizedCountry = I18n.System.getDisplayCountry(country, locale, sentenceCase); // localizedCountry = "U.S." let localizedCountry = I18n.System.getDisplayCountry(country, locale, sentenceCase); // localizedCountry = "U.S."
} catch(error) { } 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 ...@@ -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 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 let countryList = I18n.System.getSystemCountries("zh"); // countryList = ["ZW", "YT", ..., "CN", "DE"], 240 countries and regions in total
} catch(error) { } 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 ...@@ -162,7 +162,7 @@ The system provides APIs to configure information such as the system language, p
try { try {
let isSuggest = I18n.System.isSuggested("zh", "CN"); // isSuggest = true let isSuggest = I18n.System.isSuggested("zh", "CN"); // isSuggest = true
} catch(error) { } 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 ...@@ -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 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. let appPreferredLanguage = I18n.System.getAppPreferredLanguage(); // Set the preferred language of the application to en-GB if the application contains en-GB resources.
} catch(error) { } 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 ...@@ -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 **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. 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 ```js
try { try {
I18n.System.setUsingLocalDigit(true); // Enable the local digit switch. I18n.System.setUsingLocalDigit(true); // Enable the local digit switch.
let status = I18n.System.getUsingLocalDigit(); // status = true let status = I18n.System.getUsingLocalDigit(); // status = true
} catch(error) { } 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 { ...@@ -220,14 +220,14 @@ try {
| Calendar | getMinimalDaysInFirstWeek():number<sup>8+</sup> | Obtains the minimum number of days in the first week of a year. | | Calendar | getMinimalDaysInFirstWeek():number<sup>8+</sup> | Obtains the minimum number of days in the first week of a year. |
| Calendar | setMinimalDaysInFirstWeek(value:number): void<sup>8+</sup> | Sets the minimum number of days in the first week of a year. | | Calendar | setMinimalDaysInFirstWeek(value:number): void<sup>8+</sup> | Sets the minimum number of days in the first week of a year. |
| Calendar | getDisplayName(locale:string):string<sup>8+</sup> | Obtains the localized display of the **Calendar** object. | | Calendar | getDisplayName(locale:string):string<sup>8+</sup> | Obtains the localized display of the **Calendar** object. |
| Calendar | isWeekend(date?:Date):boolean<sup>8+</sup> | Checks whether the specified date in this **Calendar** object is a weekend. | | Calendar | isWeekend(date?:Date):boolean<sup>8+</sup> | Checks whether a given date is a weekend in the calendar. |
### How to Develop ### How to Develop
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Instantiate a **Calendar** object. 2. Instantiate a **Calendar** object.
...@@ -254,7 +254,7 @@ try { ...@@ -254,7 +254,7 @@ try {
Call **set** to set the year, month, day, hour, minute, and second for the **Calendar** object. Call **set** to set the year, month, day, hour, minute, and second for the **Calendar** object.
```js ```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. 5. Set and obtain the time zone for the **Calendar** object.
...@@ -317,7 +317,7 @@ try { ...@@ -317,7 +317,7 @@ try {
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Instantiate a **PhoneNumberFormat** object. 2. Instantiate a **PhoneNumberFormat** object.
...@@ -359,7 +359,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. ...@@ -359,7 +359,7 @@ The **I18NUtil** class provides an API to implement measurement conversion.
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Convert a measurement unit. 2. Convert a measurement unit.
...@@ -393,7 +393,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. ...@@ -393,7 +393,7 @@ The **I18NUtil** class provides an API to implement measurement conversion.
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Instantiates an **IndexUtil** object. 2. Instantiates an **IndexUtil** object.
...@@ -418,7 +418,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. ...@@ -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. Call **addLocale** to add the alphabet index of a new locale to the current index list.
```js ```js
indexUtil.addLocale("ar") indexUtil.addLocale("ar");
``` ```
5. Obtain the index of a string. 5. Obtain the index of a string.
...@@ -454,7 +454,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc ...@@ -454,7 +454,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Instantiate a **BreakIterator** object. 2. Instantiate a **BreakIterator** object.
...@@ -462,7 +462,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc ...@@ -462,7 +462,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc
Call **getLineInstance** to instantiate a **BreakIterator** object. Call **getLineInstance** to instantiate a **BreakIterator** object.
```js ```js
let locale = "en-US" let locale = "en-US";
let breakIterator = I18n.getLineInstance(locale); let breakIterator = I18n.getLineInstance(locale);
``` ```
...@@ -531,7 +531,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc ...@@ -531,7 +531,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Instantiate the **TimeZone** object, and obtain the time zone information. 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 ...@@ -592,7 +592,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Obtains the transliterator ID list. 2. Obtains the transliterator ID list.
...@@ -637,7 +637,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to ...@@ -637,7 +637,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Check the input character has a certain attribute. 2. Check the input character has a certain attribute.
...@@ -719,7 +719,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to ...@@ -719,7 +719,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to
1. Import the **i18n** module. 1. Import the **i18n** module.
```js ```js
import I18n from '@ohos.i18n' import I18n from '@ohos.i18n';
``` ```
2. Check the sequence of year, month, and day in a date. 2. Check the sequence of year, month, and day in a date.
......
...@@ -25,7 +25,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug ...@@ -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. Importing an incorrect bundle can lead to unexpected API behavior.
```js ```js
import Intl from '@ohos.intl' import Intl from '@ohos.intl';
``` ```
2. Instantiates a **Locale** object. 2. Instantiates a **Locale** object.
...@@ -100,7 +100,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug ...@@ -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. Importing an incorrect bundle can lead to unexpected API behavior.
```js ```js
import Intl from '@ohos.intl' import Intl from '@ohos.intl';
``` ```
2. Instantiate a **DateTimeFormat** object. 2. Instantiate a **DateTimeFormat** object.
...@@ -170,7 +170,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug ...@@ -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. Importing an incorrect bundle can lead to unexpected API behavior.
```js ```js
import Intl from '@ohos.intl' import Intl from '@ohos.intl';
``` ```
2. Instantiate a **NumberFormat** object. 2. Instantiate a **NumberFormat** object.
...@@ -195,7 +195,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug ...@@ -195,7 +195,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug
```js ```js
let options = {compactDisplay: "short", notation: "compact"}; let options = {compactDisplay: "short", notation: "compact"};
let numberFormat = new Intl.NumberFormat("zh-CN", options); let numberFormat = new Intl.NumberFormat("zh-CN", options);
let number = 1234.5678 let number = 1234.5678;
let formatResult = numberFormat.format(number); // formatResult = "1235" let formatResult = numberFormat.format(number); // formatResult = "1235"
``` ```
...@@ -229,7 +229,7 @@ Users in different regions have different requirements for string sorting. [Coll ...@@ -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. Importing an incorrect bundle can lead to unexpected API behavior.
```js ```js
import Intl from '@ohos.intl' import Intl from '@ohos.intl';
``` ```
2. Instantiate a **Collator** object. 2. Instantiate a **Collator** object.
...@@ -290,7 +290,7 @@ According to grammars in certain languages, the singular or plural form of a nou ...@@ -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. Importing an incorrect bundle can lead to unexpected API behavior.
```js ```js
import Intl from '@ohos.intl' import Intl from '@ohos.intl';
``` ```
2. Instantiate a **PluralRules** object. 2. Instantiate a **PluralRules** object.
...@@ -313,7 +313,7 @@ According to grammars in certain languages, the singular or plural form of a nou ...@@ -313,7 +313,7 @@ According to grammars in certain languages, the singular or plural form of a nou
```js ```js
let pluralRules = new Intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"}); 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" 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 ...@@ -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. Importing an incorrect bundle can lead to unexpected API behavior.
```js ```js
import Intl from '@ohos.intl' import Intl from '@ohos.intl';
``` ```
2. Instantiate a **RelativeTimeFormat** object. 2. Instantiate a **RelativeTimeFormat** object.
...@@ -362,7 +362,7 @@ According to grammars in certain languages, the singular or plural form of a nou ...@@ -362,7 +362,7 @@ According to grammars in certain languages, the singular or plural form of a nou
```js ```js
let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"});
let number = 2; let number = 2;
let unit = "year" let unit = "year";
let formatResult = relativeTimeFormat.format(number, unit); // 2 years later 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 ...@@ -373,7 +373,7 @@ According to grammars in certain languages, the singular or plural form of a nou
```js ```js
let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"});
let number = 2; 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"}] 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 ...@@ -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: 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) (API9) (Full SDK)] (https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Internationalnation/International)
-[`International`: Internationalization (ArkTS) (API8) (Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/common/International)
...@@ -30,10 +30,10 @@ Describes battery information. ...@@ -30,10 +30,10 @@ Describes battery information.
| batteryTemperature | number | Yes | No | Battery temperature of the device, in unit of 0.1°C. | | batteryTemperature | number | Yes | No | Battery temperature of the device, in unit of 0.1°C. |
| isBatteryPresent<sup>7+</sup> | boolean | Yes | No | Whether the battery is supported or present. | | isBatteryPresent<sup>7+</sup> | boolean | Yes | No | Whether the battery is supported or present. |
| batteryCapacityLevel<sup>9+</sup> | [BatteryCapacityLevel](#batterycapacitylevel9) | Yes | No | Battery level of the device. | | batteryCapacityLevel<sup>9+</sup> | [BatteryCapacityLevel](#batterycapacitylevel9) | Yes | No | Battery level of the device. |
| estimatedRemainingChargeTime<sup>9+</sup> | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. **System API**: This is a system API. | | estimatedRemainingChargeTime<sup>9+</sup> | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. This is a system API. |
| totalEnergy<sup>9+</sup> | number | Yes | No | Total battery capacity of the device, in unit of mAh. **System API**: This is a system API. | | totalEnergy<sup>9+</sup> | number | Yes | No | Total battery capacity of the device, in unit of mAh. This is a system API. |
| nowCurrent<sup>9+</sup> | number | Yes | No | Battery current of the device, in unit of mA. **System API**: This is a system API. | | nowCurrent<sup>9+</sup> | number | Yes | No | Battery current of the device, in unit of mA. This is a system API. |
| remainingEnergy<sup>9+</sup> | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. **System API**: This is a system API.| | remainingEnergy<sup>9+</sup> | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. This is a system API.|
## BatteryPluggedType ## BatteryPluggedType
......
...@@ -4,32 +4,32 @@ The **call** module provides call management functions, including making calls, ...@@ -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). To subscribe to the call status, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange).
>**NOTE**<br> >**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. >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 ## Modules to Import
```js ```js
import call from '@ohos.telephony.call'; import call from '@ohos.telephony.call';
``` ```
## call.dial ## call.dial<sup>(deprecated)</sup>
dial\(phoneNumber: string, callback: AsyncCallback<boolean\>\): void dial\(phoneNumber: string, callback: AsyncCallback<boolean\>\): void
Initiates a call. This API uses an asynchronous callback to return the result. Initiates a call. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.PLACE\_CALL (a system permission) **Required Permissions**: ohos.permission.PLACE_CALL
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | ---------------------------- | ---- | -------------------------------- | | ----------- | ---------------------------- | ---- | --------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure|
**Example** **Example**
...@@ -40,23 +40,23 @@ call.dial("138xxxxxxxx", (err, data) => { ...@@ -40,23 +40,23 @@ call.dial("138xxxxxxxx", (err, data) => {
``` ```
## call.dial ## call.dial<sup>(deprecated)</sup>
dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean\>\): void dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback<boolean\>\): void
Initiates a call 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 **System capability**: SystemCapability.Telephony.CallManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | ---------------------------- | ---- | --------------------------------------- | | ----------- | ---------------------------- | ---- | --------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call. | | options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br>- **true**: success<br>- **false**: failure|
**Example** **Example**
...@@ -69,28 +69,28 @@ call.dial("138xxxxxxxx", { ...@@ -69,28 +69,28 @@ call.dial("138xxxxxxxx", {
``` ```
## call.dial ## call.dial<sup>(deprecated)</sup>
dial\(phoneNumber: string, options?: DialOptions\): Promise<boolean\> dial\(phoneNumber: string, options?: DialOptions\): Promise<boolean\>
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 **System capability**: SystemCapability.Telephony.CallManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | -------------------------------------- | | ----------- | --------------------------- | ---- | -------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | | options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | ---------------------------------------------------------------- | | ---------------------- | ------------------------------------------------------------ |
| Promise&lt;boolean&gt; | Promise used to return the result.<br>- **true**: success<br>- **false**: failure | | Promise&lt;boolean&gt; | Promise used to return the result.<br>- **true**: success<br>- **false**: failure|
**Example** **Example**
...@@ -105,6 +105,142 @@ promise.then(data => { ...@@ -105,6 +105,142 @@ promise.then(data => {
}); });
``` ```
## call.dialCall<sup>9+</sup>
dialCall\(phoneNumber: string, callback: AsyncCallback<void\>\): 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&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 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.dialCall<sup>9+</sup>
dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback<void\>\): void
Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result.
**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&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 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.dialCall<sup>9+</sup>
dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise<void\>
Initiates a call. You can set call options as needed. This API uses a promise to return the result.
**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&lt;void&gt; | Promise used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 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.makeCall<sup>7+</sup> ## call.makeCall<sup>7+</sup>
makeCall(phoneNumber: string, callback: AsyncCallback\<void\>): void makeCall(phoneNumber: string, callback: AsyncCallback\<void\>): void
...@@ -115,16 +251,27 @@ Launches the call screen and displays the dialed number. This API uses an asynch ...@@ -115,16 +251,27 @@ Launches the call screen and displays the dialed number. This API uses an asynch
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | ------------------------- | ---- | ------------------------------------------ | | ----------- | ------------------------- | ---- | ------------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
call.makeCall("138xxxxxxxx", err => { call.makeCall("138xxxxxxxx", err => {
console.log(`makeCall callback: err->${JSON.stringify(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 ...@@ -139,24 +286,35 @@ Launches the call screen and displays the dialed number. This API uses a promise
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ---------- | | ----------- | ------ | ---- | ---------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | --------------------------------- | | ------------------- | --------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result. | | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
let promise = call.makeCall("138xxxxxxxx"); let promise = call.makeCall("138xxxxxxxx");
promise.then(() => { promise.then(() => {
console.log(`makeCall success`); console.log(`makeCall success`);
}).catch(err => { }).catch(err => {
console.error(`makeCall fail, promise: err->${JSON.stringify(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 ...@@ -170,9 +328,9 @@ Checks whether a call is in progress. This API uses an asynchronous callback to
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ------------------------------------------------------------ | | -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. Callback used to return the result.<br>- **true**: A call is in progress.<br>- **false**: No call is in progress. | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. Callback used to return the result.<br>- **true**: A call is in progress.<br>- **false**: No call is in progress.|
**Example** **Example**
...@@ -195,7 +353,7 @@ Checks whether a call is in progress. This API uses a promise to return the resu ...@@ -195,7 +353,7 @@ Checks whether a call is in progress. This API uses a promise to return the resu
| Type | Description | | Type | Description |
| ---------------------- | --------------------------------------- | | ---------------------- | --------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result. | | Promise&lt;boolean&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -219,9 +377,9 @@ Obtains the call status. This API uses an asynchronous callback to return the re ...@@ -219,9 +377,9 @@ Obtains the call status. This API uses an asynchronous callback to return the re
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | ------------------------------------ | | -------- | -------------------------------------------- | ---- | ------------------------------------ |
| callback | AsyncCallback&lt;[CallState](#callstate)&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[CallState](#callstate)&gt; | Yes | Callback used to return the result.|
**Example** **Example**
...@@ -244,7 +402,7 @@ Obtains the call status. This API uses a promise to return the result. ...@@ -244,7 +402,7 @@ Obtains the call status. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| -------------------------------------- | --------------------------------------- | | -------------------------------------- | --------------------------------------- |
| Promise&lt;[CallState](#callstate)&gt; | Promise used to return the result. | | Promise&lt;[CallState](#callstate)&gt; | Promise used to return the result.|
**Example** **Example**
...@@ -269,7 +427,7 @@ Checks whether a device supports voice calls. ...@@ -269,7 +427,7 @@ Checks whether a device supports voice calls.
| Type | Description | | Type | Description |
| ------- | ------------------------------------------------------------ | | ------- | ------------------------------------------------------------ |
| boolean | - **true**: The device supports voice calls.<br>- **false**: The device does not support voice calls. | | boolean | - **true**: The device supports voice calls.<br>- **false**: The device does not support voice calls.|
```js ```js
let result = call.hasVoiceCapability(); let result = call.hasVoiceCapability();
...@@ -286,10 +444,21 @@ Checks whether the called number is an emergency number. This API uses an asynch ...@@ -286,10 +444,21 @@ Checks whether the called number is an emergency number. This API uses an asynch
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ | | ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. - **true**: The called number is an emergency number.<br>- **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** **Example**
...@@ -304,17 +473,28 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => { ...@@ -304,17 +473,28 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => {
isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback<boolean\>\): void isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback<boolean\>\): void
Checks whether the called number is an emergency number based on the 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 **System capability**: SystemCapability.Telephony.CallManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- | | ----------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number options. | | options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number. |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.<br> - **true**: The called number is an emergency number.<br>- **false**: The called number is not an emergency number. | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. - **true**: The called number is an emergency number.<br>- **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** **Example**
...@@ -329,22 +509,33 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => { ...@@ -329,22 +509,33 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => {
isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise<boolean\> isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise<boolean\>
Checks whether the called number is an emergency number based on the 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 **System capability**: SystemCapability.Telephony.CallManager
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | -------------------------------------------------- | ---- | -------------- | | ----------- | -------------------------------------------------- | ---- | -------------- |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number options. | | options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ---------------------- | --------------------------------------------------- | | ---------------------- | --------------------------------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result. | | Promise&lt;boolean&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -369,10 +560,21 @@ A formatted phone number is a standard numeric string, for example, 555 0100. ...@@ -369,10 +560,21 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | ------------------------------------ | | ----------- | --------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -386,7 +588,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => { ...@@ -386,7 +588,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => {
formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback<string\>\): void formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback<string\>\): 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. 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. ...@@ -394,11 +596,22 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | -------------------------------------------- | ---- | ------------------------------------ | | ----------- | -------------------------------------------- | ---- | ------------------------------------ |
| phoneNumber | string | Yes | Phone number. | | phoneNumber | string | Yes | Phone number. |
| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code. | | options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -415,7 +628,7 @@ call.formatPhoneNumber("138xxxxxxxx", { ...@@ -415,7 +628,7 @@ call.formatPhoneNumber("138xxxxxxxx", {
formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise<string\> formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise<string\>
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. 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. ...@@ -423,16 +636,27 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | -------------------------------------------- | ---- | ---------------------- | | ----------- | -------------------------------------------- | ---- | ---------------------- |
| phoneNumber | string | Yes | Phone number. | | 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** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------------------------- | | --------------------- | ------------------------------------------- |
| Promise&lt;string&gt; | Promise used to return the result. | | Promise&lt;string&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -459,11 +683,22 @@ The phone number must match the specified country code. For example, for a China ...@@ -459,11 +683,22 @@ The phone number must match the specified country code. For example, for a China
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | --------------------------- | ---- | ----------------------------------------------------- | | ----------- | --------------------------- | ---- | ----------------------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | 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. |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -488,16 +723,27 @@ All country codes are supported. ...@@ -488,16 +723,27 @@ All country codes are supported.
**Parameters** **Parameters**
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ---------------------------------------- | | ----------- | ------ | ---- | ---------------------------------------- |
| phoneNumber | string | Yes | Phone number. | | 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** **Return value**
| Type | Description | | Type | Description |
| --------------------- | ------------------------------------------------------------ | | --------------------- | ------------------------------------------------------------ |
| Promise&lt;string&gt; | Promise used to return the result. | | Promise&lt;string&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -514,9 +760,9 @@ promise.then(data => { ...@@ -514,9 +760,9 @@ promise.then(data => {
muteRinger\(callback: AsyncCallback<void\>\): void muteRinger\(callback: AsyncCallback<void\>\): 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 **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -528,6 +774,17 @@ This is a system API. ...@@ -528,6 +774,17 @@ This is a system API.
| ----------- | ------------------------- | ---- | ---------- | | ----------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -541,9 +798,9 @@ call.muteRinger((err, data) => { ...@@ -541,9 +798,9 @@ call.muteRinger((err, data) => {
muteRinger\(\): Promise<void\> muteRinger\(\): Promise<void\>
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 **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -555,6 +812,18 @@ This is a system API. ...@@ -555,6 +812,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -566,13 +835,14 @@ promise.then(data => { ...@@ -566,13 +835,14 @@ promise.then(data => {
}); });
``` ```
## call.answer<sup>7+</sup>
answer\(callId: number, callback: AsyncCallback<void\>\): void ## call.answerCall<sup>7+</sup>
answerCall\(callId: number, callback: AsyncCallback<void\>\): 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 **Required permission**: ohos.permission.ANSWER_CALL
...@@ -585,22 +855,34 @@ This is a system API. ...@@ -585,22 +855,34 @@ This is a system API.
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
call.answer(1, (err, data) => { call.answerCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
## call.answer<sup>7+</sup> ## call.answerCall<sup>7+</sup>
answer(callId?: number\): Promise<void\> answerCall(callId?: number\): Promise<void\>
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 **Required permission**: ohos.permission.ANSWER_CALL
...@@ -618,24 +900,37 @@ This is a system API. ...@@ -618,24 +900,37 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
let promise = call.answer(1); let promise = call.answerCall(1);
promise.then(data => { promise.then(data => {
console.log(`answer success, promise: data->${JSON.stringify(data)}`); console.log(`answerCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
console.error(`answer fail, promise: err->${JSON.stringify(err)}`); console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`);
}); });
``` ```
## call.hangup<sup>7+</sup>
hangup\(callId: number, callback: AsyncCallback<void\>\): void ## call.answerCall<sup>9+</sup>
Ends a call. This API uses an asynchronous callback to return the result. answerCall\(callback: AsyncCallback<void\>\): 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 **Required permission**: ohos.permission.ANSWER_CALL
...@@ -645,25 +940,36 @@ This is a system API. ...@@ -645,25 +940,36 @@ This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
call.hangup(1, (err, data) => { call.answerCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
## call.answer<sup>9+</sup> ## call.hangUpCall<sup>7+</sup>
answer\(callback: AsyncCallback<void\>\): void hangUpCall\(callId: number, callback: AsyncCallback<void\>\): 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 **Required permission**: ohos.permission.ANSWER_CALL
...@@ -673,24 +979,37 @@ This is a system API. ...@@ -673,24 +979,37 @@ This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ----------------------------------------------- | | -------- | ------------------------- | ---- | ----------------------------------------------- |
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
call.answer((err, data) => { call.hangUpCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
## call.hangup<sup>7+</sup> ## call.hangUpCall<sup>7+</sup>
hangup\(callId?: number\): Promise<void\> hangUpCall\(callId?: number\): Promise<void\>
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 **Required permission**: ohos.permission.ANSWER_CALL
...@@ -708,24 +1027,37 @@ This is a system API. ...@@ -708,24 +1027,37 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
let promise = call.hangup(1); let promise = call.hangUpCall(1);
promise.then(data => { promise.then(data => {
console.log(`hangup success, promise: data->${JSON.stringify(data)}`); console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
console.error(`hangup fail, promise: err->${JSON.stringify(err)}`); console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`);
}); });
``` ```
## call.hangup<sup>9+</sup>
hangup\(callback: AsyncCallback<void\>\): void ## call.hangUpCall<sup>9+</sup>
hangUpCall\(callback: AsyncCallback<void\>\): void
Ends a call. This API uses an asynchronous callback to return the result. Ends a call. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -737,22 +1069,35 @@ This is a system API. ...@@ -737,22 +1069,35 @@ This is a system API.
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
call.hangup((err, data) => { call.hangUpCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
## call.reject<sup>7+</sup> ## call.rejectCall<sup>7+</sup>
reject(callId: number, callback: AsyncCallback\<void>): void rejectCall(callId: number, callback: AsyncCallback\<void>): 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 **Required permission**: ohos.permission.ANSWER_CALL
...@@ -765,22 +1110,35 @@ This is a system API. ...@@ -765,22 +1110,35 @@ This is a system API.
| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
call.reject(1, (err, data) => { call.rejectCall(1, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
## call.reject<sup>7+</sup>
reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void\>\): void ## call.rejectCall<sup>7+</sup>
rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void\>\): 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 **Required permission**: ohos.permission.ANSWER_CALL
...@@ -794,25 +1152,37 @@ This is a system API. ...@@ -794,25 +1152,37 @@ This is a system API.
| options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message. | | options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
let rejectMessageOptions={ let rejectMessageOptions={
messageContent: "Unknown number blocked" 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)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
## call.reject<sup>7+</sup> ## call.rejectCall<sup>7+</sup>
reject(callId?: number, options?: RejectMessageOptions\): Promise<void\> rejectCall(callId?: number, options?: RejectMessageOptions\): Promise<void\>
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 **Required permission**: ohos.permission.ANSWER_CALL
...@@ -831,28 +1201,40 @@ This is a system API. ...@@ -831,28 +1201,40 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
let rejectMessageOptions={ let rejectMessageOptions={
messageContent: "Unknown number blocked" messageContent: "Unknown number blocked"
} }
let promise = call.reject(1, rejectMessageOptions); let promise = call.rejectCall(1, rejectMessageOptions);
promise.then(data => { promise.then(data => {
console.log(`reject success, promise: data->${JSON.stringify(data)}`); console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { }).catch(err => {
console.error(`reject fail, promise: err->${JSON.stringify(err)}`); console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`);
}); });
``` ```
## call.reject<sup>9+</sup> ## call.rejectCall<sup>9+</sup>
reject\(callback: AsyncCallback<void\>\): void rejectCall\(callback: AsyncCallback<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result. Rejects a call. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -864,22 +1246,34 @@ This is a system API. ...@@ -864,22 +1246,34 @@ This is a system API.
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | 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 ```js
call.reject((err, data) => { call.rejectCall((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
## call.reject<sup>9+</sup> ## call.rejectCall<sup>9+</sup>
reject\(options: RejectMessageOptions, callback: AsyncCallback<void\>\): void rejectCall\(options: RejectMessageOptions, callback: AsyncCallback<void\>\): void
Rejects a call. This API uses an asynchronous callback to return the result. Rejects a call. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -892,13 +1286,25 @@ This is a system API. ...@@ -892,13 +1286,25 @@ This is a system API.
| options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.| | options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | 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 ```js
let rejectMessageOptions={ let rejectMessageOptions={
messageContent: "Unknown number blocked" 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)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -910,7 +1316,7 @@ holdCall\(callId: number, callback: AsyncCallback<void\>\): void ...@@ -910,7 +1316,7 @@ holdCall\(callId: number, callback: AsyncCallback<void\>\): void
Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result. Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -923,6 +1329,18 @@ This is a system API. ...@@ -923,6 +1329,18 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -938,7 +1356,7 @@ holdCall\(callId: number\): Promise<void\> ...@@ -938,7 +1356,7 @@ holdCall\(callId: number\): Promise<void\>
Holds a call based on the specified call ID. This API uses a promise to return the result. Holds a call based on the specified call ID. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -956,6 +1374,18 @@ This is a system API. ...@@ -956,6 +1374,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -973,7 +1403,7 @@ unHoldCall\(callId: number, callback: AsyncCallback<void\>\): void ...@@ -973,7 +1403,7 @@ unHoldCall\(callId: number, callback: AsyncCallback<void\>\): void
Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result. Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -986,6 +1416,18 @@ This is a system API. ...@@ -986,6 +1416,18 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1001,7 +1443,7 @@ unHoldCall\(callId: number\): Promise<void\> ...@@ -1001,7 +1443,7 @@ unHoldCall\(callId: number\): Promise<void\>
Unholds a call based on the specified call ID. This API uses a promise to return the result. Unholds a call based on the specified call ID. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -1019,6 +1461,18 @@ This is a system API. ...@@ -1019,6 +1461,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1036,7 +1490,7 @@ switchCall\(callId: number, callback: AsyncCallback<void\>\): void ...@@ -1036,7 +1490,7 @@ switchCall\(callId: number, callback: AsyncCallback<void\>\): void
Switches a call. This API uses an asynchronous callback to return the result. Switches a call. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -1049,6 +1503,18 @@ This is a system API. ...@@ -1049,6 +1503,18 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1064,7 +1530,7 @@ switchCall\(callId: number\): Promise<void\> ...@@ -1064,7 +1530,7 @@ switchCall\(callId: number\): Promise<void\>
Switches a call. This API uses a promise to return the result. Switches a call. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.ANSWER_CALL **Required permission**: ohos.permission.ANSWER_CALL
...@@ -1082,6 +1548,18 @@ This is a system API. ...@@ -1082,6 +1548,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1099,7 +1577,7 @@ combineConference\(callId: number, callback: AsyncCallback<void\>\): void ...@@ -1099,7 +1577,7 @@ combineConference\(callId: number, callback: AsyncCallback<void\>\): void
Combines two calls into a conference call. This API uses an asynchronous callback to return the result. Combines two calls into a conference call. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1110,6 +1588,17 @@ This is a system API. ...@@ -1110,6 +1588,17 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1125,7 +1614,7 @@ combineConference\(callId: number\): Promise<void\> ...@@ -1125,7 +1614,7 @@ combineConference\(callId: number\): Promise<void\>
Combines two calls into a conference call. This API uses a promise to return the result. Combines two calls into a conference call. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1141,6 +1630,17 @@ This is a system API. ...@@ -1141,6 +1630,17 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1158,7 +1658,7 @@ getMainCallId\(callId: number, callback: AsyncCallback<number\>\): void ...@@ -1158,7 +1658,7 @@ getMainCallId\(callId: number, callback: AsyncCallback<number\>\): void
Obtains the main call ID. This API uses an asynchronous callback to return the result. Obtains the main call ID. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1169,6 +1669,18 @@ This is a system API. ...@@ -1169,6 +1669,18 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1184,7 +1696,7 @@ getMainCallId\(callId: number\): Promise<number\> ...@@ -1184,7 +1696,7 @@ getMainCallId\(callId: number\): Promise<number\>
Obtains the main call ID. This API uses a promise to return the result. Obtains the main call ID. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1200,6 +1712,17 @@ This is a system API. ...@@ -1200,6 +1712,17 @@ This is a system API.
| ------------------- | ------------------------------- | | ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1217,7 +1740,7 @@ getSubCallIdList\(callId: number, callback: AsyncCallback<Array<string\>\>\): vo ...@@ -1217,7 +1740,7 @@ getSubCallIdList\(callId: number, callback: AsyncCallback<Array<string\>\>\): vo
Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result. Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1228,6 +1751,17 @@ This is a system API. ...@@ -1228,6 +1751,17 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback<Array<string\>\> | Yes | Callback used to return the result. | | callback | AsyncCallback<Array<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** **Example**
```js ```js
...@@ -1243,7 +1777,7 @@ getSubCallIdList\(callId: number\): Promise<Array<string\>\> ...@@ -1243,7 +1777,7 @@ getSubCallIdList\(callId: number\): Promise<Array<string\>\>
Obtains the list of subcall IDs. This API uses a promise to return the result. Obtains the list of subcall IDs. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1259,6 +1793,17 @@ This is a system API. ...@@ -1259,6 +1793,17 @@ This is a system API.
| ----------------------------- | ----------------------------------- | | ----------------------------- | ----------------------------------- |
| Promise&lt;Array<string\>&gt; | Promise used to return the result.| | Promise&lt;Array<string\>&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1276,7 +1821,7 @@ getCallIdListForConference\(callId: number, callback: AsyncCallback<Array<string ...@@ -1276,7 +1821,7 @@ getCallIdListForConference\(callId: number, callback: AsyncCallback<Array<string
Obtains the list of call IDs in a conference. This API uses an asynchronous callback to return the result. Obtains the list of call IDs in a conference. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1287,6 +1832,17 @@ This is a system API. ...@@ -1287,6 +1832,17 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback&lt;Array<string\>&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;Array<string\>&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1302,7 +1858,7 @@ getCallIdListForConference\(callId: number\): Promise<Array<string\>\> ...@@ -1302,7 +1858,7 @@ getCallIdListForConference\(callId: number\): Promise<Array<string\>\>
Obtains the list of call IDs in a conference. This API uses a promise to return the result. Obtains the list of call IDs in a conference. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1318,6 +1874,17 @@ This is a system API. ...@@ -1318,6 +1874,17 @@ This is a system API.
| ----------------------------- | --------------------------------------- | | ----------------------------- | --------------------------------------- |
| Promise&lt;Array<string\>&gt; | Promise used to return the result.| | Promise&lt;Array<string\>&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1335,7 +1902,7 @@ getCallWaitingStatus\(slotId: number, callback: AsyncCallback<CallWaitingStatus\ ...@@ -1335,7 +1902,7 @@ getCallWaitingStatus\(slotId: number, callback: AsyncCallback<CallWaitingStatus\
Obtains the call waiting status. This API uses an asynchronous callback to return the result. Obtains the call waiting status. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE **Required permission**: ohos.permission.GET_TELEPHONY_STATE
...@@ -1345,8 +1912,20 @@ This is a system API. ...@@ -1345,8 +1912,20 @@ This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback&lt;[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.<br>- **0**: Call waiting is disabled.<br>- **1**: Call waiting is enabled.| | callback | AsyncCallback&lt;[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.<br> <br>- **0**: Call waiting is disabled.<br>- **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** **Example**
...@@ -1363,7 +1942,7 @@ getCallWaitingStatus\(slotId: number\): Promise<CallWaitingStatus\> ...@@ -1363,7 +1942,7 @@ getCallWaitingStatus\(slotId: number\): Promise<CallWaitingStatus\>
Obtains the call waiting status. This API uses a promise to return the result. Obtains the call waiting status. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE **Required permission**: ohos.permission.GET_TELEPHONY_STATE
...@@ -1381,6 +1960,18 @@ This is a system API. ...@@ -1381,6 +1960,18 @@ This is a system API.
| ------------------------------------------------------- | ------------------------------------------------------------ | | ------------------------------------------------------- | ------------------------------------------------------------ |
| Promise&lt;[CallWaitingStatus](#callwaitingstatus7)&gt; | Promise used to return the result.<br>- **0**: Call waiting is disabled.<br>- **1**: Call waiting is enabled.| | Promise&lt;[CallWaitingStatus](#callwaitingstatus7)&gt; | Promise used to return the result.<br>- **0**: Call waiting is disabled.<br>- **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** **Example**
```js ```js
...@@ -1398,7 +1989,7 @@ setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback<void\ ...@@ -1398,7 +1989,7 @@ setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback<void\
Sets the call waiting switch. This API uses an asynchronous callback to return the result. Sets the call waiting switch. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1412,6 +2003,18 @@ This is a system API. ...@@ -1412,6 +2003,18 @@ This is a system API.
| activate | boolean | Yes | Whether to enable call waiting.<br>- **false**: Disable call waiting.<br>- **true**: Enable call waiting.| | activate | boolean | Yes | Whether to enable call waiting.<br>- **false**: Disable call waiting.<br>- **true**: Enable call waiting.|
| 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 |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1427,7 +2030,7 @@ setCallWaiting\(slotId: number, activate: boolean\): Promise<void\> ...@@ -1427,7 +2030,7 @@ setCallWaiting\(slotId: number, activate: boolean\): Promise<void\>
Sets the call waiting switch. This API uses a promise to return the result. Sets the call waiting switch. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1446,6 +2049,18 @@ This is a system API. ...@@ -1446,6 +2049,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1461,9 +2076,9 @@ promise.then(data => { ...@@ -1461,9 +2076,9 @@ promise.then(data => {
startDTMF\(callId: number, character: string, callback: AsyncCallback<void\>\): void startDTMF\(callId: number, character: string, callback: AsyncCallback<void\>\): 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 **System capability**: SystemCapability.Telephony.CallManager
...@@ -1475,6 +2090,17 @@ This is a system API. ...@@ -1475,6 +2090,17 @@ This is a system API.
| character | string | Yes | DTMF code. | | character | string | Yes | DTMF code. |
| 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** **Example**
```js ```js
...@@ -1490,7 +2116,7 @@ startDTMF\(callId: number, character: string\): Promise<void\> ...@@ -1490,7 +2116,7 @@ startDTMF\(callId: number, character: string\): Promise<void\>
Enables DTMF. This API uses a promise to return the result. Enables DTMF. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1507,6 +2133,17 @@ This is a system API. ...@@ -1507,6 +2133,17 @@ This is a system API.
| ------------------- | ----------------------- | | ------------------- | ----------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1524,7 +2161,7 @@ stopDTMF\(callId: number, callback: AsyncCallback<void\>\): void ...@@ -1524,7 +2161,7 @@ stopDTMF\(callId: number, callback: AsyncCallback<void\>\): void
Stops DTMF. This API uses an asynchronous callback to return the result. Stops DTMF. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1535,6 +2172,17 @@ This is a system API. ...@@ -1535,6 +2172,17 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1550,7 +2198,7 @@ stopDTMF\(callId: number\): Promise<void\> ...@@ -1550,7 +2198,7 @@ stopDTMF\(callId: number\): Promise<void\>
Stops DTMF. This API uses a promise to return the result. Stops DTMF. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1566,6 +2214,17 @@ This is a system API. ...@@ -1566,6 +2214,17 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1583,7 +2242,7 @@ isInEmergencyCall\(callback: AsyncCallback<boolean\>\): void ...@@ -1583,7 +2242,7 @@ isInEmergencyCall\(callback: AsyncCallback<boolean\>\): void
Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result. Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1595,6 +2254,18 @@ This is a system API. ...@@ -1595,6 +2254,18 @@ This is a system API.
| -------- | ---------------------------- | ---- | ---------- | | -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1610,7 +2281,7 @@ isInEmergencyCall\(\): Promise<boolean\> ...@@ -1610,7 +2281,7 @@ isInEmergencyCall\(\): Promise<boolean\>
Checks whether a call is an emergency call. This API uses a promise to return the result. Checks whether a call is an emergency call. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1622,6 +2293,18 @@ This is a system API. ...@@ -1622,6 +2293,18 @@ This is a system API.
| ---------------------- | --------------------------- | | ---------------------- | --------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.| | Promise&lt;boolean&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1639,7 +2322,7 @@ on\(type: 'callDetailsChange', callback: Callback<CallAttributeOptions\>\): void ...@@ -1639,7 +2322,7 @@ on\(type: 'callDetailsChange', callback: Callback<CallAttributeOptions\>\): void
Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result. Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1652,6 +2335,18 @@ This is a system API. ...@@ -1652,6 +2335,18 @@ This is a system API.
| type | string | Yes | Call details change during a call.| | type | string | Yes | Call details change during a call.|
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -1666,7 +2361,7 @@ on\(type: 'callEventChange', callback: Callback<CallEventOptions\>\): void ...@@ -1666,7 +2361,7 @@ on\(type: 'callEventChange', callback: Callback<CallEventOptions\>\): void
Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result. Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1679,6 +2374,18 @@ This is a system API. ...@@ -1679,6 +2374,18 @@ This is a system API.
| type | string | Yes | Call event change during a call.| | type | string | Yes | Call event change during a call.|
| callback | Callback<[CallEventOptions](#calleventoptions8)> | Yes | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -1693,7 +2400,7 @@ on\(type: 'callDisconnectedCause', callback: Callback<DisconnectedDetails\>): vo ...@@ -1693,7 +2400,7 @@ on\(type: 'callDisconnectedCause', callback: Callback<DisconnectedDetails\>): vo
Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1706,6 +2413,18 @@ This is a system API. ...@@ -1706,6 +2413,18 @@ This is a system API.
| type | string | Yes | Cause of the call disconnection.| | type | string | Yes | Cause of the call disconnection.|
| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | Yes | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -1720,7 +2439,7 @@ on\(type: 'mmiCodeResult', callback: Callback<MmiCodeResults\>\): void ...@@ -1720,7 +2439,7 @@ on\(type: 'mmiCodeResult', callback: Callback<MmiCodeResults\>\): void
Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result. Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1733,6 +2452,18 @@ This is a system API. ...@@ -1733,6 +2452,18 @@ This is a system API.
| type | string | Yes | Man-machine interface (MMI) code result.| | type | string | Yes | Man-machine interface (MMI) code result.|
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | Yes | Callback used to return the 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** **Example**
```js ```js
...@@ -1747,7 +2478,7 @@ off\(type: 'callDetailsChange', callback?: Callback<CallAttributeOptions\>\): vo ...@@ -1747,7 +2478,7 @@ off\(type: 'callDetailsChange', callback?: Callback<CallAttributeOptions\>\): vo
Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result. Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1757,9 +2488,21 @@ This is a system API. ...@@ -1757,9 +2488,21 @@ This is a system API.
| Name | Type | Mandatory| Description | | 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. | | 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** **Example**
```js ```js
...@@ -1774,7 +2517,7 @@ off\(type: 'callEventChange', callback?: Callback<CallEventOptions\>\): void ...@@ -1774,7 +2517,7 @@ off\(type: 'callEventChange', callback?: Callback<CallEventOptions\>\): void
Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result. Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1787,6 +2530,18 @@ This is a system API. ...@@ -1787,6 +2530,18 @@ This is a system API.
| type | string | Yes | Unsubscription from call event changes when a call ends.| | type | string | Yes | Unsubscription from call event changes when a call ends.|
| callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -1801,7 +2556,7 @@ off\(type: 'callDisconnectedCause', callback?: Callback<DisconnectedDetails\>\): ...@@ -1801,7 +2556,7 @@ off\(type: 'callDisconnectedCause', callback?: Callback<DisconnectedDetails\>\):
Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1814,6 +2569,18 @@ This is a system API. ...@@ -1814,6 +2569,18 @@ This is a system API.
| type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.| | type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.|
| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -1828,7 +2595,7 @@ off\(type: 'mmiCodeResult', callback?: Callback<MmiCodeResults\>\): void ...@@ -1828,7 +2595,7 @@ off\(type: 'mmiCodeResult', callback?: Callback<MmiCodeResults\>\): void
Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result. Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -1841,6 +2608,18 @@ This is a system API. ...@@ -1841,6 +2608,18 @@ This is a system API.
| type | 'mmiCodeResult' | Yes | MMI code result.| | type | 'mmiCodeResult' | Yes | MMI code result.|
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the 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** **Example**
```js ```js
...@@ -1855,7 +2634,7 @@ isNewCallAllowed\(callback: AsyncCallback<boolean\>\): void ...@@ -1855,7 +2634,7 @@ isNewCallAllowed\(callback: AsyncCallback<boolean\>\): void
Checks whether a new call is allowed. This API uses an asynchronous callback to return the result. Checks whether a new call is allowed. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1865,6 +2644,17 @@ This is a system API. ...@@ -1865,6 +2644,17 @@ This is a system API.
| -------- | ---------------------------- | ---- | ---------- | | -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1880,7 +2670,7 @@ isNewCallAllowed\(\): Promise<boolean\> ...@@ -1880,7 +2670,7 @@ isNewCallAllowed\(\): Promise<boolean\>
Checks whether a new call is allowed. This API uses a promise to return the result. Checks whether a new call is allowed. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -1890,6 +2680,17 @@ This is a system API. ...@@ -1890,6 +2680,17 @@ This is a system API.
| ---------------------- | --------------------------- | | ---------------------- | --------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.| | Promise&lt;boolean&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1905,9 +2706,9 @@ promise.then(data => { ...@@ -1905,9 +2706,9 @@ promise.then(data => {
separateConference\(callId: number, callback: AsyncCallback<void\>\): void separateConference\(callId: number, callback: AsyncCallback<void\>\): 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 **System capability**: SystemCapability.Telephony.CallManager
...@@ -1918,6 +2719,17 @@ This is a system API. ...@@ -1918,6 +2719,17 @@ This is a system API.
| callId | number | Yes | Call ID. | | callId | number | Yes | Call ID. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1931,9 +2743,9 @@ call.separateConference(1, (err, data) => { ...@@ -1931,9 +2743,9 @@ call.separateConference(1, (err, data) => {
separateConference\(callId: number\): Promise<void\> separateConference\(callId: number\): Promise<void\>
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 **System capability**: SystemCapability.Telephony.CallManager
...@@ -1949,6 +2761,17 @@ This is a system API. ...@@ -1949,6 +2761,17 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1966,7 +2789,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: A ...@@ -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. 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 **Required permission**: ohos.permission.GET_TELEPHONY_STATE
...@@ -1980,6 +2803,18 @@ This is a system API. ...@@ -1980,6 +2803,18 @@ This is a system API.
| type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. | | type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. |
| callback | AsyncCallback&lt;[RestrictionStatus](#restrictionstatus8)&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[RestrictionStatus](#restrictionstatus8)&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1995,7 +2830,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise<R ...@@ -1995,7 +2830,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise<R
Obtains the call restriction status. This API uses a promise to return the result. Obtains the call restriction status. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE **Required permission**: ohos.permission.GET_TELEPHONY_STATE
...@@ -2014,6 +2849,18 @@ This is a system API. ...@@ -2014,6 +2849,18 @@ This is a system API.
| ------------------------------------------------------- | --------------------------- | | ------------------------------------------------------- | --------------------------- |
| Promise&lt;[RestrictionStatus](#restrictionstatus8)&gt; | Promise used to return the result.| | Promise&lt;[RestrictionStatus](#restrictionstatus8)&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2031,7 +2878,7 @@ setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCa ...@@ -2031,7 +2878,7 @@ setCallRestriction\(slotId: number, info: CallRestrictionInfo, callback: AsyncCa
Sets the call restriction status. This API uses an asynchronous callback to return the result. Sets the call restriction status. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2045,6 +2892,18 @@ This is a system API. ...@@ -2045,6 +2892,18 @@ This is a system API.
| info | [CallRestrictionInfo](#callrestrictioninfo8) | Yes | Call restriction information. | | info | [CallRestrictionInfo](#callrestrictioninfo8) | Yes | Call restriction information. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2065,7 +2924,7 @@ setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise<void\> ...@@ -2065,7 +2924,7 @@ setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise<void\>
Sets the call restriction status. This API uses a promise to return the result. Sets the call restriction status. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2084,6 +2943,18 @@ This is a system API. ...@@ -2084,6 +2943,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2106,7 +2977,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCall ...@@ -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. 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 **Required permission**: ohos.permission.GET_TELEPHONY_STATE
...@@ -2120,10 +2991,22 @@ This is a system API. ...@@ -2120,10 +2991,22 @@ This is a system API.
| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. | | type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
| callback | AsyncCallback&lt;[CallTransferResult](#calltransferresult8)&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[CallTransferResult](#calltransferresult8)&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
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)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -2135,7 +3018,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType): Promise<CallTransf ...@@ -2135,7 +3018,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType): Promise<CallTransf
Obtains call transfer information. This API uses a promise to return the result. Obtains call transfer information. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.GET_TELEPHONY_STATE **Required permission**: ohos.permission.GET_TELEPHONY_STATE
...@@ -2154,6 +3037,18 @@ This is a system API. ...@@ -2154,6 +3037,18 @@ This is a system API.
| --------------------------------------------------------- | --------------------------- | | --------------------------------------------------------- | --------------------------- |
| Promise&lt;[CallTransferResult](#calltransferresult8)&gt; | Promise used to return the result.| | Promise&lt;[CallTransferResult](#calltransferresult8)&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2171,7 +3066,7 @@ setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback ...@@ -2171,7 +3066,7 @@ setCallTransfer\(slotId: number, info: CallTransferInfo, callback: AsyncCallback
Sets call transfer information. This API uses an asynchronous callback to return the result. Sets call transfer information. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2185,6 +3080,18 @@ This is a system API. ...@@ -2185,6 +3080,18 @@ This is a system API.
| info | [CallTransferInfo](#calltransferinfo8) | Yes | Call transfer information. | | info | [CallTransferInfo](#calltransferinfo8) | Yes | Call transfer information. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2205,7 +3112,7 @@ setCallTransfer\(slotId: number, info: CallTransferInfo): Promise<void\> ...@@ -2205,7 +3112,7 @@ setCallTransfer\(slotId: number, info: CallTransferInfo): Promise<void\>
Sets call transfer information. This API uses a promise to return the result. Sets call transfer information. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2224,6 +3131,18 @@ This is a system API. ...@@ -2224,6 +3131,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2246,7 +3165,7 @@ isRinging\(callback: AsyncCallback<boolean\>\): void ...@@ -2246,7 +3165,7 @@ isRinging\(callback: AsyncCallback<boolean\>\): void
Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result. Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2258,6 +3177,18 @@ This is a system API. ...@@ -2258,6 +3177,18 @@ This is a system API.
| -------- | ---------------------------- | ---- | ---------- | | -------- | ---------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2273,7 +3204,7 @@ isRinging\(\): Promise<boolean\> ...@@ -2273,7 +3204,7 @@ isRinging\(\): Promise<boolean\>
Checks whether the ringtone is playing. This API uses a promise to return the result. Checks whether the ringtone is playing. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2285,6 +3216,18 @@ This is a system API. ...@@ -2285,6 +3216,18 @@ This is a system API.
| ---------------------- | --------------------------- | | ---------------------- | --------------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.| | Promise&lt;boolean&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2302,7 +3245,7 @@ setMuted\(callback: AsyncCallback<void\>\): void ...@@ -2302,7 +3245,7 @@ setMuted\(callback: AsyncCallback<void\>\): void
Sets call muting. This API uses an asynchronous callback to return the result. Sets call muting. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2312,6 +3255,17 @@ This is a system API. ...@@ -2312,6 +3255,17 @@ This is a system API.
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2327,7 +3281,7 @@ setMuted\(\): Promise<void\> ...@@ -2327,7 +3281,7 @@ setMuted\(\): Promise<void\>
Sets call muting. This API uses a promise to return the result. Sets call muting. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2337,6 +3291,17 @@ This is a system API. ...@@ -2337,6 +3291,17 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2354,7 +3319,7 @@ cancelMuted(callback: AsyncCallback<void\>): void ...@@ -2354,7 +3319,7 @@ cancelMuted(callback: AsyncCallback<void\>): void
Cancels call muting. This API uses an asynchronous callback to return the result. Cancels call muting. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2364,6 +3329,17 @@ This is a system API. ...@@ -2364,6 +3329,17 @@ This is a system API.
| -------- | ------------------------- | ---- | ---------- | | -------- | ------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2379,7 +3355,7 @@ cancelMuted(): Promise<void\> ...@@ -2379,7 +3355,7 @@ cancelMuted(): Promise<void\>
Cancels call muting. This API uses a promise to return the result. Cancels call muting. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2389,6 +3365,17 @@ This is a system API. ...@@ -2389,6 +3365,17 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2400,13 +3387,13 @@ promise.then(data => { ...@@ -2400,13 +3387,13 @@ promise.then(data => {
}); });
``` ```
## call.setAudioDevice<sup>9+</sup> ## call.setAudioDevice<sup>8+</sup>
setAudioDevice\(device: AudioDevice, callback: AsyncCallback<void\>\): void setAudioDevice\(device: AudioDevice, callback: AsyncCallback<void\>\): void
Sets the audio device for a call. This API uses an asynchronous callback to return the result. Sets the audio device for a call. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2417,6 +3404,17 @@ This is a system API. ...@@ -2417,6 +3404,17 @@ This is a system API.
| device | [AudioDevice](#audiodevice8) | Yes | Audio device.| | device | [AudioDevice](#audiodevice8) | Yes | Audio device.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2432,7 +3430,7 @@ setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: Asyn ...@@ -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. 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 **System capability**: SystemCapability.Telephony.CallManager
...@@ -2444,6 +3442,17 @@ This is a system API. ...@@ -2444,6 +3442,17 @@ This is a system API.
| options | [AudioDeviceOptions](#audiodeviceoptions9) | Yes | Audio device parameters.| | options | [AudioDeviceOptions](#audiodeviceoptions9) | Yes | Audio device parameters.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2456,13 +3465,13 @@ call.setAudioDevice(1, audioDeviceOptions, (err, data) => { ...@@ -2456,13 +3465,13 @@ call.setAudioDevice(1, audioDeviceOptions, (err, data) => {
``` ```
## call.setAudioDevice<sup>8+</sup> ## call.setAudioDevice<sup>9+</sup>
setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise<void\> setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise<void\>
Sets the audio device for a call based on the specified options. This API uses a promise to return the result. Sets the audio device for a call based on the specified options. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2479,6 +3488,17 @@ This is a system API. ...@@ -2479,6 +3488,17 @@ This is a system API.
| ------------------- | ------------------------------- | | ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2499,7 +3519,7 @@ joinConference(mainCallId: number, callNumberList: Array<string\>, callback: Asy ...@@ -2499,7 +3519,7 @@ joinConference(mainCallId: number, callNumberList: Array<string\>, callback: Asy
Joins a conference call. This API uses an asynchronous callback to return the result. Joins a conference call. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2511,6 +3531,17 @@ This is a system API. ...@@ -2511,6 +3531,17 @@ This is a system API.
| callNumberList | Array<string\> | Yes | List of call numbers.| | callNumberList | Array<string\> | Yes | List of call numbers.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2528,7 +3559,7 @@ joinConference(mainCallId: number, callNumberList: Array<string\>): Promise<void ...@@ -2528,7 +3559,7 @@ joinConference(mainCallId: number, callNumberList: Array<string\>): Promise<void
Joins a conference call. This API uses a promise to return the result. Joins a conference call. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2545,6 +3576,17 @@ This is a system API. ...@@ -2545,6 +3576,17 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2565,7 +3607,7 @@ updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback<voi ...@@ -2565,7 +3607,7 @@ updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback<voi
Updates the IMS call mode. This API uses an asynchronous callback to return the result. Updates the IMS call mode. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2577,6 +3619,17 @@ This is a system API. ...@@ -2577,6 +3619,17 @@ This is a system API.
| mode | [ImsCallMode](#imscallmode8) | Yes | IMS call mode.| | mode | [ImsCallMode](#imscallmode8) | Yes | IMS call mode.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2591,7 +3644,7 @@ updateImsCallMode(callId: number, mode: ImsCallMode): Promise<void\> ...@@ -2591,7 +3644,7 @@ updateImsCallMode(callId: number, mode: ImsCallMode): Promise<void\>
Updates the IMS call mode. This API uses a promise to return the result. Updates the IMS call mode. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2608,6 +3661,17 @@ This is a system API. ...@@ -2608,6 +3661,17 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2625,7 +3689,7 @@ enableImsSwitch(slotId: number, callback: AsyncCallback<void\>): void ...@@ -2625,7 +3689,7 @@ enableImsSwitch(slotId: number, callback: AsyncCallback<void\>): void
Enables the IMS switch. This API uses an asynchronous callback to return the result. Enables the IMS switch. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2638,6 +3702,18 @@ This is a system API. ...@@ -2638,6 +3702,18 @@ This is a system API.
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2652,7 +3728,7 @@ enableImsSwitch(slotId: number): Promise<void\> ...@@ -2652,7 +3728,7 @@ enableImsSwitch(slotId: number): Promise<void\>
Enables the IMS switch. This API uses a promise to return the result. Enables the IMS switch. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2670,6 +3746,18 @@ This is a system API. ...@@ -2670,6 +3746,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2687,7 +3775,7 @@ disableImsSwitch(slotId: number, callback: AsyncCallback<void\>): void ...@@ -2687,7 +3775,7 @@ disableImsSwitch(slotId: number, callback: AsyncCallback<void\>): void
Disables the IMS switch. This API uses an asynchronous callback to return the result. Disables the IMS switch. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2700,6 +3788,18 @@ This is a system API. ...@@ -2700,6 +3788,18 @@ This is a system API.
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2714,7 +3814,7 @@ disableImsSwitch(slotId: number): Promise<void\> ...@@ -2714,7 +3814,7 @@ disableImsSwitch(slotId: number): Promise<void\>
Disables the IMS switch. This API uses a promise to return the result. Disables the IMS switch. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -2732,6 +3832,18 @@ This is a system API. ...@@ -2732,6 +3832,18 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2749,7 +3861,7 @@ isImsSwitchEnabled(slotId: number, callback: AsyncCallback<boolean\>): void ...@@ -2749,7 +3861,7 @@ isImsSwitchEnabled(slotId: number, callback: AsyncCallback<boolean\>): void
Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result. Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2760,6 +3872,17 @@ This is a system API. ...@@ -2760,6 +3872,17 @@ This is a system API.
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. |
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2774,7 +3897,7 @@ isImsSwitchEnabled(slotId: number): Promise<boolean\> ...@@ -2774,7 +3897,7 @@ isImsSwitchEnabled(slotId: number): Promise<boolean\>
Checks whether the IMS switch is enabled. This API uses a promise to return the result. Checks whether the IMS switch is enabled. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2790,6 +3913,17 @@ This is a system API. ...@@ -2790,6 +3913,17 @@ This is a system API.
| ------------------- | --------------------------- | | ------------------- | --------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2801,20 +3935,32 @@ promise.then(data => { ...@@ -2801,20 +3935,32 @@ promise.then(data => {
}); });
``` ```
## DialOptions ## DialOptions
Defines the dialup options. Provides an option for determining whether a call is a video call.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ | | ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- |
| extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call| | extras | boolean | No | Indication of a video call. <br>- **true**: video call<br>- **false** (default): voice call|
| accountId <sup>8+</sup> | number | No | Account ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br>This is a system API. | | accountId <sup>8+</sup> | number | No | Account ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br>This is a system API. |
| videoState <sup>8+</sup> | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | | videoState <sup>8+</sup> | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. |
| dialScene <sup>8+</sup> | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | | dialScene <sup>8+</sup> | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. |
| dialType <sup>8+</sup> | [DialType](#dialtype8) | No | Dialup type. This is a system API. | | dialType <sup>8+</sup> | [DialType](#dialtype8) | No | Dialup type. This is a system API. |
## DialCallOptions<sup>9+</sup>
Defines options for initiating a call.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ |
| accountId <sup>9+</sup> | number | No | Account ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br>This is a system API.|
| videoState <sup>9+</sup> | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. |
| dialScene <sup>9+</sup> | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. |
| dialType <sup>9+</sup> | [DialType](#dialtype8) | No | Dialup type. This is a system API. |
## CallState ## CallState
...@@ -2827,33 +3973,33 @@ Enumerates call states. ...@@ -2827,33 +3973,33 @@ Enumerates call states.
| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. | | 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_IDLE | 0 | No call is in progress. |
| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. | | 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.|
## EmergencyNumberOptions<sup>7+</sup> ## EmergencyNumberOptions<sup>7+</sup>
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 **System capability**: SystemCapability.Telephony.CallManager
| Name| Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| ------ | ------ | ---- | ---------------------------------------------- | | ------ | ------ | ---- | ---------------------------------------------- |
| slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | No | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
## NumberFormatOptions<sup>7+</sup> ## NumberFormatOptions<sup>7+</sup>
Defines the number formatting options. Provides an option for number formatting.
**System capability**: SystemCapability.Telephony.CallManager **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**.|
## ImsCallMode<sup>8+</sup> ## ImsCallMode<sup>8+</sup>
Enumerates IMS call modes. Enumerates IMS call modes.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2869,23 +4015,23 @@ This is a system API. ...@@ -2869,23 +4015,23 @@ This is a system API.
Enumerates audio devices. Enumerates audio devices.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description | | Name | Value | Description |
| -------------------- | ---- | ------------ | | -------------------- | ---- | ------------ |
| DEVICE_EARPIECE | 0 | Earpiece. | | DEVICE_EARPIECE | 0 | Headset device. |
| DEVICE_SPEAKER | 1 | Speaker.| | DEVICE_SPEAKER | 1 | Speaker device.|
| DEVICE_WIRED_HEADSET | 2 | Wired headset.| | DEVICE_WIRED_HEADSET | 2 | Wired headset device.|
| DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. | | DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. |
| DEVICE_MIC | 4 | Microphone. | | DEVICE_MIC | 4 | Microphone device|
## CallRestrictionType<sup>8+</sup> ## CallRestrictionType<sup>8+</sup>
Enumerates call restriction types. Enumerates call restriction types.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2904,7 +4050,7 @@ This is a system API. ...@@ -2904,7 +4050,7 @@ This is a system API.
Defines the call transfer information. Defines the call transfer information.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2915,14 +4061,14 @@ This is a system API. ...@@ -2915,14 +4061,14 @@ This is a system API.
| settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.| | settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.|
| startHour<sup>9+</sup> | number | No | Hour in the start time.| | startHour<sup>9+</sup> | number | No | Hour in the start time.|
| startMinute<sup>9+</sup> | number | No | Minute in the start time.| | startMinute<sup>9+</sup> | number | No | Minute in the start time.|
| endHour<sup>9+</sup> | number | No | Hour in the end time.| | endHour<sup>9+</sup> | number | No | Minute in the end time.|
| endMinute<sup>9+</sup> | number | No | Minute in the end time.| | endMinute<sup>9+</sup> | number | No | Minute in the end time.|
## CallTransferType<sup>8+</sup> ## CallTransferType<sup>8+</sup>
Enumerates call transfer types. Enumerates call transfer types.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2937,7 +4083,7 @@ This is a system API. ...@@ -2937,7 +4083,7 @@ This is a system API.
Enumerates call transfer setting types. Enumerates call transfer setting types.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2952,11 +4098,11 @@ This is a system API. ...@@ -2952,11 +4098,11 @@ This is a system API.
Defines the call attribute options. Defines the call attribute options.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------------- | ---------------------------------------- | ---- | -------------- | | --------------- | ---------------------------------------- | ---- | -------------- |
| accountNumber | string | Yes | Account number. | | accountNumber | string | Yes | Account number. |
| speakerphoneOn | boolean | Yes | Speakerphone on.| | speakerphoneOn | boolean | Yes | Speakerphone on.|
...@@ -2973,7 +4119,7 @@ This is a system API. ...@@ -2973,7 +4119,7 @@ This is a system API.
Enumerates conference states. Enumerates conference states.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -2988,7 +4134,7 @@ This is a system API. ...@@ -2988,7 +4134,7 @@ This is a system API.
Enumerates call types. Enumerates call types.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3001,9 +4147,9 @@ This is a system API. ...@@ -3001,9 +4147,9 @@ This is a system API.
## VideoStateType<sup>7+</sup> ## VideoStateType<sup>7+</sup>
Enumerates video state types. Video state type.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3016,7 +4162,7 @@ This is a system API. ...@@ -3016,7 +4162,7 @@ This is a system API.
Enumerates detailed call states. Enumerates detailed call states.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3036,11 +4182,11 @@ This is a system API. ...@@ -3036,11 +4182,11 @@ This is a system API.
Defines the call restriction information. Defines the call restriction information.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | ------------ | | -------- | -------------------------------------------- | ---- | ------------ |
| type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type.| | type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type.|
| password | string | Yes | Password. | | password | string | Yes | Password. |
...@@ -3050,7 +4196,7 @@ This is a system API. ...@@ -3050,7 +4196,7 @@ This is a system API.
Enumerates call restriction modes. Enumerates call restriction modes.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3063,11 +4209,11 @@ This is a system API. ...@@ -3063,11 +4209,11 @@ This is a system API.
Defines the call event options. Defines the call event options.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------- | ------------------------------------------ | ---- | -------------- | | ------- | ------------------------------------------ | ---- | -------------- |
| eventId | [CallAbilityEventId](#callabilityeventid8) | Yes | Call ability event ID.| | eventId | [CallAbilityEventId](#callabilityeventid8) | Yes | Call ability event ID.|
...@@ -3075,7 +4221,7 @@ This is a system API. ...@@ -3075,7 +4221,7 @@ This is a system API.
Enumerates call ability event IDs. Enumerates call ability event IDs.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3088,7 +4234,7 @@ This is a system API. ...@@ -3088,7 +4234,7 @@ This is a system API.
Enumerates dialup scenarios. Enumerates dialup scenarios.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3102,7 +4248,7 @@ This is a system API. ...@@ -3102,7 +4248,7 @@ This is a system API.
Enumerates dialup types. Enumerates dialup types.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3116,11 +4262,11 @@ This is a system API. ...@@ -3116,11 +4262,11 @@ This is a system API.
Defines options for the call rejection message. Defines options for the call rejection message.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------ | ---- | -------- | | -------------- | ------ | ---- | -------- |
| messageContent | string | Yes | Message content.| | messageContent | string | Yes | Message content.|
...@@ -3128,7 +4274,7 @@ This is a system API. ...@@ -3128,7 +4274,7 @@ This is a system API.
Defines the call transfer result. Defines the call transfer result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3138,14 +4284,14 @@ This is a system API. ...@@ -3138,14 +4284,14 @@ This is a system API.
| number | string | Yes | Call transfer number. | | number | string | Yes | Call transfer number. |
| startHour<sup>9+</sup> | number | Yes | Hour in the start time.| | startHour<sup>9+</sup> | number | Yes | Hour in the start time.|
| startMinute<sup>9+</sup> | number | Yes | Minute in the start time.| | startMinute<sup>9+</sup> | number | Yes | Minute in the start time.|
| endHour<sup>9+</sup> | number | Yes | Hour in the end time.| | endHour<sup>9+</sup> | number | Yes | Minute in the end time.|
| endMinute<sup>9+</sup> | number | Yes | Minute in the end time.| | endMinute<sup>9+</sup> | number | Yes | Minute in the end time.|
## CallWaitingStatus<sup>7+</sup> ## CallWaitingStatus<sup>7+</sup>
Enumerates call waiting states. Enumerates call waiting states.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3158,7 +4304,7 @@ This is a system API. ...@@ -3158,7 +4304,7 @@ This is a system API.
Enumerates call restriction states. Enumerates call restriction states.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3171,7 +4317,7 @@ This is a system API. ...@@ -3171,7 +4317,7 @@ This is a system API.
Enumerates call transfer states. Enumerates call transfer states.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3184,7 +4330,7 @@ This is a system API. ...@@ -3184,7 +4330,7 @@ This is a system API.
Defines the cause of a call disconnection. Defines the cause of a call disconnection.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3197,7 +4343,7 @@ This is a system API. ...@@ -3197,7 +4343,7 @@ This is a system API.
Enumerates causes of call disconnection. Enumerates causes of call disconnection.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3287,7 +4433,7 @@ This is a system API. ...@@ -3287,7 +4433,7 @@ This is a system API.
Defines the MMI code result. Defines the MMI code result.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
...@@ -3298,9 +4444,9 @@ This is a system API. ...@@ -3298,9 +4444,9 @@ This is a system API.
## MmiCodeResult<sup>9+</sup> ## MmiCodeResult<sup>9+</sup>
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 **System capability**: SystemCapability.Telephony.CallManager
...@@ -3313,7 +4459,7 @@ This is a system API. ...@@ -3313,7 +4459,7 @@ This is a system API.
Defines audio device options. Defines audio device options.
This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CallManager **System capability**: SystemCapability.Telephony.CallManager
......
# @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.|
...@@ -46,11 +46,11 @@ Adds one or more rules. HiChecker detects unexpected operations or gives feedbac ...@@ -46,11 +46,11 @@ Adds one or more rules. HiChecker detects unexpected operations or gives feedbac
```js ```js
try { try {
// Add a rule. // Add a rule.
hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG);} hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG);
// Add multiple rules. // Add multiple rules.
hichecker.addCheckRule( // hichecker.addCheckRule(
hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); // hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH);
catch (err) { } catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`); console.error(`code: ${err.code}, message: ${err.message}`);
} }
``` ```
...@@ -76,9 +76,9 @@ try { ...@@ -76,9 +76,9 @@ try {
// Remove a rule. // Remove a rule.
hichecker.removeCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); hichecker.removeCheckRule(hichecker.RULE_CAUTION_PRINT_LOG);
// Remove multiple rules. // Remove multiple rules.
hichecker.removeCheckRule( // hichecker.removeCheckRule(
hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); // hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH);
catch (err) { } catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`); console.error(`code: ${err.code}, message: ${err.message}`);
} }
``` ```
...@@ -113,7 +113,7 @@ try { ...@@ -113,7 +113,7 @@ try {
// Check whether the added rule exists in the collection of added rules. // 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_THREAD_CHECK_SLOW_PROCESS); // return true;
hichecker.containsCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // return false; hichecker.containsCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // return false;
catch (err) { } catch (err) {
console.error(`code: ${err.code}, message: ${err.message}`); console.error(`code: ${err.code}, message: ${err.message}`);
} }
``` ```
......
...@@ -297,7 +297,7 @@ import hidebug from '@ohos.hidebug' ...@@ -297,7 +297,7 @@ import hidebug from '@ohos.hidebug'
try { try {
hidebug.startJsCpuProfiling("cpu_profiling"); hidebug.startJsCpuProfiling("cpu_profiling");
... // ...
hidebug.stopJsCpuProfiling(); hidebug.stopJsCpuProfiling();
} catch (error) { } catch (error) {
console.info(error.code) console.info(error.code)
...@@ -326,7 +326,7 @@ import hidebug from '@ohos.hidebug' ...@@ -326,7 +326,7 @@ import hidebug from '@ohos.hidebug'
try { try {
hidebug.startJsCpuProfiling("cpu_profiling"); hidebug.startJsCpuProfiling("cpu_profiling");
... // ...
hidebug.stopJsCpuProfiling(); hidebug.stopJsCpuProfiling();
} catch (error) { } catch (error) {
console.info(error.code) console.info(error.code)
......
# @ohos.hiviewdfx.hiAppEvent (Application Event Logging) # @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**<br> > **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. > The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
...@@ -447,27 +448,27 @@ Enumerates event types. ...@@ -447,27 +448,27 @@ Enumerates event types.
| BEHAVIOR | 4 | Behavior event.| | BEHAVIOR | 4 | Behavior event.|
## Event ## event
Provides constants that define the names of all predefined events. Provides constants that define the names of all predefined events.
**System capability**: SystemCapability.HiviewDFX.HiAppEvent **System capability**: SystemCapability.HiviewDFX.HiAppEvent
| Name | Type | Readable| Writable| Description | | Name | Type | Description |
| ------------------------- | ------ | ---- | ---- | -------------------- | | ------------------------- | ------ | -------------------- |
| USER_LOGIN | string | Yes | No | User login event. | | USER_LOGIN | string | User login event. |
| USER_LOGOUT | string | Yes | No | User logout event. | | USER_LOGOUT | string | User logout event. |
| DISTRIBUTED_SERVICE_START | string | Yes | No | Distributed service startup event.| | DISTRIBUTED_SERVICE_START | string | Distributed service startup event.|
## Param ## param
Provides constants that define the names of all predefined event parameters. Provides constants that define the names of all predefined event parameters.
**System capability**: SystemCapability.HiviewDFX.HiAppEvent **System capability**: SystemCapability.HiviewDFX.HiAppEvent
| Name | Type | Readable| Writable| Description | | Name | Type | Description |
| ------------------------------- | ------ | ---- | ---- | ------------------ | | ------------------------------- | ------ | ------------------ |
| USER_ID | string | Yes | No | Custom user ID. | | USER_ID | string | Custom user ID. |
| DISTRIBUTED_SERVICE_NAME | string | Yes | No | Distributed service name. | | DISTRIBUTED_SERVICE_NAME | string | Distributed service name. |
| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Yes | No | Distributed service instance ID.| | DISTRIBUTED_SERVICE_INSTANCE_ID | string | Distributed service instance ID.|
# @ohos.i18n (Internationalization) # @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. 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. 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** > **NOTE**
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> >
> - 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 ## Modules to Import
...@@ -42,7 +42,7 @@ Obtains the localized script for the specified country. ...@@ -42,7 +42,7 @@ Obtains the localized script for the specified country.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -81,7 +81,7 @@ Obtains the localized script for the specified language. ...@@ -81,7 +81,7 @@ Obtains the localized script for the specified language.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -112,7 +112,7 @@ Obtains the list of system languages. For details about languages, see [Instanti ...@@ -112,7 +112,7 @@ Obtains the list of system languages. For details about languages, see [Instanti
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -149,7 +149,7 @@ Obtains the list of countries and regions supported for the specified language. ...@@ -149,7 +149,7 @@ Obtains the list of countries and regions supported for the specified language.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -187,7 +187,7 @@ Checks whether the system language matches the specified region. ...@@ -187,7 +187,7 @@ Checks whether the system language matches the specified region.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -218,7 +218,7 @@ Obtains the system language. For details about languages, see [Instantiating the ...@@ -218,7 +218,7 @@ Obtains the system language. For details about languages, see [Instantiating the
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -239,7 +239,7 @@ static setSystemLanguage(language: string): void ...@@ -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. 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 **Permission required**: ohos.permission.UPDATE_CONFIGURATION
...@@ -253,7 +253,7 @@ Sets the system language. Currently, this API does not support real-time updatin ...@@ -253,7 +253,7 @@ Sets the system language. Currently, this API does not support real-time updatin
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -284,7 +284,7 @@ Obtains the system region. For details about system regions, see [Instantiating ...@@ -284,7 +284,7 @@ Obtains the system region. For details about system regions, see [Instantiating
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -305,7 +305,7 @@ static setSystemRegion(region: string): void ...@@ -305,7 +305,7 @@ static setSystemRegion(region: string): void
Sets the system region. Sets the system region.
**System API**: This is a system API. This is a system API.
**Permission required**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
...@@ -319,7 +319,7 @@ Sets the system region. ...@@ -319,7 +319,7 @@ Sets the system region.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -350,7 +350,7 @@ Obtains the system locale. For details about system locales, see [Instantiating ...@@ -350,7 +350,7 @@ Obtains the system locale. For details about system locales, see [Instantiating
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -371,7 +371,7 @@ static setSystemLocale(locale: string): void ...@@ -371,7 +371,7 @@ static setSystemLocale(locale: string): void
Sets the system locale. Sets the system locale.
**System API**: This is a system API. This is a system API.
**Permission required**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
...@@ -385,7 +385,7 @@ Sets the system locale. ...@@ -385,7 +385,7 @@ Sets the system locale.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -416,7 +416,7 @@ Checks whether the 24-hour clock is used. ...@@ -416,7 +416,7 @@ Checks whether the 24-hour clock is used.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -437,7 +437,7 @@ static set24HourClock(option: boolean): void ...@@ -437,7 +437,7 @@ static set24HourClock(option: boolean): void
Sets the 24-hour clock. Sets the 24-hour clock.
**System API**: This is a system API. This is a system API.
**Permission required**: ohos.permission.UPDATE_CONFIGURATION **Permission required**: ohos.permission.UPDATE_CONFIGURATION
...@@ -451,7 +451,7 @@ Sets the 24-hour clock. ...@@ -451,7 +451,7 @@ Sets the 24-hour clock.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -473,7 +473,7 @@ static addPreferredLanguage(language: string, index?: number): void ...@@ -473,7 +473,7 @@ static addPreferredLanguage(language: string, index?: number): void
Adds a preferred language to the specified position on the preferred language list. 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 **Permission required**: ohos.permission.UPDATE_CONFIGURATION
...@@ -488,7 +488,7 @@ Adds a preferred language to the specified position on the preferred language li ...@@ -488,7 +488,7 @@ Adds a preferred language to the specified position on the preferred language li
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -512,7 +512,7 @@ static removePreferredLanguage(index: number): void ...@@ -512,7 +512,7 @@ static removePreferredLanguage(index: number): void
Deletes a preferred language from the specified position on the preferred language list. 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 **Permission required**: ohos.permission.UPDATE_CONFIGURATION
...@@ -526,7 +526,7 @@ Deletes a preferred language from the specified position on the preferred langua ...@@ -526,7 +526,7 @@ Deletes a preferred language from the specified position on the preferred langua
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -547,7 +547,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod ...@@ -547,7 +547,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod
static getPreferredLanguageList(): Array&lt;string&gt; static getPreferredLanguageList(): Array&lt;string&gt;
Obtains the preferred language list. Obtains the list of preferred languages.
**System capability**: SystemCapability.Global.I18n **System capability**: SystemCapability.Global.I18n
...@@ -555,11 +555,11 @@ Obtains the preferred language list. ...@@ -555,11 +555,11 @@ Obtains the preferred language list.
| Type | Description | | Type | Description |
| ------------------- | --------- | | ------------------- | --------- |
| Array&lt;string&gt; | Preferred language list.| | Array&lt;string&gt; | List of preferred languages.|
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -590,7 +590,7 @@ Obtains the first language in the preferred language list. ...@@ -590,7 +590,7 @@ Obtains the first language in the preferred language list.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -621,7 +621,7 @@ Obtains the preferred language of an application. ...@@ -621,7 +621,7 @@ Obtains the preferred language of an application.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -642,7 +642,7 @@ static setUsingLocalDigit(flag: boolean): void ...@@ -642,7 +642,7 @@ static setUsingLocalDigit(flag: boolean): void
Specifies whether to enable use of local digits. 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 **Permission required**: ohos.permission.UPDATE_CONFIGURATION
...@@ -652,11 +652,11 @@ Specifies whether to enable use of local digits. ...@@ -652,11 +652,11 @@ Specifies whether to enable use of local digits.
| Name | Type | Mandatory | Description | | 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** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -687,7 +687,7 @@ Checks whether use of local digits is enabled. ...@@ -687,7 +687,7 @@ Checks whether use of local digits is enabled.
**Error codes** **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 | | ID | Error Message |
| ------ | ---------------------- | | ------ | ---------------------- |
...@@ -1059,7 +1059,7 @@ Creates a **PhoneNumberFormat** object. ...@@ -1059,7 +1059,7 @@ Creates a **PhoneNumberFormat** object.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ---------------------------------------- | ---- | ---------------- | | ------- | ---------------------------------------- | ---- | ---------------- |
| country | string | Yes | Country or region to which the phone number to be formatted belongs.| | 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** **Example**
```js ```js
...@@ -1149,7 +1149,7 @@ Obtains the home location of a phone number. ...@@ -1149,7 +1149,7 @@ Obtains the home location of a phone number.
``` ```
## PhoneNumberFormatOptions<sup>8+</sup> ## PhoneNumberFormatOptions<sup>9+</sup>
Defines the options for this PhoneNumberFormat object. Defines the options for this PhoneNumberFormat object.
...@@ -1194,7 +1194,7 @@ Creates an **IndexUtil** object. ...@@ -1194,7 +1194,7 @@ Creates an **IndexUtil** object.
**Example** **Example**
```js ```js
let indexUtil= I18n.getInstance("zh-CN"); let indexUtil = I18n.getInstance("zh-CN");
``` ```
...@@ -1267,7 +1267,7 @@ Obtains the index of a text object. ...@@ -1267,7 +1267,7 @@ Obtains the index of a text object.
**Example** **Example**
```js ```js
let indexUtil= I18n.getInstance("zh-CN"); let indexUtil = I18n.getInstance("zh-CN");
let index = indexUtil.getIndex("hi"); // index = "H" let index = indexUtil.getIndex("hi"); // index = "H"
``` ```
...@@ -1382,7 +1382,7 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi ...@@ -1382,7 +1382,7 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi
**Example** **Example**
```js ```js
let iterator = i18n.getLineInstance("en"); let iterator = I18n.getLineInstance("en");
iterator.setLineBreakText("Apple is my favorite fruit."); iterator.setLineBreakText("Apple is my favorite fruit.");
let firstPos = iterator.first(); // firstPos = 0 let firstPos = iterator.first(); // firstPos = 0
``` ```
...@@ -1689,7 +1689,7 @@ Obtains the list of time zone city IDs supported by the system. ...@@ -1689,7 +1689,7 @@ Obtains the list of time zone city IDs supported by the system.
static getCityDisplayName(cityID: string, locale: string): string 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 **System capability**: SystemCapability.Global.I18n
...@@ -2363,7 +2363,7 @@ This API is supported since API version 8 and is deprecated since API version 9. ...@@ -2363,7 +2363,7 @@ This API is supported since API version 8 and is deprecated since API version 9.
getPreferredLanguageList(): Array&lt;string&gt; getPreferredLanguageList(): Array&lt;string&gt;
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. 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. ...@@ -2373,7 +2373,7 @@ This API is supported since API version 8 and is deprecated since API version 9.
| Type | Description | | Type | Description |
| ------------------- | --------- | | ------------------- | --------- |
| Array&lt;string&gt; | Preferred language list.| | Array&lt;string&gt; | List of preferred languages.|
**Example** **Example**
```js ```js
......
# @ohos.intl (Internationalization) # @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. 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** > **NOTE**
...@@ -48,9 +48,9 @@ Creates a **Locale** object. ...@@ -48,9 +48,9 @@ Creates a **Locale** object.
**Example** **Example**
```js ```js
// The default constructor uses the current system locale to create a Locale object. // 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. // Return the current system locale.
let localeID = locale.toString() let localeID = locale.toString();
``` ```
...@@ -67,13 +67,13 @@ Creates a **Locale** object. ...@@ -67,13 +67,13 @@ Creates a **Locale** object.
| Name | Type | Mandatory | Description | | 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).| | 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).|
| options<sup>9+</sup> | [LocaleOptions](#localeoptions6) | No | Options for creating the **Locale** object. | | options<sup>9+</sup> | [LocaleOptions](#localeoptions9) | No | Options for creating the **Locale** object. |
**Example** **Example**
```js ```js
// Create a Locale object named zh-CN. // Create a Locale object named zh-CN.
let locale = new Intl.Locale("zh-CN") let locale = new Intl.Locale("zh-CN");
let localeID = locale.toString() // localeID = "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 ...@@ -159,7 +159,7 @@ Minimizes information of the **Locale** object. If the script and locale informa
``` ```
## LocaleOptions<sup>6+</sup> ## LocaleOptions<sup>9+</sup>
Represents the locale options. Represents the locale options.
...@@ -206,7 +206,7 @@ Creates a **DateTimeOptions** object for the specified locale. ...@@ -206,7 +206,7 @@ Creates a **DateTimeOptions** object for the specified locale.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------------- | ------------------------------------ | ---- | ---------------------------- | | -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.| | locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [DateTimeOptions](#datetimeoptions6) | No | Options for creating a **DateTimeFormat** object. | | options<sup>9+</sup> | [DateTimeOptions](#datetimeoptions9) | No | Options for creating a **DateTimeFormat** object. |
**Example** **Example**
```js ```js
...@@ -298,7 +298,7 @@ Obtains the formatting options for **DateTimeFormat** object. ...@@ -298,7 +298,7 @@ Obtains the formatting options for **DateTimeFormat** object.
| Type | Description | | Type | Description |
| ------------------------------------ | ----------------------------- | | ------------------------------------ | ----------------------------- |
| [DateTimeOptions](#datetimeoptions6) | Formatting options for **DateTimeFormat** objects.| | [DateTimeOptions](#datetimeoptions9) | Formatting options for **DateTimeFormat** objects.|
**Example** **Example**
```js ```js
...@@ -310,7 +310,7 @@ Obtains the formatting options for **DateTimeFormat** object. ...@@ -310,7 +310,7 @@ Obtains the formatting options for **DateTimeFormat** object.
``` ```
## DateTimeOptions<sup>6+</sup> ## DateTimeOptions<sup>9+</sup>
Provides the options for the **DateTimeFormat** object. Provides the options for the **DateTimeFormat** object.
...@@ -370,7 +370,7 @@ Creates a **NumberFormat** object for the specified locale. ...@@ -370,7 +370,7 @@ Creates a **NumberFormat** object for the specified locale.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------------- | -------------------------------- | ---- | ---------------------------- | | -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.| | locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [NumberOptions](#numberoptions6) | No | Options for creating a **NumberFormat** object. | | options<sup>9+</sup> | [NumberOptions](#numberoptions9) | No | Options for creating a **NumberFormat** object. |
**Example** **Example**
```js ```js
...@@ -420,7 +420,7 @@ Obtains the options of the **NumberFormat** object. ...@@ -420,7 +420,7 @@ Obtains the options of the **NumberFormat** object.
| Type | Description | | Type | Description |
| -------------------------------- | --------------------------- | | -------------------------------- | --------------------------- |
| [NumberOptions](#numberoptions6) | Formatting options for **NumberFormat** objects.| | [NumberOptions](#numberoptions9) | Formatting options for **NumberFormat** objects.|
**Example** **Example**
...@@ -429,11 +429,11 @@ Obtains the options of the **NumberFormat** object. ...@@ -429,11 +429,11 @@ Obtains the options of the **NumberFormat** object.
// Obtain the options of the NumberFormat object. // Obtain the options of the NumberFormat object.
let options = numfmt.resolvedOptions(); let options = numfmt.resolvedOptions();
let style = options.style; // style = decimal let style = options.style; // style = decimal
let notation = options.notation // notation = scientific let notation = options.notation; // notation = scientific
``` ```
## NumberOptions<sup>6+</sup> ## NumberOptions<sup>9+</sup>
Defines the device capability. Defines the device capability.
...@@ -493,7 +493,7 @@ Creates a **Collator** object. ...@@ -493,7 +493,7 @@ Creates a **Collator** object.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------------- | ------------------------------------ | ---- | ---------------------------- | | -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.| | locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [CollatorOptions](#collatoroptions8) | No | Options for creating a **Collator** object. | | options<sup>9+</sup> | [CollatorOptions](#collatoroptions9) | No | Options for creating a **Collator** object. |
**Example** **Example**
```js ```js
...@@ -544,7 +544,7 @@ Returns properties reflecting the locale and collation options of a **Collator** ...@@ -544,7 +544,7 @@ Returns properties reflecting the locale and collation options of a **Collator**
| Type | Description | | Type | Description |
| ------------------------------------ | ----------------- | | ------------------------------------ | ----------------- |
| [CollatorOptions](#collatoroptions8) | Properties of the **Collator** object.| | [CollatorOptions](#collatoroptions9) | Properties of the **Collator** object.|
**Example** **Example**
```js ```js
...@@ -552,11 +552,11 @@ Returns properties reflecting the locale and collation options of a **Collator** ...@@ -552,11 +552,11 @@ Returns properties reflecting the locale and collation options of a **Collator**
// Obtain the options of the Collator object. // Obtain the options of the Collator object.
let options = collator.resolvedOptions(); let options = collator.resolvedOptions();
let usage = options.usage; // usage = "sort" let usage = options.usage; // usage = "sort"
let ignorePunctuation = options.ignorePunctuation // ignorePunctuation = true let ignorePunctuation = options.ignorePunctuation; // ignorePunctuation = true
``` ```
## CollatorOptions<sup>8+</sup> ## CollatorOptions<sup>9+</sup>
Represents the properties of a **Collator** object. Represents the properties of a **Collator** object.
...@@ -604,7 +604,7 @@ Creates a **PluralRules** object to obtain the singular-plural type of numbers. ...@@ -604,7 +604,7 @@ Creates a **PluralRules** object to obtain the singular-plural type of numbers.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- | | -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.| | locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [PluralRulesOptions](#pluralrulesoptions8) | No | Options for creating a **PluralRules** object. | | options<sup>9+</sup> | [PluralRulesOptions](#pluralrulesoptions9) | No | Options for creating a **PluralRules** object. |
**Example** **Example**
```js ```js
...@@ -631,7 +631,7 @@ Obtains a string that represents the singular-plural type of the specified numbe ...@@ -631,7 +631,7 @@ Obtains a string that represents the singular-plural type of the specified numbe
| Type | Description | | 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** **Example**
```js ```js
...@@ -647,7 +647,7 @@ Obtains a string that represents the singular-plural type of the specified numbe ...@@ -647,7 +647,7 @@ Obtains a string that represents the singular-plural type of the specified numbe
``` ```
## PluralRulesOptions<sup>8+</sup> ## PluralRulesOptions<sup>9+</sup>
Represents the properties of a **PluralRules** object. Represents the properties of a **PluralRules** object.
...@@ -695,7 +695,7 @@ Creates a **RelativeTimeFormat** object. ...@@ -695,7 +695,7 @@ Creates a **RelativeTimeFormat** object.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- | | -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.| | locale | string \| Array&lt;string&gt; | Yes | A string containing locale information, including the language, optional script, and region.|
| options<sup>9+</sup> | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | No | Options for creating a **RelativeTimeFormat** object. | | options<sup>9+</sup> | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions9) | No | Options for creating a **RelativeTimeFormat** object. |
**Example** **Example**
```js ```js
...@@ -787,7 +787,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects. ...@@ -787,7 +787,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects.
``` ```
## RelativeTimeFormatInputOptions<sup>8+</sup> ## RelativeTimeFormatInputOptions<sup>9+</sup>
Represents the properties of a **RelativeTimeFormat** object. Represents the properties of a **RelativeTimeFormat** object.
......
...@@ -9,7 +9,7 @@ The **observer** module provides event subscription management functions. You ca ...@@ -9,7 +9,7 @@ The **observer** module provides event subscription management functions. You ca
## Modules to Import ## Modules to Import
```js ```
import observer from '@ohos.telephony.observer' import observer from '@ohos.telephony.observer'
``` ```
...@@ -17,7 +17,7 @@ import observer from '@ohos.telephony.observer' ...@@ -17,7 +17,7 @@ import observer from '@ohos.telephony.observer'
on\(type: \'networkStateChange\', callback: Callback<NetworkState\>\): void; on\(type: \'networkStateChange\', callback: Callback<NetworkState\>\): void;
Registers an observer for network status change events. This API uses an asynchronous callback to return the 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 **Required permission**: ohos.permission.GET_NETWORK_INFO
...@@ -30,6 +30,18 @@ Registers an observer for network status change events. This API uses an asynchr ...@@ -30,6 +30,18 @@ Registers an observer for network status change events. This API uses an asynchr
| type | string | Yes | Network status change event. | | 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).| | 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** **Example**
```js ```js
...@@ -43,7 +55,7 @@ observer.on('networkStateChange', data =>{ ...@@ -43,7 +55,7 @@ observer.on('networkStateChange', data =>{
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback<NetworkState\>\): void; on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback<NetworkState\>\): void;
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the 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 **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 ...@@ -54,9 +66,21 @@ Registers an observer for network status change events of the SIM card in the sp
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- | | ------ | ------ | ---- | -------------------------------------- |
| type | string | Yes | Network status change event. | | type | string | Yes | Network status change event. |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| | 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** **Example**
```js ```js
...@@ -70,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data =>{ ...@@ -70,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data =>{
off\(type: \'networkStateChange\', callback?: Callback<NetworkState\>\): void; off\(type: \'networkStateChange\', callback?: Callback<NetworkState\>\): void;
Unregisters the observer for network status change events. This API uses an asynchronous callback to return the result. Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result.
>**NOTE** >**NOTE**
> >
...@@ -85,6 +109,14 @@ Unregisters the observer for network status change events. This API uses an asyn ...@@ -85,6 +109,14 @@ Unregisters the observer for network status change events. This API uses an asyn
| type | string | Yes | Network status change event. | | 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).| | 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** **Example**
```js ```js
...@@ -101,7 +133,7 @@ observer.off('networkStateChange'); ...@@ -101,7 +133,7 @@ observer.off('networkStateChange');
on\(type: \'signalInfoChange\', callback: Callback<Array<SignalInformation\>\>): void; on\(type: \'signalInfoChange\', callback: Callback<Array<SignalInformation\>\>): void;
Registers an observer for signal status change events. This API uses an asynchronous callback to return the 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 **System capability**: SystemCapability.Telephony.StateRegistry
...@@ -109,9 +141,21 @@ Registers an observer for signal status change events. This API uses an asynchro ...@@ -109,9 +141,21 @@ Registers an observer for signal status change events. This API uses an asynchro
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Signal status change event. | | type | string | Yes | Signal information change event. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| | callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
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** **Example**
```js ```js
...@@ -125,7 +169,7 @@ observer.on('signalInfoChange', data =>{ ...@@ -125,7 +169,7 @@ observer.on('signalInfoChange', data =>{
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback<Array<SignalInformation\>\>): void; on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback<Array<SignalInformation\>\>): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the 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 **System capability**: SystemCapability.Telephony.StateRegistry
...@@ -133,10 +177,22 @@ Registers an observer for signal status change events of the SIM card in the spe ...@@ -133,10 +177,22 @@ Registers an observer for signal status change events of the SIM card in the spe
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- | | ------ | ------ | ---- | -------------------------------------- |
| type | string | Yes | Signal status change event. | | type | string | Yes | Signal information change event. |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| | callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
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** **Example**
```js ```js
...@@ -150,7 +206,7 @@ observer.on('signalInfoChange', {slotId: 0}, data =>{ ...@@ -150,7 +206,7 @@ observer.on('signalInfoChange', {slotId: 0}, data =>{
off\(type: \'signalInfoChange\', callback?: Callback<Array<SignalInformation\>\>): void; off\(type: \'signalInfoChange\', callback?: Callback<Array<SignalInformation\>\>): void;
Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the result. Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the execution result.
>**NOTE** >**NOTE**
> >
...@@ -162,9 +218,20 @@ Unregisters the observer for signal status change events. This API uses an async ...@@ -162,9 +218,20 @@ Unregisters the observer for signal status change events. This API uses an async
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Signal status change event. | | type | string | Yes | Signal information change event. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| | callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -182,7 +249,7 @@ observer.off('signalInfoChange'); ...@@ -182,7 +249,7 @@ observer.off('signalInfoChange');
on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: string }\>): void; 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 **System capability**: SystemCapability.Telephony.StateRegistry
...@@ -193,6 +260,17 @@ Registers an observer for call status change events. This API uses an asynchrono ...@@ -193,6 +260,17 @@ Registers an observer for call status change events. This API uses an asynchrono
| type | string | Yes | Call status change event. | | 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.<br>**number**: phone number.| | 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.<br>**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** **Example**
```js ```js
...@@ -206,7 +284,7 @@ observer.on('callStateChange', value =>{ ...@@ -206,7 +284,7 @@ observer.on('callStateChange', value =>{
on(type: 'callStateChange', options: { slotId: number }, callback: Callback<{ state:CallState, number: string }>): void; 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 **System capability**: SystemCapability.Telephony.StateRegistry
...@@ -215,9 +293,20 @@ Registers an observer for call status change events. This API uses an asynchrono ...@@ -215,9 +293,20 @@ Registers an observer for call status change events. This API uses an asynchrono
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Call status change event. | | type | string | Yes | Call status change event. |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.<br>**number**: phone number.| | 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.<br>**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** **Example**
```js ```js
...@@ -231,7 +320,7 @@ observer.on('callStateChange', {slotId: 0}, value =>{ ...@@ -231,7 +320,7 @@ observer.on('callStateChange', {slotId: 0}, value =>{
off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: string }>): void; 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** >**NOTE**
> >
...@@ -246,6 +335,17 @@ Unregisters the observer for call status change events. This API uses an asynchr ...@@ -246,6 +335,17 @@ Unregisters the observer for call status change events. This API uses an asynchr
| type | string | Yes | Call status change event. | | 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.<br>**number**: phone number.| | 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.<br>**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** **Example**
```js ```js
...@@ -263,7 +363,7 @@ observer.off('callStateChange'); ...@@ -263,7 +363,7 @@ observer.off('callStateChange');
on\(type: 'cellularDataConnectionStateChange', callback: Callback\<{ state: DataConnectState, network: RatType}\>\): void; 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 **System capability**: SystemCapability.Telephony.StateRegistry
...@@ -271,9 +371,20 @@ Registers an observer for connection status change events of the cellular data c ...@@ -271,9 +371,20 @@ Registers an observer for connection status change events of the cellular data c
| Name | Type | Mandatory| Description | | 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).| | 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** **Example**
```js ```js
...@@ -287,7 +398,7 @@ observer.on('cellularDataConnectionStateChange', value =>{ ...@@ -287,7 +398,7 @@ observer.on('cellularDataConnectionStateChange', value =>{
on\(type: 'cellularDataConnectionStateChange', options: { slotId: number }, callback: Callback\<{ state: DataConnectState, network: RatType }\>\): void; 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 **System capability**: SystemCapability.Telephony.StateRegistry
...@@ -295,10 +406,21 @@ Registers an observer for connection status change events of the cellular data c ...@@ -295,10 +406,21 @@ Registers an observer for connection status change events of the cellular data c
| Name | Type | Mandatory| Description | | 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. |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | Callback\<{ 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).| | 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** **Example**
```js ```js
...@@ -312,7 +434,7 @@ observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{ ...@@ -312,7 +434,7 @@ observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{
off\(type: 'cellularDataConnectionStateChange', callback?: Callback\<{ state: DataConnectState, network: RatType}\>\): void; 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** >**NOTE**
> >
...@@ -324,9 +446,20 @@ Unregisters the observer for connection status change events of the cellular dat ...@@ -324,9 +446,20 @@ Unregisters the observer for connection status change events of the cellular dat
| Name | Type | Mandatory| Description | | 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).| | 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** **Example**
```js ```js
...@@ -355,6 +488,17 @@ Registers an observer for the uplink and downlink data flow status change events ...@@ -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. | | 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).| | 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** **Example**
```js ```js
...@@ -377,9 +521,20 @@ Registers an observer for the uplink and downlink data flow status change events ...@@ -377,9 +521,20 @@ Registers an observer for the uplink and downlink data flow status change events
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | | type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| | 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** **Example**
```js ```js
...@@ -408,6 +563,17 @@ Unregisters the observer for the uplink and downlink data flow status change eve ...@@ -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. | | 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).| | 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** **Example**
```js ```js
...@@ -436,6 +602,17 @@ Registers an observer for SIM card status change events. This API uses an asynch ...@@ -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. | | type | string | Yes | SIM card status change event. |
| callback | Callback\<[SimStateData](#simstatedata7)\> | Yes | Callback used to return the result.| | 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** **Example**
```js ```js
...@@ -458,9 +635,20 @@ Registers an observer for status change events of the SIM card in the specified ...@@ -458,9 +635,20 @@ Registers an observer for status change events of the SIM card in the specified
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| type | string | Yes | SIM card status change event. | | type | string | Yes | SIM card status change event. |
| slotId | number | Yes | Card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | Callback\<[SimStateData](#simstatedata7)\> | Yes | Callback used to return the result.| | 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** **Example**
```js ```js
...@@ -489,6 +677,17 @@ Unregisters the observer for SIM card status change events. This API uses an asy ...@@ -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. | | type | string | Yes | SIM card status change event. |
| callback | Callback\<[SimStateData](#simstatedata7)\> | No | Callback used to return the result.| | 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** **Example**
```js ```js
...@@ -531,8 +730,8 @@ Enumerates SIM card types and states. ...@@ -531,8 +730,8 @@ Enumerates SIM card types and states.
**System capability**: SystemCapability.Telephony.StateRegistry **System capability**: SystemCapability.Telephony.StateRegistry
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------------------- | ----------------------------------- | ---- | -------------------------------------------------------- |
| type | [CardType](js-apis-sim.md#cardtype) | Yes| SIM card type. For details, see [CardType](js-apis-sim.md#cardtype).| | 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).| | state | [SimState](js-apis-sim.md#simstate) | Yes | SIM card status. For details, see [SimState](js-apis-sim.md#simstate).|
| reason<sup>8+</sup> | [LockReason](#lockreason8) | Yes| SIM card lock type.| | reason<sup>8+</sup> | [LockReason](#lockreason8) | Yes | SIM card lock type. |
...@@ -10,7 +10,7 @@ The **radio** module provides basic network search management functions. You can ...@@ -10,7 +10,7 @@ The **radio** module provides basic network search management functions. You can
## Modules to Import ## Modules to Import
``` ```
import radio from '@ohos.telephony.radio' import radio from '@ohos.telephony.radio';
``` ```
## radio.getRadioTech ## radio.getRadioTech
...@@ -45,7 +45,7 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified ...@@ -45,7 +45,7 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified
```js ```js
let slotId = 0; let slotId = 0;
radio.getRadioTech(slotId, (err, data) =>{ radio.getRadioTech(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(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 ...@@ -127,7 +127,7 @@ Obtains the network status. This API uses an asynchronous callback to return the
**Example** **Example**
```js ```js
radio.getNetworkState((err, data) =>{ radio.getNetworkState((err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
}); });
``` ```
...@@ -2464,7 +2464,7 @@ Defines the signal strength. ...@@ -2464,7 +2464,7 @@ Defines the signal strength.
| --------------- | --------------------------- | ---- | ------------------ | | --------------- | --------------------------- | ---- | ------------------ |
| signalType | [NetworkType](#networktype) | Yes | Signal strength type.| | signalType | [NetworkType](#networktype) | Yes | Signal strength type.|
| signalLevel | number | Yes | Signal strength level.| | signalLevel | number | Yes | Signal strength level.|
| dBm<sup>9+</sup>| number | Yes | Network signal strength. | | dBm<sup>9+</sup>| number | Yes | Signal strength, in dBm. |
## NetworkType ## NetworkType
......
...@@ -482,7 +482,7 @@ Enumerates the types of **RunningLock** objects. ...@@ -482,7 +482,7 @@ Enumerates the types of **RunningLock** objects.
**System capability:** SystemCapability.PowerManager.PowerManager.Core **System capability:** SystemCapability.PowerManager.PowerManager.Core
| Name | Value | Description | | Name | Value | Description |
| ------------------------ | ---- | -------------------------------------- | | --------------------------------- | ---- | ------------------------------------------------------------ |
| BACKGROUND | 1 | A lock that prevents the system from hibernating when the screen is off. | | BACKGROUND<sup>(deprecated)</sup> | 1 | A lock that prevents the system from hibernating when the screen is off.<br>**NOTE**<br>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.| | PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen. |
# @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** >**NOTE**
> >
...@@ -121,7 +121,7 @@ promise.then(data => { ...@@ -121,7 +121,7 @@ promise.then(data => {
hasOperatorPrivileges(slotId: number, callback: AsyncCallback\<boolean\>): void hasOperatorPrivileges(slotId: number, callback: AsyncCallback\<boolean\>): void
Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result. Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -132,6 +132,17 @@ Checks whether the application (caller) has been granted the operator permission ...@@ -132,6 +132,17 @@ Checks whether the application (caller) has been granted the operator permission
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -144,7 +155,7 @@ sim.hasOperatorPrivileges(0, (err, data) => { ...@@ -144,7 +155,7 @@ sim.hasOperatorPrivileges(0, (err, data) => {
hasOperatorPrivileges(slotId: number): Promise<boolean\> hasOperatorPrivileges(slotId: number): Promise<boolean\>
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 **System capability**: SystemCapability.Telephony.CoreService
...@@ -160,6 +171,17 @@ Checks whether the application (caller) has been granted the carrier permission. ...@@ -160,6 +171,17 @@ Checks whether the application (caller) has been granted the carrier permission.
| :----------------- | :---------------------------------------------------------- | | :----------------- | :---------------------------------------------------------- |
| Promise\<boolean\> | 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.| | Promise\<boolean\> | 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** **Example**
```js ```js
...@@ -184,7 +206,18 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use ...@@ -184,7 +206,18 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ---------------------------------------- | | -------- | ----------------------- | ---- | ---------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. which is an ISO country code, for example, **CN** (China).| | callback | AsyncCallback\<string\> | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -215,6 +248,17 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use ...@@ -215,6 +248,17 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use
| ----------------- | ------------------------------------------------------------ | | ----------------- | ------------------------------------------------------------ |
| Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).| | Promise\<string\> | Promise used to return the result, which is an ISO country code, for example, **CN** (China).|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -231,7 +275,7 @@ promise.then(data => { ...@@ -231,7 +275,7 @@ promise.then(data => {
getSimOperatorNumeric\(slotId: number, callback: AsyncCallback<string\>\): void getSimOperatorNumeric\(slotId: number, callback: AsyncCallback<string\>\): void
Obtains the public land mobile network (PLMN) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -242,6 +286,17 @@ Obtains the public land mobile network (PLMN) ID of the SIM card in the specifie ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -271,6 +326,17 @@ Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promi ...@@ -271,6 +326,17 @@ Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promi
| ----------------- | ------------------------------------------------ | | ----------------- | ------------------------------------------------ |
| Promise\<string\> | Promise used to return the result.| | Promise\<string\> | 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** **Example**
```js ```js
...@@ -287,7 +353,7 @@ promise.then(data => { ...@@ -287,7 +353,7 @@ promise.then(data => {
getSimSpn\(slotId: number, callback: AsyncCallback<string\>\): void getSimSpn\(slotId: number, callback: AsyncCallback<string\>\): void
Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
...@@ -298,6 +364,17 @@ Obtains the service provider name (SPN) of the SIM card in the specified slot. T ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -311,7 +388,7 @@ sim.getSimSpn(0, (err, data) => { ...@@ -311,7 +388,7 @@ sim.getSimSpn(0, (err, data) => {
getSimSpn\(slotId: number\): Promise<string\> getSimSpn\(slotId: number\): Promise<string\>
Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result.
**System capability**: SystemCapability.Telephony.CoreService **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 ...@@ -327,6 +404,17 @@ Obtains the SPN of the SIM card in the specified slot. This API uses a promise t
| ----------------- | ----------------------------------------- | | ----------------- | ----------------------------------------- |
| Promise\<string\> | Promise used to return the result.| | Promise\<string\> | 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** **Example**
```js ```js
...@@ -343,7 +431,7 @@ promise.then(data => { ...@@ -343,7 +431,7 @@ promise.then(data => {
getSimState\(slotId: number, callback: AsyncCallback<SimState\>\): void getSimState\(slotId: number, callback: AsyncCallback<SimState\>\): 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 **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 ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[SimState](#simstate)\> | Yes | Callback used to return the result. For details, see [SimState](#simstate). | | 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** **Example**
```js ```js
...@@ -367,7 +466,7 @@ sim.getSimState(0, (err, data) => { ...@@ -367,7 +466,7 @@ sim.getSimState(0, (err, data) => {
getSimState\(slotId: number\): Promise<SimState\> getSimState\(slotId: number\): Promise<SimState\>
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 **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 ...@@ -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.| | 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** **Example**
```js ```js
...@@ -409,6 +519,17 @@ Obtains the type of the SIM card in the specified slot. This API uses an asynchr ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[CardType](#cardtype7)\> | Yes | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -438,6 +559,17 @@ Obtains the type of the SIM card in the specified slot. This API uses a promise ...@@ -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.| | 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** **Example**
```js ```js
...@@ -465,6 +597,17 @@ Checks whether the SIM card in the specified slot is installed. This API uses an ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;boolean&gt; | 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** **Example**
```js ```js
...@@ -494,6 +637,17 @@ Checks whether the SIM card in the specified slot is installed. This API uses a ...@@ -494,6 +637,17 @@ Checks whether the SIM card in the specified slot is installed. This API uses a
| --------------------- | ---------------------------------- | | --------------------- | ---------------------------------- |
| Promise&lt;boolean&gt; | 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.| | Promise&lt;boolean&gt; | 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** **Example**
```js ```js
...@@ -509,7 +663,7 @@ promise.then(data => { ...@@ -509,7 +663,7 @@ promise.then(data => {
getSimAccountInfo(slotId: number, callback: AsyncCallback<IccAccountInfo\>): void getSimAccountInfo(slotId: number, callback: AsyncCallback<IccAccountInfo\>): 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. **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 ...@@ -524,6 +678,19 @@ Obtains account information of the SIM card in the specified slot. This API uses
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<[IccAccountInfo](#iccaccountinfo7)\> | Yes | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -537,7 +704,7 @@ sim.getSimAccountInfo(0, (err, data) => { ...@@ -537,7 +704,7 @@ sim.getSimAccountInfo(0, (err, data) => {
getSimAccountInfo(slotId: number): Promise<IccAccountInfo\> getSimAccountInfo(slotId: number): Promise<IccAccountInfo\>
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. **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 ...@@ -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.| | 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** **Example**
```js ```js
...@@ -586,6 +766,18 @@ Obtains the account information list of the active SIM card. This API uses an as ...@@ -586,6 +766,18 @@ Obtains the account information list of the active SIM card. This API uses an as
| -------- | ----------------------------------------------------------- | ---- | ---------- | | -------- | ----------------------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<Array<[IccAccountInfo](#iccaccountinfo7)\>\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<Array<[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. |
**Example** **Example**
```js ```js
...@@ -613,6 +805,18 @@ Obtains the account information list of the active SIM card. This API uses a pro ...@@ -613,6 +805,18 @@ Obtains the account information list of the active SIM card. This API uses a pro
| ---------------------------------------------------- | ---------------------------------------------- | | ---------------------------------------------------- | ---------------------------------------------- |
| Promise<Array<[IccAccountInfo](#iccaccountinfo7)\>\> | Promise used to return the result.| | Promise<Array<[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. |
**Example** **Example**
```js ```js
...@@ -643,6 +847,19 @@ Sets the default slot ID of the SIM card that provides voice services. This API ...@@ -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. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: Clears the default configuration.| | slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: Clears the default configuration.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | 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** **Example**
```js ```js
...@@ -676,6 +893,19 @@ Sets the default slot ID of the SIM card that provides voice services. This API ...@@ -676,6 +893,19 @@ Sets the default slot ID of the SIM card that provides voice services. This API
| --------------- | ------------------------------- | | --------------- | ------------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301001 | SIM card is not activated. |
**Example** **Example**
```js ```js
...@@ -707,6 +937,18 @@ Sets a display name for the SIM card in the specified slot. This API uses an asy ...@@ -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. | | name | string | Yes | SIM card name. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -741,6 +983,18 @@ Sets a display name for the SIM card in the specified slot. This API uses a prom ...@@ -741,6 +983,18 @@ Sets a display name for the SIM card in the specified slot. This API uses a prom
| --------------- | ------------------------------- | | --------------- | ------------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -772,6 +1026,18 @@ Obtains the name of the SIM card in the specified slot. This API uses an asynchr ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -805,6 +1071,18 @@ Obtains the name of the SIM card in the specified slot. This API uses a promise ...@@ -805,6 +1071,18 @@ Obtains the name of the SIM card in the specified slot. This API uses a promise
| --------------------- | -------------------------------------- | | --------------------- | -------------------------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -836,6 +1114,18 @@ Sets a display number for the SIM card in the specified slot. This API uses an a ...@@ -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. | | number | string | Yes | SIM card number. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -871,6 +1161,18 @@ Sets a display number for the SIM card in the specified slot. This API uses a pr ...@@ -871,6 +1161,18 @@ Sets a display number for the SIM card in the specified slot. This API uses a pr
| -------------- | ------------------------------- | | -------------- | ------------------------------- |
| Promise<void\> | Promise used to return the result.| | Promise<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -902,6 +1204,18 @@ Obtains the display number of the SIM card in the specified slot. This API uses ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -935,6 +1249,18 @@ Obtains the display number of the SIM card in the specified slot. This API uses ...@@ -935,6 +1249,18 @@ Obtains the display number of the SIM card in the specified slot. This API uses
| --------------------- | --------------------------------- | | --------------------- | --------------------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -950,7 +1276,7 @@ promise.then(data => { ...@@ -950,7 +1276,7 @@ promise.then(data => {
activateSim(slotId: number, callback: AsyncCallback<void\>): void activateSim(slotId: number, callback: AsyncCallback<void\>): 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. **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 ...@@ -965,6 +1291,18 @@ Activates the SIM card in the specified slot. This API uses an asynchronous call
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -998,6 +1336,18 @@ Activates the SIM card in the specified slot. This API uses a promise to return ...@@ -998,6 +1336,18 @@ Activates the SIM card in the specified slot. This API uses a promise to return
| --------------- | ------------------------------- | | --------------- | ------------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1013,7 +1363,7 @@ promise.then(data => { ...@@ -1013,7 +1363,7 @@ promise.then(data => {
deactivateSim(slotId: number, callback: AsyncCallback<void\>): void deactivateSim(slotId: number, callback: AsyncCallback<void\>): 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. **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 ...@@ -1028,6 +1378,18 @@ Deactivates the SIM card in the specified slot. This API uses an asynchronous ca
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1041,7 +1403,7 @@ sim.deactivateSim(0, (err, data) => { ...@@ -1041,7 +1403,7 @@ sim.deactivateSim(0, (err, data) => {
deactivateSim(slotId: number): Promise\<void\> deactivateSim(slotId: number): Promise\<void\>
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. **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 ...@@ -1061,6 +1423,18 @@ Deactivates the SIM card in the specified slot. This API uses a promise to retur
| --------------- | ------------------------------- | | --------------- | ------------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1090,7 +1464,20 @@ Sets the lock status of the SIM card in the specified slot. This API uses an asy ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. |
| options | [LockInfo](#lockinfo8) | Yes | Lock information.<br>- **lockType**: [LockType](#locktype8)<br>- **password**: string<br>- **state**: [LockState](#lockstate8) | | options | [LockInfo](#lockinfo8) | Yes | Lock information.<br>- lockType: [LockType](#locktype8)<br>- password: string<br>- 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** **Example**
...@@ -1123,7 +1510,7 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom ...@@ -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 | | Name | Type | Mandatory| Description |
| ------- | ---------------------- | ---- | ------------------------------------------------------------ | | ------- | ---------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| options | [LockInfo](#lockinfo8) | Yes | Lock information.<br>- **lockType**: [LockType](#locktype8)<br>- **password**: string<br>- **state**: [LockState](#lockstate8) | | options | [LockInfo](#lockinfo8) | Yes | Lock information.<br>- lockType: [LockType](#locktype8)<br>- password: string<br>- state: [LockState](#lockstate8) |
**Return value** **Return value**
...@@ -1131,6 +1518,19 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom ...@@ -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.| | 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** **Example**
```js ```js
...@@ -1167,6 +1567,19 @@ Obtains the lock status of the SIM card in the specified slot. This API uses an ...@@ -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. | | callback | AsyncCallback\<[LockState](#lockstate8)\> | Yes | Callback used to return the result. |
| options | [LockType](#locktype8) | Yes | Lock type.<br>- **1**: PIN lock<br>- **2**: PIN 2 lock| | options | [LockType](#locktype8) | Yes | Lock type.<br>- **1**: PIN lock<br>- **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** **Example**
```js ```js
...@@ -1201,6 +1614,19 @@ Obtains the lock status of the SIM card in the specified slot. This API uses a p ...@@ -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.| | 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** **Example**
```js ```js
...@@ -1233,6 +1659,19 @@ Changes the PIN of the SIM card in the specified slot. This API uses an asynchro ...@@ -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. | | newPin | string | Yes | New PIN. |
| oldPin | string | Yes | Old 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** **Example**
```js ```js
...@@ -1268,6 +1707,19 @@ Changes the PIN of the SIM card in the specified slot. This API uses a promise t ...@@ -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.| | 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** **Example**
```js ```js
...@@ -1300,6 +1752,19 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses an asynchrono ...@@ -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. | | newPin2 | string | Yes | New PIN. |
| oldPin2 | string | Yes | Old 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** **Example**
```js ```js
...@@ -1335,6 +1800,19 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses a promise to ...@@ -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.| | 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** **Example**
```js ```js
...@@ -1350,7 +1828,7 @@ promise.then(data => { ...@@ -1350,7 +1828,7 @@ promise.then(data => {
unlockPin(slotId: number, pin: string, callback: AsyncCallback<LockStatusResponse\>): void unlockPin(slotId: number, pin: string, callback: AsyncCallback<LockStatusResponse\>): 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. **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 ...@@ -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. | | pin | string | Yes | PIN of the SIM card. |
| callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[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** **Example**
```js ```js
...@@ -1401,6 +1892,19 @@ Unlocks the PIN of the SIM card in the specified slot. This API uses a promise t ...@@ -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.| | 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** **Example**
```js ```js
...@@ -1415,7 +1919,7 @@ promise.then(data => { ...@@ -1415,7 +1919,7 @@ promise.then(data => {
## sim.unlockPuk<sup>7+</sup> ## sim.unlockPuk<sup>7+</sup>
unlockPuk(slotId: number, newPin: string, puk: string ,callback: AsyncCallback<LockStatusResponse\>): void unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback<LockStatusResponse\>): void
Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...@@ -1434,6 +1938,19 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchro ...@@ -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. | | puk | string | Yes | PUK of the SIM card. |
| callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | 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** **Example**
```js ```js
...@@ -1471,6 +1988,19 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses a promise t ...@@ -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.| | 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** **Example**
```js ```js
...@@ -1501,9 +2031,22 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses an asynchrono ...@@ -1501,9 +2031,22 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses an asynchrono
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| pin2 | string | Yes | PIN 2 of the SIM card. | | pin2 | string | Yes | PIN of the SIM card. |
| callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | 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** **Example**
```js ```js
...@@ -1531,7 +2074,7 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to ...@@ -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 | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- | | ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| pin2 | string | Yes | PIN 2 of the SIM card. | | pin2 | string | Yes | PIN of the SIM card. |
**Return value** **Return value**
...@@ -1539,6 +2082,19 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to ...@@ -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.| | 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** **Example**
```js ```js
...@@ -1569,9 +2125,22 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses an asynchrono ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| newPin2 | string | Yes | New PIN 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&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[LockStatusResponse](#lockstatusresponse7)&gt; | 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** **Example**
```js ```js
...@@ -1601,7 +2170,7 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| newPin2 | string | Yes | New PIN 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** **Return value**
...@@ -1609,6 +2178,19 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to ...@@ -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.| | 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** **Example**
```js ```js
...@@ -1646,7 +2228,7 @@ console.log("Result: "+ sim.getMaxSimCount()) ...@@ -1646,7 +2228,7 @@ console.log("Result: "+ sim.getMaxSimCount())
getSimIccId(slotId: number, callback: AsyncCallback<string\>): void getSimIccId(slotId: number, callback: AsyncCallback<string\>): 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. **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 ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1694,6 +2288,18 @@ Obtains the ICCID of the SIM card in the specified slot. This API uses a promise ...@@ -1694,6 +2288,18 @@ Obtains the ICCID of the SIM card in the specified slot. This API uses a promise
| ---------------- | ------------------------------------------- | | ---------------- | ------------------------------------------- |
| Promise<string\> | Promise used to return the result.| | Promise<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1724,6 +2330,18 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot ...@@ -1724,6 +2330,18 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1757,6 +2375,18 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot ...@@ -1757,6 +2375,18 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot
| ---------------- | ------------------------------------------------- | | ---------------- | ------------------------------------------------- |
| Promise<string\> | Promise used to return the result.| | Promise<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1787,6 +2417,18 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1820,6 +2462,18 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API ...@@ -1820,6 +2462,18 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API
| ---------------- | ------------------------------------------------ | | ---------------- | ------------------------------------------------ |
| Promise<string\> | Promise used to return the result.| | Promise<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1831,6 +2485,7 @@ promise.then(data => { ...@@ -1831,6 +2485,7 @@ promise.then(data => {
}); });
``` ```
## sim.setVoiceMailInfo<sup>8+</sup> ## sim.setVoiceMailInfo<sup>8+</sup>
setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback<void\>): void setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback<void\>): void
...@@ -1852,6 +2507,19 @@ Sets voice mailbox information for the SIM card in the specified slot. This API ...@@ -1852,6 +2507,19 @@ Sets voice mailbox information for the SIM card in the specified slot. This API
| mailNumber | string | Yes | Voice mailbox number. | | mailNumber | string | Yes | Voice mailbox number. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301002 | SIM card operation error. |
**Example** **Example**
```js ```js
...@@ -1887,6 +2555,19 @@ Sets voice mailbox information for the SIM card in the specified slot. This API ...@@ -1887,6 +2555,19 @@ Sets voice mailbox information for the SIM card in the specified slot. This API
| -------------- | ----------------------- | | -------------- | ----------------------- |
| Promise<void\> | Promise used to return the result.| | Promise<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301002 | SIM card operation error. |
**Example** **Example**
```js ```js
...@@ -1902,7 +2583,7 @@ promise.then(data => { ...@@ -1902,7 +2583,7 @@ promise.then(data => {
getSimTelephoneNumber(slotId: number, callback: AsyncCallback<string\>): void getSimTelephoneNumber(slotId: number, callback: AsyncCallback<string\>): 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. **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 ...@@ -1917,6 +2598,18 @@ Obtains the mobile subscriber ISDN number (MSISDN) of the SIM card in the specif
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1950,6 +2643,18 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses a promis ...@@ -1950,6 +2643,18 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses a promis
| ---------------- | -------------------------------------------- | | ---------------- | -------------------------------------------- |
| Promise<string\> | Promise used to return the result.| | Promise<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1980,6 +2685,18 @@ Obtains the group identifier level 1 (GID1) of the SIM card in the specified slo ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2013,6 +2730,18 @@ Obtains the GID1 of the SIM card in the specified slot. This API uses a promise ...@@ -2013,6 +2730,18 @@ Obtains the GID1 of the SIM card in the specified slot. This API uses a promise
| ---------------- | ------------------------------------------------- | | ---------------- | ------------------------------------------------- |
| Promise<string\> | Promise used to return the result.| | Promise<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2043,6 +2772,18 @@ Obtains the international mobile subscriber identity (IMSI) of the SIM card in t ...@@ -2043,6 +2772,18 @@ Obtains the international mobile subscriber identity (IMSI) of the SIM card in t
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback\<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2076,6 +2817,18 @@ Obtains the IMSI of the SIM card in the specified slot. This API uses a promise ...@@ -2076,6 +2817,18 @@ Obtains the IMSI of the SIM card in the specified slot. This API uses a promise
| ---------------- | ------------------------------------------- | | ---------------- | ------------------------------------------- |
| Promise<string\> | Promise used to return the result.| | Promise<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2106,6 +2859,18 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP ...@@ -2106,6 +2859,18 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<Array<[OperatorConfig](#operatorconfig8)\>> | Yes | Callback used to return the result. | | callback | AsyncCallback<Array<[OperatorConfig](#operatorconfig8)\>> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2139,6 +2904,18 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP ...@@ -2139,6 +2904,18 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP
| --------------------------------------------------- | ----------------------------- | | --------------------------------------------------- | ----------------------------- |
| Promise<Array<[OperatorConfig](#operatorconfig8)\>> | Promise used to return the result.| | Promise<Array<[OperatorConfig](#operatorconfig8)\>> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2167,8 +2944,21 @@ Queries contact numbers of the SIM card in the specified slot. This API uses an ...@@ -2167,8 +2944,21 @@ Queries contact numbers of the SIM card in the specified slot. This API uses an
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- | | -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| type | [ContactType](#contacttype8) | Yes | Contact type.<br>- **1**: GENERAL_CONTACT<br>- **2**: FIXED_DIALING | | type | [ContactType](#contacttype8) | Yes | Contact type.<br>- **1**: GENERAL_CONTACT<br>- **2**: FIXED_DIALING|
| callback | AsyncCallback<Array<[DiallingNumbersInfo](#diallingnumbersinfo8)\>> | Yes | Callback used to return the result. | | callback | AsyncCallback<Array<[DiallingNumbersInfo](#diallingnumbersinfo8)\>> | 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** **Example**
...@@ -2196,13 +2986,26 @@ Queries contact numbers of the SIM card in the specified slot. This API uses a p ...@@ -2196,13 +2986,26 @@ Queries contact numbers of the SIM card in the specified slot. This API uses a p
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ----------- | ---- | ---------------------------------------------------------- | | ------ | ----------- | ---- | ---------------------------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2 |
| type | [ContactType](#contacttype8) | Yes | Contact type.<br>- **1**: GENERAL_CONTACT<br>- **2**: FIXED_DIALING | | type | [ContactType](#contacttype8) | Yes | Contact type.<br>- **1**: GENERAL_CONTACT<br>- **2**: FIXED_DIALING|
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------------------ | ------------------------------ | | ------------------------------------------------------------ | ------------------------------ |
| Promise<Array<[DiallingNumbersInfo](#diallingnumbersinfo8)\>> | Promise used to return the result.| | Promise<Array<[DiallingNumbersInfo](#diallingnumbersinfo8)\>> | 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** **Example**
...@@ -2236,6 +3039,19 @@ Adds contact numbers for the SIM card in the specified slot. This API uses an as ...@@ -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. | | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301002 | SIM card operation error. |
**Example** **Example**
```js ```js
...@@ -2274,7 +3090,20 @@ Adds contact numbers for the SIM card in the specified slot. This API uses a pro ...@@ -2274,7 +3090,20 @@ Adds contact numbers for the SIM card in the specified slot. This API uses a pro
| Type | Description | | Type | Description |
| -------------- | --------------------------- | | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.| | Promise<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301002 | SIM card operation error. |
**Example** **Example**
...@@ -2312,12 +3141,27 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a ...@@ -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. | | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301002 | SIM card operation error. |
**Example** **Example**
```js ```js
let diallingNumbersInof = { let diallingNumbersInof = {
alphaTag: "alpha", alphaTag: "alpha",
number: "138xxxxxxxx" number: "138xxxxxxxx",
recordNumber: 123,
pin2: "1234"
}; };
sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(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 ...@@ -2349,7 +3193,20 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a
| Type | Description | | Type | Description |
| -------------- | --------------------------- | | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.| | Promise<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301002 | SIM card operation error. |
**Example** **Example**
...@@ -2387,12 +3244,27 @@ Updates contact numbers for the SIM card in the specified slot. This API uses an ...@@ -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. | | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301002 | SIM card operation error. |
**Example** **Example**
```js ```js
let diallingNumbersInof = { let diallingNumbersInof = {
alphaTag: "alpha", alphaTag: "alpha",
number: "138xxxxxxxx" number: "138xxxxxxxx",
recordNumber: 123,
pin2: "1234"
}; };
sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(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 ...@@ -2426,14 +3298,26 @@ Updates contact numbers for the SIM card in the specified slot. This API uses a
| -------------- | ----------------------------- | | -------------- | ----------------------------- |
| Promise<void\> | Promise used to return the result.| | Promise<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301002 | SIM card operation error. |
**Example** **Example**
```js ```js
let diallingNumbersInof = { let diallingNumbersInof = {
alphaTag: "alpha", alphaTag: "alpha",
number: "138xxxxxxxx", number: "138xxxxxxxx",
recordNumber: 123, recordNumber: 123
pin2: "1234"
}; };
let promise = sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); let promise = sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof);
promise.then(data => { promise.then(data => {
...@@ -2461,7 +3345,19 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| cmd | string | Yes | Envelope command. | | cmd | string | Yes | Envelope command. |
| callback | AsyncCallback<void\> | Yes | Yes | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -2497,6 +3393,18 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a ...@@ -2497,6 +3393,18 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a
| -------------- | --------------------------- | | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.| | Promise<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2525,9 +3433,21 @@ Sends a terminal response command to the SIM card in the specified slot. This AP ...@@ -2525,9 +3433,21 @@ Sends a terminal response command to the SIM card in the specified slot. This AP
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | -------------------- | ---- | -------------------------------------- | | -------- | -------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| cmd | string | Yes | Command | | cmd | string | Yes | Envelope command. |
| callback | AsyncCallback<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2554,7 +3474,7 @@ Sends a terminal response command to the SIM card in the specified slot. This AP ...@@ -2554,7 +3474,7 @@ Sends a terminal response command to the SIM card in the specified slot. This AP
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- | | ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| cmd | string | Yes | Command | | cmd | string | Yes | Envelope command. |
**Return value** **Return value**
...@@ -2562,6 +3482,18 @@ Sends a terminal response command to the SIM card in the specified slot. This AP ...@@ -2562,6 +3482,18 @@ Sends a terminal response command to the SIM card in the specified slot. This AP
| -------------- | --------------------------- | | -------------- | --------------------------- |
| Promise<void\> | Promise used to return the result.| | Promise<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -2573,11 +3505,12 @@ promise.then(data => { ...@@ -2573,11 +3505,12 @@ promise.then(data => {
}); });
``` ```
## sim.unlockSimLock<sup>8+</sup> ## sim.unlockSimLock<sup>8+</sup>
unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback<LockStatusResponse\>): void unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback<LockStatusResponse\>): void
Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API. **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 ...@@ -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. | | lockInfo | [PersoLockInfo](#persolockinfo8) | Yes | Personalized lock information. |
| callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. | | 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** **Example**
```js ```js
...@@ -2610,7 +3556,7 @@ sim.unlockSimLock(0, persoLockInfo, (err, data) => { ...@@ -2610,7 +3556,7 @@ sim.unlockSimLock(0, persoLockInfo, (err, data) => {
unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise<LockStatusResponse\> unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise<LockStatusResponse\>
Unlocks the SIM card in the specified slot. This API uses a promise to return the result. Unlocks the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API. **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 ...@@ -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.| | 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** **Example**
```js ```js
...@@ -2652,8 +3611,6 @@ getOpKey(slotId: number, callback: AsyncCallback<string\>): void ...@@ -2652,8 +3611,6 @@ getOpKey(slotId: number, callback: AsyncCallback<string\>): void
Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
**Parameters** **Parameters**
...@@ -2661,14 +3618,34 @@ Obtains the opkey of the SIM card in the specified slot. This API uses an asynch ...@@ -2661,14 +3618,34 @@ Obtains the opkey of the SIM card in the specified slot. This API uses an asynch
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------------------------- | | -------- | ---------------------- | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback<string\> | 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** **Example**
```js ```js
sim.getOpKey(0, (err, data) => { try {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 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 ...@@ -2692,15 +3669,27 @@ Obtains the opkey of the SIM card in the specified slot. This API uses a promise
| ---------------- | ----------------------------------------- | | ---------------- | ----------------------------------------- |
| Promise<string\> | Promise used to return the result.| | Promise<string\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 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** **Example**
```js ```js
let promise = sim.getOpKey(0); try {
promise.then(data => { let data = sim.getOpKey(0);
console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`); console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { } catch (error) {
console.log(`getOpKey failed, promise: err->${JSON.stringify(err)}`); console.log(`getOpKey failed, promise: err->${JSON.stringify(error)}`);
}); }
``` ```
## sim.getOpName<sup>9+</sup> ## sim.getOpName<sup>9+</sup>
...@@ -2718,12 +3707,32 @@ Obtains the OpName of the SIM card in the specified slot. This API uses an async ...@@ -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.<br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<string\> | Yes | Callback used to return the result. | | callback | AsyncCallback<string\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 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** **Example**
```js ```js
sim.getOpName(0, (err, data) => { try {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); 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 ...@@ -2747,15 +3756,27 @@ Obtains the OpName of the SIM card in the specified slot. This API uses a promis
| ---------------- | ------------------------------------------ | | ---------------- | ------------------------------------------ |
| Promise<string\> | Promise used to return the result.| | Promise<string\> | 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** **Example**
```js ```js
let promise = sim.getOpName(0); try {
promise.then(data => { let data = sim.getOpName(0);
console.log(`getOpName success, promise: data->${JSON.stringify(data)}`); console.log(`getOpName success, promise: data->${JSON.stringify(data)}`);
}).catch(err => { } catch (error) {
console.log(`getOpName failed, promise: err->${JSON.stringify(err)}`); console.log(`getOpName failed, promise: err->${JSON.stringify(error)}`);
}); }
``` ```
## SimState ## SimState
...@@ -2781,16 +3802,16 @@ Enumerates SIM card types. ...@@ -2781,16 +3802,16 @@ Enumerates SIM card types.
| Name| Value| Description| | Name| Value| Description|
| ----- | ----- | ----- | | ----- | ----- | ----- |
|UNKNOWN_CARD | -1 | Unknown| |UNKNOWN_CARD | -1 | Unknown type.|
|SINGLE_MODE_SIM_CARD | 10 | Single-card (SIM)| |SINGLE_MODE_SIM_CARD | 10 | Single-card (SIM).|
|SINGLE_MODE_USIM_CARD | 20 | Single-card (USIM)| |SINGLE_MODE_USIM_CARD | 20 | Single-card (USIM).|
|SINGLE_MODE_RUIM_CARD | 30 | Single-card (RUIM)| |SINGLE_MODE_RUIM_CARD | 30 | Single-card (RUIM).|
|DUAL_MODE_CG_CARD | 40 | Dual-card (CDMA+GSM)| |DUAL_MODE_CG_CARD | 40 | Dual-card (CDMA+GSM).|
|CT_NATIONAL_ROAMING_CARD | 41 | China Telecom internal roaming card| |CT_NATIONAL_ROAMING_CARD | 41 | China Telecom internal roaming card.|
|CU_DUAL_MODE_CARD | 42 | China Unicom dual-mode 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_TELECOM_LTE_CARD | 43 | China Telecom dual-mode LTE card.|
|DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM)| |DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM).|
|SINGLE_MODE_ISIM_CARD<sup>8+</sup> | 60 | Single-card (ISIM)| |SINGLE_MODE_ISIM_CARD<sup>8+</sup> | 60 | Single-card (ISIM).|
## LockType<sup>8+</sup> ## LockType<sup>8+</sup>
...@@ -2841,30 +3862,30 @@ Enumerates personalized lock types. ...@@ -2841,30 +3862,30 @@ Enumerates personalized lock types.
## LockStatusResponse<sup>7+</sup> ## LockStatusResponse<sup>7+</sup>
Defines the lock status response. Defines the personalized lock information.
**System API**: This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | --------------- | ------ | ---- | --------------------- |
| result | number | Yes | Operation result. | | result | number | Yes | Operation result. |
| remain?: number | number | Yes | Remaining attempts (can be null).| | remain?: number | number | No | Remaining attempts (can be null).|
## LockInfo<sup>8+</sup> ## LockInfo<sup>8+</sup>
Defines the lock information. Defines the personalized lock information.
**System API**: This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | -------- | ------------------------ | ---- | -------- |
| lockType | [LockType](#locktype8) | Yes | Lock type.| | lockType | [LockType](#locktype8) | Yes | Lock type.|
| password | string | Yes | Password. | | password | string | Yes | Password. |
| state | [LockState](#lockstate8) | Yes | Lock state.| | state | [LockState](#lockstate8) | Yes | Lock state.|
## PersoLockInfo<sup>8+</sup> ## PersoLockInfo<sup>8+</sup>
...@@ -2874,10 +3895,10 @@ Defines the personalized lock information. ...@@ -2874,10 +3895,10 @@ Defines the personalized lock information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | -------- | -------------------------------- | ---- | ------------- |
| lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.| | lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.|
| password | string | Yes | Password. | | password | string | Yes | Password. |
## IccAccountInfo<sup>7+</sup> ## IccAccountInfo<sup>7+</sup>
...@@ -2887,15 +3908,15 @@ Defines the ICC account information. ...@@ -2887,15 +3908,15 @@ Defines the ICC account information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ---------- | ------- | ---- | ---------------- |
| simId | number | Yes | SIM card ID. | | simId | number | Yes | SIM card ID. |
| slotIndex | number | Yes | Card slot ID. | | slotIndex | number | Yes | Card slot ID. |
| isEsim | boolean | Yes | Whether the SIM card is an eSim card.| | isEsim | boolean | Yes | Whether the SIM card is an eSim card.|
| isActive | boolean | Yes | Whether the card is activated. | | isActive | boolean | Yes | Whether the card is activated. |
| iccId | string | Yes | ICCID number. | | iccId | string | Yes | ICCID number. |
| showName | string | Yes | SIM card display name. | | showName | string | Yes | SIM card display name. |
| showNumber | string | Yes | SIM card display number. | | showNumber | string | Yes | SIM card display number. |
## OperatorConfig<sup>8+</sup> ## OperatorConfig<sup>8+</sup>
...@@ -2905,10 +3926,10 @@ Defines the carrier configuration. ...@@ -2905,10 +3926,10 @@ Defines the carrier configuration.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description|
| -------- | ------- | --------- | ----------- | | ----- | ------ | ---- | ---- |
| field | string | Yes | Field. | | field | string | Yes | Field.|
| value | string | Yes | Value. | | value | string | Yes | Value. |
## DiallingNumbersInfo<sup>8+</sup> ## DiallingNumbersInfo<sup>8+</sup>
...@@ -2918,12 +3939,12 @@ Defines the contact number information. ...@@ -2918,12 +3939,12 @@ Defines the contact number information.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------------ | ------ | ---- | ---------- |
| alphaTag | string | Yes | Alpha tag. | | alphaTag | string | Yes | Tag. |
| number | string | Yes | Contact number. | | number | string | Yes | Call transfer number. |
| recordNumber | number | Yes | Record number.| | recordNumber | number | Yes | Record number.|
| pin2 | string | Yes | PIN 2.| | pin2 | string | Yes | PIN 2.|
## ContactType<sup>8+</sup> ## ContactType<sup>8+</sup>
...@@ -2934,7 +3955,7 @@ Enumerates contact types. ...@@ -2934,7 +3955,7 @@ Enumerates contact types.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Value | Description | | Name | Value | Description |
| -------------- | ---- | ---------- | | --------------- | ---- | ---------- |
| GENERAL_CONTACT | 1 | Common contact number.| | GENERAL_CONTACT | 1 | Common contact number.|
| FIXED_DIALING | 2 | Fixed dialing number. | | FIXED_DIALING | 2 | Fixed dialing number. |
...@@ -2946,8 +3967,8 @@ Enumerates carrier configuration keys. ...@@ -2946,8 +3967,8 @@ Enumerates carrier configuration keys.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
| Name | Value | Description | | Name | Value | Description |
| ------------------------------------------------------- | ---------------------------------------------------- | -------------------- | | ------------------------------------------------------- | ------------------------------------------------------ | -------------------- |
| KEY_VOICE_MAIL_NUMBER_STRING | "voice_mail_number_string" | Voice mailbox number. | | 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_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. | | KEY_HIDE_IMS_SWITCH_BOOL | "hide_ims_switch_bool" | Whether to hide the IMS switch. |
...@@ -2960,7 +3981,7 @@ Enumerates carrier configuration keys. ...@@ -2960,7 +3981,7 @@ Enumerates carrier configuration keys.
| KEY_IMS_PREFER_FOR_EMERGENCY_BOOL | "ims_prefer_for_emergency_bool" | IMS preferences for emergency. | | 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_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_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_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_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. | | KEY_OPERATOR_NAME_CUST_STRING | "operator_name_cust_string" | Carrier name. |
......
...@@ -16,7 +16,7 @@ import sms from '@ohos.telephony.sms'; ...@@ -16,7 +16,7 @@ import sms from '@ohos.telephony.sms';
createMessage\(pdu: Array&lt;number&gt;, specification: string, callback: AsyncCallback<ShortMessage\>\): void createMessage\(pdu: Array&lt;number&gt;, specification: string, callback: AsyncCallback<ShortMessage\>\): void
Creates an SMS 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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -44,7 +44,7 @@ sms.createMessage(pdu, specification, (err, data) => { ...@@ -44,7 +44,7 @@ sms.createMessage(pdu, specification, (err, data) => {
createMessage\(pdu: Array&lt;number&gt;, specification: string\): Promise<ShortMessage\> createMessage\(pdu: Array&lt;number&gt;, specification: string\): Promise<ShortMessage\>
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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -81,7 +81,7 @@ sendMessage(options: SendMessageOptions): void ...@@ -81,7 +81,7 @@ sendMessage(options: SendMessageOptions): void
Sends an SMS message. Sends an SMS message.
**Required permission**: ohos.permission.SEND_MESSAGES **Required permissions**: ohos.permission.SEND_MESSAGES
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
...@@ -114,7 +114,7 @@ sms.sendMessage(options); ...@@ -114,7 +114,7 @@ sms.sendMessage(options);
getDefaultSmsSlotId\(callback: AsyncCallback&lt;number&gt;\): void getDefaultSmsSlotId\(callback: AsyncCallback&lt;number&gt;\): 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 **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 ...@@ -122,7 +122,7 @@ Obtains the default slot of the SIM card used to send SMS messages. This API use
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------------------- | | -------- | --------------------------- | ---- | ---------------------------------------- |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the result. <br>- **0**: card slot 1<br>- **1**: card slot 2| | callback | AsyncCallback&lt;number&gt; | Yes | Callback used to return the result.<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Example** **Example**
...@@ -137,7 +137,7 @@ sms.getDefaultSmsSlotId((err, data) => { ...@@ -137,7 +137,7 @@ sms.getDefaultSmsSlotId((err, data) => {
getDefaultSmsSlotId\(\): Promise&lt;number&gt; getDefaultSmsSlotId\(\): Promise&lt;number&gt;
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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -162,11 +162,11 @@ promise.then(data => { ...@@ -162,11 +162,11 @@ promise.then(data => {
setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback&lt;void&gt;\): void setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback&lt;void&gt;\): 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. **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 **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 ...@@ -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 | | Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ | | -------- | ------------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: clearing the default configuration| | slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: Clears the default configuration.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -190,11 +202,11 @@ sms.setDefaultSmsSlotId(0, (err, data) => { ...@@ -190,11 +202,11 @@ sms.setDefaultSmsSlotId(0, (err, data) => {
setDefaultSmsSlotId\(slotId: number\): Promise&lt;void&gt; setDefaultSmsSlotId\(slotId: number\): Promise&lt;void&gt;
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. **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 **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 ...@@ -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 | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: clearing the default configuration| | slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: Clears the default configuration.|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ------------------------------- | | --------------- | ------------------------------- |
| Promise\<void\> | Promise used to return the result. | | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -229,7 +253,7 @@ Sets the short message service center (SMSC) address. This API uses an asynchron ...@@ -229,7 +253,7 @@ Sets the short message service center (SMSC) address. This API uses an asynchron
**System API**: This is a system API. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -241,6 +265,17 @@ Sets the short message service center (SMSC) address. This API uses an asynchron ...@@ -241,6 +265,17 @@ Sets the short message service center (SMSC) address. This API uses an asynchron
| smscAddr | string | Yes | SMSC address. | | smscAddr | string | Yes | SMSC address. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -260,7 +295,7 @@ Sets the SMSC address. This API uses a promise to return the result. ...@@ -260,7 +295,7 @@ Sets the SMSC address. This API uses a promise to return the result.
**System API**: This is a system API. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -277,6 +312,17 @@ Sets the SMSC address. This API uses a promise to return the result. ...@@ -277,6 +312,17 @@ Sets the SMSC address. This API uses a promise to return the result.
| ------------------- | ------------------------------- | | ------------------- | ------------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -299,7 +345,7 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r ...@@ -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. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -310,6 +356,17 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r ...@@ -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. <br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -328,7 +385,7 @@ Obtains the SMSC address. This API uses a promise to return the result. ...@@ -328,7 +385,7 @@ Obtains the SMSC address. This API uses a promise to return the result.
**System API**: This is a system API. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -344,6 +401,17 @@ Obtains the SMSC address. This API uses a promise to return the result. ...@@ -344,6 +401,17 @@ Obtains the SMSC address. This API uses a promise to return the result.
| --------------------- | --------------------------------------------- | | --------------------- | --------------------------------------------- |
| Promise&lt;string&gt; | Promise used to return the result.| | Promise&lt;string&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -360,7 +428,7 @@ promise.then(data => { ...@@ -360,7 +428,7 @@ promise.then(data => {
hasSmsCapability(): boolean 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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -383,7 +451,7 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call ...@@ -383,7 +451,7 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call
**System API**: This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SEND_MESSAGES **Required permissions**: ohos.permission.SEND_MESSAGES
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
...@@ -394,6 +462,17 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call ...@@ -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.| | content | string | Yes | SMS message content. The value cannot be null.|
| callback | AsyncCallback<Array<string\>> | Yes | Callback used to return the result. | | callback | AsyncCallback<Array<string\>> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -412,7 +491,7 @@ Splits an SMS message into multiple segments. This API uses a promise to return ...@@ -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. **System API**: This is a system API.
**Required permission**: ohos.permission.SEND_MESSAGES **Required permissions**: ohos.permission.SEND_MESSAGES
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
...@@ -428,6 +507,17 @@ Splits an SMS message into multiple segments. This API uses a promise to return ...@@ -428,6 +507,17 @@ Splits an SMS message into multiple segments. This API uses a promise to return
| ----------------------- | ----------------------------------- | | ----------------------- | ----------------------------------- |
| Promise<Array<string\>> | Promise used to return the result.| | Promise<Array<string\>> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -448,7 +538,7 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. ...@@ -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. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -459,6 +549,17 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. ...@@ -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.| | options | [SimMessageOptions](#simmessageoptions7) | Yes | SIM message options.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -482,7 +583,7 @@ Adds a SIM message. This API uses a promise to return the result. ...@@ -482,7 +583,7 @@ Adds a SIM message. This API uses a promise to return the result.
**System API**: This is a system API. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -498,6 +599,17 @@ Adds a SIM message. This API uses a promise to return the result. ...@@ -498,6 +599,17 @@ Adds a SIM message. This API uses a promise to return the result.
| ------------------- | ----------------------------- | | ------------------- | ----------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -523,7 +635,7 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu ...@@ -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. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -535,6 +647,17 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu ...@@ -535,6 +647,17 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu
| msgIndex | number | Yes | Message index. | | msgIndex | number | Yes | Message index. |
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -554,7 +677,7 @@ Deletes a SIM message. This API uses a promise to return the result. ...@@ -554,7 +677,7 @@ Deletes a SIM message. This API uses a promise to return the result.
**System API**: This is a system API. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -571,6 +694,17 @@ Deletes a SIM message. This API uses a promise to return the result. ...@@ -571,6 +694,17 @@ Deletes a SIM message. This API uses a promise to return the result.
| ------------------- | ----------------------------- | | ------------------- | ----------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -592,7 +726,7 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu ...@@ -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. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -603,6 +737,17 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu ...@@ -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.| | options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | Yes | SIM message updating options.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -627,7 +772,7 @@ Updates a SIM message. This API uses a promise to return the result. ...@@ -627,7 +772,7 @@ Updates a SIM message. This API uses a promise to return the result.
**System API**: This is a system API. **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 **System capability**: SystemCapability.Telephony.SmsMms
...@@ -643,6 +788,17 @@ Updates a SIM message. This API uses a promise to return the result. ...@@ -643,6 +788,17 @@ Updates a SIM message. This API uses a promise to return the result.
| ------------------- | ----------------------------- | | ------------------- | ----------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -669,7 +825,7 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return ...@@ -669,7 +825,7 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return
**System API**: This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.RECEIVE_SMS **Required permissions**: ohos.permission.RECEIVE_SMS
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
...@@ -680,6 +836,17 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return ...@@ -680,6 +836,17 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback<Array<[SimShortMessage](#simshortmessage7)\>> | Yes | Callback used to return the result. | | callback | AsyncCallback<Array<[SimShortMessage](#simshortmessage7)\>> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -698,7 +865,7 @@ Obtains all SIM card messages. This API uses a promise to return the result. ...@@ -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. **System API**: This is a system API.
**Required permission**: ohos.permission.RECEIVE_SMS **Required permissions**: ohos.permission.RECEIVE_SMS
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
...@@ -714,6 +881,17 @@ Obtains all SIM card messages. This API uses a promise to return the result. ...@@ -714,6 +881,17 @@ Obtains all SIM card messages. This API uses a promise to return the result.
| ------------------------------------------------------- | ---------------------------------- | | ------------------------------------------------------- | ---------------------------------- |
| PromiseArray<[SimShortMessage](#simshortmessage7)\>&gt; | Promise used to return the result.| | PromiseArray<[SimShortMessage](#simshortmessage7)\>&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -734,7 +912,7 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to ...@@ -734,7 +912,7 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to
**System API**: This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.RECEIVE_SMS **Required permissions**: ohos.permission.RECEIVE_SMS
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
...@@ -745,6 +923,17 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to ...@@ -745,6 +923,17 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to
| options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.| | options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.|
| callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;void&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -769,7 +958,7 @@ Sets the cell broadcast configuration. This API uses a promise to return the res ...@@ -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. **System API**: This is a system API.
**Required permission**: ohos.permission.RECEIVE_SMS **Required permissions**: ohos.permission.RECEIVE_SMS
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
...@@ -785,6 +974,17 @@ Sets the cell broadcast configuration. This API uses a promise to return the res ...@@ -785,6 +974,17 @@ Sets the cell broadcast configuration. This API uses a promise to return the res
| ------------------- | ----------------------------- | | ------------------- | ----------------------------- |
| Promise&lt;void&gt; | Promise used to return the result.| | Promise&lt;void&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -820,7 +1020,17 @@ Obtains SMS message segment information. This API uses an asynchronous callback ...@@ -820,7 +1020,17 @@ Obtains SMS message segment information. This API uses an asynchronous callback
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| message | string | Yes | SMS message. | | message | string | Yes | SMS message. |
| force7bit | boolean | Yes | Whether to use 7-bit coding. | | force7bit | boolean | Yes | Whether to use 7-bit coding. |
| callback | | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[SmsSegmentsInfo](#smssegmentsinfo8)&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -847,14 +1057,24 @@ Obtains SMS message segment information. This API uses a promise to return the r ...@@ -847,14 +1057,24 @@ Obtains SMS message segment information. This API uses a promise to return the r
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ------- | ---- | ----------------------------------------- | | --------- | ------- | ---- | ----------------------------------------- |
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| message | string | Yes | Message | | message | string | Yes | SMS message. |
| force7bit | boolean | Yes | Whether to use 7-bit coding. | | force7bit | boolean | Yes | Whether to use 7-bit coding. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------------- | ----------------------------- | | ------------------------------------------------------- | ----------------------------- |
| | Promise used to return the result.| | Promise&lt;[SmsSegmentsInfo](#smssegmentsinfo8)&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
...@@ -885,6 +1105,16 @@ Checks whether SMS is supported on IMS. This API uses an asynchronous callback t ...@@ -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. <br>- **0**: card slot 1<br>- **1**: card slot 2| | slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2|
| callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;boolean&gt; | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -899,7 +1129,7 @@ sms.isImsSmsSupported(slotId, (err, data) => { ...@@ -899,7 +1129,7 @@ sms.isImsSmsSupported(slotId, (err, data) => {
isImsSmsSupported(slotId: number): Promise<boolean\> isImsSmsSupported(slotId: number): Promise<boolean\>
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. **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 ...@@ -917,6 +1147,16 @@ Checks whether SMS is supported on IMS. This API uses a promise to return the re
| ---------------------- | ----------------------- | | ---------------------- | ----------------------- |
| Promise&lt;boolean&gt; | Promise used to return the result.| | Promise&lt;boolean&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -945,6 +1185,17 @@ Obtains the SMS format supported by the IMS. This API uses an asynchronous callb ...@@ -945,6 +1185,17 @@ Obtains the SMS format supported by the IMS. This API uses an asynchronous callb
| -------- | --------------------------- | ---- | ---------- | | -------- | --------------------------- | ---- | ---------- |
| callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;string&gt; | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -970,6 +1221,17 @@ Obtains the SMS format supported by the IMS. This API uses a promise to return t ...@@ -970,6 +1221,17 @@ Obtains the SMS format supported by the IMS. This API uses a promise to return t
| --------------------- | -------------------------- | | --------------------- | -------------------------- |
| Promise&lt;string&gt; | Promise used to return the result. | | Promise&lt;string&gt; | Promise used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -998,6 +1260,16 @@ Decodes MMS messages. This API uses an asynchronous callback to return the resul ...@@ -998,6 +1260,16 @@ Decodes MMS messages. This API uses an asynchronous callback to return the resul
| mmsFilePathName | string \|Array<number\> | Yes | MMS message file path.| | mmsFilePathName | string \|Array<number\> | Yes | MMS message file path.|
| callback | AsyncCallback&lt;[MmsInformation](#mmsinformation8)&gt; | Yes | Callback used to return the result. | | callback | AsyncCallback&lt;[MmsInformation](#mmsinformation8)&gt; | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1030,6 +1302,16 @@ Decodes MMS messages. This API uses a promise to return the result. ...@@ -1030,6 +1302,16 @@ Decodes MMS messages. This API uses a promise to return the result.
| --------------------------------------------------------- | --------------------------- | | --------------------------------------------------------- | --------------------------- |
| Promise&lt;&lt;[MmsInformation](#mmsinformation8)&gt;&gt; | Promise used to return the result.| | Promise&lt;&lt;[MmsInformation](#mmsinformation8)&gt;&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1046,7 +1328,7 @@ promise.then(data => { ...@@ -1046,7 +1328,7 @@ promise.then(data => {
encodeMms(mms: MmsInformation, callback: AsyncCallback<Array<number\>>): void encodeMms(mms: MmsInformation, callback: AsyncCallback<Array<number\>>): 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. **System API**: This is a system API.
...@@ -1059,6 +1341,16 @@ Encodes MMS messages. This API uses an asynchronous callback to return the resul ...@@ -1059,6 +1341,16 @@ Encodes MMS messages. This API uses an asynchronous callback to return the resul
| mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.| | mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.|
| callback | AsyncCallback&lt;Array<number\>&gt; | Yes | Callback used to return the result.| | callback | AsyncCallback&lt;Array<number\>&gt; | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1081,7 +1373,7 @@ sms.encodeMms(mmsInformation, (err, data) => { ...@@ -1081,7 +1373,7 @@ sms.encodeMms(mmsInformation, (err, data) => {
encodeMms(mms: MmsInformation): Promise<Array<number\>> encodeMms(mms: MmsInformation): Promise<Array<number\>>
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. **System API**: This is a system API.
...@@ -1099,6 +1391,16 @@ Encodes MMS messages. This API uses a promise to return the result. ...@@ -1099,6 +1391,16 @@ Encodes MMS messages. This API uses a promise to return the result.
| ----------------------------- | ----------------------------------- | | ----------------------------- | ----------------------------------- |
| Promise&lt;Array<number\>&gt; | Promise used to return the result.| | Promise&lt;Array<number\>&gt; | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -1125,19 +1427,19 @@ Defines an SMS message instance. ...@@ -1125,19 +1427,19 @@ Defines an SMS message instance.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory | Description | | Name | Type | Mandatory| Description |
| -------- | ------- | --------- | ----------- | | ------------------------ | --------------------------------------- | ---- | ------------------------------------------------------------ |
| hasReplyPath | boolean | Yes |Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.<br>**TP-Reply-Path**: The device returns a response based on the SMSC that sends the SMS message.| | hasReplyPath | boolean | Yes | Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.<br>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**.<br>For details, see section 9.2.3.9 in **3GPP TS 23.040**.| | isReplaceMessage | boolean | Yes | Whether the received SMS message is a **replace short message**. The default value is **false**.<br>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**.<br>**SMS-Status-Report**: a message sent from the SMSC to the mobile station to show the SMS message delivery status.| | isSmsStatusReportMessage | boolean | Yes | Whether the received SMS message is an SMS delivery report. The default value is **false**.<br>SMS delivery report: a message sent from the SMSC to show the current status of the SMS message you delivered.|
| messageClass | [ShortMessageClass](#shortmessageclass) | Yes | SMS message type. | | messageClass | [ShortMessageClass](#shortmessageclass) | Yes | Enumerates SMS message types. |
| pdu | Array&lt;number&gt; | Yes | PDU in the SMS message. | | pdu | Array&lt;number&gt; | Yes | PDU in the SMS message. |
| protocolId | number | Yes | Protocol identifier used for delivering the SMS message. | | protocolId | number | Yes | Protocol identifier used for delivering the SMS message. |
| scAddress | string | Yes | SMSC address. | | scAddress | string | Yes | SMSC address. |
| scTimestamp | number | Yes | SMSC timestamp. | | scTimestamp | number | Yes | SMSC timestamp. |
| status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.| | status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.|
| visibleMessageBody | string | Yes | SMS message body. | | visibleMessageBody | string | Yes | SMS message body. |
| visibleRawAddress | string | Yes | Sender address. | | visibleRawAddress | string | Yes | Sender address. |
## ShortMessageClass ## ShortMessageClass
...@@ -1161,7 +1463,7 @@ Provides the options (including callbacks) for sending an SMS message. For examp ...@@ -1161,7 +1463,7 @@ Provides the options (including callbacks) for sending an SMS message. For examp
**System capability**: SystemCapability.Telephony.SmsMms **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. <br>- **0**: card slot 1<br>- **1**: card slot 2 | | slotId | number | Yes | Slot ID of the SIM card used for sending SMS messages. <br>- **0**: card slot 1<br>- **1**: card slot 2 |
| destinationHost | string | Yes | Destination address of the SMS message. | | 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 ...@@ -1178,22 +1480,22 @@ Provides the callback for the SMS message sending result. It consists of three p
**System capability**: SystemCapability.Telephony.SmsMms **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**.| | 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. | | result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. |
| url | string | Yes | URI for storing the sent SMS message. | | url | string | Yes | URI for storing the sent SMS message. |
## IDeliveryShortMessageCallback ## IDeliveryShortMessageCallback
Provides the callback for the SMS message delivery report. Provides the callback for the SMS message delivery report.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------------------- | ---- | -------------- | | ---- | ------------------- | ---- | -------------- |
| pdu | Array&lt;number&gt; | Yes | SMS message delivery report.| | pdu | Array&lt;number&gt; | Yes | SMS message delivery report.|
## SendSmsResult ## SendSmsResult
...@@ -1209,7 +1511,6 @@ Enumerates SMS message sending results. ...@@ -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_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.| | 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.|
## MmsInformation<sup>8+</sup> ## MmsInformation<sup>8+</sup>
Defines the MMS message information. Defines the MMS message information.
...@@ -1218,10 +1519,10 @@ Defines the MMS message information. ...@@ -1218,10 +1519,10 @@ Defines the MMS message information.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------- | ------------------------------------------------------------ | ---- | --------- | | ----------- | ------------------------------------------------------------ | ---- | ---------- |
| messageType | [MessageType](#messagetype8) | Yes | Message type. | | 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.| | 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. | | attachment | Array<[MmsAttachment](#mmsattachment8)\> | No | Attachment. |
## MmsSendReq<sup>8+</sup> ## MmsSendReq<sup>8+</sup>
...@@ -1232,13 +1533,13 @@ Defines an MMS message sending request. ...@@ -1232,13 +1533,13 @@ Defines an MMS message sending request.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------------- | ------------------------------------ | ---- | ------------ | | ---------------- | ------------------------------------ | ---- | ------------ |
| from | [MmsAddress](#mmsaddress8) | Yes | MMS message source. | | from | [MmsAddress](#mmsaddress8) | Yes | MMS message source. |
| transactionId | string | Yes | Transaction ID. | | transactionId | string | Yes | Transaction ID. |
| contentType | string | Yes | Content type. | | contentType | string | Yes | Content type. |
| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | 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. | | date | number | No | Date. |
| cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | | cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. |
| bcc | Array<[MmsAddress](#mmsaddress8)\> | No | Blind carbon copy. | | bcc | Array<[MmsAddress](#mmsaddress8)\> | No | Blind carbon copy. |
...@@ -1258,7 +1559,7 @@ Defines the MMS message sending configuration. ...@@ -1258,7 +1559,7 @@ Defines the MMS message sending configuration.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------- | ---------------------------------- | ---- | -------- | | ------------- | ---------------------------------- | ---- | -------- |
| responseState | number | Yes | Response status.| | responseState | number | Yes | Response status.|
| transactionId | string | Yes | Transaction ID. | | transactionId | string | Yes | Transaction ID. |
...@@ -1273,7 +1574,7 @@ Defines an MMS notification index. ...@@ -1273,7 +1574,7 @@ Defines an MMS notification index.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------------- | ---------------------------------- | ---- | -------- | | --------------- | ---------------------------------- | ---- | -------- |
| transactionId | string | Yes | Transaction ID. | | transactionId | string | Yes | Transaction ID. |
| messageClass | number | Yes | Message class. | | messageClass | number | Yes | Message class. |
...@@ -1281,7 +1582,7 @@ Defines an MMS notification index. ...@@ -1281,7 +1582,7 @@ Defines an MMS notification index.
| expiry | number | Yes | Expiration. | | expiry | number | Yes | Expiration. |
| contentLocation | string | Yes | Content location.| | contentLocation | string | Yes | Content location.|
| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. |
| from | [MmsAddress](#mmsaddress8) | No | Source. | | from | [MmsAddress](#mmsaddress8) | No | Source address. |
| subject | string | No | Subject. | | subject | string | No | Subject. |
| deliveryReport | number | No | Status report.| | deliveryReport | number | No | Status report.|
| contentClass | number | No | Content class. | | contentClass | number | No | Content class. |
...@@ -1294,7 +1595,7 @@ Defines an MMS confirmation index. ...@@ -1294,7 +1595,7 @@ Defines an MMS confirmation index.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------- | ---------------------------------- | ---- | -------- | | ------------- | ---------------------------------- | ---- | -------- |
| transactionId | string | Yes | Transaction ID. | | transactionId | string | Yes | Transaction ID. |
| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. |
...@@ -1308,15 +1609,15 @@ Defines the MMS message retrieval configuration. ...@@ -1308,15 +1609,15 @@ Defines the MMS message retrieval configuration.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | ------------------------------------ | ---- | -------- | | -------------- | ------------------------------------ | ---- | -------- |
| transactionId | string | Yes | Transaction ID. | | transactionId | string | Yes | Transaction ID. |
| messageId | string | Yes | Message ID. | | messageId | string | Yes | Message ID. |
| date | number | Yes | Date. | | date | number | Yes | Date. |
| contentType | string | Yes | Content type.| | contentType | string | Yes | Content type.|
| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent. | | to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. |
| version | [MmsVersionType](#mmsversiontype8) | Yes | Version | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. |
| from | [MmsAddress](#mmsaddress8) | No | Source. | | from | [MmsAddress](#mmsaddress8) | No | Source address. |
| cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | | cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. |
| subject | string | No | Subject. | | subject | string | No | Subject. |
| priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. | | priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. |
...@@ -1333,16 +1634,15 @@ Defines the original MMS message reading index. ...@@ -1333,16 +1634,15 @@ Defines the original MMS message reading index.
**System capability**: SystemCapability.Telephony.SmsMms **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. | | messageId | string | Yes | Message ID. |
| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent. | | to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. |
| from | [MmsAddress](#mmsaddress8) | Yes | Source. | | from | [MmsAddress](#mmsaddress8) | Yes | Source address. |
| date | number | Yes | Date. | | date | number | Yes | Date. |
| readStatus | number | Yes | Read status.| | readStatus | number | Yes | Read status.|
## MmsReadRecInd<sup>8+</sup> ## MmsReadRecInd<sup>8+</sup>
Defines the MMS message reading index. Defines the MMS message reading index.
...@@ -1351,16 +1651,15 @@ Defines the MMS message reading index. ...@@ -1351,16 +1651,15 @@ Defines the MMS message reading index.
**System capability**: SystemCapability.Telephony.SmsMms **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. | | messageId | string | Yes | Message ID. |
| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination. | | to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. |
| from | [MmsAddress](#mmsaddress8) | Yes | Source. | | from | [MmsAddress](#mmsaddress8) | Yes | Source address. |
| readStatus | number | Yes | Read state.| | readStatus | number | Yes | Read status.|
| date | number | No | Date. | | date | number | No | Date. |
## MmsAttachment<sup>8+</sup> ## MmsAttachment<sup>8+</sup>
Defines the attachment of an MMS message. Defines the attachment of an MMS message.
...@@ -1369,7 +1668,7 @@ Defines the attachment of an MMS message. ...@@ -1369,7 +1668,7 @@ Defines the attachment of an MMS message.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ----------------------- | ------------------------------------ | ---- | ------------------ | | ----------------------- | ------------------------------------ | ---- | ------------------ |
| contentId | string | Yes | Content ID. | | contentId | string | Yes | Content ID. |
| contentLocation | string | Yes | Content location. | | contentLocation | string | Yes | Content location. |
...@@ -1378,7 +1677,7 @@ Defines the attachment of an MMS message. ...@@ -1378,7 +1677,7 @@ Defines the attachment of an MMS message.
| contentType | string | Yes | Content type. | | contentType | string | Yes | Content type. |
| isSmil | boolean | Yes | Whether the synchronized multimedia integration language is used.| | isSmil | boolean | Yes | Whether the synchronized multimedia integration language is used.|
| path | string | No | Path. | | path | string | No | Path. |
| inBuff | Array<number\> | No | In the buffer | | inBuff | Array<number\> | No | Whether the message is in the buffer. |
| fileName | string | No | File name. | | fileName | string | No | File name. |
| charset | [MmsCharSets](#mmscharsets8) | No | Character set. | | charset | [MmsCharSets](#mmscharsets8) | No | Character set. |
...@@ -1390,20 +1689,20 @@ Defines an MMSC address. ...@@ -1390,20 +1689,20 @@ Defines an MMSC address.
**System capability**: SystemCapability.Telephony.SmsMms **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.| | charset | [MmsCharSets](#mmscharsets8) | Yes | Character set.|
## MessageType<sup>8+</sup> ## MessageType<sup>8+</sup>
Enumerates message types. Message type.
**System API**: This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description | | Name | Value | Description |
| ------------------------- | ---- | -------------------- | | ------------------------- | ---- | -------------------- |
| TYPE_MMS_SEND_REQ | 128 | MMS message sending request. | | TYPE_MMS_SEND_REQ | 128 | MMS message sending request. |
| TYPE_MMS_SEND_CONF | 129 | MMS message sending configuration. | | TYPE_MMS_SEND_CONF | 129 | MMS message sending configuration. |
...@@ -1423,7 +1722,7 @@ Enumerates MMS message priorities. ...@@ -1423,7 +1722,7 @@ Enumerates MMS message priorities.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description | | Name | Value | Description |
| ---------- | ---- | -------------- | | ---------- | ---- | -------------- |
| MMS_LOW | 128 | Low priority. | | MMS_LOW | 128 | Low priority. |
| MMS_NORMAL | 129 | Normal priority.| | MMS_NORMAL | 129 | Normal priority.|
...@@ -1437,7 +1736,7 @@ Enumerates MMS versions. ...@@ -1437,7 +1736,7 @@ Enumerates MMS versions.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description | | Name | Value | Description |
| --------------- | ---- | ----------- | | --------------- | ---- | ----------- |
| MMS_VERSION_1_0 | 0x10 | MMS version 1_0.| | MMS_VERSION_1_0 | 0x10 | MMS version 1_0.|
| MMS_VERSION_1_1 | 0x11 | MMS version 1_1.| | MMS_VERSION_1_1 | 0x11 | MMS version 1_1.|
...@@ -1452,7 +1751,7 @@ Enumerates MMS character sets. ...@@ -1452,7 +1751,7 @@ Enumerates MMS character sets.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description | | Name | Value | Description |
| --------------- | ------ | ------------------- | | --------------- | ------ | ------------------- |
| BIG5 | 0X07EA | BIG5 format. | | BIG5 | 0X07EA | BIG5 format. |
| ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2 format.| | ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2 format.|
...@@ -1477,7 +1776,7 @@ Enumerates disposition types. ...@@ -1477,7 +1776,7 @@ Enumerates disposition types.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description | | Name | Value | Description |
| ---------- | ---- | -------- | | ---------- | ---- | -------- |
| FROM_DATA | 0 | Data source.| | FROM_DATA | 0 | Data source.|
| ATTACHMENT | 1 | Attachment. | | ATTACHMENT | 1 | Attachment. |
...@@ -1491,7 +1790,7 @@ Enumerates report types. ...@@ -1491,7 +1790,7 @@ Enumerates report types.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description| | Name | Value | Description|
| ------- | ---- | ---- | | ------- | ---- | ---- |
| MMS_YES | 128 | YES | | MMS_YES | 128 | YES |
| MMS_NO | 129 | NO | | MMS_NO | 129 | NO |
...@@ -1504,7 +1803,7 @@ Defines the cell broadcast configuration options. ...@@ -1504,7 +1803,7 @@ Defines the cell broadcast configuration options.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------- | -------------------- | ---- | ------------ | | -------------- | -------------------- | ---- | ------------ |
| slotId | number | Yes | Card slot ID. | | slotId | number | Yes | Card slot ID. |
| enable | boolean | Yes | Whether to enable cell broadcast. | | enable | boolean | Yes | Whether to enable cell broadcast. |
...@@ -1520,7 +1819,7 @@ Defines the SIM message status. ...@@ -1520,7 +1819,7 @@ Defines the SIM message status.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description | | Name | Value | Description |
| ------------------------- | ---- | --------------------------- | | ------------------------- | ---- | --------------------------- |
| SIM_MESSAGE_STATUS_FREE | 0 | Free state. | | SIM_MESSAGE_STATUS_FREE | 0 | Free state. |
| SIM_MESSAGE_STATUS_READ | 1 | Read state. | | SIM_MESSAGE_STATUS_READ | 1 | Read state. |
...@@ -1530,13 +1829,13 @@ Defines the SIM message status. ...@@ -1530,13 +1829,13 @@ Defines the SIM message status.
## RanType<sup>7+</sup> ## RanType<sup>7+</sup>
Enumerates RAN types. RAN type.
**System API**: This is a system API. **System API**: This is a system API.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description| | Name | Value | Description|
| --------- | ---- | ---- | | --------- | ---- | ---- |
| TYPE_GSM | 1 | GSM | | TYPE_GSM | 1 | GSM |
| TYPE_CDMA | 2 | CMDA | | TYPE_CDMA | 2 | CMDA |
...@@ -1549,7 +1848,7 @@ Enumerates SMS encoding schemes. ...@@ -1549,7 +1848,7 @@ Enumerates SMS encoding schemes.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Value | Description | | Name | Value | Description |
| -------------------- | ---- | ------------ | | -------------------- | ---- | ------------ |
| SMS_ENCODING_UNKNOWN | 0 | Unknown code.| | SMS_ENCODING_UNKNOWN | 0 | Unknown code.|
| SMS_ENCODING_7BIT | 1 | 7-digit code. | | SMS_ENCODING_7BIT | 1 | 7-digit code. |
...@@ -1564,12 +1863,12 @@ Defines the SIM message options. ...@@ -1564,12 +1863,12 @@ Defines the SIM message options.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name| Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------ | -------------------------------------- | ---- | -------------- | | ------ | -------------------------------------- | ---- | -------------- |
| slotId | number | Yes | Card slot ID. | | slotId | number | Yes | Card slot ID. |
| smsc | string | Yes | Short message service center.| | smsc | string | Yes | Short message service center.|
| pdu | string | Yes | Protocol data unit. | | pdu | string | Yes | Protocol data unit. |
| status | [SimMessageStatus](#simmessagestatus7) | Yes | Message status. | | status | [SimMessageStatus](#simmessagestatus7) | Yes | Status. |
## UpdateSimMessageOptions<sup>7+</sup> ## UpdateSimMessageOptions<sup>7+</sup>
...@@ -1579,7 +1878,7 @@ Defines the updating SIM message options. ...@@ -1579,7 +1878,7 @@ Defines the updating SIM message options.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | -------------------------------------- | ---- | -------------- | | --------- | -------------------------------------- | ---- | -------------- |
| slotId | number | Yes | Card slot ID. | | slotId | number | Yes | Card slot ID. |
| msgIndex | number | Yes | Message index. | | msgIndex | number | Yes | Message index. |
...@@ -1595,7 +1894,7 @@ Defines a SIM message. ...@@ -1595,7 +1894,7 @@ Defines a SIM message.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ---------------- | -------------------------------------- | ---- | ------------- | | ---------------- | -------------------------------------- | ---- | ------------- |
| shortMessage | [ShortMessage](#shortmessage) | Yes | SMS message. | | shortMessage | [ShortMessage](#shortmessage) | Yes | SMS message. |
| simMessageStatus | [SimMessageStatus](#simmessagestatus7) | Yes | SIM message status.| | simMessageStatus | [SimMessageStatus](#simmessagestatus7) | Yes | SIM message status.|
...@@ -1609,12 +1908,12 @@ Defines an MMS message delivery index. ...@@ -1609,12 +1908,12 @@ Defines an MMS message delivery index.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| --------- | ---------------------------------- | ---- | ------ | | --------- | ---------------------------------- | ---- | ------ |
| messageId | string | Yes | Message ID.| | messageId | string | Yes | Message ID.|
| date | number | Yes | Date. | | date | number | Yes | Date. |
| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent.| | to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address.|
| status | number | Yes | Status. | | status | number | Yes | Status |
| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. |
## MmsRespInd<sup>8+</sup> ## MmsRespInd<sup>8+</sup>
...@@ -1625,10 +1924,10 @@ Defines an MMS response index. ...@@ -1625,10 +1924,10 @@ Defines an MMS response index.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| ------------- | ---------------------------------- | ---- | -------- | | ------------- | ---------------------------------- | ---- | -------- |
| transactionId | string | Yes | Event ID. | | transactionId | string | Yes | Event ID. |
| status | number | Yes | Status. | | status | number | Yes | Status |
| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. |
| reportAllowed | [ReportType](#reporttype8) | No | Report allowed.| | reportAllowed | [ReportType](#reporttype8) | No | Report allowed.|
...@@ -1640,7 +1939,7 @@ Defines the SMS message segment information. ...@@ -1640,7 +1939,7 @@ Defines the SMS message segment information.
**System capability**: SystemCapability.Telephony.SmsMms **System capability**: SystemCapability.Telephony.SmsMms
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------------------- | ---------------------------------------- | ---- | ------------ | | -------------------- | ---------------------------------------- | ---- | ------------ |
| splitCount | number | Yes | Split count. | | splitCount | number | Yes | Split count. |
| encodeCount | number | Yes | Encoding count. | | encodeCount | number | Yes | Encoding count. |
......
# @ohos.telephony.data (Cellular Data) # @ohos.telephony.data (Cellular Data)
The **data** module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled. The cellular data module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled.
>**NOTE** >**NOTE**
> >
...@@ -85,7 +85,7 @@ setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\<void\>): v ...@@ -85,7 +85,7 @@ setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\<void\>): v
Sets the default slot of the SIM card used for mobile data. This API uses an asynchronous callback to return the result. 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 **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -98,6 +98,19 @@ This is a system API. ...@@ -98,6 +98,19 @@ This is a system API.
| slotId | number | Yes | SIM card slot ID. <br>**0**: card slot 1<br>**1**: card slot 2<br>**-1**: Clears the default configuration.| | slotId | number | Yes | SIM card slot ID. <br>**0**: card slot 1<br>**1**: card slot 2<br>**-1**: Clears the default configuration.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
| 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** **Example**
```js ```js
...@@ -112,7 +125,7 @@ setDefaultCellularDataSlotId(slotId: number): Promise\<void\> ...@@ -112,7 +125,7 @@ setDefaultCellularDataSlotId(slotId: number): Promise\<void\>
Sets the default slot of the SIM card used for mobile data. This API uses a promise to return the result. 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 **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -130,6 +143,19 @@ This is a system API. ...@@ -130,6 +143,19 @@ This is a system API.
| --------------- | ------------------------------- | | --------------- | ------------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300004 | Do not have sim card. |
| 8300999 | Unknown error code. |
| 8301001 | SIM card is not activated. |
**Example** **Example**
```js ```js
...@@ -251,6 +277,17 @@ Checks whether the cellular data service is enabled. This API uses an asynchrono ...@@ -251,6 +277,17 @@ Checks whether the cellular data service is enabled. This API uses an asynchrono
| -------- | ------------------------ | ---- | ------------------------------------------------------------ | | -------- | ------------------------ | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.| | callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: The cellular data service is enabled.<br>**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** **Example**
```js ```js
...@@ -275,6 +312,17 @@ Checks whether the cellular data service is enabled. This API uses a promise to ...@@ -275,6 +312,17 @@ Checks whether the cellular data service is enabled. This API uses a promise to
| ------------------ | ------------------------------------------------------------ | | ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result.<br>**true**: The cellular data service is enabled.<br>**false**: The cellular data service is disabled.| | Promise\<boolean\> | Promise used to return the result.<br>**true**: The cellular data service is enabled.<br>**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** **Example**
```js ```js
...@@ -303,6 +351,17 @@ Checks whether roaming is enabled for the cellular data service. This API uses a ...@@ -303,6 +351,17 @@ Checks whether roaming is enabled for the cellular data service. This API uses a
| slotId | number | Yes | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2 | | slotId | number | Yes | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2 |
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.| | callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -333,6 +392,17 @@ Checks whether roaming is enabled for the cellular data service. This API uses a ...@@ -333,6 +392,17 @@ Checks whether roaming is enabled for the cellular data service. This API uses a
| ------------------ | ------------------------------------------------------------ | | ------------------ | ------------------------------------------------------------ |
| Promise\<boolean\> | Promise used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.| | Promise\<boolean\> | Promise used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -350,7 +420,7 @@ enableCellularData(callback: AsyncCallback<void\>): void ...@@ -350,7 +420,7 @@ enableCellularData(callback: AsyncCallback<void\>): void
Enables the cellular data service. This API uses an asynchronous callback to return the result. Enables the cellular data service. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -362,6 +432,17 @@ This is a system API. ...@@ -362,6 +432,17 @@ This is a system API.
| -------- | --------------------- | ---- | ---------- | | -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -376,7 +457,7 @@ enableCellularData(): Promise<void\> ...@@ -376,7 +457,7 @@ enableCellularData(): Promise<void\>
Enables the cellular data service. This API uses a promise to return the result. Enables the cellular data service. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -388,6 +469,17 @@ This is a system API. ...@@ -388,6 +469,17 @@ This is a system API.
| --------------- | ----------------------- | | --------------- | ----------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -405,7 +497,7 @@ disableCellularData(callback: AsyncCallback<void\>): void ...@@ -405,7 +497,7 @@ disableCellularData(callback: AsyncCallback<void\>): void
Disables the cellular data service. This API uses an asynchronous callback to return the result. Disables the cellular data service. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -417,6 +509,17 @@ This is a system API. ...@@ -417,6 +509,17 @@ This is a system API.
| -------- | --------------------- | ---- | ---------- | | -------- | --------------------- | ---- | ---------- |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<void\> | Yes | Callback used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -431,7 +534,7 @@ disableCellularData(): Promise<void\> ...@@ -431,7 +534,7 @@ disableCellularData(): Promise<void\>
Disables the cellular data service. This API uses a promise to return the result. Disables the cellular data service. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -443,6 +546,17 @@ This is a system API. ...@@ -443,6 +546,17 @@ This is a system API.
| --------------- | --------------------------- | | --------------- | --------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -460,7 +574,7 @@ enableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void ...@@ -460,7 +574,7 @@ enableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void
Enables the cellular data roaming service. This API uses an asynchronous callback to return the result. Enables the cellular data roaming service. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -473,6 +587,17 @@ This is a system API. ...@@ -473,6 +587,17 @@ This is a system API.
| slotId | number | Yes | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -487,7 +612,7 @@ enableCellularDataRoaming(slotId: number): Promise<void\> ...@@ -487,7 +612,7 @@ enableCellularDataRoaming(slotId: number): Promise<void\>
Enables the cellular data roaming service. This API uses a promise to return the result. Enables the cellular data roaming service. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -505,6 +630,17 @@ This is a system API. ...@@ -505,6 +630,17 @@ This is a system API.
| --------------- | ------------------------- | | --------------- | ------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -522,7 +658,7 @@ disableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void ...@@ -522,7 +658,7 @@ disableCellularDataRoaming(slotId: number, callback: AsyncCallback<void\>): void
Disables the cellular data roaming service. This API uses an asynchronous callback to return the result. Disables the cellular data roaming service. This API uses an asynchronous callback to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -535,6 +671,17 @@ This is a system API. ...@@ -535,6 +671,17 @@ This is a system API.
| slotId | number | Yes | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2| | slotId | number | Yes | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
...@@ -549,7 +696,7 @@ disableCellularDataRoaming(slotId: number): Promise<void\> ...@@ -549,7 +696,7 @@ disableCellularDataRoaming(slotId: number): Promise<void\>
Disables the cellular data roaming service. This API uses a promise to return the result. Disables the cellular data roaming service. This API uses a promise to return the result.
This is a system API. **System API**: This is a system API.
**Required permission**: ohos.permission.SET_TELEPHONY_STATE **Required permission**: ohos.permission.SET_TELEPHONY_STATE
...@@ -567,6 +714,17 @@ This is a system API. ...@@ -567,6 +714,17 @@ This is a system API.
| --------------- | ------------------------- | | --------------- | ------------------------- |
| Promise\<void\> | Promise used to return the result.| | Promise\<void\> | Promise used to return the result.|
**Error codes**
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
**Example** **Example**
```js ```js
......
# 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.
# HiSysEvent Logging Configuration<a name="EN-US_TOPIC_0000001080478132"></a> # HiSysEvent Logging Configuration
## Overview<a name="section315316685115"></a>
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<a name="section123181432175143"></a>
### 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. Understanding the following concepts would be helpful for you in configuring HiSysEvent logging.
- Event domain - Event domain<br>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.
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 name - Event name<br>Indicates the events in an event domain. For details, see [EVENT\_NAMEA/EVENT\_NAMEB](#example) in the example YAML file.
Indicates the events in an event domain. For details, see [EVENT\_NAMEA/EVENT\_NAMEB](#section123181432175123) in the example YAML file.
- Parameter - Parameter<br>Defines the key values in an event name. For details, see [__BASE/NAME1/NAME2](#example) in the example YAML file.
Defines the key values in an event name. For details, see [__BASE/NAME1/NAME2](#section123181432175123) in the example YAML file.
### Constraints<a name="section123181432175114"></a> ### 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. - 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. - 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. - 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
**Table 1** Fields in the \__BASE parameter
| Field| Description|
| -------- | -------- |
| type | Event type. This field is mandatory.<br>Value:<br>- FAULT: fault<br>- STATISTIC: statistics<br>- SECURITY: security<br>- BEHAVIOR: user behavior|
| level | Event level. This field is mandatory.<br>Value:<br>- CRITICAL: critical<br>- MINOR: minor|
| tag | Event tag. This field is mandatory.<br>Rule:<br>- You can define a maximum of five tags, separated with a space.<br>- 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.<br>Rule:<br>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| | Field| Description|
| ----- | ----- | | -------- | -------- |
| type | Indicates the type of the event. This field is mandatory. <br><br>Value:<ul><li>**FAULT**: fault </li><li>**STATISTIC**: statistics </li><li>**SECURITY**: security </li><li>**BEHAVIOR**: user behavior</li></ul> | | type | Parameter type. This field is mandatory.<br>Value:<br>- BOOL<br>- INT8<br>- UINT8<br>- INT16<br>- UINT16<br>- INT32<br>- UINT32<br>- INT64<br>- UINT64<br>- FLOAT<br>- DOUBLE<br>- STRING |
| level | Indicates the level of the event. This field is mandatory. <br><br>Value: <ul><li>**CRITICAL**: critical </li><li>**MINOR**: minor</li></ul> | | arrsize | Length of the parameter of the array type. This field is optional.<br>Value:<br>1-100|
| tag | Indicates the tag of the event. This field is mandatory. <br><br>Rule:<ul><li>You can define a maximum of five tags separated with a space. </li><li>A single tag can contain a maximum of 16 characters, including a to z, A to Z, and 0 to 9.</li></ul>| | desc | Parameter description. This field is mandatory.<br>Rule:<br>The description contains 3 to 128 characters, including a to z, A to Z, 0 to 9, and underscores (_).|
| desc | Describes the event name. This field is mandatory. <br><br>Rule:<ul><li>The description contains 3 to 128 characters, including a to z, A to Z, 0 to 9, and underscores (&#95;).</li></ul>|
**Table 2** Description of custom parameters
| Field| Description| ## Writing a YAML File
| ----- | ----- |
| type | Indicates the type of a parameter. This field is mandatory. <br><br>Value: <ul><li>BOOL</li><li>UINT8</li><li>UINT16</li><li>INT32</li><li>UINT32</li><li>UINT64</li><li>FLOAT</li><li>DOUBLE</li><li>STRING</li></ul>|
| arrsize | Specifies the length of the parameter of the array type. This field is optional. <br><br>Value range: <ul><li>1-100</li></ul>| ### Writing Rules
| desc | Describes the parameter. This field is mandatory. <br><br>Rule:<ul><li>The description contains 3 to 128 characters, including a to z, A to Z, 0 to 9, and underscores (&#95;).</li></ul>|
- Event domain naming rules:
- The name must start with a letter and can contain only uppercase letters, digits, and underscores (&#95;).
- The name contains 1 to 16 characters.
## Writing a YAML File<a name="section123181432175113"></a> - Event naming rules:
- The name must start with a letter and can contain only uppercase letters, digits, and underscores (&#95;).
- The name contains 1 to 32 characters.
- The number of internal event names in an event domain cannot exceed 4096.
### Writing Rules<a name="section123181432175133"></a> - Parameter naming rules:
- The name must start with a letter and can contain only uppercase letters, digits, and underscores (&#95;).
- 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 (&#95;).
- 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 (&#95;).
- 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 (&#95;).
- The name contains 1 to 32 characters.
- The number of parameters in an event domain cannot exceed 128.
### Example<a name="section123181432175123"></a> ### Example
- In the example YAML file, the event domain name is **MODULEA**. The event domain contains two events named **EVENT\_NAMEA** and **EVENT\_NAMEB**. - 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.
``` - **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**.
##########################################
# HiSysEvent definition for MODULEA
##########################################
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: ## Verifying the YAML File
__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<a name="section123181432175115"></a>
### Configuring the YAML File Path<a name="section123181432175135"></a> ### 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 ...@@ -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<a name="section123181432175137"></a>
- 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**<br>
> 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 <product name>
```
- To obtain the **hisysevent.def** file generated after full compilation, run the following command: ### Compiling YAML Files
``` - Perform full compilation.
cd absolute path of the project's root directory - 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.
find out -name hisysevent.def -type f
``` ```
cd *absolute path of the project's root directory*
./build --product-name <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 <yaml file list> --def-path <file store directory> cd absolute path of the project's root directory
``` ./build/ohos/hisysevent/gen_def_from_all_yaml.py --yaml-list <yaml file list> --def-path <file store directory>
```
**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<a name="section123181432175139"></a> ### 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.
# 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.
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册