提交 65a2aedf 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 83eb21e2
# DFX
- Application Event Logging
- [Overview of Application Event Logging](hiappevent-overview.md)
- [Development of Application Event Logging](hiappevent-guidelines.md)
- Performance Tracing
- [Overview of Performance Tracing](hitracemeter-overview.md)
- [Development of Performance Tracing](hitracemeter-guidelines.md)
- Distributed Call Chain Tracing
- [Overview of Distributed Call Chain Tracing](hitracechain-overview.md)
- [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md)
- [Development of Application Event Logging](hiappevent-guidelines.md)
- [Development of Performance Tracing](hitracemeter-guidelines.md)
- [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md)
- Error Management
- [Development of Error Manager](errormanager-guidelines.md)
- [Development of Application Recovery](apprecovery-guidelines.md)
# Development of Application Event Logging
## When to Use
## Introduction
The event logging function helps applications log various information generated during running.
A traditional log system aggregates log information generated by all applications running on the entire device, making it difficult to identify key information in the log. Therefore, an effective logging mechanism is needed to evaluate mission-critical information, for example, number of visits, number of daily active users, user operation habits, and key factors that affect application usage.
## Available APIs
HiAppEvent is a module that provides the event logging function for applications to log the fault, statistical, security, and user behavior events reported during running. Based on event information, you will be able to analyze the running status of applications.
## Basic Concepts
- **Logging**
Logs changes caused by user operations to provide service data for development, product, and O&M analysis.
## Event Design Specifications
JS application event logging APIs are provided by the **hiAppEvent** module.
- Event domain: identifies the domain of an event. You are advised to set this parameter to the service module name to differentiate service modules.
- Event name: specifies the name of an event. You are advised to set this parameter to a specific service name to differentiate services.
- Event type: specifies the type of an event. Four event types are supported:
- Behavior event: used to record the daily operation behavior of a user, for example, button click and page redirection.
- Fault event: used to locate and analyze application faults, for example, frame freezing, network disconnection, and call drop.
- Statistical event: used to collect statistics on key application behaviors, for example, usage duration and number of visits.
- Security event: used to record events related to application security, for example, password change and user authorization.
- Event parameter: specifies the parameters of an event. Each event can contain a group of parameters. You are advised to set this parameter to an event attribute or event context to depict the event details.
## Available APIs
The following table provides only a brief description of related APIs. For details, see [HiAppEvent](../reference/apis/js-apis-hiviewdfx-hiappevent.md).
......@@ -17,33 +34,68 @@ The following table provides only a brief description of related APIs. For detai
| write(AppEventInfo info, AsyncCallback\<void> callback): void | Logs application events in asynchronous mode. This API uses an asynchronous callback to return the result.|
| write(AppEventInfo info): Promise\<void> | Logs application events in asynchronous mode. This API uses a promise to return the result. |
**Table 2** APIs for event logging configuration
| API | Description |
| ------------------------------------ | ---------------------------------------------------- |
| configure(ConfigOption config): void | Sets the configuration options for application event logging.|
**Table 3** APIs for watcher management
| API | Description |
| -------------------------------------------------- | -------------------- |
| addWatcher(Watcher watcher): AppEventPackageHolder | Adds an event watcher.|
| removeWatcher(Watcher watcher): void | Removes an event watcher.|
| API | Description |
| -------------------------------------------------- | -------------------------------------------- |
| addWatcher(Watcher watcher): AppEventPackageHolder | Adds an event watcher to subscribe to expected application events.|
| removeWatcher(Watcher watcher): void | Adds an event watcher to unsubscribe from expected application events.|
**Table 4** APIs for clearing logging data
## How to Develop
| API | Description |
| ----------------- | -------------------- |
| clearData(): void | Clears local logging data.|
The following example illustrates how to log and subscribe to button click events of users.
## How to Develop
1. Create an eTS application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **entryability** > **EntryAbility.ts**, and double-click **EntryAbility.ts**. Then, add an event watcher to subscribe to button click events. The complete sample code is as follows:
The following uses a one-time event watcher as an example to illustrate the development procedure.
```js
import hilog from '@ohos.hilog';
import Ability from '@ohos.application.Ability'
import Window from '@ohos.window'
import hiAppEvent from '@ohos.hiviewdfx.hiAppEvent'
export default class EntryAbility extends Ability {
onCreate(want, launchParam) {
hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO);
hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? '');
hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:' + JSON.stringify(launchParam) ?? '');
hiAppEvent.addWatcher({
// Add a watcher. You can customize the watcher name. The system identifies different watchers based on their names.
name: "watcher1",
// Subscribe to application events you are interested in, for example, button click events.
appEventFilters: [{ domain: "button" }],
// Set the subscription callback trigger condition. In this example, a callback is triggered if one event is logged.
triggerCondition: { row: 1 },
// Implement the subscription callback function to apply custom processing to the event logging data obtained through subscription.
onTrigger: function (curRow, curSize, holder) {
// If the watcher incurs an error while it is working, return a null holder object after recording the error in the log.
if (holder == null) {
hilog.error(0x0000, 'testTag', "HiAppEvent holder is null")
return
}
let eventPkg = null
// Fetch the subscription event package based on the specified threshold (512 KB by default) until all subscription event data is fetched.
// If all subscription event data is fetched, return a null event package object. The subscription callback process is ended.
while ((eventPkg = holder.takeNext()) != null) {
// Apply custom processing to the event logging data in the event package, for example, print the event logging data in the log.
hilog.info(0x0000, 'testTag', `HiAppEvent eventPkg.packageId=%{public}d`, eventPkg.packageId)
hilog.info(0x0000, 'testTag', `HiAppEvent eventPkg.row=%{public}d`, eventPkg.row)
hilog.info(0x0000, 'testTag', `HiAppEvent eventPkg.size=%{public}d`, eventPkg.size)
for (const eventInfo of eventPkg.data) {
hilog.info(0x0000, 'testTag', `HiAppEvent eventPkg.info=%{public}s`, eventInfo)
}
}
}
})
}
}
1. Create an eTS application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **pages** > **index.ets**, and double-click **index.ets**. Then, add three buttons to simulate the process of watching for application events. Wherein, button 1 is used to invoke application event logging, button 2 to add an event watcher that automatically triggers a callback, and button 3 to remove the watcher. The complete sample code is as follows:
2. Choose **entry** > **src** > **main** > **ets** > **pages** > **index.ets**, and double-click **index.ets**. Then, add a button, and enable logging of button click events in its **onClick** function. The complete sample code is as follows:
```ts
import hiAppEvent from '@ohos.hiviewdfx.hiAppEvent';
```js
import hiAppEvent from '@ohos.hiviewdfx.hiAppEvent'
import hilog from '@ohos.hilog'
@Entry
@Component
......@@ -57,61 +109,21 @@ The following uses a one-time event watcher as an example to illustrate the deve
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button("1 writeTest").onClick(()=>{
// Perform event logging based on the input event parameters.
Button("writeTest").onClick(()=>{
// Enable event logging in the button click function to log button click events.
hiAppEvent.write({
domain: "test_domain",
name: "test_event",
eventType: hiAppEvent.EventType.FAULT,
params: {
int_data: 100,
str_data: "strValue"
}
// Define the event domain.
domain: "button",
// Define the event name.
name: "click",
// Define the event type.
eventType: hiAppEvent.EventType.BEHAVIOR,
// Define event parameters.
params: { click_time: 100 }
}).then(() => {
console.log(`HiAppEvent success to write event`);
hilog.info(0x0000, 'testTag', `HiAppEvent success to write event`)
}).catch((err) => {
console.error(`code: ${err.code}, message: ${err.message}`);
});
})
Button("2 addWatcherTest").onClick(()=>{
// Add an event watcher based on the input subscription parameters.
hiAppEvent.addWatcher({
name: "watcher1",
appEventFilters: [{ domain: "test_domain" }],
triggerCondition: {
row: 2,
size: 1000,
timeOut: 2
},
onTrigger: function (curRow, curSize, holder) {
// If the holder object is null, return an error after recording it in the log.
if (holder == null) {
console.error("HiAppEvent holder is null");
return;
}
// Set the size threshold to 1,000 bytes for obtaining an event package.
holder.setSize(1000);
let eventPkg = null;
// Obtain the event package based on the configured size threshold. If returned event package is null, all event data has been obtained.
while ((eventPkg = holder.takeNext()) != null) {
// Parse the obtained event package and display the result on the Log page.
console.info(`HiAppEvent eventPkg.packageId=${eventPkg.packageId}`);
console.info(`HiAppEvent eventPkg.row=${eventPkg.row}`);
console.info(`HiAppEvent eventPkg.size=${eventPkg.size}`);
// Traverse and parse event string arrays in the obtained event package.
for (const eventInfo of eventPkg.data) {
console.info(`HiAppEvent eventPkg.data=${eventInfo}`);
}
}
}
});
})
Button("3 removeWatcherTest").onClick(()=>{
// Remove the specified event watcher.
hiAppEvent.removeWatcher({
name: "watcher1"
hilog.error(0x0000, 'testTag', `HiAppEvent err.code: ${err.code}, err.message: ${err.message}`)
})
})
}
......@@ -121,26 +133,20 @@ The following uses a one-time event watcher as an example to illustrate the deve
}
}
```
3. Touch the run button on the IDE to run the project. Then, touch the **writeTest** button on the application UI to trigger application event logging.
2. Touch the run button on the IDE to run the project.
3. Touch button 1 on the application UI to start application event logging. If the logging is successful, you'll see the following message in the **Log** window:
```
success to write event: 0
```
4. On the application UI, touch button 2 to add an event watcher, and touch button 1 for multiple times to perform application event logging. If any callback trigger condition (event count, event data size, and timeout duration) is met, the event watcher will invoke a callback and the event package obtained through the callback will be displayed in the **Log** window.
4. View the information printed in the **Log** window. If logging of the button click event is successful, you will see a message indicating successful event logging as well as the log information specific to processing of the event logging data in the subscription callback.
```
```js
HiAppEvent success to write event
HiAppEvent eventPkg.packageId=0
HiAppEvent eventPkg.row=2
HiAppEvent eventPkg.size=308
HiAppEvent eventPkg.data={"domain_":"test_domain","name_":"test_event","type_":1,"time_":1502096107556,"tz_":"+0000","pid_":4204,"tid_":4223,"int_data":100,"str_data":"strValue"}
HiAppEvent eventPkg.row=1
HiAppEvent eventPkg.size=124
HiAppEvent eventPkg.info={"domain_":"button","name_":"click","type_":4,"time_":1670268234523,"tz_":"+0800","pid_":3295,"tid_":3309,"click_time":100}
```
5. On the application UI, touch button 3 to remove the event watcher. Then, touch button 1 for multiple times to perform application event logging. In such a case, there will be no log information about the callback invoked by the event watcher.
## Samples
The following sample is provided to help you better understand how to develop the application event logging feature:
......
# Overview of Application Event Logging
The HiAppEvent module provides event logging APIs for applications to log the fault, statistical, security, and user behavior events reported during running. Based on event information, you will be able to analyze the running status of your application.
You can use this module to develop application event-related functions, including flushing application events to a disk, querying and clearing application events, and customizing application event logging configuration.
## Basic Concepts
**Logging**
A function that logs changes caused by user operations to provide service data for development, product, and O&M analysis.
\ No newline at end of file
# Development of Distributed Call Chain Tracing
## When to Use
## Introduction
HiTraceChain is the module that provides APIs to implement call chain tracing throughout a service process. With HiTraceChain, you can quickly obtain the run log for the call chain of a specified service process and locate faults in inter-device, inter-process, or inter-thread communications.
The hiTraceChain module provides APIs to implement call chain tracing throughout a service process. This can help you quickly obtain the run log for the call chain of a specified service process and locate faults in inter-device, inter-process, or inter-thread communications.
hiTraceChain is a lightweight implementation of the cloud-based distributed call chain tracing. It allows applications to trace cross-thread, cross-process, and cross-device service calls. The hiTraceChain module generates a unique **chainId** for a service process and passes it to various information (including application events, system time, and logs) specific to the service process. During debugging and fault locating, you can use the unique **chainId** to quickly correlate various information related to the service process.
## Basic Concepts
- **chainId**
Distributed call chain tracing ID, which is a part of **HiTraceId** and is used to identify the service process being traced.
## Available APIs
......
# Overview of Distributed Call Chain Tracing
hiTraceChain is a lightweight implementation of the cloud-based distributed call chain tracing. It allows applications to trace cross-thread, cross-process, and cross-device service calls.
## Basic Concepts
- **chainId**
Distributed call chain tracing ID, which is a part of **HiTraceId** and is used to identify the service process being traced.
## Working Principles
The hiTraceChain module generates a unique **chainId** for a service process and passes it to various information (including application events, system time, and logs) specific to the service process. During debugging and fault locating, you can use the unique **chainId** to quickly correlate various information related to the service process.
## Constraints
All APIs provided by the hiTraceChain module work in synchronous mode.
# Development of Performance Tracing
## When to Use
## Introduction
HiTraceMeter provides APIs for system performance tracing. You can call the APIs provided by HiTraceMeter module in your own service logic to effectively track service processes and check the system performance.
hiTraceMeter provides APIs for system performance tracing. You can call the APIs provided by the hiTraceMeter module in your own service logic to effectively track service processes and check the system performance.
## Basic Concepts
- **hiTraceMeter Tag**
Tag used for tracing data categorization. It is also known as **hiTraceMeter Category**. Generally, one subsystem maps to a tag. The tag is passed as the **Tag** parameter in performance tracing APIs. When you use the hiTraceMeter CLI tool to collect tracing data, only the tracing data specified by the **Tag** parameter is collected.
## Working Principles
- The application calls hiTraceMeter APIs to perform performance tracing. The APIs output the tracing data to the kernel's ftrace data buffer through the kernel's sysfs file interface.
- The hiTraceMeter CLI tool reads the tracing data in the ftrace data buffer and saves the trace data as a text file on the device.
## Constraints
Due to the asynchronous I/O feature of JS, the hiTraceMeter module provides only asynchronous APIs.
## Available APIs
......
# Overview of Performance Tracing
hiTraceMeter is a tool for you to trace service processes and monitor system performance. Through encapsulating and extending the ftrace inside the kernel, hiTraceMeter supports performance tracing for code execution in the user space. You can use hiTraceMeter APIs to implement performance tracing and use the hiTraceMeter CLI tool to collect traced data.
## Basic Concepts
- **hiTraceMeter Tag**
Tag used for tracing data categorization. It is also known as **hiTraceMeter Category**. Generally, one subsystem maps to a tag. The tag is passed as the **Tag** parameter in performance tracing APIs. When you use the hiTraceMeter CLI tool to collect tracing data, only the tracing data specified by the **Tag** parameter is collected.
## Working Principles
- The application calls hiTraceMeter APIs to perform performance tracing. The APIs output the tracing data to the kernel's ftrace data buffer through the kernel's sysfs file interface.
- The hiTraceMeter CLI tool reads the tracing data in the ftrace data buffer and saves the trace data as a text file on the device.
## Constraints
Due to the asynchronous I/O feature of JS, the hiTraceMeter module provides only asynchronous APIs.
......@@ -1704,7 +1704,7 @@ This is a system API.
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------ | ---- | -------------------------- |
| type | string | Yes | Cause of the call disconnection.|
| callback | Callback<[DisconnectedDetails](#disconnecteddetails8)> | Yes | Callback used to return the result. |
| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | Yes | Callback used to return the result. |
**Example**
......@@ -1812,7 +1812,7 @@ This is a system API.
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------------------- | ---- | -------------------- |
| type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.|
| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails8)> | No | Callback used to return the result. |
| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. |
**Example**
......@@ -2908,11 +2908,15 @@ This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------------------------- | ---- | ---------------- |
| transferNum | string | Yes | Call transfer number. |
| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
| settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.|
| Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------------------------- | ---- | ---------------- |
| transferNum | string | Yes | Call transfer number. |
| type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. |
| settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.|
| startHour<sup>9+</sup> | number | No | Hour 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.|
| endMinute<sup>9+</sup> | number | No | Minute in the end time.|
## CallTransferType<sup>8+</sup>
......@@ -3128,10 +3132,14 @@ This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name| Type | Mandatory| Description |
| ------ | ---------------------------------- | ---- | -------- |
| status | [TransferStatus](#transferstatus8) | Yes | Transfer status.|
| number | string | Yes | Number. |
| Name | Type | Mandatory| Description |
| ------------------------ | ---------------------------------- | ---- | ---------------- |
| status | [TransferStatus](#transferstatus8) | Yes | Call transfer status. |
| number | string | Yes | Call transfer number. |
| startHour<sup>9+</sup> | number | Yes | Hour 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.|
| endMinute<sup>9+</sup> | number | Yes | Minute in the end time.|
## CallWaitingStatus<sup>7+</sup>
......@@ -3172,7 +3180,20 @@ This is a system API.
| TRANSFER_DISABLE | 0 | Call transfer disabled.|
| TRANSFER_ENABLE | 1 | Call transfer enabled.|
## DisconnectedDetails<sup>8+</sup>
## DisconnectedDetails<sup>9+</sup>
Defines the cause of a call disconnection.
This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Type | Mandatory| Description |
| ------- | ------------------------------------------ | ---- | --------------- |
| reason | [DisconnectedReason](#disconnectedreason8) | Yes | Cause of the call disconnection. |
| message | string | Yes | Message indicating the call disconnection.|
## DisconnectedReason<sup>8+</sup>
Enumerates causes of call disconnection.
......@@ -3180,28 +3201,87 @@ This is a system API.
**System capability**: SystemCapability.Telephony.CallManager
| Name | Value | Description |
| --------------------------- | ---- | ---------------------- |
| UNASSIGNED_NUMBER | 1 | Unallocated number. |
| NO_ROUTE_TO_DESTINATION | 3 | No route to the destination. |
| CHANNEL_UNACCEPTABLE | 6 | Unacceptable channel. |
| OPERATOR_DETERMINED_BARRING | 8 | Operator determined barring (ODB). |
| NORMAL_CALL_CLEARING | 16 | Normal call clearing. |
| USER_BUSY | 17 | User busy. |
| NO_USER_RESPONDING | 18 | No user response. |
| USER_ALERTING_NO_ANSWER | 19 | Alerting but no answer.|
| CALL_REJECTED | 21 | Call rejected. |
| NUMBER_CHANGED | 22 | Number changed. |
| DESTINATION_OUT_OF_ORDER | 27 | Destination fault. |
| INVALID_NUMBER_FORMAT | 28 | Invalid number format. |
| NETWORK_OUT_OF_ORDER | 38 | Network fault. |
| TEMPORARY_FAILURE | 41 | Temporary fault. |
| INVALID_PARAMETER | 1025 | Invalid parameter. |
| SIM_NOT_EXIT | 1026 | SIM card not exit. |
| SIM_PIN_NEED | 1027 | SIM card PIN required. |
| CALL_NOT_ALLOW | 1029 | Call not allowed. |
| SIM_INVALID | 1045 | Invalid SIM card. |
| UNKNOWN | 1279 | Unknown reason. |
| Name | Value | Description |
| ------------------------------------------------------------ | ---- | --------------------------------------- |
| UNASSIGNED_NUMBER | 1 | Unallocated (unassigned) number. |
| NO_ROUTE_TO_DESTINATION | 3 | No route to destination. |
| CHANNEL_UNACCEPTABLE | 6 | Channel unacceptable. |
| OPERATOR_DETERMINED_BARRING | 8 | Operator determined barring (ODB). |
| CALL_COMPLETED_ELSEWHERE<sup>9+</sup> | 13 | Call completed elsewhere. |
| NORMAL_CALL_CLEARING | 16 | Normal call clearing. |
| USER_BUSY | 17 | User busy. |
| NO_USER_RESPONDING | 18 | No user responding. |
| USER_ALERTING_NO_ANSWER | 19 | User alerting, no answer. |
| CALL_REJECTED | 21 | Call rejected. |
| NUMBER_CHANGED | 22 | Number changed. |
| CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION<sup>9+</sup> | 24 | Call rejected due to feature at the destination.|
| FAILED_PRE_EMPTION<sup>9+</sup> | 25 | Failed preemption. |
| NON_SELECTED_USER_CLEARING<sup>9+</sup> | 26 | Non-selected user clearing. |
| DESTINATION_OUT_OF_ORDER | 27 | Destination out of order. |
| INVALID_NUMBER_FORMAT | 28 | Invalid number format (incomplete number). |
| FACILITY_REJECTED<sup>9+</sup> | 29 | Facility rejected. |
| RESPONSE_TO_STATUS_ENQUIRY<sup>9+</sup> | 30 | Response to status enquiry. |
| NORMAL_UNSPECIFIED<sup>9+</sup> | 31 | Normal, unspecified. |
| NO_CIRCUIT_CHANNEL_AVAILABLE<sup>9+</sup> | 34 | No circuit/channel available. |
| NETWORK_OUT_OF_ORDER | 38 | Network fault. |
| TEMPORARY_FAILURE | 41 | Temporary failure. |
| SWITCHING_EQUIPMENT_CONGESTION<sup>9+</sup> | 42 | Switching equipment congestion. |
| ACCESS_INFORMATION_DISCARDED<sup>9+</sup> | 43 | Access information discarded. |
| REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE<sup>9+</sup> | 44 | Requested circuit/channel unavailable |
| RESOURCES_UNAVAILABLE_UNSPECIFIED<sup>9+</sup> | 47 | Resources unavailable, unspecified. |
| QUALITY_OF_SERVICE_UNAVAILABLE<sup>9+</sup> | 49 | QoS unavailable. |
| REQUESTED_FACILITY_NOT_SUBSCRIBED<sup>9+</sup> | 50 | Requested facility not subscribed. |
| INCOMING_CALLS_BARRED_WITHIN_THE_CUG<sup>9+</sup> | 55 | Incoming calls barred within the CUG. |
| BEARER_CAPABILITY_NOT_AUTHORIZED<sup>9+</sup> | 57 | Bearer capability not authorized. |
| BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE<sup>9+</sup> | 58 | Bearer capability presently available. |
| SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED<sup>9+</sup> | 63 | Service or option not available, unspecified. |
| BEARER_SERVICE_NOT_IMPLEMENTED<sup>9+</sup> | 65 | Bearer service not implemented. |
| ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE<sup>9+</sup> | 68 | ACM greater than or equal to the maximum value. |
| REQUESTED_FACILITY_NOT_IMPLEMENTED<sup>9+</sup> | 69 | Requested facility not implemented. |
| ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE<sup>9+</sup> | 70 | Only restricted digital information capability available. |
| SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED<sup>9+</sup> | 79 | Service or option not implemented, unspecified. |
| INVALID_TRANSACTION_IDENTIFIER_VALUE<sup>9+</sup> | 81 | Invalid transaction identifier value. |
| USER_NOT_MEMBER_OF_CUG<sup>9+</sup> | 87 | User not member of CUG. |
| INCOMPATIBLE_DESTINATION<sup>9+</sup> | 88 | Incompatible destination. |
| INVALID_TRANSIT_NETWORK_SELECTION<sup>9+</sup> | 91 | Invalid transit network selection. |
| SEMANTICALLY_INCORRECT_MESSAGE<sup>9+</sup> | 95 | Semantically incorrect message. |
| INVALID_MANDATORY_INFORMATION<sup>9+</sup> | 96 | Invalid mandatory information. |
| MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED<sup>9+</sup> | 97 | Message type non-existent or not implemented. |
| MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE<sup>9+</sup> | 98 | Message type not compatible with protocol state. |
| INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED<sup>9+</sup> | 99 | IE non-existent or not implemented. |
| CONDITIONAL_IE_ERROR<sup>9+</sup> | 100 | Conditional IE error. |
| MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE<sup>9+</sup> | 101 | Message not compatible with protocol state. |
| RECOVERY_ON_TIMER_EXPIRED<sup>9+</sup> | 102 | Recovery on timer expiry. |
| PROTOCOL_ERROR_UNSPECIFIED<sup>9+</sup> | 111 | Protocol error, unspecified. |
| INTERWORKING_UNSPECIFIED<sup>9+</sup> | 127 | Interworking, unspecified. |
| CALL_BARRED<sup>9+</sup> | 240 | Call barred. |
| FDN_BLOCKED<sup>9+</sup> | 241 | FDN blocked. |
| IMSI_UNKNOWN_IN_VLR<sup>9+</sup> | 242 | IMSI unknown in VLR. |
| IMEI_NOT_ACCEPTED<sup>9+</sup> | 243 | IMEI not accepted. |
| DIAL_MODIFIED_TO_USSD<sup>9+</sup> | 244 | Dial request modified to USSD request. |
| DIAL_MODIFIED_TO_SS<sup>9+</sup> | 245 | Dial request modified to SS request. |
| DIAL_MODIFIED_TO_DIAL<sup>9+</sup> | 246 | Dial request modified to dial with different number. |
| RADIO_OFF<sup>9+</sup> | 247 | Radio off. |
| OUT_OF_SERVICE<sup>9+</sup> | 248 | Out of service. |
| NO_VALID_SIM<sup>9+</sup> | 249 | No valid SIM. |
| RADIO_INTERNAL_ERROR<sup>9+</sup> | 250 | Radio internal error. |
| NETWORK_RESP_TIMEOUT<sup>9+</sup> | 251 | Network response timeout. |
| NETWORK_REJECT<sup>9+</sup> | 252 | Request rejected by network. |
| RADIO_ACCESS_FAILURE<sup>9+</sup> | 253 | Radio access failure. |
| RADIO_LINK_FAILURE<sup>9+</sup> | 254 | Radio link failure. |
| RADIO_LINK_LOST<sup>9+</sup> | 255 | Radio link lost. |
| RADIO_UPLINK_FAILURE<sup>9+</sup> | 256 | Radio uplink failure. |
| RADIO_SETUP_FAILURE<sup>9+</sup> | 257 | Radio setup failure. |
| RADIO_RELEASE_NORMAL<sup>9+</sup> | 258 | Radio release normal. |
| RADIO_RELEASE_ABNORMAL<sup>9+</sup> | 259 | Radio release abnormal. |
| ACCESS_CLASS_BLOCKED<sup>9+</sup> | 260 | Access class blocked. |
| NETWORK_DETACH<sup>9+</sup> | 261 | Network detached. |
| INVALID_PARAMETER | 1025 | Invalid parameter. |
| SIM_NOT_EXIT | 1026 | SIM not exit. |
| SIM_PIN_NEED | 1027 | SIM PIN needed. |
| CALL_NOT_ALLOW | 1029 | Call not allowed. |
| SIM_INVALID | 1045 | No valid SIM. |
| UNKNOWN | 1279 | Unknown reason. |
## MmiCodeResults<sup>9+</sup>
......
......@@ -72,7 +72,7 @@ Creates an HTTP request. You can use this API to initiate or destroy an HTTP req
**Return value**
| Type | Description |
| :---------- | :----------------------------------------------------------- |
| ---------- | ----------------------------------------------------------- |
| HttpRequest | An **HttpRequest** object, which contains the **request**, **destroy**, **on**, or **off** method.|
**Example**
......@@ -181,7 +181,7 @@ Initiates an HTTP request to a given URL. This API uses a promise to return the
**Return value**
| Type | Description |
| :------------------------------------- | :-------------------------------- |
| ------------------------------------- | -------------------------------- |
| Promise<[HttpResponse](#httpresponse)> | Promise used to return the result.|
......@@ -374,7 +374,7 @@ Defines an HTTP request method.
**System capability**: SystemCapability.Communication.NetStack
| Name | Value | Description |
| :------ | ------- | :------------------ |
| ------ | ------- | ------------------ |
| OPTIONS | "OPTIONS" | OPTIONS method.|
| GET | "GET" | GET method. |
| HEAD | "HEAD" | HEAD method. |
......@@ -459,7 +459,7 @@ Creates a default object to store responses to HTTP access requests.
**Return value**
| Type | Description |
| :---------- | :----------------------------------------------------------- |
| ---------- | ----------------------------------------------------------- |
| [HttpResponseCache](#httpresponsecache9) | Object that stores the response to the HTTP request.|
**Example**
......@@ -602,6 +602,6 @@ Enumerates HTTP protocol versions.
**System capability**: SystemCapability.Communication.NetStack
| Name | Description |
| :-------- | :----------- |
| -------- | ----------- |
| HTTP1_1 | HTTP1.1 |
| HTTP2 | HTTP2 |
......@@ -61,7 +61,7 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.getDefaultNetSync
## connection.getDefaultNetSync<sup>9+</sup>
getDefaultNetSync(): NetHandle;
......@@ -303,6 +303,55 @@ connection.getDefaultNet().then(function (netHandle) {
})
```
## connection.isDefaultNetMetered<sup>9+</sup>
isDefaultNetMetered(callback: AsyncCallback\<boolean>): void
Checks whether the data traffic usage on the current network is metered. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback\<boolean> | Yes | Callback used to return the result. The value **true** indicates the data traffic usage is metered.|
**Example**:
```js
connection.isDefaultNetMetered(function (error, has) {
console.log(JSON.stringify(error))
console.log('has: ' + has)
})
```
## connection.isDefaultNetMetered<sup>9+</sup>
isDefaultNetMetered(): Promise\<boolean>
Checks whether the data traffic usage on the current network is metered. This API uses a promise to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core
**Return value**
| Type | Description |
| ----------------- | ----------------------------------------------- |
| Promise\<boolean> | Promise used to return the result. The value **true** indicates the data traffic usage is metered.|
**Example**:
```js
connection.isDefaultNetMetered().then(function (has) {
console.log('has: ' + has)
})
```
## connection.reportNetConnected
reportNetConnected(netHandle: NetHandle, callback: AsyncCallback&lt;void&gt;): void
......@@ -495,7 +544,7 @@ enableAirplaneMode(callback: AsyncCallback\<void>): void
Enables the airplane 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.Communication.NetManager.Core
......@@ -519,7 +568,7 @@ enableAirplaneMode(): Promise\<void>
Enables the airplane 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.Communication.NetManager.Core
......@@ -543,7 +592,7 @@ disableAirplaneMode(callback: AsyncCallback\<void>): void
Disables the airplane 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.Communication.NetManager.Core
......@@ -567,7 +616,7 @@ disableAirplaneMode(): Promise\<void>
Disables the airplane 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.Communication.NetManager.Core
......@@ -823,7 +872,7 @@ Before invoking NetHandle APIs, call **getNetHandle** to obtain a **NetHandle**
| ------ | ------ | ------------------------- |
| netId | number | Network ID. The value **0** indicates no default network. Any other value must be greater than or equal to 100.|
### bindSocket
### bindSocket<sup>9+</sup>
bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\<void>): void;
......@@ -1091,10 +1140,10 @@ Provides an instance that bears data network capabilities.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Type | Description |
| ----------------------- | ----------------------------------- | ------------------------------------------------------------ |
| netCapabilities | [NetCapabilities](#netcapabilities) | Network transmission capabilities and bearer types of the data network. |
| bearerPrivateIdentifier | string | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).|
| Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ----------- |
| netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. |
| bearerPrivateIdentifier | string | No | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).|
## NetCapabilities
......@@ -1102,12 +1151,12 @@ Defines the network capability set.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Type | Description |
| --------------------- | ---------------------------------- | ------------------------ |
| linkUpBandwidthKbps | number | Uplink (from the device to the network) bandwidth.|
| linkDownBandwidthKbps | number | Downlink (from the network to the device) bandwidth.|
| networkCap | Array<[NetCap](#netcap)> | Network capability. |
| bearerTypes | Array<[NetBearType](#netbeartype)> | Network type. |
| Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ----------- |
| linkUpBandwidthKbps | number | No | Uplink (from the device to the network) bandwidth.|
| linkDownBandwidthKbps | number | No | Downlink (from the network to the device) bandwidth.|
| networkCap | Array<[NetCap](#netcap)> | No | Network capability. |
| bearerTypes | Array<[NetBearType](#netbeartype)> | Yes | Network type. |
## NetCap
......@@ -1141,14 +1190,14 @@ Defines the network connection properties.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Type | Description |
| ------------- | ---------------------------------- | ---------------- |
| interfaceName | string | NIC card name. |
| domains | string | Domain. The default value is **""**.|
| linkAddresses | Array<[LinkAddress](#linkaddress)> | Link information. |
| routes | Array<[RouteInfo](#routeinfo)> | Route information. |
| dnses | Array&lt;[NetAddress](#netaddress)&gt; | Network address. For details, see [NetAddress](#netaddress).|
| mtu | number | Maximum transmission unit (MTU). |
| Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ----------- |
| interfaceName | string | Yes | NIC card name. |
| domains | string | Yes | Domain. The default value is **""**.|
| linkAddresses | Array\<[LinkAddress](#linkaddress)> | Yes | Link information. |
| routes | Array\<[RouteInfo](#routeinfo)> | Yes | Route information. |
| dnses | Array\<[NetAddress](#netaddress)>; | Yes | Network address. For details, see [NetAddress](#netaddress).|
| mtu | number | Yes | Maximum transmission unit (MTU). |
## LinkAddress
......@@ -1156,10 +1205,10 @@ Network link information.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Type | Description |
| ------------ | ------------------------- | -------------------- |
| address | [NetAddress](#netaddress) | Link address. |
| prefixLength | number | Length of the link address prefix.|
| Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ----------- |
| address | [NetAddress](#netaddress) | Yes | Link address. |
| prefixLength | number | Yes | Length of the link address prefix.|
## RouteInfo
......@@ -1167,13 +1216,13 @@ Network route information.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Type | Description |
| -------------- | --------------------------- | ---------------- |
| interface | string | NIC card name. |
| destination | [LinkAddress](#linkaddress) | Destination IP address. |
| gateway | [NetAddress](#netaddress) | Gateway address. |
| hasGateway | boolean | Whether a gateway is present. |
| isDefaultRoute | boolean | Whether the route is the default route.|
| Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ----------- |
| interface | string | Yes | NIC card name. |
| destination | [LinkAddress](#linkaddress) | Yes | Destination IP address. |
| gateway | [NetAddress](#netaddress) | Yes | Gateway address. |
| hasGateway | boolean | Yes | Whether a gateway is present. |
| isDefaultRoute | boolean | Yes | Whether the route is the default route.|
## NetAddress
......@@ -1181,8 +1230,8 @@ Defines the network address.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Type | Description |
| ------- | ------ | ------------------------------ |
| address | string | Network address. |
| family | number | Address family identifier. The value is **1** for IPv4 and **2** for IPv6. The default value is **1**.|
| port | number | Port number. The value ranges from **0** to **65535**. |
| Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ----------- |
| address | string | Yes | Network address. |
| family | number | Yes | Address family identifier. The value is **1** for IPv4 and **2** for IPv6. The default value is **1**.|
| port | number | No | Port number. The value ranges from **0** to **65535**. |
......@@ -14,7 +14,7 @@ import ethernet from '@ohos.net.ethernet'
## ethernet.setIfaceConfig
setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\<void>): void;
setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\<void>): void
Sets the network interface configuration. This API uses an asynchronous callback to return the result.
......@@ -46,7 +46,7 @@ ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.1.123", ro
## ethernet.setIfaceConfig
setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void>;
setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void>
Sets the network interface configuration. This API uses a promise to return the result.
......@@ -80,7 +80,7 @@ ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.1.123", ro
## ethernet.getIfaceConfig
getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>): void;
getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>): void
Obtains the configuration of a network interface. This API uses an asynchronous callback to return the result.
......@@ -115,7 +115,7 @@ ethernet.getIfaceConfig("eth0", (error, value) => {
## ethernet.getIfaceConfig
getIfaceConfig(iface: string): Promise\<InterfaceConfiguration>;
getIfaceConfig(iface: string): Promise\<InterfaceConfiguration>
Obtains the configuration of a network interface. This API uses a promise to return the result.
......@@ -153,7 +153,7 @@ ethernet.getIfaceConfig("eth0").then((data) => {
## ethernet.isIfaceActive
isIfaceActive(iface?: string, callback: AsyncCallback\<number>): void;
isIfaceActive(iface?: string, callback: AsyncCallback\<number>): void
Checks whether a network interface is active. This API uses an asynchronous callback to return the result.
......@@ -165,7 +165,7 @@ Checks whether a network interface is active. This API uses an asynchronous call
| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | -------------------------------------------------- |
| iface | string | No | Name of the network interface. If this parameter is left empty, the API checks for any active network interface. |
| iface | string | Yes | Name of the network interface. If this parameter is left empty, the API checks for any active network interface. |
| callback | AsyncCallback\<number> | Yes | Callback used to return the result. The value **1** means that the network interface is active, **0** means that the network interface is inactive, and any other value means that an error has occurred.|
**Example**
......@@ -182,7 +182,7 @@ ethernet.isIfaceActive("eth0", (error, value) => {
## ethernet.isIfaceActive
isIfaceActive(iface?: string): Promise\<number>;
isIfaceActive(iface: string): Promise\<number>
Checks whether a network interface is active. This API uses a promise to return the result.
......@@ -194,7 +194,7 @@ Checks whether a network interface is active. This API uses a promise to return
| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
| iface | string | No | Name of the network interface. If this parameter is left empty, the API checks for any active network interface.|
| iface | string | Yes | Name of the network interface. If this parameter is left empty, the API checks for any active network interface.|
**Return value**
......@@ -214,7 +214,7 @@ ethernet.isIfaceActive("eth0").then((data) => {
## ethernet.getAllActiveIfaces
getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void;
getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void
Obtains all active network interfaces. This API uses an asynchronous callback to return the result.
......@@ -245,7 +245,7 @@ ethernet.getAllActiveIfaces((error, value) => {
## ethernet.getAllActiveIfaces
getAllActiveIfaces(): Promise\<Array\<string>>;
getAllActiveIfaces(): Promise\<Array\<string>>
Obtains all active network interfaces. This API uses a promise to return the result.
......@@ -280,14 +280,14 @@ Defines the network configuration for the Ethernet connection.
**System capability**: SystemCapability.Communication.NetManager.Core
| Name | Type | Description |
| ----------------------- | ----------------------------------- | ------------------------------------------------------------ |
| mode | [IPSetMode](#ipsetmode) | Configuration mode of the Ethernet connection.|
| ipAddr | string | Static IP address of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in Dynamic Host Configuration Protocol (DHCP) mode.|
| route | string | Route of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.|
| gateway | string | Gateway of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.|
| netMask | string | Subnet mask of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.|
| dnsServers | string | DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).|
| Name | Type | Mandatory | Description |
| -------- | ------- | --------- | ----------- |
| mode | [IPSetMode](#ipsetmode) | Yes | Configuration mode of the Ethernet connection.|
| ipAddr | string | Yes | Static IP address of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in Dynamic Host Configuration Protocol (DHCP) mode.|
| route | string | Yes | Route of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.|
| gateway | string | Yes | Gateway of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.|
| netMask | string | Yes | Subnet mask of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.|
| dnsServers | string | Yes | DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).|
## IPSetMode
......
......@@ -18,9 +18,11 @@ isSharingSupported(callback: AsyncCallback\<boolean>): void
Checks whether network sharing is supported. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -43,9 +45,11 @@ isSharingSupported(): Promise\<boolean>
Checks whether network sharing is supported. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Return value**
......@@ -69,9 +73,11 @@ isSharing(callback: AsyncCallback\<boolean>): void
Checks whether network sharing is in progress. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -96,7 +102,9 @@ Checks whether network sharing is in progress. This API uses a promise to return
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System API**: This is a system API.
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Return value**
......@@ -122,7 +130,9 @@ Starts network sharing of a specified type. This API uses an asynchronous callba
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System API**: This is a system API.
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -146,9 +156,11 @@ startSharing(type: SharingIfaceType): Promise\<void>
Starts network sharing of a specified type. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -179,9 +191,11 @@ stopSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void
Stops network sharing of a specified type. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -205,9 +219,11 @@ stopSharing(type: SharingIfaceType): Promise\<void>
Stops network sharing of a specified type. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -238,9 +254,11 @@ getStatsRxBytes(callback: AsyncCallback\<number>): void
Obtains the volume of mobile data traffic received via network sharing. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -263,9 +281,11 @@ getStatsRxBytes(): Promise\<number>
Obtains the volume of mobile data traffic received via network sharing. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Return value**
......@@ -289,9 +309,11 @@ getStatsTxBytes(callback: AsyncCallback\<number>): void
Obtains the volume of mobile data traffic sent via network sharing. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -314,9 +336,11 @@ getStatsTxBytes(): Promise\<number>
Obtains the volume of mobile data traffic sent via network sharing. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Return value**
......@@ -340,9 +364,11 @@ getStatsTotalBytes(callback: AsyncCallback\<number>): void
Obtains the volume of mobile data traffic sent and received via network sharing. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -365,9 +391,11 @@ getStatsTotalBytes(): Promise\<number>
Obtains the volume of mobile data traffic sent and received via network sharing. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Return value**
......@@ -391,15 +419,17 @@ getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\<Array\<strin
Obtains the names of NICs in the specified network sharing state. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------- |
| state | state: [SharingIfaceState](#sharingifacestate) | Yes | Network sharing state.|
| state | [SharingIfaceState](#sharingifacestate) | Yes | Network sharing state.|
| callback | AsyncCallback\<Array\<string>> | Yes | Callback used to return an array of NIC names.|
**Example**
......@@ -418,15 +448,17 @@ getSharingIfaces(state: SharingIfaceState): Promise\<Array\<string>>
Obtains the names of NICs in the specified network sharing state. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------- |
| state | state: [SharingIfaceState](#sharingifacestate) | Yes | Network sharing state.|
| state | [SharingIfaceState](#sharingifacestate) | Yes | Network sharing state.|
**Return value**
......@@ -451,9 +483,11 @@ getSharingState(type: SharingIfaceType, callback: AsyncCallback\<SharingIfaceSta
Obtains the network sharing state of the specified type. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -478,9 +512,11 @@ getSharingState(type: SharingIfaceType): Promise\<SharingIfaceState>
Obtains the network sharing state of the specified type. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -511,9 +547,11 @@ getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\<Array\<strin
Obtains regular expressions of NICs of a specified type. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -538,9 +576,11 @@ getSharableRegexes(type: SharingIfaceType): Promise\<Array\<string>>
Obtains regular expressions of NICs of a specified type. This API uses a promise to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -571,9 +611,11 @@ on(type: 'sharingStateChange', callback: Callback\<boolean>): void
Subscribes to network sharing state changes. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -597,9 +639,11 @@ off(type: 'sharingStateChange', callback?: Callback\<boolean>): void
Unsubscribes from network sharing state changes. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -623,9 +667,11 @@ on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIface
Subscribes to network sharing state changes of a specified NIC. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -649,15 +695,17 @@ off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfa
Unsubscribes from network sharing status changes of a specified NIC. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------------------------- | ---- | ---------- |
| type | string | No | Event name.|
| type | string | Yes | Event name.|
| callback | AsyncCallback\<{ type: [SharingIfaceType](#sharingifacetype), iface: string, state: SharingIfaceState(#sharingifacestate) }> | No | Callback used for unsubscription.|
**Example**
......@@ -675,9 +723,11 @@ on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void
Subscribes to upstream network changes. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -701,9 +751,11 @@ off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void
Unsubscribes from upstream network changes. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL
**System capability**: SystemCapability.Communication.NetManager.Core
**System capability**: SystemCapability.Communication.NetManager.NetSharing
**Parameters**
......@@ -725,7 +777,9 @@ sharing.off('sharingUpstreamChange', (error, data) => {
Enumerates the network sharing states of an NIC.
**System capability**: SystemCapability.Communication.NetManager.Core
**System API**: This is a system API.
**System capability**: SystemCapability.Communication.NetManager.NetSharing
| Name | Value | Description |
| ------------------------ | ---- | ---------------------- |
......@@ -737,7 +791,9 @@ Enumerates the network sharing states of an NIC.
Enumerates the network sharing types of an NIC.
**System capability**: SystemCapability.Communication.NetManager.Core
**System API**: This is a system API.
**System capability**: SystemCapability.Communication.NetManager.NetSharing
| Name | Value | Description |
| ------------------------ | ---- | ---------------------- |
......
......@@ -2934,6 +2934,37 @@ Enumerates contact types.
**System capability**: SystemCapability.Telephony.CoreService
| Name | Value | Description |
| :-------------- | ---- | ---------- |
| -------------- | ---- | ---------- |
| GENERAL_CONTACT | 1 | Common contact number.|
| FIXED_DIALING | 2 | Fixed dialing number. |
## OperatorConfigKey<sup>9+</sup>
Enumerates carrier configuration keys.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService
| Name | Value | Description |
| ------------------------------------------------------- | ---------------------------------------------------- | -------------------- |
| KEY_VOICE_MAIL_NUMBER_STRING | "voice_mail_number_string" | Voice mailbox number. |
| KEY_IMS_SWITCH_ON_BY_DEFAULT_BOOL | "ims_switch_on_by_default_bool" | Fixed dialing number. |
| KEY_HIDE_IMS_SWITCH_BOOL | "hide_ims_switch_bool" | Whether to hide the IMS switch. |
| KEY_VOLTE_SUPPORTED_BOOL | "volte_supported_bool" | Whether to support VoLTE. |
| KEY_NR_MODE_SUPPORTED_LIST_INT_ARRAY | "nr_mode_supported_list_int_array" | List of supported NR modes. |
| KEY_VOLTE_PROVISIONING_SUPPORTED_BOOL | "volte_provisioning_supported_bool" | Whether to support VoLTE provisioning. |
| KEY_SS_OVER_UT_SUPPORTED_BOOL | "ss_over_ut_supported_bool" | Whether SS over UT is supported. |
| KEY_IMS_GBA_REQUIRED_BOOL | "ims_gba_required_bool" | Whether GBA is required for IMS. |
| KEY_UT_PROVISIONING_SUPPORTED_BOOL | "ut_provisioning_supported_bool" | Whether to support UT provisioning. |
| KEY_IMS_PREFER_FOR_EMERGENCY_BOOL | "ims_prefer_for_emergency_bool" | IMS preferences for emergency. |
| KEY_CALL_WAITING_SERVICE_CLASS_INT | "call_waiting_service_class_int" | Call waiting service. |
| KEY_CALL_TRANSFER_VISIBILITY_BOOL | "call_transfer_visibility_bool" | Call transfer visibility. |
| KEY_IMS_CALL_DISCONNECT_REASONINFO_MAPPING_STRING_ARRAY | "ims_call_disconnect_reasoninfo_mapping_string_array" | List of IMS call disconnection reasons.|
| KEY_FORCE_VOLTE_SWITCH_ON_BOOL | "force_volte_switch_on_bool" | Whether to forcibly turn on VoLTE. |
| KEY_ENABLE_OPERATOR_NAME_CUST_BOOL | "enable_operator_name_cust_bool" | Whether to display the carrier name.|
| KEY_OPERATOR_NAME_CUST_STRING | "operator_name_cust_string" | Carrier name. |
| KEY_SPN_DISPLAY_CONDITION_CUST_INT | "spn_display_condition_cust_int" | SPN display rule. |
| KEY_PNN_CUST_STRING_ARRAY | "pnn_cust_string_array" | PLMN name |
| KEY_OPL_CUST_STRING_ARRAY | "opl_cust_string_array" | PLMN information of the carrier. |
| KEY_EMERGENCY_CALL_STRING_ARRAY | "emergency_call_string_array" | Emergency call list. |
......@@ -870,7 +870,7 @@ promise.then(data => {
## sms.isImsSmsSupported<sup>8+</sup>
isImsSmsSupported(callback: AsyncCallback<boolean\>): void
isImsSmsSupported(slotId: number, callback: AsyncCallback<boolean\>): void
Checks whether SMS is supported on IMS. This API uses an asynchronous callback to return the result.
......@@ -882,12 +882,14 @@ Checks whether SMS is supported on IMS. This API uses an asynchronous callback t
| Name | Type | Mandatory| Description |
| -------- | ---------------------------- | ---- | ---------- |
| 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.|
**Example**
```js
sms.isImsSmsSupported((err, data) => {
let slotId = 0;
sms.isImsSmsSupported(slotId, (err, data) => {
console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
});
```
......@@ -895,7 +897,7 @@ sms.isImsSmsSupported((err, data) => {
## sms.isImsSmsSupported<sup>8+</sup>
isImsSmsSupported(): Promise<boolean\>
isImsSmsSupported(slotId: number): Promise<boolean\>
Checks whether SMS is supported on IMS. This API uses a promise to return the result.
......@@ -903,6 +905,12 @@ Checks whether SMS is supported on IMS. This API uses a promise to return the re
**System capability**: SystemCapability.Telephony.SmsMms
**Parameters**
| Name| Type | Mandatory | Description |
| ------ | ------ | ---- | -------------------------------------- |
| slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2|
**Return value**
| Type | Description |
......@@ -912,7 +920,8 @@ Checks whether SMS is supported on IMS. This API uses a promise to return the re
**Example**
```js
let promise = sms.isImsSmsSupported();
let slotId = 0;
let promise = sms.isImsSmsSupported(slotId);
promise.then(data => {
console.log(`isImsSmsSupported success, promise: data->${JSON.stringify(data)}`);
}).catch(err => {
......
......@@ -21,7 +21,7 @@ Creates a **UDPSocket** object.
**Return value**
| Type | Description |
| :--------------------------------- | :---------------------- |
| --------------------------------- | ---------------------- |
| [UDPSocket](#udpsocket) | **UDPSocket** object.|
......@@ -87,7 +87,7 @@ Binds the IP address and port number. The port number can be specified or random
**Return value**
| Type | Description |
| :-------------- | :----------------------------------------- |
| -------------- | ----------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
......@@ -164,7 +164,7 @@ Before sending data, call [UDPSocket.bind()](#bind) to bind the IP address and p
**Return value**
| Type | Description |
| :-------------- | :--------------------------------------------- |
| -------------- | --------------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
......@@ -230,7 +230,7 @@ Closes a UDPSocket connection. This API uses a promise to return the result.
**Return value**
| Type | Description |
| :-------------- | :----------------------------------------- |
| -------------- | ----------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
......@@ -252,7 +252,7 @@ getState\(callback: AsyncCallback<SocketStateBase\>\): void
Obtains the status of the UDPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [bind](#bind) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -292,7 +292,7 @@ getState\(\): Promise<SocketStateBase\>
Obtains the status of the UDPSocket connection. This API uses a promise to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [bind](#bind) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -302,7 +302,7 @@ Obtains the status of the UDPSocket connection. This API uses a promise to retur
**Return value**
| Type | Description |
| :----------------------------------------------- | :----------------------------------------- |
| ----------------------------------------------- | ----------------------------------------- |
| Promise<[SocketStateBase](#socketstatebase)> | Promise used to return the result.|
**Example**
......@@ -331,7 +331,7 @@ setExtraOptions\(options: UDPExtraOptions, callback: AsyncCallback<void\>\): voi
Sets other properties of the UDPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [bind](#bind) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -379,7 +379,7 @@ setExtraOptions\(options: UDPExtraOptions\): Promise<void\>
Sets other properties of the UDPSocket connection. This API uses a promise to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [bind](#bind) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -395,7 +395,7 @@ Sets other properties of the UDPSocket connection. This API uses a promise to re
**Return value**
| Type | Description |
| :-------------- | :--------------------------------------------------- |
| -------------- | --------------------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
......@@ -454,7 +454,7 @@ off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: So
Disables listening for message receiving events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>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.
**System capability**: SystemCapability.Communication.NetStack
......@@ -514,7 +514,7 @@ off\(type: 'listening' | 'close', callback?: Callback<void\>\): void
Disables listening for data packet message events or close events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>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.
**System capability**: SystemCapability.Communication.NetStack
......@@ -579,7 +579,7 @@ off\(type: 'error', callback?: ErrorCallback\): void
Disables listening for error events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>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.
**System capability**: SystemCapability.Communication.NetStack
......@@ -678,7 +678,7 @@ Creates a **TCPSocket** object.
**Return value**
| Type | Description |
| :--------------------------------- | :---------------------- |
| --------------------------------- | ---------------------- |
| [TCPSocket](#tcpsocket) | **TCPSocket** object.|
**Example**
......@@ -743,7 +743,7 @@ Binds the IP address and port number. The port number can be specified or random
**Return value**
| Type | Description |
| :-------------- | :------------------------------------------------------- |
| -------------- | ------------------------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
......@@ -809,7 +809,7 @@ Sets up a connection to the specified IP address and port number. This API uses
**Return value**
| Type | Description |
| :-------------- | :--------------------------------------------------------- |
| -------------- | --------------------------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
......@@ -831,7 +831,7 @@ send\(options: TCPSendOptions, callback: AsyncCallback<void\>\): void
Sends data over a TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [connect](#connect) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -873,7 +873,7 @@ send\(options: TCPSendOptions\): Promise<void\>
Sends data over a TCPSocket connection. This API uses a promise to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [connect](#connect) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -889,7 +889,7 @@ Sends data over a TCPSocket connection. This API uses a promise to return the re
**Return value**
| Type | Description |
| :-------------- | :------------------------------------------------- |
| -------------- | ------------------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
......@@ -957,7 +957,7 @@ Closes a TCPSocket connection. This API uses a promise to return the result.
**Return value**
| Type | Description |
| :-------------- | :----------------------------------------- |
| -------------- | ----------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
**Example**
......@@ -979,7 +979,7 @@ getRemoteAddress\(callback: AsyncCallback<NetAddress\>\): void
Obtains the remote address of a socket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [connect](#connect) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1018,7 +1018,7 @@ getRemoteAddress\(\): Promise<NetAddress\>
Obtains the remote address of a socket connection. This API uses a promise to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [connect](#connect) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1028,7 +1028,7 @@ Obtains the remote address of a socket connection. This API uses a promise to re
**Return value**
| Type | Description |
| :------------------------------------------ | :------------------------------------------ |
| ------------------------------------------ | ------------------------------------------ |
| Promise<[NetAddress](#netaddress)> | Promise used to return the result.|
**Example**
......@@ -1056,7 +1056,7 @@ getState\(callback: AsyncCallback<SocketStateBase\>\): void
Obtains the status of the TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [bind](#bind) or [connect](#connect) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1096,7 +1096,7 @@ getState\(\): Promise<SocketStateBase\>
Obtains the status of the TCPSocket connection. This API uses a promise to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [bind](#bind) or [connect](#connect) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1106,7 +1106,7 @@ Obtains the status of the TCPSocket connection. This API uses a promise to retur
**Return value**
| Type | Description |
| :----------------------------------------------- | :----------------------------------------- |
| ----------------------------------------------- | ----------------------------------------- |
| Promise<[SocketStateBase](#socketstatebase)> | Promise used to return the result.|
......@@ -1135,7 +1135,7 @@ setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback<void\>\): voi
Sets other properties of the TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [bind](#bind) or [connect](#connect) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1184,7 +1184,7 @@ setExtraOptions\(options: TCPExtraOptions\): Promise<void\>
Sets other properties of the TCPSocket connection. This API uses a promise to return the result.
>**NOTE**
>**NOTE**<br/>
>This API can be called only after [bind](#bind) or [connect](#connect) is successfully called.
**Required permissions**: ohos.permission.INTERNET
......@@ -1200,7 +1200,7 @@ Sets other properties of the TCPSocket connection. This API uses a promise to re
**Return value**
| Type | Description |
| :-------------- | :--------------------------------------------------- |
| -------------- | --------------------------------------------------- |
| Promise\<void\> | Promise used to return the result.|
......@@ -1263,7 +1263,7 @@ off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: So
Disables listening for message receiving events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>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.
**System capability**: SystemCapability.Communication.NetStack
......@@ -1324,7 +1324,7 @@ off\(type: 'connect' | 'close', callback?: Callback<void\>\): void
Disables listening for connection or close events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>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.
**System capability**: SystemCapability.Communication.NetStack
......@@ -1388,7 +1388,7 @@ off\(type: 'error', callback?: ErrorCallback\): void
Disables listening for error events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
>**NOTE**
>**NOTE**<br/>
>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.
**System capability**: SystemCapability.Communication.NetStack
......@@ -1464,7 +1464,7 @@ Creates a **TLSSocket** object.
**Return value**
| Type | Description |
| :--------------------------------- | :---------------------- |
| --------------------------------- | ---------------------- |
| [TLSSocket](#tlssocket9) | **TLSSocket** object.|
**Example**
......@@ -1534,7 +1534,7 @@ Binds the IP address and port number. This API uses a promise to return the resu
**Return value**
| Type | Description |
| :-------------- | :------------------------------------------------------- |
| -------------- | ------------------------------------------------------- |
| Promise\<void\> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -1608,7 +1608,7 @@ Obtains the status of the TLSSocket connection. This API uses a promise to retur
**Return value**
| Type | Description |
| :----------------------------------------------- | :----------------------------------------- |
| ----------------------------------------------- | ----------------------------------------- |
| Promise\<[SocketStateBase](#socketstatebase)> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -1705,7 +1705,7 @@ Sets other properties of the TCPSocket connection after successful binding of th
**Return value**
| Type | Description |
| :-------------- | :--------------------------------------------------- |
| -------------- | --------------------------------------------------- |
| Promise\<void\> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -1984,7 +1984,7 @@ Obtains the remote address of a TLSSocket connection. This API uses a promise to
**Return value**
| Type | Description |
| :------------------------------------------ | :------------------------------------------ |
| ------------------------------------------ | ------------------------------------------ |
| Promise\<[NetAddress](#netaddress)> | Promise used to return the result. If the operation fails, an error message is returned.|
**Error codes**
......@@ -2049,7 +2049,7 @@ Obtains the local digital certificate after a TLSSocket connection is establishe
**Return value**
| Type | Description |
| Type | Description |
| -------------- | -------------------- |
| Promise\<[X509CertRawData](#x509certrawdata9)> | Promise used to return the result. If the operation fails, an error message is returned.|
......@@ -2490,7 +2490,7 @@ Defines TLS connection options.
| -------------- | ------------------------------------- | --- |-------------- |
| address | [NetAddress](#netaddress) | Yes | Gateway address. |
| secureOptions | [TLSSecureOptions](#tlssecureoptions9) | Yes| TLS security options.|
| ALPNProtocols | Array\<string> | No| Application Layer Protocol Negotiation (ALPN) protocols. |
| ALPNProtocols | Array\<string> | Yes| Application Layer Protocol Negotiation (ALPN) protocols. |
## TLSSecureOptions<sup>9+</sup>
......
......@@ -265,6 +265,7 @@
- [Development of Distributed Call Chain Tracing](dfx/hitracechain-guidelines.md)
- Error Management
- [Development of Error Manager](dfx/errormanager-guidelines.md)
- [Development of Application Recovery](apprecovery-guidelines.md)
- Internationalization
- [Internationalization Overview](internationalization/international-overview.md)
- [Internationalization Development (intl)](internationalization/intl-guidelines.md)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册