Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses an asynchronous callback to return the result.
@@ -213,6 +229,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, ca
Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses an asynchronous callback to return the result.
| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown.|
| CALL_STATE_IDLE | 0 | No call is in progress.|
| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state.|
| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.|
| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown.<br/>**System capability**: SystemCapability.Telephony.CallManager|
| CALL_STATE_IDLE | 0 | No call is in progress.<br/>**System capability**: SystemCapability.Telephony.CallManager|
| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state.<br/>**System capability**: SystemCapability.Telephony.CallManager|
| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.<br/>**System capability**: SystemCapability.Telephony.CallManager|
>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.
| 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).|
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 function uses an asynchronous callback to return the execution result.
| type | string | Yes| Network status change event.|
| slotId | number | Yes| Card slot ID. The options are as follows: <br/> - **0**: slot 1 <br/> - **1**: 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).|
**Example**
```
observer.on('networkStateChange', {slotId: 0}, data =>{
>You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
| 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).|
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
| type | string | Yes| Signal status 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).|
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 function uses an asynchronous callback to return the execution result.
| type | string | Yes| Signal status change event.|
| slotId | number | Yes| Card slot ID. The options are as follows: <br/> - **0**: slot 1 <br/> - **1**: 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).|
**Example**
```
observer.on('signalInfoChange', {slotId: 0}, data =>{
Unregisters the observer for signal status change events. This function uses an asynchronous callback to return the execution result.
>**NOTE**
>
>You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
| type | string | Yes| Signal status 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).|
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
| callback | Callback\<{ state: [CallState](js-apis-call.md#CallState), number: string }\> | Yes| Callback used to return the result. For details, see [CallState](js-apis-call.md#CallState)<br/>**number**: phone number.|
| slotId | number | Yes| Card slot ID. The options are as follows: <br/> - **0**: slot 1<br/> - **1**: slot 2|
| callback | Callback\<{ state: [CallState](js-apis-call.md#CallState), number: string }\> | Yes| Callback used to return the result. For details, see [CallState](js-apis-call.md#CallState)<br/>**number**: phone number.|
**Example**
```
observer.on('callStateChange', {slotId: 0}, value =>{
>You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
| callback | Callback\<{ state: [CallState](js-apis-call.md#CallState), number: string }\> | No| Callback used to return the result. For details, see [CallState](js-apis-call.md#CallState)<br/>**number**: phone number.|
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. This function uses an asynchronous callback to return the result.
| INSTANT_MESSAGE | 1 | Instant message, which is displayed immediately after being received.<br/>**System capability**: SystemCapability.Telephony.SmsMms|
| OPTIONAL_MESSAGE | 2 | Message stored in the device or SIM card.<br/>**System capability**: SystemCapability.Telephony.SmsMms|
| SIM_MESSAGE | 3 | Message containing SIM card information, which is to be stored in the SIM card.<br/>**System capability**: SystemCapability.Telephony.SmsMms|
| FORWARD_MESSAGE | 4 | Message to be forwarded to another device.<br/>**System capability**: SystemCapability.Telephony.SmsMms|
| slotId | number | Yes| Slot ID of the SIM card used for sending SMS messages: <br/> - **0**: slot 1 <br/> - **1**: slot 2|
| destinationHost | string | Yes| Destination address of the SMS message.|
| content | string \| Array<number> | Yes| SMS message type. If the content is comprised of character strings, the SMS message is a text message. If the content is comprised of byte arrays, the SMS message is a data message.|
| content | string \| Array<number> | Yes| SMS message type. If the content is composed of character strings, the SMS message is a text message. If the content is composed of byte arrays, the SMS message is a data message.|
| serviceCenter | string | No| SMSC address. By default, the SMSC address in the SIM card is used.|
| destinationPort | number | No| Destination port of the SMS message. This parameter is mandatory only for a data message. Otherwise, it is optional.|
| sendCallback | AsyncCallback<[ISendShortMessageCallback](#ISendShortMessageCallback)> | No| Callback used to return the SMS message sending result. For details, see [ISendShortMessageCallback](#ISendShortMessageCallback).|
...
...
@@ -322,7 +344,9 @@ For example, you can specify the SMS message type by the optional parameter **co
Provides the callback for the SMS message delivery report. It consists of three parts: SMS message sending result, URI for storing the sent SMS message, and whether the SMS message is the last part of a long SMS message.
Provides the callback for the SMS message sending result. It consists of three parts: SMS message sending result, URI for storing the sent SMS message, and whether the SMS message is the last part of a long SMS message.
>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.
| 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.|
| Promise\<boolean\> | Promise used to return the result, wherein: <br/>**true**: The cellular data service is enabled. <br/>**false**: The cellular data service is disabled.|
| slotId | number | Yes| Card slot ID. The options are as follows: <br/>**0**: slot 1 <br/>**1**: 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.|
| Promise\<boolean\> | Promise used to return the result, wherein: <br/>**true**: Roaming is enabled for the cellular data service. <br/>**false**: Roaming is disabled for the cellular data service.|
**Example**
```
let promise = data.isCellularDataRoamingEnabled(0);
| 0 | DATA_FLOW_TYPE_NONE | No uplink or downlink data is available. <br/>**System capability**: SystemCapability.Telephony.CellularData|
| 1 | DATA_FLOW_TYPE_DOWN | Only the downlink data is available. <br/>**System capability**: SystemCapability.Telephony.CellularData|
| 2 | DATA_FLOW_TYPE_UP | Only the uplink data is available. <br/>**System capability**: SystemCapability.Telephony.CellularData|
| 3 | DATA_FLOW_TYPE_UP_DOWN | Both uplink data and downlink data are available. <br/>**System capability**: SystemCapability.Telephony.CellularData|
| 4 | DATA_FLOW_TYPE_DORMANT | No uplink or downlink data is available because the lower-layer link is in the dormant state. <br/>**System capability**: SystemCapability.Telephony.CellularData|
## DataConnectState<a name=DataConnectState></a>
Describes the connection status of a cellular data link.