> - The APIs of this module are no longer maintained since API version 8. It is recommended that you use the APIs of [hiTraceMeter](js-apis-hitracemeter.md) instead.
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import<a name="s56d19203690d4782bfc74069abb6bd71"></a>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p2084833211463"><a name="p2084833211463"></a><a name="p2084833211463"></a>Name of the trace task to start.</p>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p22262111381"><a name="p22262111381"></a><a name="p22262111381"></a>Expected duration of the trace, in ms.</p>
>If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different **taskId**s must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same **taskId** can be used. For details, see the **bytrace.finishTrace** example.
- Example
```
bytrace.startTrace("myTestFunc", 1);
bytrace.startTrace("myTestFunc", 1, 5); // The expected duration of the trace is 5 ms.
> If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For details, see the bytrace.finishTrace example.
**Example**
```
bytrace.startTrace("myTestFunc", 1);
bytrace.startTrace("myTestFunc", 1, 5); // The expected duration of the trace is 5 ms.
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p1989674810124"><a name="p1989674810124"></a><a name="p1989674810124"></a>Name of the trace task to stop.</p>
>To stop a trace task, the values of **name** and **taskId** in **finishTrace** must be the same as those in **startTrace**.
- Example
```
bytrace.finishTrace("myTestFunc", 1);
```
```
// Start track tasks with the same name concurrently.
bytrace.startTrace("myTestFunc", 1);
...... // Service flow
bytrace.startTrace ("myTestFunc", 2); // The second trace task starts while the first task is still running. The first and second tasks have the same name but different task IDs.
...... // Service flow
bytrace.finishTrace("myTestFunc", 1);
...... // Service flow
bytrace.finishTrace("myTestFunc", 2);
```
```
// Start track tasks with the same name at different times.
bytrace.startTrace("myTestFunc", 1);
...... // Service flow
bytrace.finishTrace("myTestFunc", 1); // The first trace task ends.
...... // Service flow
bytrace.startTrace("myTestFunc", 1); // The second trace task starts after the first task ends. The two tasks have the same name and task ID.
> To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in **startTrace**.
**Example**
```
bytrace.finishTrace("myTestFunc", 1);
```
```
// Start track tasks with the same name concurrently.
bytrace.startTrace("myTestFunc", 1);
// Service flow
bytrace.startTrace("myTestFunc", 2); // The second trace task starts while the first task is still running. The first and second tasks have the same name but different task IDs.
// Service flow
bytrace.finishTrace("myTestFunc", 1);
// Service flow
bytrace.finishTrace("myTestFunc", 2);
```
```
// Start track tasks with the same name at different times.
bytrace.startTrace("myTestFunc", 1);
// Service flow
bytrace.finishTrace("myTestFunc", 1); // The first trace task ends.
// Service flow
bytrace.startTrace("myTestFunc", 1); // The second trace task starts after the first task ends. The two tasks have the same name and task ID.
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p17884517161715"><a name="p17884517161715"></a><a name="p17884517161715"></a>Name of the variable to trace.</p>
<td class="cellrowborder" valign="top" width="61.29%" headers="mcps1.1.5.1.4 "><p id="p178842174174"><a name="p178842174174"></a><a name="p178842174174"></a>Value of the variable to trace.</p>
>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.
...
...
@@ -19,20 +19,20 @@ Initiates a call. This function uses an asynchronous callback to return the exec
Before using this API, you must declare the **ohos.permission.PLACE\_CALL** permission (a system permission).
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| phoneNumber | string | Yes|Phone number.|
| callback |AsyncCallback<boolean>|Yes|Callback used to return the result.<br/> - **true**: success <br/> -**false**: failure|
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result: <br/> - **true**: A call is in progress. <br/> - **false**: No call is in progress. |
| callback | AsyncCallback<boolean> | Yes| Callback used to return the result: <br/> - **true**: A call is in progress. <br/> - **false**: No call is in progress. |
Checks whether the call number is an emergency number. This function uses an asynchronous callback to return the result.
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.
| callback | AsyncCallback<boolean> | 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<boolean> | 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.|
Checks whether the call number is an emergency number. This function uses an asynchronous callback to return the result.
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.
| options | EmergencyNumberOptions | Yes| Emergency number options defined in [EmergencyNumberOptions](#EmergencyNumberOptions).|
| callback | AsyncCallback<boolean> | 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.|
| options | EmergencyNumberOptions | Yes| Emergency number options defined in [EmergencyNumberOptions](#EmergencyNumberOptions).|
| callback | AsyncCallback<boolean> | 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.|
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import<a name="s56d19203690d4782bfc74069abb6bd71"></a>
Writes event information to the event file of the current day. This function supports JSON parameters and uses an asynchronous callback to return the result.
<td class="cellrowborder" valign="top" width="52.67000000000001%" headers="mcps1.1.5.1.4 "><p id="p55431154164513"><a name="p55431154164513"></a><a name="p55431154164513"></a>Indicates an array of JSON parameters of the application event. A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).</p>
<td class="cellrowborder" valign="top" width="52.67000000000001%" headers="mcps1.1.5.1.4 "><p id="p1065434111303"><a name="p1065434111303"></a><a name="p1065434111303"></a>Indicates the callback function, which can be used to process the received return value.</p>
<a name="ul182248492307"></a><a name="ul182248492307"></a><ul id="ul182248492307"><li>Value <strong id="b27171235133215"><a name="b27171235133215"></a><a name="b27171235133215"></a>0</strong> indicates that the event verification is successful, and the event will be written to the event file asynchronously. </li><li>A value greater than <strong id="b89271810175013"><a name="b89271810175013"></a><a name="b89271810175013"></a>0</strong> indicates that invalid parameters are present in the event, and the event will be written to the event file asynchronously after the invalid parameters are ignored. </li><li>A value smaller than <strong id="b8363151395017"><a name="b8363151395017"></a><a name="b8363151395017"></a>0</strong> indicates that the event verification fails, and the event will not be written to the event file.</li></ul>
// Event writing exception: Write the event to the event file after the invalid parameters in the event are ignored, or stop writing the event if the event verification fails.
console.error(`failed to write event because ${err.code}`);
| keyValues | object | Yes| Array of JSON parameters of the application event. A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).|
| callback | AsyncCallback<void> | No| Callback used to process the received return value. <br/>- The value **0** indicates that the event parameter verification is successful, and the event will be written to the event file asynchronously.<br/>- A value greater than **0** indicates that invalid parameters are present in the event, and the event will be written to the event file asynchronously after the invalid parameters are ignored.<br/>- A value smaller than **0** indicates that the event parameter verification fails, and the event will not be written to the event file asynchronously.|
// Event writing exception: Write the event to the event file after the invalid parameters in the event are ignored, or stop writing the event if the event verification fails.
console.error(`failed to write event because ${err.code}`);
| keyValues | object | Yes| Array of JSON parameters of the application event. A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<void> | Promise used to process the callback in the then() and catch() methods when event writing succeeded or failed.|
// Event writing exception: Write the event to the event file after the invalid parameters in the event are ignored, or stop writing the event if the event verification fails.
console.error(`failed to write event because ${err.code}`);
Writes event information to the event file of the current day. This function supports JSON parameters and uses a promise to return the result.
Configures the application event logging function, such as setting the event logging switch and maximum size of the directory that stores the event logging files.
<td class="cellrowborder" valign="top" width="64.41%" headers="mcps1.1.5.1.4 "><p id="p1859114984515"><a name="p1859114984515"></a><a name="p1859114984515"></a>Indicates an array of JSON parameters of the application event. A key must be a string, and a value must be a string, number, boolean, or Array (which can only be a string, number, or boolean).</p>
<td class="cellrowborder" valign="top" width="73.94%" headers="mcps1.1.3.1.2 "><p id="p14811710164718"><a name="p14811710164718"></a><a name="p14811710164718"></a>Promise used to process the callback in the <strong id="b1588612407278"><a name="b1588612407278"></a><a name="b1588612407278"></a>then()</strong> and <strong id="b116252458275"><a name="b116252458275"></a><a name="b116252458275"></a>catch()</strong> methods when event writing succeeded or failed.</p>
// Event writing exception: Write the event to the event file after the invalid parameters in the event are ignored, or stop writing the event if the event verification fails.
console.error(`failed to write event because ${err.code}`);
Configures the application event logging function, such as setting the event logging switch and maximum size of the directory that stores the event logging files.
<tdclass="cellrowborder"valign="top"width="65.79%"headers="mcps1.1.5.1.4 "><pid="a42ab0decfa2a497782c54a4edfc72b8a"><aname="a42ab0decfa2a497782c54a4edfc72b8a"></a><aname="a42ab0decfa2a497782c54a4edfc72b8a"></a>Application event logging switch. The value <strongid="b13365319489"><aname="b13365319489"></a><aname="b13365319489"></a>true</strong> means to disable the application event logging function, and the value <strongid="b4491356184818"><aname="b4491356184818"></a><aname="b4491356184818"></a>false</strong> means the opposite.</p>
<tdclass="cellrowborder"valign="top"width="65.79%"headers="mcps1.1.5.1.4 "><pid="p96071927366"><aname="p96071927366"></a><aname="p96071927366"></a>Maximum size of the event file storage directory. The default value is <strongid="b1263295715012"><aname="b1263295715012"></a><aname="b1263295715012"></a>10M</strong>. If the specified size is exceeded, the oldest event logging files in the storage directory will be deleted to free up space.</p>
</td>
</tr>
</tbody>
</table>
## EventType<a name="section099619567453"></a>
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| disable | boolean | No| Application event logging switch. The value <b>true</b> means to disable the application event logging function, and the value <b>false</b> means the opposite.|
| maxStorage | string | No| Maximum size of the event file storage directory. The default value is **10M**. If the specified size is exceeded, the oldest event logging files in the storage directory will be deleted to free up space.|
<tdclass="cellrowborder"valign="top"width="37.730000000000004%"headers="mcps1.1.6.1.5 "><pid="p19772191715296"><aname="p19772191715296"></a><aname="p19772191715296"></a>Distributed service startup event.</p>
<tdclass="cellrowborder"valign="top"width="35.949999999999996%"headers="mcps1.1.6.1.5 "><pid="p4829620183115"><aname="p4829620183115"></a><aname="p4829620183115"></a>Custom user ID.</p>
<tdclass="cellrowborder"valign="top"width="35.949999999999996%"headers="mcps1.1.6.1.5 "><pid="p882916205315"><aname="p882916205315"></a><aname="p882916205315"></a>Distributed service name.</p>
<tdclass="cellrowborder"valign="top"width="35.949999999999996%"headers="mcps1.1.6.1.5 "><pid="p15829132023112"><aname="p15829132023112"></a><aname="p15829132023112"></a>Distributed service instance ID.</p>
</td>
</tr>
</tbody>
</table>
## Param
Provides constants that define the names of all predefined event parameters.
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
| RULE_CAUTION_PRINT_LOG | BigInt | Alarm rule, which is programmed to print a log when an alarm is generated.|
| RULE_CAUTION_TRIGGER_CRASH | BigInt | Alarm rule. When an alarm is generated, the application exits.|
| RULE_THREAD_CHECK_SLOW_PROCESS | BigInt | Caution rule, which is programmed to detect whether any time-consuming function is invoked.|
| RULE_CHECK_SLOW_EVENT | BigInt | Caution rule, which is programmed to detect whether the event distribution or processing time has exceeded the specified time threshold.|
| RULE_CHECK_ABILITY_CONNECTION_LEAK | BigInt | Caution rule, which is programmed to detect whether ability leakage has occurred.|
## hichecker.addRule
addRule(rule: BigInt): void
Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules.
Checks whether the specified rule exists in the collection of added rules. If the rule is of the thread level, this operation is performed only on the current thread.
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
You can run the hidebug command to obtain the memory usage of an application, including the static heap memory (native heap) and proportional set size (PSS) occupied by the application process. You can also export VM memory slices and collect VM CPU profiling data.
## Modules to Import
```
import hidebug from '@ohos.hidebug';
```
## System Capabilities
SystemCapability.HiviewDFX.HiProfiler.HiDebug
## hidebug.getNativeHeapSize
getNativeHeapSize(): bigint
Obtains the total size of the native heap memory.
-**Return value**
| Type| Description|
| -------- | -------- |
| bigint | Total size of the native heap memory.|
-**Example**
```
let nativeHeapSize = hidebug.getNativeHeapSize();
```
## hidebug.getNativeHeapAllocatedSize
getNativeHeapAllocatedSize(): bigint
Obtains the size of the allocated native heap memory.
-**Return value**
| Type| Description|
| -------- | -------- |
| bigint | Size of the allocated native heap memory.|
-**Example**
```
let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize();
```
## hidebug.getNativeHeapFreeSize
getNativeHeapFreeSize(): bigint
Obtains the size of the free native heap memory.
-**Return value**
| Type| Description|
| -------- | -------- |
| bigint | Size of the free native heap memory.|
-**Example**
```
let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize();
```
## hidebug.getPss
getPss(): bigint
Obtains the PSS of this process.
-**Return value**
| Type| Description|
| -------- | -------- |
| bigint | PSS of the process.|
-**Example**
```
let pss = hidebug.getPss();
```
## hidebug.getSharedDirty
getSharedDirty(): bigint
Obtains the size of the shared dirty memory of this process.
-**Return value**
| Type| Description|
| -------- | -------- |
| bigint | Size of the shared dirty memory of the process.|
-**Example**
```
let sharedDirty = hidebug.getSharedDirty());
```
## hidebug.startProfiling
startProfiling(filename : string) : void
Starts the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the following sequences is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`.
| filename | string | Yes| User-defined profile name. The `filename.json` file is generated in the `files` directory of the application based on the specified `filename`.|
**Example**
```js
hidebug.startProfiling("cpuprofiler-20220216");
// Code block
// ...
// Code block
hidebug.stopProfiling();
```
## hidebug.stopProfiling
stopProfiling() : void
Stops the profiling method. `stopProfiling()` and `startProfiling()` are called in pairs. `stopProfiling()` always occurs after `startProfiling()`; that is, calling the functions in the following sequences is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`.
| filename | string | Yes| User-defined heap file name. The `filename.heapsnapshot` file is generated in the `files` directory of the app based on the specified `filename`.|
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Starts a trace task. **expectedTime** is an optional parameter, which specifies the expected duration of the trace.
If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the trace task to start.|
| taskId | number | Yes| Task ID.|
| expectedTime | number | No| Expected duration of the trace, in ms.|
If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For a specific example, refer to an example in [hiTraceMeter.finishTrace](#hitracemeterfinishtrace).
> If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same task ID can be used. For details, see the **hiTraceMeter.finishTrace** example.
**Parameters**
- Example
```
hiTraceMeter.startTrace("myTestFunc", 1);
hiTraceMeter.startTrace("myTestFunc", 1, 5); // The expected duration of the trace task is 5 ms.
```
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the trace task to start.|
| taskId | number | Yes| Task ID.|
| expectedTime | number | No| Expected duration of the trace, in ms.|
**Example**
```
hiTraceMeter.startTrace("myTestFunc", 1);
hiTraceMeter.startTrace("myTestFunc", 1, 5); // The expected duration of the trace task is 5 ms.
To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in [startTrace](#hitracemeterstarttrace).
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the trace task to start.|
| taskId | number | Yes| Task ID.|
**Example**
```
hiTraceMeter.finishTrace("myTestFunc", 1);
```
```
// Start track tasks with the same name concurrently.
hiTraceMeter.startTrace("myTestFunc", 1);
// Service flow
hiTraceMeter.startTrace("myTestFunc", 2); // The second trace task starts while the first task is still running. The first and second tasks have the same name but different task IDs.
// Service flow
hiTraceMeter.finishTrace("myTestFunc", 1);
// Service flow
hiTraceMeter.finishTrace("myTestFunc", 2);
```
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| name | string | Yes| Name of the trace task to start.|
> To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in **startTrace**.
- Example
```
hiTraceMeter.finishTrace("myTestFunc", 1);
```
```
// Start track tasks with the same name concurrently.
hiTraceMeter.startTrace("myTestFunc", 1);
// Service flow
hiTraceMeter.startTrace("myTestFunc", 2); // The second trace task starts while the first task is still running. The first and second tasks have the same name but different task IDs.
// Service flow
hiTraceMeter.finishTrace("myTestFunc", 1);
// Service flow
hiTraceMeter.finishTrace("myTestFunc", 2);
```
```
// Start track tasks with the same name at different times.
hiTraceMeter.startTrace("myTestFunc", 1);
// Service flow
hiTraceMeter.finishTrace("myTestFunc", 1); // The first trace task ends.
// Service flow
hiTraceMeter.startTrace("myTestFunc", 1); // The second trace task starts after the first task ends. The two tasks have the same name and task ID.
// Service flow
hiTraceMeter.finishTrace("myTestFunc", 1);
```
```
// Start track tasks with the same name at different times.
hiTraceMeter.startTrace("myTestFunc", 1);
// Service flow
hiTraceMeter.finishTrace("myTestFunc", 1); // The first trace task ends.
// Service flow
hiTraceMeter.startTrace("myTestFunc", 1); // The second trace task starts after the first task ends. The two tasks have the same name and task ID.
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import<a name="s56d19203690d4782bfc74069abb6bd71"></a>
## Modules to Import
```
import power from '@ohos.power';
...
...
@@ -14,163 +15,94 @@ import power from '@ohos.power';
<td class="cellrowborder" valign="top" width="46.1%" headers="mcps1.1.5.1.4 "><p id="p163691850191515"><a name="p163691850191515"></a><a name="p163691850191515"></a>Callback used to obtain the return value.</p>
<p id="p3566124615812"><a name="p3566124615812"></a><a name="p3566124615812"></a>The value <strong id="b4350172620165"><a name="b4350172620165"></a><a name="b4350172620165"></a>true</strong> indicates that the screen is on, and value <strong id="b035432613168"><a name="b035432613168"></a><a name="b035432613168"></a>false</strong> indicates the opposite.</p>
Before using this API, you must declare the **ohos.permission.REBOOT** permission (to reboot) or the **ohos.permission.REBOOT_RECOVERY** permission (to reboot and enter the recovery mode)
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| reason | string | Yes| Reason for system reboot.|
<td class="cellrowborder" valign="top" width="76.13%" headers="mcps1.1.3.1.2 "><p id="p163041531916"><a name="p163041531916"></a><a name="p163041531916"></a>Promise used to asynchronously obtain the return value. The value <strong id="b1934154320392"><a name="b1934154320392"></a><a name="b1934154320392"></a>true</strong> indicates that the screen is on, and value <strong id="b1693454393914"><a name="b1693454393914"></a><a name="b1693454393914"></a>false</strong> indicates the opposite.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
power.isScreenOn()
.then(screenOn => {
**Parameters**
| Type| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback<boolean> | Yes| Callback used to obtain the return value. <br/>The value **true** indicates that the screen is on, and value **false** indicates the opposite.|
**Example**
```
power.isScreenOn((error, screenOn) => {
if (typeof error === "undefined") {
console.info('screenOn status is ' + screenOn);
})
.catch(error => {
} else {
console.log('error: ' + error);
})
```
}
})
```
## power.isScreenOn
isScreenOn(): Promise<boolean>
Checks the screen status of the current device.
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<boolean> | Promise used to asynchronously obtain the return value. <br/>The value **true** indicates that the screen is on, and value **false** indicates the opposite.|
>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.
...
...
@@ -19,21 +19,21 @@ Obtains the radio access technologies (RATs) used by the CS and PS domains. This
Before using this API, you must declare the **ohos.permission.GET\_NETWORK\_INFO** permission.
| slotId | number | Yes| SIM card slot ID. The options are as follows: <br/> - **0**: slot 1<br/> - **1**: slot 2|
| callback | AsyncCallback\<{psRadioTech: [RadioTechnology](#RadioTechnology), csRadioTech:[RadioTechnology](#RadioTechnology)}\> | Yes| Callback used to return the result.|
| slotId | number | Yes| Card slot ID. The options are as follows: <br/> - **0**: slot 1 <br/> - **1**: slot 2|
| callback | AsyncCallback\<{psRadioTech: [RadioTechnology](#RadioTechnology), csRadioTech:[RadioTechnology](#RadioTechnology)}\> | Yes| Callback used to return the result.|
Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. This function uses an asynchronous callback to return the result.
Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. This function uses a promise to return the result.
Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. This function uses an asynchronous callback to return the result.
| slotId | number | Yes| SIM card slot ID. The options are as follows: <br/> - **0**: slot 1<br/> - **1**: slot 2|
| callback | AsyncCallback\<Array\<[SignalInformation](#SignalInformation)\>\> | Yes| Callback used to return the result, which is a list of [SignalInformation](#SignalInformation) objects.|
| slotId | number | Yes| Card slot ID. The options are as follows: <br/> - **0**: slot 1<br/> - **1**: slot 2|
| callback | AsyncCallback\<Array\<[SignalInformation](#SignalInformation)\>\> | Yes| Callback used to return the result, which is a list of [SignalInformation](#SignalInformation) objects.|
Obtains a list of signal strengths of the network with which the SIM card in the specified slot is registered. This function uses a promise to return the result.
| Promise\<Array\<[SignalInformation](#SignalInformation)\>\> | Promise used to return the result, which is a list of [SignalInformation](#SignalInformation) objects.|
| Promise\<Array\<[SignalInformation](#SignalInformation)\>\> | Promise used to return the result, which is a list of [SignalInformation](#SignalInformation) objects.|
| callback | AsyncCallback\<boolean\> | Yes| Callback used to return the result. <br/> - **true**: Radio is turned on.<br/> - **false**: Radio is turned off.|
| callback | AsyncCallback\<boolean\> | Yes| Callback used to return the result. <br/> - **true**: The radio service is enabled.<br/> - **false**: The radio service is disabled.|
| Promise\<boolean\> | Promise used to return the result. <br/> - **true**: The radio service is enabled.<br/> - **false**: The radio service is disabled.|
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import<a name="s56d19203690d4782bfc74069abb6bd71"></a>
<tdclass="cellrowborder"valign="top"width="57.699999999999996%"headers="mcps1.1.4.1.3 "><pid="p12478654172415"><aname="p12478654172415"></a><aname="p12478654172415"></a>A lock that prevents the system from hibernating.</p>
<tdclass="cellrowborder"valign="top"width="57.699999999999996%"headers="mcps1.1.4.1.3 "><pid="p1470645211154"><aname="p1470645211154"></a><aname="p1470645211154"></a>A lock that determines whether to turn on or off the screen based on the distance away from the screen.</p>
<td class="cellrowborder" valign="top" width="46.239999999999995%" headers="mcps1.1.5.1.4 "><p id="p81931947161019"><a name="p81931947161019"></a><a name="p81931947161019"></a>Callback used to obtain the return value.</p>
<p id="p1189279101115"><a name="p1189279101115"></a><a name="p1189279101115"></a>The value <strong id="b662801125113"><a name="b662801125113"></a><a name="b662801125113"></a>true</strong> indicates that the specified type of <strong id="b155741421610"><a name="b155741421610"></a><a name="b155741421610"></a>RunningLock</strong> is supported, and value <strong id="b1062831135112"><a name="b1062831135112"></a><a name="b1062831135112"></a>false</strong> indicates the opposite.</p>
<td class="cellrowborder" valign="top" width="74.42999999999999%" headers="mcps1.1.3.1.2 "><p id="p102681127973"><a name="p102681127973"></a><a name="p102681127973"></a>Promise used to asynchronously obtain the return value. The value <strong id="b13367196248"><a name="b13367196248"></a><a name="b13367196248"></a>true</strong> indicates that the specified type of <strong id="b594492361616"><a name="b594492361616"></a><a name="b594492361616"></a>RunningLock</strong> is supported, and value <strong id="b136619112410"><a name="b136619112410"></a><a name="b136619112410"></a>false</strong> indicates the opposite.</p>
Checks whether a specified type of RunningLock is supported. This function uses an asynchronous callback to return the result.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | RunningLockType | Yes| Type of the **RunningLock** object.|
| callback | AsyncCallback<boolean> | Yes| Callback used to obtain the return value. <br/>The value **true** indicates that the specified type of **RunningLock** is supported, and value **false** indicates the opposite.|
<td class="cellrowborder" valign="top" width="40.489999999999995%" headers="mcps1.1.5.1.4 "><p id="p1287815113222"><a name="p1287815113222"></a><a name="p1287815113222"></a>Type of the <strong id="b8849195023516"><a name="b8849195023516"></a><a name="b8849195023516"></a>RunningLock</strong> object to be created.</p>
<td class="cellrowborder" valign="top" width="40.489999999999995%" headers="mcps1.1.5.1.4 "><p id="p14467151017"><a name="p14467151017"></a><a name="p14467151017"></a>Callback used to obtain the return value.</p>
<td class="cellrowborder" valign="top" width="39.51%" headers="mcps1.1.5.1.4 "><p id="p1254245010819"><a name="p1254245010819"></a><a name="p1254245010819"></a>Type of the <strong id="b1302039324"><a name="b1302039324"></a><a name="b1302039324"></a>RunningLock</strong> object to be created.</p>
<td class="cellrowborder" valign="top" width="67.43%" headers="mcps1.1.3.1.2 "><p id="p165439501082"><a name="p165439501082"></a><a name="p165439501082"></a>Promise used to asynchronously obtain the returned <strong id="b120575312249"><a name="b120575312249"></a><a name="b120575312249"></a>RunningLock</strong> object.</p>
Checks whether a specified type of **RunningLock** is supported. This function uses an asynchronous callback to return the result.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | RunningLockType | Yes| Type of the **RunningLock** object.|
**Return value**
| Type| Description|
| -------- | -------- |
| Promise<boolean> | Promise used to asynchronously obtain the return value. The value **true** indicates that the specified type of **RunningLock** is supported, and value **false** indicates the opposite.|
>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.
...
...
@@ -18,21 +18,20 @@ Obtains the integrated circuit card identity (ICCID) of the SIM card in the spe
Before using this API, you must declare the **ohos.permission.GET\_TELEPHONY\_STATE** permission.
Obtains the public land mobile network (PLMN) ID of the SIM card in the specified slot. This function uses an asynchronous callback to return the result.
>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.
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.
| options | [SendMessageOptions](#SendMessageOptions) | Yes| Options (including the callback) for sending an SMS message. For details, see [SendMessageOptions](#SendMessageOptions).|
| options | [SendMessageOptions](#SendMessageOptions) | Yes| Options (including the callback) for sending an SMS message. For details, see [SendMessageOptions](#SendMessageOptions).|
@@ -281,13 +281,13 @@ Defines an SMS message instance.
| isSmsStatusReportMessage | boolean | Whether the received SMS message is an SMS delivery status report. The default value is **false**. <br/>SMS delivery status report: a message sent from the SMSC to show the current status of the SMS message you delivered.|
@@ -315,7 +315,7 @@ For example, you can specify the SMS message type by the optional parameter **co
| 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.|
| 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. |
| 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).|
| deliveryCallback | AsyncCallback<[IDeliveryShortMessageCallback](#IDeliveryShortMessageCallback)> | No| Callback used to return the SMS message delivery report. For details, see [IDeliveryShortMessageCallback](#IDeliveryShortMessageCallback).|
...
...
@@ -333,7 +333,7 @@ Provides the callback for the SMS message delivery report. It consists of three
| SEND_SMS_SUCCESS | 0 | The SMS message is sent successfully.|
| SEND_SMS_SUCCESS | 0 | SMS message sent successfully.|
| SEND_SMS_FAILURE_UNKNOWN | 1 | Failed to send the SMS message due to unknown reasons.|
| 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.|