@@ -53,7 +53,7 @@ Defines a reverse geocoding request.
...
@@ -53,7 +53,7 @@ Defines a reverse geocoding request.
| locale | string | Yes| Yes| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.|
| locale | string | Yes| Yes| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.|
| latitude | number | Yes| Yes| Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude. The value ranges from **-90** to **90**.|
| latitude | number | Yes| Yes| Latitude information. A positive value indicates north latitude, and a negative value indicates south latitude. The value ranges from **-90** to **90**.|
| longitude | number | Yes| Yes| Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from **-180** to **180**.|
| longitude | number | Yes| Yes| Longitude information. A positive value indicates east longitude , and a negative value indicates west longitude . The value ranges from **-180** to **180**.|
| maxItems | number | Yes| Yes| Maximum number of location records to be returned. The value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
| maxItems | number | Yes| Yes| Maximum number of location records to be returned. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
| locale | string | Yes| Yes| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.|
| locale | string | Yes| Yes| Language used for the location description. **zh** indicates Chinese, and **en** indicates English.|
| description | string | Yes| Yes| Location description, for example, **No. xx, xx Road, Pudong New District, Shanghai**.|
| description | string | Yes| Yes| Location description, for example, **No. xx, xx Road, Pudong New District, Shanghai**.|
| maxItems | number | Yes| Yes| Maximum number of location records to be returned. The value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
| maxItems | number | Yes| Yes| Maximum number of location records to be returned. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
| minLatitude | number | Yes| Yes| Minimum latitude. This parameter is used with **minLongitude**, **maxLatitude**, and **maxLongitude** to specify the latitude and longitude ranges. The value ranges from **-90** to **90**.|
| minLatitude | number | Yes| Yes| Minimum latitude. This parameter is used with **minLongitude**, **maxLatitude**, and **maxLongitude** to specify the latitude and longitude ranges. The value ranges from **-90** to **90**.|
| minLongitude | number | Yes| Yes| Minimum longitude. The value ranges from **-180** to **180**.|
| minLongitude | number | Yes| Yes| Minimum longitude. The value ranges from **-180** to **180**.|
| maxLatitude | number | Yes| Yes| Maximum latitude. The value ranges from **-90** to **90**.|
| maxLatitude | number | Yes| Yes| Maximum latitude. The value ranges from **-90** to **90**.|
| descriptionsSize | number | Yes| No| Total number of additional descriptions. The value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
| descriptionsSize | number | Yes| No| Total number of additional descriptions. The specified value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
| isFromMock | Boolean | Yes| No| Whether the geographical name is from the mock reverse geocoding function.<br>**System API**: This is a system API.|
| isFromMock | Boolean | Yes| No| Whether the geographical name is from the mock reverse geocoding function.<br>**System API**: This is a system API.|
| priority | [LocationRequestPriority](#locationrequestpriority) | Yes| Yes| Priority of the location request. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
| priority | [LocationRequestPriority](#locationrequestpriority) | Yes| Yes| Priority of the location request. This parameter is effective only when **scenario** is set to **UNSET**. If this parameter and **scenario** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Yes| Scenario of the location request. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Yes| Scenario of the location request. The **priority** parameter is effective only when this parameter is set to **UNSET**. If this parameter and **priority** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
| timeInterval | number | Yes| Yes| Time interval at which location information is reported, in seconds. The value must be greater than **0**.|
| timeInterval | number | Yes| Yes| Time interval at which location information is reported, in seconds. The specified value must be greater than or equal to **0**. The default value is **1**.|
| distanceInterval | number | Yes| Yes| Distance interval at which location information is reported. The value must be greater than **0**, in meters.|
| distanceInterval | number | Yes| Yes| Distance interval at which location information is reported, in meters. The specified value must be greater than or equal to **0**. The default value is **0**.|
| maxAccuracy | number | Yes| Yes| Location accuracy. This parameter is valid only when the precise location function is enabled, and is invalid when the approximate location function is enabled. The value must be greater than**0**.|
| maxAccuracy | number | Yes| Yes| Location accuracy, in meters. This parameter is valid only when the precise location function is enabled, and is invalid when the approximate location function is enabled. The specified value must be greater than or equal to **0**. The default value is**0**.|
## CurrentLocationRequest
## CurrentLocationRequest
...
@@ -125,10 +125,10 @@ Defines the current location request.
...
@@ -125,10 +125,10 @@ Defines the current location request.
| priority | [LocationRequestPriority](#locationrequestpriority) | Yes| Yes| Priority of the location request. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
| priority | [LocationRequestPriority](#locationrequestpriority) | Yes| Yes| Priority of the location request. This parameter is effective only when **scenario** is set to **UNSET**. If this parameter and **scenario** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestPriority](#locationrequestpriority).|
| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Yes| Scenario of the location request. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
| scenario | [LocationRequestScenario](#locationrequestscenario) | Yes| Yes| Scenario of the location request. The **priority** parameter is effective only when this parameter is set to **UNSET**. If this parameter and **priority** are set to **UNSET**, the attempt to initiate a location request will fail. For details about the value range, see [LocationRequestScenario](#locationrequestscenario).|
| maxAccuracy | number | Yes| Yes| Location accuracy, in meters. This parameter is valid only when the precise location function is enabled, and is invalid when the approximate location function is enabled. The value must be greater than**0**.|
| maxAccuracy | number | Yes| Yes| Location accuracy, in meters. This parameter is valid only when the precise location function is enabled, and is invalid when the approximate location function is enabled. The specified value must be greater than or equal to **0**. The default value is**0**.|
| timeoutMs | number | Yes| Yes| Timeout duration, in milliseconds. The minimum value is **1000**. The value must be greater than or equal to **1000**.|
| timeoutMs | number | Yes| Yes| Timeout duration, in milliseconds. The minimum value is **1000**. The specified value must be greater than or equal to **1000**.|
## SatelliteStatusInfo
## SatelliteStatusInfo
...
@@ -139,23 +139,23 @@ Defines the satellite status information.
...
@@ -139,23 +139,23 @@ Defines the satellite status information.
| satellitesNumber | number | Yes| No| Number of satellites. The value must be greater than or equal to **0**.|
| satellitesNumber | number | Yes| No| Number of satellites. The specified value must be greater than or equal to **0**.|
| satelliteIds | Array<number> | Yes| No| Array of satellite IDs. The value must be greater than or equal to **0**.|
| satelliteIds | Array<number> | Yes| No| Array of satellite IDs. The specified value must be greater than or equal to **0**.|
| carrierToNoiseDensitys | Array<number> | Yes| No| Carrier-to-noise density ratio, that is, **cn0**. The value must be greater than **0**.|
| carrierToNoiseDensitys | Array<number> | Yes| No| Carrier-to-noise density ratio, that is, **cn0**. The specified value must be greater than **0**.|
| altitudes | Array<number> | Yes| No| Satellite altitude angle information. The value ranges from **-90** to **90**, in degrees.|
| altitudes | Array<number> | Yes| No| Satellite altitude angle information. The value ranges from **-90** to **90**, in degrees.|
| azimuths | Array<number> | Yes| No| Azimuth information. The value ranges from **0** to **360**, in degrees.|
| azimuths | Array<number> | Yes| No| Azimuth information. The value ranges from **0** to **360**, in degrees.|
| carrierFrequencies | Array<number> | Yes| No| Carrier frequency. The value must be greater than or equal to **0**, in Hz.|
| carrierFrequencies | Array<number> | Yes| No| Carrier frequency, in Hz. The specified value must be greater than or equal to **0**.|
## CachedGnssLocationsRequest
## CachedGnssLocationsRequest
Represents a request for reporting cached GNSS locations.
Defines a request for reporting cached GNSS locations.
| reportingPeriodSec | number | Yes| Yes| Interval for reporting the cached GNSS locations, in milliseconds. The value must be greater than **0**.|
| reportingPeriodSec | number | Yes| Yes| Interval for reporting the cached GNSS locations, in milliseconds. The specified value must be greater than **0**.|
| wakeUpCacheQueueFull | boolean | Yes| Yes | **true**: reports the cached GNSS locations to the application when the cache queue is full.<br>**false**: discards the cached GNSS locations when the cache queue is full.|
| wakeUpCacheQueueFull | boolean | Yes| Yes | **true**: reports the cached GNSS locations to the application when the cache queue is full.<br>**false**: discards the cached GNSS locations when the cache queue is full.|
...
@@ -169,13 +169,13 @@ Defines a GNSS geofence. Currently, only circular geofences are supported.
...
@@ -169,13 +169,13 @@ Defines a GNSS geofence. Currently, only circular geofences are supported.
| scanInterval | number | Yes| Yes| Scanning interval, in milliseconds. The specified value must be greater than **0**. The default value is **10000**.|
| scanTimeout | number | Yes| Yes| Scanning timeout interval, in milliseconds. The value ranges from **0** to **600000**. The default value is **10000**.|
## LocatingRequiredData<sup>10+</sup>
Defines the required data of the location service, including the Wi-Fi or Bluetooth scanning result. After obtaining the data, an application can use the data for services such as network positioning.
@@ -376,12 +453,12 @@ Unregisters the listener for location changes with the corresponding location re
...
@@ -376,12 +453,12 @@ Unregisters the listener for location changes with the corresponding location re
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **locationChange** indicates a location change event.|
| type | string | Yes| Event type. The value **locationChange** indicates a location change.|
| callback | Callback<[Location](#location)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
| callback | Callback<[Location](#location)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
**Error codes**
For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
@@ -456,12 +533,12 @@ Unregisters the listener for location service status change events.
...
@@ -456,12 +533,12 @@ Unregisters the listener for location service status change events.
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **locationEnabledChange** indicates a location service status change event.|
| type | string | Yes| Event type. The value **locationEnabledChange** indicates a location service status change.|
| callback | Callback<boolean> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
| callback | Callback<boolean> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
**Error codes**
For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
@@ -627,12 +704,12 @@ Unregisters the listener for GNSS satellite status change events.
...
@@ -627,12 +704,12 @@ Unregisters the listener for GNSS satellite status change events.
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **satelliteStatusChange** indicates a GNSS satellite status change event.|
| type | string | Yes| Event type. The value **satelliteStatusChange** indicates a GNSS satellite status change.|
| callback | Callback<[SatelliteStatusInfo](#satellitestatusinfo)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
| callback | Callback<[SatelliteStatusInfo](#satellitestatusinfo)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
**Error codes**
For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
Unregisters the listener for GNSS NMEA message change events.
Unsubscribes from GNSS NMEA message change events.
**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
...
@@ -713,12 +790,12 @@ Unregisters the listener for GNSS NMEA message change events.
...
@@ -713,12 +790,12 @@ Unregisters the listener for GNSS NMEA message change events.
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **nmeaMessage** indicates a GNSS NMEA message change event.|
| type | string | Yes| Event type. The value **nmeaMessage** indicates a GNSS NMEA message change.|
| callback | Callback<string> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
| callback | Callback<string> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
**Error codes**
For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
@@ -913,12 +990,12 @@ Unregisters the listener for country code change events.
...
@@ -913,12 +990,12 @@ Unregisters the listener for country code change events.
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | string | Yes| Event type. The value **countryCodeChange** indicates a country code change event.|
| type | string | Yes| Event type. The value **countryCodeChange** indicates a country code change.|
| callback | Callback<[CountryCode](#countrycode)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
| callback | Callback<[CountryCode](#countrycode)> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
**Error codes**
For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
Subscribes to changes in the required data of the location service, including Wi-Fi and Bluetooth scanning information. An application can then determine whether to enable Wi-Fi and Bluetooth scanning based on the return result.
**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
| type | string | Yes| Event type. The value **locatingRequiredDataChange** indicates a change in the required data of the location service.|
| config | [LocatingRequiredDataConfig](#locatingrequireddataconfig10) | Yes| Configuration for obtaining the required data of the location service.|
| callback | Callback<Array<[LocatingRequiredData](#locatingrequireddata10)>> | Yes| Callback used to receive the required data of the location service.|
**Error codes**
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| type | string | Yes| Event type. The value **locatingRequiredDataChange** indicates a change in the required data of the location service.|
| callback | Callback<Array<[LocatingRequiredData](#locatingrequireddata10)>> | No| Callback to unregister. If this parameter is not specified, all callbacks of the specified event type are unregistered.|
**Error codes**
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
@@ -2106,11 +2265,11 @@ Sets the user confirmation status for the privacy statement of the location serv
...
@@ -2106,11 +2265,11 @@ Sets the user confirmation status for the privacy statement of the location serv
| Name| Type| Mandatory| Description|
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| -------- | -------- | -------- | -------- |
| type | [LocationPrivacyType](#locationprivacytype) | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when the location service is enabled.|
| type | [LocationPrivacyType](#locationprivacytype) | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when the location service is enabled.|
| isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
| isConfirmed | boolean | Yes| Whether the user agrees with the privacy statement.|
**Error codes**
**Error codes**
For details about the following error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
| config | [LocatingRequiredDataConfig](#locatingrequireddataconfig10) | Yes| Configuration for obtaining the required data of the location service.|
**Return value**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| Promise<Array<[LocatingRequiredData](#locatingrequireddata10)>> | [LocatingRequiredData](#locatingrequireddata10) | NA | Promise used to receive the required data of the location service, such as the Wi-Fi and Bluetooth scanning information.|
**Error codes**
For details about the error codes, see [Location Error Codes](../errorcodes/errorcode-geoLocationManager.md).
The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSocket, and TLSSocket connections.
The **socket** module implements data transfer over TCP, UDP, Web, and TLS socket connections.
> **NOTE**
> **NOTE**
>
>
...
@@ -34,7 +34,7 @@ let udp = socket.constructUDPSocketInstance();
...
@@ -34,7 +34,7 @@ let udp = socket.constructUDPSocketInstance();
## UDPSocket<sup>7+</sup>
## UDPSocket<sup>7+</sup>
Defines a UDPSocket connection. Before calling UDPSocket APIs, you need to call [socket.constructUDPSocketInstance](#socketconstructudpsocketinstance) to create a **UDPSocket** object.
Defines a UDP socket connection. Before calling UDPSocket APIs, you need to call [socket.constructUDPSocketInstance](#socketconstructudpsocketinstance) to create a **UDPSocket** object.
| options | [UDPSendOptions](#udpsendoptions) | Yes | Parameters for sending data over the UDPSocket connection. For details, see [UDPSendOptions](#udpsendoptions).|
| options | [UDPSendOptions](#udpsendoptions) | Yes | Parameters for sending data over the UDP socket connection. For details, see [UDPSendOptions](#udpsendoptions).|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
...
@@ -164,7 +164,7 @@ udp.send({
...
@@ -164,7 +164,7 @@ udp.send({
send(options: UDPSendOptions): Promise\<void\>
send(options: UDPSendOptions): Promise\<void\>
Sends data over a UDPSocket connection. This API uses a promise to return the result.
Sends data over a UDP socket connection. This API uses a promise to return the result.
Before sending data, call [UDPSocket.bind()](#bind) to bind the IP address and port.
Before sending data, call [UDPSocket.bind()](#bind) to bind the IP address and port.
...
@@ -176,7 +176,7 @@ Before sending data, call [UDPSocket.bind()](#bind) to bind the IP address and p
...
@@ -176,7 +176,7 @@ Before sending data, call [UDPSocket.bind()](#bind) to bind the IP address and p
| options | [UDPSendOptions](#udpsendoptions) | Yes | Parameters for sending data over the UDPSocket connection. For details, see [UDPSendOptions](#udpsendoptions).|
| options | [UDPSendOptions](#udpsendoptions) | Yes | Parameters for sending data over the UDP socket connection. For details, see [UDPSendOptions](#udpsendoptions).|
**Error codes**
**Error codes**
...
@@ -214,7 +214,7 @@ promise.then(() => {
...
@@ -214,7 +214,7 @@ promise.then(() => {
close(callback: AsyncCallback\<void\>): void
close(callback: AsyncCallback\<void\>): void
Closes a UDPSocket connection. This API uses an asynchronous callback to return the result.
Closes a UDP socket connection. This API uses an asynchronous callback to return the result.
| options | [UDPExtraOptions](#udpextraoptions) | Yes | Other properties of the UDPSocket connection. For details, see [UDPExtraOptions](#udpextraoptions).|
| options | [UDPExtraOptions](#udpextraoptions) | Yes | Other properties of the UDP socket connection. For details, see [UDPExtraOptions](#udpextraoptions).|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| options | [UDPExtraOptions](#udpextraoptions) | Yes | Other properties of the UDPSocket connection. For details, see [UDPExtraOptions](#udpextraoptions).|
| options | [UDPExtraOptions](#udpextraoptions) | Yes | Other properties of the UDP socket connection. For details, see [UDPExtraOptions](#udpextraoptions).|
Disables listening for message receiving events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **message** events of the UDP socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Enables listening for data packet message events or close events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
Subscribes to **listening** events or **close** events of the UDP socket connection. This API uses an asynchronous callback to return the result.
Disables listening for data packet message events or close events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **listening** events or **close** events of the UDP socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
udp.off('listening',callback1);
udp.off('listening',callback1);
udp.off('listening');
udp.off('listening');
letcallback2=()=>{
letcallback2=()=>{
console.log("on close, success");
console.log("on close, success");
}
}
udp.on('close',callback2);
udp.on('close',callback2);
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
udp.off('close',callback2);
udp.off('close',callback2);
udp.off('close');
udp.off('close');
```
```
...
@@ -598,7 +598,7 @@ udp.off('close');
...
@@ -598,7 +598,7 @@ udp.off('close');
on(type: 'error', callback: ErrorCallback): void
on(type: 'error', callback: ErrorCallback): void
Enables listening for error events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
Subscribes to **error** events of the UDP socket connection. This API uses an asynchronous callback to return the result.
Disables listening for error events of the UDPSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **error** events of the UDP socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
udp.off('error',callback);
udp.off('error',callback);
udp.off('error');
udp.off('error');
```
```
...
@@ -663,7 +663,7 @@ Defines the destination address.
...
@@ -663,7 +663,7 @@ Defines the destination address.
## UDPSendOptions<sup>7+</sup>
## UDPSendOptions<sup>7+</sup>
Defines the parameters for sending data over the UDPSocket connection.
Defines the parameters for sending data over the UDP socket connection.
@@ -684,7 +684,7 @@ Defines other properties of the UDPSocket connection.
...
@@ -684,7 +684,7 @@ Defines other properties of the UDPSocket connection.
| receiveBufferSize | number | No | Size of the receive buffer, in bytes. The default value is **0**. |
| receiveBufferSize | number | No | Size of the receive buffer, in bytes. The default value is **0**. |
| sendBufferSize | number | No | Size of the send buffer, in bytes. The default value is **0**. |
| sendBufferSize | number | No | Size of the send buffer, in bytes. The default value is **0**. |
| 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. The default value is **0**.|
| socketTimeout | number | No | Timeout duration of the UDP socket connection, in ms. The default value is **0**.|
## SocketStateBase<sup>7+</sup>
## SocketStateBase<sup>7+</sup>
...
@@ -739,7 +739,7 @@ let tcp = socket.constructTCPSocketInstance();
...
@@ -739,7 +739,7 @@ let tcp = socket.constructTCPSocketInstance();
## TCPSocket<sup>7+</sup>
## TCPSocket<sup>7+</sup>
Defines a TCPSocket connection. Before calling TCPSocket APIs, you need to call [socket.constructTCPSocketInstance](#socketconstructtcpsocketinstance) to create a **TCPSocket** object.
Defines a TCP socket connection. Before calling 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**
> If the operation fails, the system randomly allocates a port number.
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**
> If the operation fails, the system randomly allocates a port number.
| options | [TCPSendOptions](#tcpsendoptions) | Yes | Parameters for sending data over the TCPSocket connection. For details, see [TCPSendOptions](#tcpsendoptions).|
| options | [TCPSendOptions](#tcpsendoptions) | Yes | Parameters for sending data over the TCP socket connection. For details, see [TCPSendOptions](#tcpsendoptions).|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| options | [TCPSendOptions](#tcpsendoptions) | Yes | Parameters for sending data over the TCPSocket connection. For details, see [TCPSendOptions](#tcpsendoptions).|
| options | [TCPSendOptions](#tcpsendoptions) | Yes | Parameters for sending data over the TCP socket connection. For details, see [TCPSendOptions](#tcpsendoptions).|
**Return value**
**Return value**
...
@@ -1002,7 +1008,7 @@ promise1.then(() => {
...
@@ -1002,7 +1008,7 @@ promise1.then(() => {
close(callback: AsyncCallback\<void\>): void
close(callback: AsyncCallback\<void\>): void
Closes a TCPSocket connection. This API uses an asynchronous callback to return the result.
Closes a TCP socket connection. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback\<number\> | Yes | Callback used to return the result. If the operation is successful, the file descriptor of the socket is returned. Otherwise, **undefined** is returned.|
**Example**
```js
importsocketfrom"@ohos.net.socket";
vartcp=socket.constructTCPSocketInstance();
lettunnelfd=0
tcp.bind({
address:"0.0.0.0",
family:1,
})
letconnectAddress={
address:"192.168.1.11",
port:8888,
family:1
};
tcp.connect({
address:connectAddress,timeout:6000
})
tcp.getSocketFd((data)=>{
console.info("tunenlfd: "+data);
tunnelfd=data
})
```
### getSocketFd<sup>10+</sup>
getSocketFd(): Promise\<number\>
Obtains the file descriptor of the **TCPSocket** object. This API uses a promise to return the result.
> **NOTE**
> This API can be called only after **bind** or **connect** is successfully called.
| options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCPSocket connection. For details, see [TCPExtraOptions](#tcpextraoptions).|
| options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCP socket connection. For details, see [TCPExtraOptions](#tcpextraoptions).|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Error codes**
**Error codes**
...
@@ -1291,7 +1378,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa
...
@@ -1291,7 +1378,7 @@ let promise = tcp.connect({ address: { address: '192.168.xx.xxx', port: xxxx, fa
| options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCPSocket connection. For details, see [TCPExtraOptions](#tcpextraoptions).|
| options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCP socket connection. For details, see [TCPExtraOptions](#tcpextraoptions).|
Disables listening for message receiving events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **message** events of the TCP socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Disables listening for connection or close events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from connection or close events of the TCP socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
tcp.off('connect',callback1);
tcp.off('connect',callback1);
tcp.off('connect');
tcp.off('connect');
letcallback2=()=>{
letcallback2=()=>{
console.log("on close success");
console.log("on close success");
}
}
tcp.on('close',callback2);
tcp.on('close',callback2);
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
tcp.off('close',callback2);
tcp.off('close',callback2);
tcp.off('close');
tcp.off('close');
```
```
...
@@ -1484,7 +1571,7 @@ tcp.off('close');
...
@@ -1484,7 +1571,7 @@ tcp.off('close');
on(type: 'error', callback: ErrorCallback): void
on(type: 'error', callback: ErrorCallback): void
Enables listening for error events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
Subscribes to **error** events of the TCP socket connection. This API uses an asynchronous callback to return the result.
Disables listening for error events of the TCPSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **error** events of the TCP socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
| keepAlive | boolean | No | Whether to keep the connection alive. The default value is **false**. |
| keepAlive | boolean | No | Whether to keep the connection alive. The default value is **false**. |
| OOBInline | boolean | No | Whether to enable OOBInline. The default value is **false**. |
| OOBInline | boolean | No | Whether to enable OOBInline. The default value is **false**. |
| TCPNoDelay | boolean | No | Whether to enable no-delay on the TCPSocket connection. The default value is **false**. |
| TCPNoDelay | boolean | No | Whether to enable no-delay on the TCP socket connection. The default value is **false**. |
| socketLinger | Object | Yes | Socket linger.<br>- **on**: whether to enable socket linger. The value true means to enable socket linger and false means the opposite.<br>- **linger**: linger time, in ms. The value ranges from **0** to **65535**.<br>Specify this parameter only when **on** is set to **true**.|
| socketLinger | Object | Yes | Socket linger.<br>- **on**: whether to enable socket linger. The value true means to enable socket linger and false means the opposite.<br>- **linger**: linger time, in ms. The value ranges from **0** to **65535**.<br>Specify this parameter only when **on** is set to **true**.|
| receiveBufferSize | number | No | Size of the receive buffer, in bytes. The default value is **0**. |
| receiveBufferSize | number | No | Size of the receive buffer, in bytes. The default value is **0**. |
| sendBufferSize | number | No | Size of the send buffer, in bytes. The default value is **0**. |
| sendBufferSize | number | No | Size of the send buffer, in bytes. The default value is **0**. |
| 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. The default value is **0**. |
| socketTimeout | number | No | Timeout duration of the UDP socket connection, in ms. The default value is **0**. |
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. The server listens to and accepts TCPSocket connections established over the socket. Multiple threads are used to process client data concurrently. 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. The server listens to and accepts TCP socket connections established over the socket. Multiple threads are used to process client data concurrently. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> The server uses this API to perform the bind, listen, and accept operations.
> The server uses this API to perform the **bind**, **listen**, and **accept** operations. If the **bind** operation fails, the system randomly allocates a port number.
Binds the IP address and port number. The port number can be specified or randomly allocated by the system. The server listens to and accepts TCPSocket connections established over the socket. Multiple threads are used to process client data concurrently. 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. The server listens to and accepts TCP socket connections established over the socket. Multiple threads are used to process client data concurrently. This API uses a promise to return the result.
> **NOTE**
> **NOTE**
> The server uses this API to perform the bind, listen, and accept operations.
> The server uses this API to perform the **bind**, **listen**, and **accept** operations. If the **bind** operation fails, the system randomly allocates a port number.
Disables listening for TCPSocketServer connection events. This API uses an asynchronous callback to return the result.
Unsubscribes from TCPSocketServer connection events. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
tcpServer.off('connect',callback);
tcpServer.off('connect',callback);
tcpServer.off('connect');
tcpServer.off('connect');
```
```
...
@@ -1975,7 +2065,10 @@ tcpServer.off('connect');
...
@@ -1975,7 +2065,10 @@ tcpServer.off('connect');
on(type: 'error', callback: ErrorCallback): void
on(type: 'error', callback: ErrorCallback): void
Enables listening for error events of the TCPSocketServer connection. This API uses an asynchronous callback to return the result.
Subscribes to **error** events of the TCPSocketServer connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> This API can be called only after **listen** is successfully called.
Disables listening for error events of the TCPSocketServer connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **error** events of the TCPSocketServer connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Disables listening for**message** events of a **TCPSocketConnection** object. This API uses an asynchronous callback to return the result.
Unsubscribes from**message** events of a **TCPSocketConnection** object. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Disables listening for**close** events of a **TCPSocketConnection** object. This API uses an asynchronous callback to return the result.
Unsubscribes from**close** events of a **TCPSocketConnection** object. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Disables listening for**error** events of a **TCPSocketConnection** object. This API uses an asynchronous callback to return the result.
Unsubscribes from**error** events of a **TCPSocketConnection** object. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
client.off('error',callback);
client.off('error',callback);
client.off('error');
client.off('error');
});
});
...
@@ -2558,7 +2651,7 @@ let tls = socket.constructTLSSocketInstance();
...
@@ -2558,7 +2651,7 @@ let tls = socket.constructTLSSocketInstance();
## TLSSocket<sup>9+</sup>
## TLSSocket<sup>9+</sup>
Defines a TLSSocket connection. Before calling TLSSocket APIs, you need to call [socket.constructTLSSocketInstance](#socketconstructtlssocketinstance9) to create a **TLSSocket** object.
Defines a TLS socket connection. Before calling TLSSocket APIs, you need to call [socket.constructTLSSocketInstance](#socketconstructtlssocketinstance9) to create a **TLSSocket** object.
| callback | AsyncCallback\<[SocketStateBase](#socketstatebase)> | Yes | Callback used to return the result. If the operation is successful, the status of the TLSSocket connection is returned. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<[SocketStateBase](#socketstatebase)> | Yes | Callback used to return the result. If the operation is successful, the status of the TLS socket connection is returned. If the operation fails, an error message is returned.|
| options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCPSocket connection. For details, see [TCPExtraOptions](#tcpextraoptions).|
| options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCP socket connection. For details, see [TCPExtraOptions](#tcpextraoptions).|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation is successful, the result of setting other properties of the TCPSocket connection is returned. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation is successful, the result of setting other properties of the TCP socket connection is returned. If the operation fails, an error message is returned.|
| options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCPSocket connection. For details, see [TCPExtraOptions](#tcpextraoptions).|
| options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCP socket connection. For details, see [TCPExtraOptions](#tcpextraoptions).|
Disables listening for **message** events of the TLSSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **message** events of the TLS socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
| type | string | Yes | Type of the event to subscribe to.<br/>**message**: message receiving event.|
| type | string | Yes | Type of the event to subscribe to.<br/>**message**: message receiving event.|
| callback | Callback<{message:ArrayBuffer,remoteInfo:[SocketRemoteInfo](#socketremoteinfo)}> | No | Callback used to return the result.<br/>**message**: received message.<br>**remoteInfo**: socket connection information.|
| callback | Callback<{message:ArrayBuffer,remoteInfo:[SocketRemoteInfo](#socketremoteinfo)}> | No | Callback used to return the result.<br>**message**: received message.<br>**remoteInfo**: socket connection information.|
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Disables listening for **connect** or **close** events of the TLSSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **connect** or **close** events of the TLS socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
tls.off('connect',callback1);
tls.off('connect',callback1);
tls.off('connect');
tls.off('connect');
letcallback2=()=>{
letcallback2=()=>{
console.log("on close success");
console.log("on close success");
}
}
tls.on('close',callback2);
tls.on('close',callback2);
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Disables listening for error events of the TLSSocket connection. This API uses an asynchronous callback to return the result.
Unsubscribes from **error** events of the TLS socket connection. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Sets up a TLSSocket connection, and creates and initializes a TLS session after **bind** is successfully called. During this process, a TLS/SSL handshake is performed between the application and the server to implement data transmission. This API uses an asynchronous callback to return the result.
Sets up a TLS socket connection, and creates and initializes a TLS session after **bind** is successfully called. During this process, a TLS/SSL handshake is performed between the application and the server to implement data transmission. This API uses an asynchronous callback to return the result.
| options | [TLSConnectOptions](#tlsconnectoptions9) | Yes | Parameters required for the TLSSocket connection.|
| options | [TLSConnectOptions](#tlsconnectoptions9) | Yes | Parameters required for the TLS socket connection.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.|
Sets up a TLSSocket connection, and creates and initializes a TLS session after **bind** is successfully called. During this process, a TLS/SSL handshake is performed between the application and the server to implement data transmission. Both two-way and one-way authentication modes are supported. This API uses a promise to return the result.
Sets up a TLS socket connection, and creates and initializes a TLS session after **bind** is successfully called. During this process, a TLS/SSL handshake is performed between the application and the server to implement data transmission. Both two-way and one-way authentication modes are supported. This API uses a promise to return the result.
Obtains the local digital certificate after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses an asynchronous callback to return the result.
Obtains the local digital certificate after a TLS socket connection is established. This API is applicable to two-way authentication. It uses an asynchronous callback to return the result.
Obtains the local digital certificate after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses a promise to return the result.
Obtains the local digital certificate after a TLS socket connection is established. This API is applicable to two-way authentication. It uses a promise to return the result.
Obtains the digital certificate of the server after a TLSSocket connection is established. This API uses an asynchronous callback to return the result.
Obtains the digital certificate of the server after a TLS socket connection is established. This API uses an asynchronous callback to return the result.
Obtains the cipher suite negotiated by both communication parties after a TLSSocket connection is established. This API uses an asynchronous callback to return the result.
Obtains the cipher suite negotiated by both communication parties after a TLS socket connection is established. This API uses an asynchronous callback to return the result.
Obtains the cipher suite negotiated by both communication parties after a TLSSocket connection is established. This API uses a promise to return the result.
Obtains the cipher suite negotiated by both communication parties after a TLS socket connection is established. This API uses a promise to return the result.
Obtains the signing algorithm negotiated by both communication parties after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses an asynchronous callback to return the result.
Obtains the signing algorithm negotiated by both communication parties after a TLS socket connection is established. This API is applicable to two-way authentication. It uses an asynchronous callback to return the result.
Obtains the signing algorithm negotiated by both communication parties after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses a promise to return the result.
Obtains the signing algorithm negotiated by both communication parties after a TLS socket connection is established. This API is applicable to two-way authentication. It uses a promise to return the result.
@@ -3815,7 +3908,7 @@ let tlsServer = socket.constructTLSSocketServerInstance();
...
@@ -3815,7 +3908,7 @@ let tlsServer = socket.constructTLSSocketServerInstance();
## TLSSocketServer<sup>10+</sup>
## TLSSocketServer<sup>10+</sup>
Defines a TLSSocketServer connection. Before calling TLSSocketServer APIs, you need to call [socket.constructTLSSocketServerInstance](#socketconstructtlssocketserverinstance10) to create a **TLSSocketServer** object.
Defines a TLS socket server connection. Before calling TLSSocketServer APIs, you need to call [socket.constructTLSSocketServerInstance](#socketconstructtlssocketserverinstance10) to create a **TLSSocketServer** object.
| callback | AsyncCallback\<[SocketStateBase](#socketstatebase7)> | Yes | Callback used to return the result. If the operation is successful, the status of the TLSSocketServer connection is returned. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<[SocketStateBase](#socketstatebase7)> | Yes | Callback used to return the result. If the operation is successful, the status of the TLS socket server connection is returned. If the operation fails, an error message is returned.|
| options | [TCPExtraOptions](#tcpextraoptions7) | Yes | Other properties of the TLSSocketServer connection. |
| options | [TCPExtraOptions](#tcpextraoptions7) | Yes | Other properties of the TLS socket server connection. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.|
Obtains the local digital certificate after a TLSSocketServer connection is established. This API uses an asynchronous callback to return the result.
Obtains the local digital certificate after a TLS socket server connection is established. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> This API can be called only after **listen** is successfully called.
> This API can be called only after **listen** is successfully called.
Obtains the communication protocol version after a TLSSocketServer connection is established. This API uses an asynchronous callback to return the result.
Obtains the communication protocol version after a TLS socket server connection is established. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> This API can be called only after **listen** is successfully called.
> This API can be called only after **listen** is successfully called.
Disables listening for TLSSocketServer connection events. This API uses an asynchronous callback to return the result.
Unsubscribes from TLS socket server connection events. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
tlsServer.off('connect',callback);
tlsServer.off('connect',callback);
tlsServer.off('connect');
tlsServer.off('connect');
```
```
### on('error')
### on('error')<sup>10+</sup>
on(type: 'error', callback: ErrorCallback): void
on(type: 'error', callback: ErrorCallback): void
Enables listening for**error** events of a **TLSSocketServer** object. This API uses an asynchronous callback to return the result.
Subscribes to**error** events of a **TLSSocketServer** object. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> This API can be called only after **listen** is successfully called.
> This API can be called only after **listen** is successfully called.
Disables listening for**error** events of a **TLSSocketServer** object. This API uses an asynchronous callback to return the result.
Unsubscribes from**error** events of a **TLSSocketServer** object. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
tlsServer.off('error',callback);
tlsServer.off('error',callback);
tlsServer.off('error');
tlsServer.off('error');
```
```
...
@@ -4704,7 +4797,7 @@ Defines a **TLSSocketConnection** object, that is, the connection between the TL
...
@@ -4704,7 +4797,7 @@ Defines a **TLSSocketConnection** object, that is, the connection between the TL
| data | string | Yes | Parameters for sending data over the TLSSocketServer connection. |
| data | string | Yes | Parameters for sending data over the TLS socket server connection. |
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.|
Obtains the digital certificate of the peer end after a TLSSocketServer connection is established. This API uses an asynchronous callback to return the result. It applies only to the scenario where the client sends a certificate to the server.
Obtains the digital certificate of the peer end after a TLS socket server connection is established. This API uses an asynchronous callback to return the result. It applies only to the scenario where the client sends a certificate to the server.
Obtains the digital certificate of the peer end after a TLSSocketServer connection is established. This API uses a promise to return the result. It applies only to the scenario where the client sends a certificate to the server.
Obtains the digital certificate of the peer end after a TLS socket server connection is established. This API uses a promise to return the result. It applies only to the scenario where the client sends a certificate to the server.
Obtains the cipher suite negotiated by both communication parties after a TLSSocketServer connection is established. This API uses an asynchronous callback to return the result.
Obtains the cipher suite negotiated by both communication parties after a TLS socket server connection is established. This API uses an asynchronous callback to return the result.
Obtains the cipher suite negotiated by both communication parties after a TLSSocketServer connection is established. This API uses a promise to return the result.
Obtains the cipher suite negotiated by both communication parties after a TLS socket server connection is established. This API uses a promise to return the result.
Obtains the signing algorithm negotiated by both communication parties after a TLSSocketServer connection is established. This API uses an asynchronous callback to return the result.
Obtains the signing algorithm negotiated by both communication parties after a TLS socket server connection is established. This API uses an asynchronous callback to return the result.
Obtains the signing algorithm negotiated by both communication parties after a TLSSocketServer connection is established. This API uses a promise to return the result.
Obtains the signing algorithm negotiated by both communication parties after a TLS socket server connection is established. This API uses a promise to return the result.
Disables listening for**message** events of a **TLSSocketConnection** object. This API uses an asynchronous callback to return the result.
Unsubscribes from**message** events of a **TLSSocketConnection** object. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Disables listening for**close** events of a **TLSSocketConnection** object. This API uses an asynchronous callback to return the result.
Unsubscribes from**close** events of a **TLSSocketConnection** object. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
Disables listening for**error** events of a **TLSSocketConnection** object. This API uses an asynchronous callback to return the result.
Unsubscribes from**error** events of a **TLSSocketConnection** object. This API uses an asynchronous callback to return the result.
> **NOTE**
> **NOTE**
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events.
> You can pass the callback of the **on** function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on method to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
// You can pass the callback of the on function if you want to cancel listening for a certain type of events. If you do not pass the callback, you will cancel listening for all events.
| **Source Code of the Latest Release**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| **Source Code of the Latest Release**| **Version**| **Site**| **SHA-256 Checksum**| **Software Package Size**|
| Full code base (for mini, small, and standard systems) | 4.0 Beta1 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/code-v4.0-Beta1.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta1/code-v4.0-Beta1.tar.gz.sha256)| 26.2 GB |
| Full code base (for mini, small, and standard systems) | 4.0 Beta2 | [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/code-v4.0-Beta2.tar.gz)| [Download](https://repo.huaweicloud.com/openharmony/os/4.0-Beta2/code-v4.0-Beta2.tar.gz.sha256)| 27.7 GB |
## cl.usb_manager.1 Error Information Return Method Change
The USB Manager API uses service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. Beginning from API version 9, error information is returned by throwing exceptions.
**Change Impact**
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
**Key API/Component Changes**
Changed the USB module name from **@ohos.usb.d.ts** to **@ohos.usbV9.d.ts**, and added error code processing for all APIs in the module.
**Adaptation Guide**
Take the **getDevices** API as an example. The sample code is as follows:
```ts
importusbV9from'@ohos.usbV9'
try{
usbV9.getDevices();// If an improper parameter is passed to this API, an exception will be thrown.
## cl.location.1 Migration of System APIs and APIs in API Version 9 to the New @ohos.geoLocationManager.d.ts
The APIs in **@ohos.geolocation.d.ts** do not support throwing error codes. However, APIs in API version 9 and system APIs are required to support throwing of error codes. To support this function, all system APIs and APIs in API version 9 in **@ohos.geolocation.d.ts** are migrated to the newly added **@ohos.geoLocationManager.d.ts** file, and corresponding error code description is added.
To use system APIs and APIs in API version 9 of the location subsystem, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
**Change Impact**
System APIs and APIs in API version 9 are affected. To ensure normal use of these APIs, you need to import **@ohos.geoLocationManager**.
import geoLocationManager from '@ohos.geoLocationManager';
Other APIs are not affected.
**Key API/Component Changes**
| Class| API Type| Declaration| Change Type|
| -- | -- | -- | -- |
|geolocation| namespace | declare namespacegeolocation| Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface ReverseGeocodingMockInfo | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface LocationMockConfig | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | interface | export interface CountryCode | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation | enum | export enum CountryCodeType | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoAddress | field | isFromMock?: Boolean; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.Location | field | isFromMock?: Boolean; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoLocationErrorCode | field | NOT_SUPPORTED = 100 | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation.GeoLocationErrorCode | field | QUERY_COUNTRY_CODE_ERROR | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function on(type: 'countryCodeChange', callback: Callback<CountryCode>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function off(type: 'countryCodeChange', callback?: Callback<CountryCode>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCountryCode(callback: AsyncCallback<CountryCode>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function getCountryCode(): Promise<CountryCode>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback<void>): void; | Deleted this API in API version 9.|
|geolocation| method | function enableLocationMock(callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function enableLocationMock(scenario: LocationRequestScenario): Promise<void>; | Deleted this API in API version 9.|
|geolocation| method | function enableLocationMock(): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**.|
|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario, callback: AsyncCallback<void>): void; | Deleted this API in API version 9.|
|geolocation| method | function disableLocationMock(callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableLocationMock(scenario: LocationRequestScenario): Promise<void>; | Deleted this API in API version 9.|
|geolocation| method | function disableLocationMock(): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setMockedLocations(config: LocationMockConfig, callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setMockedLocations(config: LocationMockConfig): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function enableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function enableReverseGeocodingMock(): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableReverseGeocodingMock(callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function disableReverseGeocodingMock(): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>, callback: AsyncCallback<void>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): Promise<void>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType, callback: AsyncCallback<boolean>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function isLocationPrivacyConfirmed(type: LocationPrivacyType): Promise<boolean>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean, callback: AsyncCallback<boolean>): void; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the return value in the callback to **void**. |
|geolocation| method | function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): Promise<boolean>; | Migrated this API in API version 9 to **@ohos.geoLocationManager.d.ts** and changed the return value in the promise to **void**. |
**(Optional) Adaptation Guide**
The following sample code shows how to call **enableLocation** in the new version:
## cl.location.2 Location Service Permission Change
From API version 9, the **ohos.permission.APPROXIMATELY_LOCATION** permission is added for obtaining the approximate location.
If you use API version 9 or later, you need to apply for both the **ohos.permission.LOCATION** and **ohos.permission.APPROXIMATELY_LOCATION** permissions. Applying for only the **ohos.permission.LOCATION** permission will fail.
**Change Impact**
Applications using API versions earlier than 9 are not affected. For an application using API version 9 or later, the method for applying for the location permission is changed. The details are as follows:
Before using basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user as described below.
The system provides the following location permissions:
- ohos.permission.LOCATION
- ohos.permission.APPROXIMATELY_LOCATION
- ohos.permission.LOCATION_IN_BACKGROUND
If your application needs to access the device location information, it must first apply for required permissions. Specifically speaking:
API versions earlier than 9: Apply for **ohos.permission.LOCATION**.
API version 9 and later: Apply for **ohos.permission.APPROXIMATELY_LOCATION**, or apply for **ohos.permission.APPROXIMATELY_LOCATION** and **ohos.permission.LOCATION**. Note that **ohos.permission.LOCATION** cannot be applied for separately.
| API Version| Location Permission| Permission Application Result| Location Accuracy|
| -------- | -------- | -------- | -------- |
| Earlier than 9| ohos.permission.LOCATION | Success| Location accurate to meters|
| 9 and later| ohos.permission.LOCATION | Failed| No location obtained.|
| 9 and later| ohos.permission.APPROXIMATELY_LOCATION | Success| Location accurate to 5 kilometers.|
| 9 and later| ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION| Success| Location accurate to meters|
If your application needs to access the device location information when running in the background, it must be configured to be able to run in the background and be granted the **ohos.permission.LOCATION_IN_BACKGROUND** permission. In this way, the system continues to report device location information after your application moves to the background.
You can declare the required permissions in your application's configuration file. For details, see the [permission application guide](../../../application-dev/security/accesstoken-guidelines.md).
**Key API/Component Changes**
Applications using API versions earlier than 9 are not affected.
If your application uses API version 9 or later and needs to call APIs requiring the **ohos.permission.LOCATION** permission in **@ohos.geolocation** and **@ohos.geoLocationManager**, you need to apply for the corresponding permission as described previously.
## cl.global.1 Support of Error Codes for the Internalization Module
APIs provided by the internationalization module of the globalization subsystem are changed to support error codes in the following scenarios. The following changes are made in API version 9 and later:
- Obtaining the local expression of a country or language
- Obtaining the list of languages supported by the system and the list of areas supported by a language
- Checking whether a language matches an area
- Obtaining and setting the system language, country or region, and area
- Obtaining and setting the 24-hour clock of the system
- Obtaining, adding, and removing the preferred language
- Obtaining and setting localized numbers
You need to adapt your application.
**Change Impact**
The preceding APIs are changed to the static methods of the **System** class. When such an API is called, add the class name to the end of the module name.
For setter APIs, the type of the return value is changed from boolean to void, for example, **setSystemLanguage**.
When a call to an API fails, an error code is returned according to the failure cause. For example, when permissions are not correctly configured for an application, **201** is returned.
## cl.powermgr.1 Error Information Return Method Change of APIs
The **power** module uses service logic return values to indicate error information, which does not comply with the API error code specifications of OpenHarmony. Therefore, modification is made in API version 9 and later.
- Power consumption statistics: [@ohos.batteryStatistics](../../../application-dev/reference/apis/js-apis-batteryStatistics.md)
Asynchronous API: An error message is returned via **AsyncCallback** or the **error** object of **Promise**.
Synchronous API: An error message is returned via an exception.
#### Change Impact
The application developed based on earlier versions needs to adapt the method for returning API error information. Otherwise, the original service logic will be affected.
#### Key API/Component Changes
Error code processing is added for the following APIs:
For details, see the API reference document of each API.
## cl.powermgr.2 System API Change
#### Change Impact
The application developed based on earlier versions needs to adapt to new API names and the new method for returning API error information. Otherwise, the original service logic will be affected.
## cl.request.1 Changes of Error Code Definitions and Some API Names
## cl.request.1 Changes of Error Code Definitions and API Names
-The processing of the [upload and download error codes](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/errorcodes/errorcode-request.md) is added to the upload and download APIs.
-Processing of [error codes](https://gitee.com/openharmony/docs/blob/master/en/application-dev/reference/errorcodes/errorcode-request.md) is added to the upload and download APIs.
-An error message is returned via **AsyncCallback** or the **error** object of**Promise**. An error message related to the parameter type or quantity is returned via an exception.
-Error information is returned via the **error** object in **AsyncCallback** or**Promise**. An error message related to the parameter type or quantity is returned via an exception.
- Some APIs need to be replaced with new APIs, and the parameters remain unchanged.
- Some APIs are replaced with new APIs, but the parameters remain unchanged.
**Change Impact**
**Change Impact**
...
@@ -12,7 +12,7 @@ The application developed based on earlier versions needs to adapt the method fo
...
@@ -12,7 +12,7 @@ The application developed based on earlier versions needs to adapt the method fo
**Key API/Component Changes**
**Key API/Component Changes**
| Module | Class | Method/Attribute/Enumeration/Constant | Change Type |
| Module | Class | Method/Attribute/Enum/Constant | Change Type |
## cl.telephony.1 Input Parameter Change of System APIs of the SMS Module
Input parameters of some system APIs of the SMS module are changed, leading to noncompliance with the API specifications of OpenHarmony. The following changes are made in API version 9 and later:
The **slotId** parameter is added to the **isImsSmsSupported** API, indicating the slot ID.
**Change Impact**
Input parameters of JS APIs need to be adapted for applications developed based on earlier versions. Otherwise, relevant functions will be affected.