| options | [DialCallOptions](#dialcalloptions9)| No | Call options, which carry other configuration information of the call.|
| options | [DialCallOptions](#dialcalloptions9)| No | Call options, which carry other configuration information of the call.<br>If this parameter is not set, the following configuration is used by default. For details, see [DialCallOptions](#dialcalloptions9).<br>- **accountId**: 0 (card slot 1)<br>- **videoState**: voice call<br>- **dialScene**: common call<br>- **dialType**: carrier call |
**Return value**
**Return value**
...
@@ -134,6 +136,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -134,6 +136,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.<br>If this parameter is not set, the latest ringing call will be connected.|
**Return value**
**Return value**
...
@@ -935,6 +941,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -935,6 +941,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.<br>If this parameter is not set, the latest ongoing, dialed, or connected call will be ended.|
**Return value**
**Return value**
...
@@ -1064,6 +1073,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -1064,6 +1073,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.|
| callId | number | No | Call ID. You can obtain the value by subscribing to **callDetailsChange** events. This parameter is optional from API version 9.<br>If this parameter is not set, the latest ringing call will be rejected.|
| options | [RejectMessageOptions](#rejectmessageoptions7) | No | Options for the call rejection message. |
| options | [RejectMessageOptions](#rejectmessageoptions7) | No | Options for the call rejection message. If this parameter is not set, no call rejection message will be sent.|
**Return value**
**Return value**
...
@@ -1241,6 +1254,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -1241,6 +1254,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| type | string | Yes | Call details change. This field has a fixed value of **callDetailsChange**.|
| type | string | Yes | Call details change. This field has a fixed value of **callDetailsChange**.|
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. |
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received.|
**Error codes**
**Error codes**
...
@@ -2554,6 +2581,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -2554,6 +2581,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| type | string | Yes | Call event change. This field has a fixed value of **callEventChange**.|
| type | string | Yes | Call event change. This field has a fixed value of **callEventChange**.|
| callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. |
| callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received.|
**Error codes**
**Error codes**
...
@@ -2594,6 +2622,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -2594,6 +2622,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| type | string | Yes | Call disconnection cause. This field has a fixed value of **callDisconnectedCause**.|
| type | string | Yes | Call disconnection cause. This field has a fixed value of **callDisconnectedCause**.|
| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. |
| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received.|
**Error codes**
**Error codes**
...
@@ -2634,6 +2663,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -2634,6 +2663,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| type | string | Yes | MMI code result. This field has a fixed value of **mmiCodeResult**.|
| type | string | Yes | MMI code result. This field has a fixed value of **mmiCodeResult**.|
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. |
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. If this parameter is not set, no subscription cancellation result will be received.|
**Error codes**
**Error codes**
...
@@ -2674,6 +2704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -2674,6 +2704,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
The **inputDeviceCooperate** module enables two or more networked devices to share the keyboard and mouse for collaborative operations.
The **inputDeviceCooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
> **NOTE**
> **NOTE**
>
>
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs provided by this module are system APIs.
>
> - The APIs provided by this module are system APIs.
## Modules to Import
## Modules to Import
...
@@ -66,7 +66,7 @@ Specifies whether to enable screen hopping. This API uses a promise to return th
...
@@ -66,7 +66,7 @@ Specifies whether to enable screen hopping. This API uses a promise to return th
The **cooperate** module implements screen hopping for two or more networked devices to share the keyboard and mouse for collaborative operations.
> **NOTE**
>
> - The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> - The APIs provided by this module are system APIs.
| type | string | Yes | Event type. The value is **cooperate**.|
| callback | AsyncCallback<void> | No | Callback to be unregistered. If this parameter is not specified, all callbacks registered by the current application will be unregistered.|
connectTimeout:60000// Optional. The default value is 60000, in ms.
connectTimeout:60000// Optional. The default value is 60000, in ms.
readTimeout:60000,// Optional. The default value is 60000, in ms.
readTimeout:60000,// Optional. The default value is 60000, in ms.
usingProtocol:http.HttpProtocol.HTTP1_1,// Optional. The default protocol type is automatically specified by the system.
usingProtocol:http.HttpProtocol.HTTP1_1,// Optional. The default protocol type is automatically specified by the system.
usingProxy:false,// Optional. By default, network proxy is not used. This field is supported since API 10.
usingProxy:false,// Optional. By default, network proxy is not used. This field is supported since API version 10.
caPath:"",// Optional. The preset CA certificate is used by default. This field is supported since API version 10.
},(err,data)=>{
},(err,data)=>{
if(!err){
if(!err){
// data.result carries the HTTP response. Parse the response based on service requirements.
// data.result carries the HTTP response. Parse the response based on service requirements.
...
@@ -68,7 +69,7 @@ httpRequest.request(
...
@@ -68,7 +69,7 @@ httpRequest.request(
> **NOTE**
> **NOTE**
> If the data in **console.info()** contains a newline character, the data will be truncated.
> If the data in **console.info()** contains a newline character, the data will be truncated.
## http.createHttp
## http.createHttp<sup>6+</sup>
createHttp(): HttpRequest
createHttp(): HttpRequest
...
@@ -94,7 +95,7 @@ let httpRequest = http.createHttp();
...
@@ -94,7 +95,7 @@ let httpRequest = http.createHttp();
Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object.
Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object.
Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
on(type: 'dataProgress', callback: AsyncCallback\<{ receiveSize: number, totalSize: number }\>): void
on(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>): void
Registers an observer for events indicating progress of receiving HTTP streaming responses.
Registers an observer for events indicating progress of receiving HTTP streaming responses.
...
@@ -802,7 +851,7 @@ Unregisters the observer for events indicating progress of receiving HTTP stream
...
@@ -802,7 +851,7 @@ Unregisters the observer for events indicating progress of receiving HTTP stream
httpRequest.off('dataProgress');
httpRequest.off('dataProgress');
```
```
## HttpRequestOptions
## HttpRequestOptions<sup>6+</sup>
Specifies the type and value range of the optional parameters in the HTTP request.
Specifies the type and value range of the optional parameters in the HTTP request.
...
@@ -819,9 +868,10 @@ Specifies the type and value range of the optional parameters in the HTTP reques
...
@@ -819,9 +868,10 @@ Specifies the type and value range of the optional parameters in the HTTP reques
| readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms.<br>The value **0** indicates no timeout.|
| readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms.<br>The value **0** indicates no timeout.|
| connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. |
| connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. |
| usingProtocol<sup>9+</sup> | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. |
| usingProtocol<sup>9+</sup> | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. |
| usingProxy<sup>10+</sup> | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.<br>- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.<br>- If **usingProxy** is of the **object** type, the specified network proxy is used. |
| usingProxy<sup>10+</sup> | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.<br>- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.<br>- If **usingProxy** is of the **object** type, the specified network proxy is used.
| caPath<sup>10+</sup> | string | No | Path of the CA certificate. If this parameter is set, the system uses the CA certificate in the specified path. Otherwise, the system uses the preset CA certificate. |
## RequestMethod
## RequestMethod<sup>6+</sup>
Defines an HTTP request method.
Defines an HTTP request method.
...
@@ -838,7 +888,7 @@ Defines an HTTP request method.
...
@@ -838,7 +888,7 @@ Defines an HTTP request method.
| TRACE | "TRACE" | TRACE method. |
| TRACE | "TRACE" | TRACE method. |
| CONNECT | "CONNECT" | CONNECT method.|
| CONNECT | "CONNECT" | CONNECT method.|
## ResponseCode
## ResponseCode<sup>6+</sup>
Enumerates the response codes for an HTTP request.
Enumerates the response codes for an HTTP request.
...
@@ -882,7 +932,7 @@ Enumerates the response codes for an HTTP request.
...
@@ -882,7 +932,7 @@ Enumerates the response codes for an HTTP request.
| GATEWAY_TIMEOUT | 504 | "Gateway Timeout." The server acting as a gateway or proxy does not receive requests from the remote server within the timeout period. |
| GATEWAY_TIMEOUT | 504 | "Gateway Timeout." The server acting as a gateway or proxy does not receive requests from the remote server within the timeout period. |
| VERSION | 505 | "HTTP Version Not Supported." The server does not support the HTTP protocol version used in the request. |
| VERSION | 505 | "HTTP Version Not Supported." The server does not support the HTTP protocol version used in the request. |
@@ -1174,7 +1178,7 @@ Represents the network connection handle.
...
@@ -1174,7 +1178,7 @@ Represents the network connection handle.
> When a device changes to the network disconnected state, the **netLost** event will be triggered.
> When a device changes to the network disconnected state, the **netLost** event will be triggered.
> When a device switches from a Wi-Fi network to a cellular network, the **netLost** event will be first triggered to indicate that the Wi-Fi network is lost and then the **netAvaliable** event will be triggered to indicate that the cellular network is available.
> When a device switches from a Wi-Fi network to a cellular network, the **netLost** event will be first triggered to indicate that the Wi-Fi network is lost and then the **netAvaliable** event will be triggered to indicate that the cellular network is available.
### register
### register<sup>8+</sup>
register(callback: AsyncCallback\<void>): void
register(callback: AsyncCallback\<void>): void
...
@@ -1195,9 +1199,10 @@ Registers a listener for network status changes.
...
@@ -1195,9 +1199,10 @@ Registers a listener for network status changes.
| ID| Error Message |
| ID| Error Message |
| ------- | ----------------------------- |
| ------- | ----------------------------- |
| 201 | Permission denied. |
| 201 | Permission denied. |
| 401 | Parameter error. |
| 2100002 | Operation failed. Cannot connect to service.|
| 2100002 | Operation failed. Cannot connect to service.|
| 2100003 | System internal error. |
| 2100003 | System internal error. |
| 2101008 | The callback is not exists. |
| 2101008 | The same callback exists. |
| 2101022 | The number of requests exceeded the maximum. |
| 2101022 | The number of requests exceeded the maximum. |
@@ -1818,7 +1825,7 @@ Defines the network capability.
...
@@ -1818,7 +1825,7 @@ Defines the network capability.
| NET_CAPABILITY_NOT_VPN | 15 | The network does not use a virtual private network (VPN).|
| NET_CAPABILITY_NOT_VPN | 15 | The network does not use a virtual private network (VPN).|
| NET_CAPABILITY_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.|
| NET_CAPABILITY_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.|
## NetBearType
## NetBearType<sup>8+</sup>
Enumerates network types.
Enumerates network types.
...
@@ -1842,7 +1849,7 @@ Defines the global HTTP proxy configuration of the network.
...
@@ -1842,7 +1849,7 @@ Defines the global HTTP proxy configuration of the network.
| port | number | No | Host port.|
| port | number | No | Host port.|
| exclusionList | Array<string> | No | Exclusion list of hosts that do not use the proxy server. The length of the combined elements in the list cannot exceed 96 bytes.<br>For example, the length of **baidu.com,zhihu.com** is 20 bytes.|
| exclusionList | Array<string> | No | Exclusion list of hosts that do not use the proxy server. The length of the combined elements in the list cannot exceed 96 bytes.<br>For example, the length of **baidu.com,zhihu.com** is 20 bytes.|
## NetSpecifier
## NetSpecifier<sup>8+</sup>
Provides an instance that bears data network capabilities.
Provides an instance that bears data network capabilities.
...
@@ -1853,7 +1860,7 @@ Provides an instance that bears data network capabilities.
...
@@ -1853,7 +1860,7 @@ Provides an instance that bears data network capabilities.
| netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. |
| 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).|
| 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
## NetCapabilities<sup>8+</sup>
Defines the network capability set.
Defines the network capability set.
...
@@ -1866,7 +1873,7 @@ Defines the network capability set.
...
@@ -1866,7 +1873,7 @@ Defines the network capability set.
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| callback | Callback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| callback | AsyncCallback\<{ iface: string, active: boolean }\> | Yes | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| type | string | Yes | Event type. The value is **interfaceStateChange**.|
| callback | Callback\<{ iface: string, active: boolean }> | No | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| callback | AsyncCallback\<{ iface: string, active: boolean }> | No | Callback used to return the result.<br>**iface**: NIC name.<br>**active**: whether the NIC is active. The value **true** indicates that the NIC is active, and the value **false** indicates the opposite.|
| 202 | Non-system applications use system APIs. |
| 202 | Applicable only to system applications. |
| 401 | Parameter error. |
**Example**
**Example**
...
@@ -454,7 +460,7 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
...
@@ -454,7 +460,7 @@ Unregisters the observer for NIC hot swap events. This API uses an asynchronous
ethernet.off('interfaceStateChange');
ethernet.off('interfaceStateChange');
```
```
## InterfaceConfiguration
## InterfaceConfiguration<sup>9+</sup>
Defines the network configuration for the Ethernet connection.
Defines the network configuration for the Ethernet connection.
...
@@ -471,7 +477,7 @@ Defines the network configuration for the Ethernet connection.
...
@@ -471,7 +477,7 @@ Defines the network configuration for the Ethernet connection.
| netMask | string | Yes| Subnet mask 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 DHCP mode.|
| netMask | string | Yes| Subnet mask 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 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 (,).|
| 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
## IPSetMode<sup>9+</sup>
Defines the configuration mode of the Ethernet connection.
Defines the configuration mode of the Ethernet connection.
@@ -811,7 +811,7 @@ Defines the mDNS service information.
...
@@ -811,7 +811,7 @@ Defines the mDNS service information.
| host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. |
| host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. |
Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result.
Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result.
...
@@ -54,7 +54,7 @@ observer.on('networkStateChange', data => {
...
@@ -54,7 +54,7 @@ observer.on('networkStateChange', data => {
## observer.on('networkStateChange')
## observer.on('networkStateChange')
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback<NetworkState\>\): void;
on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callback\<NetworkState\>\): void;
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
Registers an observer for network status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...
@@ -94,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data => {
...
@@ -94,7 +94,7 @@ observer.on('networkStateChange', {slotId: 0}, data => {
Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result.
Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result.
...
@@ -111,6 +111,10 @@ Unregisters the observer for network status change events. This API uses an asyn
...
@@ -111,6 +111,10 @@ Unregisters the observer for network status change events. This API uses an asyn
| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. |
| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. |
| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).|
| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).|
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
**Error codes**
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
...
@@ -170,7 +173,7 @@ observer.on('signalInfoChange', data => {
...
@@ -170,7 +173,7 @@ observer.on('signalInfoChange', data => {
## observer.on('signalInfoChange')
## observer.on('signalInfoChange')
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback<Array<SignalInformation\>\>): void;
on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback\<Array\<SignalInformation\>\>): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...
@@ -182,7 +185,7 @@ Registers an observer for signal status change events of the SIM card in the spe
...
@@ -182,7 +185,7 @@ Registers an observer for signal status change events of the SIM card in the spe
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
**Error codes**
**Error codes**
...
@@ -190,7 +193,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -190,7 +193,6 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. |
| callback | Callback<Array<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| callback | Callback\<Array\<[SignalInformation](js-apis-radio.md#signalinformation)\>\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).|
| 202 | Non-system applications use system APIs. |
| 401 | Parameter error. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300002 | Operation failed. Cannot connect to service. |
...
@@ -290,7 +295,7 @@ observer.on('cellInfoChange', data => {
...
@@ -290,7 +295,7 @@ observer.on('cellInfoChange', data => {
## observer.on('cellInfoChange')<sup>8+</sup>
## observer.on('cellInfoChange')<sup>8+</sup>
on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback<CellInformation\>\): void;
on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback\<Array\<CellInformation\>\>\): void;
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
Registers an observer for signal status change events of the SIM card in the specified slot. This API uses an asynchronous callback to return the execution result.
...
@@ -302,17 +307,20 @@ Registers an observer for signal status change events of the SIM card in the spe
...
@@ -302,17 +307,20 @@ Registers an observer for signal status change events of the SIM card in the spe
Obtains the ISO country code of the network with which the SIM card in the specified slot is registered. This API 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 API uses an asynchronous callback 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 API uses an asynchronous callback 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 API uses an asynchronous callback 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 API 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 API uses a promise to return the result.
Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...
@@ -2392,6 +2425,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -2392,6 +2425,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses a promise to return the result.
Obtains the IMS registration status of the specified IMS service type for the SIM card in the specified slot. This API uses a promise to return the result.
...
@@ -2438,6 +2472,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -2438,6 +2472,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
| callback | Callback<[ImsRegInfo](#imsreginfo9)> | No | Callback used to return the result. |
| callback | Callback<[ImsRegInfo](#imsreginfo9)> | No | Callback used to return the result. If this parameter is not set, the API unsubscribes from all callbacks.|
**Error codes**
**Error codes**
...
@@ -2525,6 +2561,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -2525,6 +2561,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
The Resource Manager module provides APIs to obtain information about application resources based on the current configuration, including the language, region, screen direction, MCC/MNC, as well as device capability and density.
The **resourceManager** module provides APIs to obtain information about application resources based on the current configuration, including the language, region, screen direction, MCC/MNC, as well as device capability and density.
> **NOTE**
> **NOTE**
>
>
...
@@ -13,7 +13,7 @@ The Resource Manager module provides APIs to obtain information about applicatio
...
@@ -13,7 +13,7 @@ The Resource Manager module provides APIs to obtain information about applicatio
importresourceManagerfrom'@ohos.resourceManager';
importresourceManagerfrom'@ohos.resourceManager';
```
```
## Instruction
## How to Use
Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model. For the FA model, you need to import the required bundle and then call the [getResourceManager](#resourcemanagergetresourcemanager) API to obtain a **ResourceManager** object.
Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model. For the FA model, you need to import the required bundle and then call the [getResourceManager](#resourcemanagergetresourcemanager) API to obtain a **ResourceManager** object.
For details about how to reference context in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md).
For details about how to reference context in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md).
...
@@ -171,12 +171,12 @@ Enumerates the device types.
...
@@ -171,12 +171,12 @@ Enumerates the device types.
| Name | Value | Description |
| Name | Value | Description |
| -------------------- | ---- | ---- |
| -------------------- | ---- | ---- |
| DEVICE_TYPE_PHONE | 0x00 | Phone |
| DEVICE_TYPE_PHONE | 0x00 | Phone. |
| DEVICE_TYPE_TABLET | 0x01 | Tablet |
| DEVICE_TYPE_TABLET | 0x01 | Tablet. |
| DEVICE_TYPE_CAR | 0x02 | Head unit |
| DEVICE_TYPE_CAR | 0x02 | Head unit. |
| DEVICE_TYPE_PC | 0x03 | PC |
| DEVICE_TYPE_PC | 0x03 | PC. |
| DEVICE_TYPE_TV | 0x04 | TV |
| DEVICE_TYPE_TV | 0x04 | TV. |
| DEVICE_TYPE_WEARABLE | 0x06 | Wearable |
| DEVICE_TYPE_WEARABLE | 0x06 | Wearable. |
## ScreenDensity
## ScreenDensity
...
@@ -253,7 +253,7 @@ Defines the descriptor of the raw file.
...
@@ -253,7 +253,7 @@ Defines the descriptor of the raw file.
| Name | Type | Readable | Writable | Description |
| Name | Type | Readable | Writable | Description |
| fd | number | Yes | No| Descriptor of the raw file.|
| fd | number | Yes | No| File descriptor of the HAP where the raw file is located.|
| offset | number | Yes | No| Start offset of the raw file. |
| offset | number | Yes | No| Start offset of the raw file. |
| length | number | Yes | No| Length of the raw file. |
| length | number | Yes | No| Length of the raw file. |
...
@@ -278,7 +278,7 @@ Defines the capability of accessing application resources.
...
@@ -278,7 +278,7 @@ Defines the capability of accessing application resources.
> **NOTE**
> **NOTE**
>
>
> - The APIs involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm.
> - The methods involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm.
>
>
> - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**.
> - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**.
...
@@ -343,10 +343,10 @@ Obtains the string corresponding to the specified resource ID. This API uses a p
...
@@ -343,10 +343,10 @@ Obtains the string corresponding to the specified resource ID. This API uses a p
| --------------------- | ----------- |
| --------------------- | ----------- |
| Promise<string> | Promise used to return the result.|
| Promise<string> | Promise used to return the result.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes**
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
Obtains the content of the media file with the screen density corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
Obtains the content of the media file with the screen density corresponding to the specified resource ID. This API uses a promise to return the result.
Obtains the content of the media file with the screen density corresponding to the specified resource object. This API uses an asynchronous callback to return the result.
Obtains the content of the media file with the screen density corresponding to the specified resource object. This API uses a promise to return the result.
Obtains the Base64 code of an image with the screen density corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
Obtains the Base64 code of an image with the screen density corresponding to the specified resource object. This API uses an asynchronous callback to return the result.
Obtains the Base64 code of an image with the screen density corresponding to the specified resource object. This API uses a promise to return the result.
Obtains the content of the media file with the screen density corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
Obtains the content of the media file with the screen density corresponding to the specified resource name. This API uses a promise to return the result.
Obtains the Base64 code of an image with the screen density corresponding to the specified resource name. This API uses an asynchronous callback to return the result.
Obtains the Base64 code of an image with the screen density corresponding to the specified resource name. This API uses a promise to return the result.
@@ -2407,12 +2996,12 @@ Obtains the integer or float value corresponding to the specified resource ID. T
...
@@ -2407,12 +2996,12 @@ Obtains the integer or float value corresponding to the specified resource ID. T
| Type | Description |
| Type | Description |
| ------ | ---------- |
| ------ | ---------- |
| number | Integer or float value corresponding to the specified resource ID. Wherein, the integer value is the original value, and the float value is the actual pixel value.|
| number | Integer or float value corresponding to the specified resource ID. Wherein, the integer value is the original value, and the float value is the actual pixel value. For details, see the sample code.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes**
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
@@ -2452,12 +3041,12 @@ Obtains the integer or float value corresponding to the specified resource objec
...
@@ -2452,12 +3041,12 @@ Obtains the integer or float value corresponding to the specified resource objec
| Type | Description |
| Type | Description |
| ------ | --------------- |
| ------ | --------------- |
| number | Integer or float value corresponding to the specified resource object. Wherein, the integer value is the original value, and the float value is the actual pixel value.|
| number | Integer or float value corresponding to the specified resource object. Wherein, the integer value is the original value, and the float value is the actual pixel value. For details, see the sample code.|
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
**Error codes**
**Error codes**
For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md).
Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses a promise to return the result.
Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses a promise to return the result.
This API is deprecated since API version 9. You are advised to use [getPluralStringValue](#getpluralstringvalue9).
This API is deprecated since API version 9. You are advised to use [getPluralStringValue](#getpluralstringvalue9) instead.
Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses an asynchronous callback to return the result.
Obtains the singular-plural string corresponding to the specified resource ID based on the specified number. This API uses an asynchronous callback to return the result.
This API is deprecated since API version 9. You are advised to use [getPluralStringValue](#getpluralstringvalue9-1).
This API is deprecated since API version 9. You are advised to use [getPluralStringValue](#getpluralstringvalue9-1) instead.
The **runningLock** module provides APIs for creating, querying, holding, and releasing running locks.
The **runningLock** module provides APIs for creating, querying, holding, and releasing running locks.
> **NOTE**<br>
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
## Modules to Import
...
@@ -15,7 +16,7 @@ import runningLock from '@ohos.runningLock';
...
@@ -15,7 +16,7 @@ import runningLock from '@ohos.runningLock';
isSupported(type: RunningLockType): boolean;
isSupported(type: RunningLockType): boolean;
Checks whether a specified type of **RunningLock** is supported.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead.
Checks whether a specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses an asynchronous callback to return the result.
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object. |
| type | [RunningLockType](#runninglocktype) | Yes | Type of the **RunningLock** object. |
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the query result obtained, where the value **true** indicates that **RunningLock** is supported and **false** indicates the opposite. Otherwise, **err** is an error object.|
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the query result obtained, where the value **true** indicates that the specified type of **RunningLock** is supported and **false** indicates the opposite. Otherwise, **err** is an error object.|
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9).
> This API is deprecated since API version 9. You are advised to use [runningLock.isSupported](#runninglockissupported9) instead.
Checks whether a specified type of **RunningLock** is supported. This API uses a promise to return the result.
Checks whether the specified type of **RunningLock** is supported. This API uses an asynchronous callback to return the result. This API uses a promise to return the result.
| boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.|
| boolean | The value **true** indicates that the **Runninglock** object is held; and the value **false** indicates that the **Runninglock** object is released.|
The SIM management module provides basic SIM card management functions. You can obtain the name, number, ISO country code, home PLMN number, service provider name, SIM card status, type, installation status, activation status, and lock status of the SIM card in the specified slot. Besides, you can set the name, number, and lock status of the SIM card, activate or deactivate the SIM card, and change the PIN or unlock the PIN or PUK of the SIM card.
The **sim** module provides basic SIM card management functions. You can obtain the name, number, ISO country code, home PLMN number, service provider name, SIM card status, type, installation status, activation status, and lock status of the SIM card in the specified slot. Besides, you can set the name, number, and lock status of the SIM card, activate or deactivate the SIM card, and change the PIN or unlock the PIN or PUK of the SIM card.
>**NOTE**
>**NOTE**
>
>
...
@@ -15,7 +15,7 @@ import sim from '@ohos.telephony.sim';
...
@@ -15,7 +15,7 @@ import sim from '@ohos.telephony.sim';
Obtains the international mobile subscriber identity (IMSI) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
Obtains the international mobile subscriber identity (IMSI) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
...
@@ -2893,6 +2934,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
...
@@ -2893,6 +2934,7 @@ For details about the following error codes, see [Telephony Error Codes](../../r
@@ -12,7 +12,7 @@ The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSoc
...
@@ -12,7 +12,7 @@ The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSoc
importsocketfrom'@ohos.net.socket';
importsocketfrom'@ohos.net.socket';
```
```
## socket.constructUDPSocketInstance
## socket.constructUDPSocketInstance<sup>7+</sup>
constructUDPSocketInstance(): UDPSocket
constructUDPSocketInstance(): UDPSocket
...
@@ -32,19 +32,16 @@ Creates a **UDPSocket** object.
...
@@ -32,19 +32,16 @@ Creates a **UDPSocket** object.
letudp=socket.constructUDPSocketInstance();
letudp=socket.constructUDPSocketInstance();
```
```
## UDPSocket
## UDPSocket<sup>7+</sup>
Defines a **UDPSocket** connection. Before invoking UDPSocket APIs, you need to call [socket.constructUDPSocketInstance](#socketconstructudpsocketinstance) to create a **UDPSocket** object.
Defines a **UDPSocket** connection. Before invoking UDPSocket APIs, you need to call [socket.constructUDPSocketInstance](#socketconstructudpsocketinstance) to create a **UDPSocket** object.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result.
> **NOTE**
> This API is used for the client to create a socket.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result.
> **NOTE**
> This API is used for the client to create a socket.
@@ -667,7 +661,7 @@ Defines the destination address.
...
@@ -667,7 +661,7 @@ Defines the destination address.
| port | number | No | Port number. The value ranges from **0** to **65535**. If this parameter is not specified, the system randomly allocates a port. |
| port | number | No | Port number. The value ranges from **0** to **65535**. If this parameter is not specified, the system randomly allocates a port. |
| family | number | No | Network protocol type.<br>- **1**: IPv4<br>- **2**: IPv6<br>The default value is **1**.|
| family | number | No | Network protocol type.<br>- **1**: IPv4<br>- **2**: IPv6<br>The default value is **1**.|
## UDPSendOptions
## UDPSendOptions<sup>7+</sup>
Defines the parameters for sending data over the UDPSocket connection.
Defines the parameters for sending data over the UDPSocket connection.
...
@@ -678,7 +672,7 @@ Defines the parameters for sending data over the UDPSocket connection.
...
@@ -678,7 +672,7 @@ Defines the parameters for sending data over the UDPSocket connection.
| data | string \| ArrayBuffer<sup>7+</sup> | Yes | Data to send. |
| data | string \| ArrayBuffer<sup>7+</sup> | Yes | Data to send. |
Defines other properties of the UDPSocket connection.
Defines other properties of the UDPSocket connection.
...
@@ -692,7 +686,7 @@ Defines other properties of the UDPSocket connection.
...
@@ -692,7 +686,7 @@ Defines other properties of the UDPSocket connection.
| reuseAddress | boolean | No | Whether to reuse addresses. The default value is **false**. |
| reuseAddress | boolean | No | Whether to reuse addresses. The default value is **false**. |
| socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms.|
| socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms.|
## SocketStateBase
## SocketStateBase<sup>7+</sup>
Defines the status of the socket connection.
Defines the status of the socket connection.
...
@@ -704,7 +698,7 @@ Defines the status of the socket connection.
...
@@ -704,7 +698,7 @@ Defines the status of the socket connection.
| isClose | boolean | Yes | Whether the connection is in the closed state.|
| isClose | boolean | Yes | Whether the connection is in the closed state.|
| isConnected | boolean | Yes | Whether the connection is in the connected state.|
| isConnected | boolean | Yes | Whether the connection is in the connected state.|
## SocketRemoteInfo
## SocketRemoteInfo<sup>7+</sup>
Defines information about the socket connection.
Defines information about the socket connection.
...
@@ -723,7 +717,7 @@ The UDP error code mapping is in the format of 2301000 + Linux kernel error code
...
@@ -723,7 +717,7 @@ The UDP error code mapping is in the format of 2301000 + Linux kernel error code
For details about error codes, see [Socket Error Codes](../errorcodes/errorcode-net-socket.md).
For details about error codes, see [Socket Error Codes](../errorcodes/errorcode-net-socket.md).
## socket.constructTCPSocketInstance
## socket.constructTCPSocketInstance<sup>7+</sup>
constructTCPSocketInstance(): TCPSocket
constructTCPSocketInstance(): TCPSocket
...
@@ -743,19 +737,16 @@ Creates a **TCPSocket** object.
...
@@ -743,19 +737,16 @@ Creates a **TCPSocket** object.
lettcp=socket.constructTCPSocketInstance();
lettcp=socket.constructTCPSocketInstance();
```
```
## TCPSocket
## TCPSocket<sup>7+</sup>
Defines a TCPSocket connection. Before invoking TCPSocket APIs, you need to call [socket.constructTCPSocketInstance](#socketconstructtcpsocketinstance) to create a **TCPSocket** object.
Defines a TCPSocket connection. Before invoking TCPSocket APIs, you need to call [socket.constructTCPSocketInstance](#socketconstructtcpsocketinstance) to create a **TCPSocket** object.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result.
> **NOTE**
> This API is used for the client to create a socket.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result.
> **NOTE**
> This API is used for the client to create a socket.
| address | [NetAddress](#netaddress) | Yes | Bound IP address and port number. |
| address | [NetAddress](#netaddress) | Yes | Bound IP address and port number. |
| timeout | number | No | Timeout duration of the TCPSocket connection, in ms.|
| timeout | number | No | Timeout duration of the TCPSocket connection, in ms.|
## TCPSendOptions
## TCPSendOptions<sup>7+</sup>
Defines the parameters for sending data over the TCPSocket connection.
Defines the parameters for sending data over the TCPSocket connection.
...
@@ -1569,7 +1557,7 @@ Defines the parameters for sending data over the TCPSocket connection.
...
@@ -1569,7 +1557,7 @@ Defines the parameters for sending data over the TCPSocket connection.
| data | string\| ArrayBuffer<sup>7+</sup> | Yes | Data to send. |
| data | string\| ArrayBuffer<sup>7+</sup> | Yes | Data to send. |
| encoding | string | No | Character encoding format. The options are as follows: **UTF-8**, **UTF-16BE**, **UTF-16LE**, **UTF-16**, **US-AECII**, and **ISO-8859-1**. The default value is **UTF-8**.|
| encoding | string | No | Character encoding format. The options are as follows: **UTF-8**, **UTF-16BE**, **UTF-16LE**, **UTF-16**, **US-AECII**, and **ISO-8859-1**. The default value is **UTF-8**.|
## TCPExtraOptions
## TCPExtraOptions<sup>7+</sup>
Defines other properties of the TCPSocket connection.
Defines other properties of the TCPSocket connection.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks.
@@ -16,7 +16,48 @@ import fetch from '@system.fetch';
...
@@ -16,7 +16,48 @@ import fetch from '@system.fetch';
## fetch.fetch<sup>3+</sup>
## fetch.fetch<sup>3+</sup>
fetch(Object): void
fetch(options:{
/**
* Resource URL.
* @since 3
*/
url: string;
/**
* Request parameter, which can be of the string type or a JSON object.
* @since 3
*/
data?: string | object;
/**
* Request header, which accommodates all attributes of the request.
* @since 3
*/
header?: Object;
/**
* Request methods available: OPTIONS, GET, HEAD, POST, PUT, DELETE and TRACE. The default value is GET.
* @since 3
*/
method?: string;
/**
* The return type can be text, or JSON. By default, the return type is determined based on Content-Type in the header returned by the server.
* @since 3
*/
responseType?: string;
/**
* Called when the network data is obtained successfully.
* @since 3
*/
success?: (data: FetchResponse) => void;
/**
* Called when the network data fails to be obtained.
* @since 3
*/
fail?: (data: any, code: number) => void;
/**
* Called when the execution is completed.
* @since 3
*/
complete?: () => void;
} ): void
Obtains data through a network.
Obtains data through a network.
...
@@ -43,7 +84,9 @@ Obtains data through a network.
...
@@ -43,7 +84,9 @@ Obtains data through a network.
| Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.|
| Object | Not set| The default value of **Content-Type** is **application/x-www-form-urlencoded**. The **data** value is encoded based on the URL rule and appended in the request body.|
| Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.|
| Object | application/x-www-form-urlencoded | The value of data is encoded based on the URL rule and is used as the request body.|
The **data** module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled.
The cellular data module provides basic mobile data management functions. You can obtain and set the default slot of the SIM card used for mobile data, and obtain the uplink and downlink connection status of cellular data services and connection status of the packet switched (PS) domain. Besides, you can check whether cellular data services and data roaming are enabled.
>**NOTE**
>**NOTE**
>
>
...
@@ -24,7 +24,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses an
...
@@ -24,7 +24,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses an
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
| callback | AsyncCallback\<boolean\> | Yes | Callback used to return the result.<br>**true**: Roaming is enabled for the cellular data service.<br>**false**: Roaming is disabled for the cellular data service.|
**Error codes**
**Error codes**
...
@@ -394,7 +394,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses a
...
@@ -394,7 +394,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses a
The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
The **thermal** module provides thermal level-related callback and query APIs to obtain the information required for thermal control.
> **NOTE**<br>
> **NOTE**
>
> 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.
## Modules to Import
## Modules to Import
...
@@ -29,9 +30,9 @@ Subscribes to thermal level changes.
...
@@ -29,9 +30,9 @@ Subscribes to thermal level changes.
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
**Example**
**Example**
...
@@ -58,15 +59,15 @@ Unsubscribes from thermal level changes.
...
@@ -58,15 +59,15 @@ Unsubscribes from thermal level changes.
| callback | Callback<void> | No | Callback used to return the result. No value is returned. If this parameter is not set, this API unsubscribes from all callbacks.|
| callback | Callback<void> | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.|
**Error codes**
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
**Example**
**Example**
...
@@ -93,15 +94,15 @@ Obtains the current thermal level.
...
@@ -93,15 +94,15 @@ Obtains the current thermal level.
| Type | Description |
| Type | Description |
| ------------ | ------------ |
| ------------ | ------------ |
| ThermalLevel | Thermal level obtained.|
| ThermalLevel | Thermal level.|
**Error codes**
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-thermal.md).
| Code | Error Message |
| ID | Error Message |
|---------|---------|
|---------|---------|
| 4800101 | Operation failed. Cannot connect to service.|
| 4800101 | If connecting to the service failed. |
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9).
> This API is deprecated since API version 9. You are advised to use [thermal.registerThermalLevelCallback](#thermalregisterthermallevelcallback9) instead.
> **NOTE**<br>This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9).
> This API is deprecated since API version 9. You are advised to use [thermal.unregisterThermalLevelCallback](#thermalunregisterthermallevelcallback9) instead.
Unsubscribes from thermal level changes.
Unsubscribes from thermal level changes.
...
@@ -154,7 +153,7 @@ Unsubscribes from thermal level changes.
...
@@ -154,7 +153,7 @@ Unsubscribes from thermal level changes.
| callback | AsyncCallback<void> | No | Callback used to return the result. No value is returned. If this parameter is not set, this API unsubscribes from all callbacks.|
| callback | AsyncCallback<void> | No | Callback that returns no value. If this parameter is not set, this API unsubscribes from all callbacks.|
@@ -87,11 +87,11 @@ Creates a WebSocket connection. You can use this API to create or close a WebSoc
...
@@ -87,11 +87,11 @@ Creates a WebSocket connection. You can use this API to create or close a WebSoc
letws=webSocket.createWebSocket();
letws=webSocket.createWebSocket();
```
```
## WebSocket
## WebSocket<sup>6+</sup>
Defines a **WebSocket** object. Before invoking WebSocket APIs, you need to call [webSocket.createWebSocket](#websocketcreatewebsocket) to create a **WebSocket** object.
Defines a **WebSocket** object. Before invoking WebSocket APIs, you need to call [webSocket.createWebSocket](#websocketcreatewebsocket) to create a **WebSocket** object.