The **dragInteraction** module provides the APIs to enable and disable listening for dragging status changes.
> **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. This field has a fixed value of **drag**.|
| callback | Callback<[DragState](#dragstate)> | No | Callback to be unregistered. If this parameter is not specified, all callbacks registered by the current application will be unregistered.|
| method | [RequestMethod](#requestmethod) | No | Request method. The default value is **GET**. |
| extraData | string<sup>6+</sup>\| Object<sup>6+</sup>\| ArrayBuffer<sup>8+</sup> | No | Additional data for sending a request. This parameter is not used by default.<br>- If the HTTP request uses a POST or PUT method, this parameter serves as the content of the HTTP request and is encoded in UTF-8 format. If **'Content-Type'** is **'application/x-www-form-urlencoded'**, the data in the request body must be encoded in the format of **key1=value1&key2=value2&key3=value3** after URL transcoding. - If the HTTP request uses the GET, OPTIONS, DELETE, TRACE, or CONNECT method, this parameter serves as a supplement to HTTP request parameters. Parameters of the string type need to be encoded before being passed to the HTTP request. Parameters of the object type do not need to be precoded and will be directly concatenated to the URL. Parameters of the ArrayBuffer type will not be concatenated to the URL.|
| extraData | string<sup>6+</sup>\| Object<sup>6+</sup>\| ArrayBuffer<sup>8+</sup> | No | Additional data for sending a request. This parameter is not used by default.<br>- If the HTTP request uses a POST or PUT method, this parameter serves as the content of the HTTP request and is encoded in UTF-8 format. If **'Content-Type'** is **'application/x-www-form-urlencoded'**, the data in the request body must be encoded in the format of **key1=value1&key2=value2&key3=value3** after URL transcoding and passed to the API as a string.<br>- If the HTTP request uses the GET, OPTIONS, DELETE, TRACE, or CONNECT method, this parameter serves as a supplement to HTTP request parameters. Parameters of the string type need to be encoded before being passed to the HTTP request. Parameters of the object type do not need to be precoded and will be directly concatenated to the URL. Parameters of the ArrayBuffer type will not be concatenated to the URL.|
| expectDataType<sup>9+</sup> | [HttpDataType](#httpdatatype9) | No | Type of the returned data. This parameter is not used by default. If this parameter is set, the system returns the specified type of data preferentially.|
| usingCache<sup>9+</sup> | boolean | No | Whether to use the cache. The default value is **true**. |
| priority<sup>9+</sup> | number | No | Priority. The value range is [1,1000]. The default value is **1**. |
...
...
@@ -883,7 +883,7 @@ Specifies the type and value range of the optional parameters in the HTTP reques
| 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. |
| 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. |
| caPath<sup>10+</sup> | string | No | Path of CA certificates. If a path is set, the system uses the CA certificates in this path. If a path is not set, the system uses the preset CA certificates. The path is the sandbox mapping path, and preset CA certificates are stored in **/etc/ssl/certs/cacert.pem**. You are advised to store CA certificates in this path. Currently, only **.pem** certificates are supported. |
@@ -156,11 +165,14 @@ For details about the error codes, see [I18N Error Codes](../errorcodes/errorcod
| 890001 | param value not valid |
**Example**
```js
```ts
import{BusinessError}from'@ohos.base';
try{
letsystemCountries=I18n.System.getSystemCountries('zh');// systemCountries = [ "ZW", "YT", "YE", ..., "ER", "CN", "DE" ], 240 countries or regions in total
letsystemCountries:Array<string>=I18n.System.getSystemCountries('zh');// systemCountries = [ "ZW", "YT", "YE", ..., "ER", "CN", "DE" ], 240 countries or regions in total
@@ -979,10 +1039,10 @@ Obtains the value of the specified field in the **Calendar** object.
| number | Value of the specified field. For example, if the year in the internal date of this **Calendar** object is **1990**, the **get("year")** function will return **1990**.|
calendar.set(2021,11,11,8,0,0);// set time to 2021.11.11 08:00:00
calendar.isWeekend();// false
letdate=newDate(2011,11,6,9,0,0);
letdate:Date=newDate(2011,11,6,9,0,0);
calendar.isWeekend(date);// true
```
...
...
@@ -1062,8 +1122,9 @@ Creates a **PhoneNumberFormat** object.
| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. The default value is **NATIONAL**. |
iterator.setLineBreakText("Apple is my favorite fruit.");
letlastPos=iterator.last();// lastPos = 27
letlastPos:number=iterator.last();// lastPos = 27
```
...
...
@@ -1431,10 +1492,10 @@ Moves the **BreakIterator** object backward by the corresponding number of break
| number | Position of the **BreakIterator** object in the text after it is moved by the specified number of break points. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of break points.|
iterator.setLineBreakText("Apple is my favorite fruit.");
letpos=iterator.first();// pos = 0
letpos:number=iterator.first();// pos = 0
pos=iterator.next();// pos = 6
pos=iterator.next(10);// pos = -1
```
...
...
@@ -1455,10 +1516,10 @@ Moves the **BreakIterator** object forward by one break point.
| number | Position of the **BreakIterator** object in the text after it is moved to the previous break point. The value **-1** is returned if the position of the [BreakIterator](#breakiterator8) object is outside of the processed text after it is moved by the specified number of break points.|
@@ -1637,9 +1698,9 @@ Obtains the offset between the time zone represented by a **TimeZone** object an
| number | Offset between the time zone represented by the **TimeZone** object and the UTC time zone at a certain time point. The default value is the system time zone.|
@@ -1788,7 +1849,7 @@ Obtains a list of IDs supported by the **Transliterator** object.
```ts
// A total of 671 IDs are supported. One ID is comprised of two parts separated by a hyphen (-) in the format of source-destination. For example, in **ids = ["Han-Latin","Latin-ASCII", "Amharic-Latin/BGN","Accents-Any", ...]**, **Han-Latin** indicates conversion from Chinese to Latin, and **Amharic-Latin** indicates conversion from Amharic to Latin.
The **intelligentVoice** module provides the intelligent voice enrollment and voice wakeup functions.
Its functions are implemented by:
-[IntelligentVoiceManager](#intelligentvoicemanager): intelligent voice manager class, which declares the functions provided by the module. Currently, voice enrollment and voice wakeup are supported. Before developing intelligent voice functions, call [getIntelligentVoiceManager()](#intelligentvoicegetintelligentvoicemanager) to check whether they are supported.
-[EnrollIntelligentVoiceEngine](#enrollintelligentvoiceengine): class that implements voice enrollment. You need to perform voice enrollment before using voice wakeup.
-[WakeupIntelligentVoiceEngine](#wakeupintelligentvoiceengine): class that implements voice wakeup. You need to perform voice enrollment before using voice wakeup.
> **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.
console.info('Succeeded in creating wakeupIntelligentVoice engine.');
}).catch((err)=>{
console.error('Failed to create wakeupIntelligentVoice engine, Code:${err.code}, message:${err.message});
});
```
## IntelligentVoiceManager
Class that implements intelligent voice management. Before use, you need to call [getIntelligentVoiceManager()](#intelligentvoicegetintelligentvoicemanager) to obtain an **IntelligentVoiceManager** object.
| type | string | Yes | Event type. This field has a fixed value of **serviceChange**.|
| callback | Callback\<[ServiceChangeType](#servicechangetype)\> | No | Callback for processing of the service status change event. If this parameter is specified, only the specified callback will be unsubscribed. Otherwise, all callbacks will be unsubscribed. |
| needReconfirm | boolean | Yes | Whether re-confirmation of the wakeup result is needed. The value **true** indicates that re-confirmation is needed, and the value **false** indicates the opposite.|
| eventId | [WakeupIntelligentVoiceEventType](#wakeupintelligentvoiceeventtype) | Yes | Event type of the intelligent voice wakeup engine.|
| isSuccess | boolean | Yes | Wakeup result. The value **true** indicates that the wakeup is successful, and the value **false** indicates the opposite.|
| context | string | Yes | Context of the wakeup event.|
## EnrollIntelligentVoiceEngine
Class that implements the intelligent voice enrollment engine. Before use, you need to call [createEnrollIntelligentVoiceEngine()](#intelligentvoicecreateenrollintelligentvoiceengine) to obtain an instance of the intelligent voice enrollment engine.
| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the result, which is an array of supported countries/regions. Only China is supported currently, and the value is **CN**.|
| Promise<Array<string>> | Promise used to return the result, which is an array of supported countries/regions. Only China is supported currently, and the value is **CN**. |
| isLast | boolean | Yes | Whether this is the last enrollment. The value **value** indicates the last enrollment, and the value **false** indicates the opposite.|
| callback | AsyncCallback<[EnrollCallbackInfo](#enrollcallbackinfo)> | Yes | Callback used to return the result.|
| isLast | boolean | Yes | Whether this is the last enrollment. The value **value** indicates the last enrollment, and the value **false** indicates the opposite.|
| Promise<void> | Promise that returns no value. |
**Example**
```js
enrollIntelligentVoiceEngine.release().then(()=>{
console.info('Succeeded in releasing enrollIntelligentVoice engine.');
}).catch((err)=>{
console.error('Failed to release enrollIntelligentVoice engine, Code:${err.code}, message:${err.message}');
});
```
## WakeupIntelligentVoiceEngine
Class that implements the intelligent voice wakeup engine. Before use, you need to call [createWakeupIntelligentVoiceEngine()](#intelligentvoicecreatewakeupintelligentvoiceengine) to obtain an instance of the intelligent voice wakeup engine.
| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the result, which is an array of supported countries/regions. Only China is supported currently, and the value is **CN**.|
| Promise<Array<string>> | Promise used to return the result, which is an array of supported countries/regions. Only China is supported currently, and the value is **CN**. |
| type |string | Yes | Event type. This field has a fixed value of **wakeupIntelligentVoiceEvent**.|
| callback | Callback\<[WakeupIntelligentVoiceEngineCallbackInfo](#wakeupintelligentvoiceenginecallbackinfo)\> | No | Callback for processing of the wakeup event. If this parameter is specified, only the specified callback will be unsubscribed. Otherwise, all callbacks will be unsubscribed. |
Obtains the default proxy configuration of the network.
Obtains the default HTTP proxy configuration of the network.
If the global proxy is set, the global HTTP proxy configuration is returned. If [setAppNet](#connectionsetappnet) is used to bind the application to the network specified by [NetHandle](#nethandle), the HTTP proxy configuration of this network is returned. In other cases, the HTTP proxy configuration of the default network is returned.
| type | string | Yes | Event type. The value is fixed to**netAvailable**.<br>**netAvailable**: event indicating that the data network is available.|
| type | string | Yes | Event type. This field has a fixed value of**netAvailable**.<br>**netAvailable**: event indicating that the data network is available.|
| callback | Callback\<[NetHandle](#nethandle)> | Yes | Callback used to return the network handle.|
**Example**
...
...
@@ -1388,7 +1587,7 @@ Registers a listener for **netBlockStatusChange** events. This API uses an async
| type | string | Yes | Event type. The value is fixed to**netBlockStatusChange**.<br>**netBlockStatusChange**: event indicating a change in the network blocking status.|
| type | string | Yes | Event type. This field has a fixed value of**netBlockStatusChange**.<br>**netBlockStatusChange**: event indicating a change in the network blocking status.|
| callback | Callback<{ netHandle: [NetHandle](#nethandle), blocked: boolean }> | Yes | Callback used to return the network handle (**netHandle**) and network status (**blocked**).|
| type | string | Yes | Event type. The value is fixed to**netCapabilitiesChange**.<br>**netCapabilitiesChange**: event indicating that the network capabilities have changed.|
| callback | Callback<{netHandle:[NetHandle](#nethandle),netCap:[NetCapabilities](#netcapabilities)}> | Yes | Callback used to return the network handle (**netHandle**) and capability information (**netCap**).|
| type | string | Yes | Event type. This field has a fixed value of**netCapabilitiesChange**.<br>**netCapabilitiesChange**: event indicating that the network capabilities have changed.|
| callback | Callback<[NetCapabilityInfo](#netcapabilityinfo)> | Yes | Callback used to return the network handle (**netHandle**) and capability information (**netCap**).|
**Example**
...
...
@@ -1467,7 +1666,7 @@ Registers a listener for **netConnectionPropertiesChange** events.
| type | string | Yes | Event type. The value is fixed to**netConnectionPropertiesChange**.<br>**netConnectionPropertiesChange**: event indicating that network connection properties have changed.|
| type | string | Yes | Event type. This field has a fixed value of**netConnectionPropertiesChange**.<br>**netConnectionPropertiesChange**: event indicating that network connection properties have changed.|
| callback | Callback<{netHandle:[NetHandle](#nethandle),connectionProperties:[ConnectionProperties](#connectionproperties)}> | Yes | Callback used to return the network handle (**netHandle**) and connection information (**connectionProperties**).|
**Example**
...
...
@@ -1506,7 +1705,7 @@ Registers a listener for **netLost** events.
| type | string | Yes | Event type. The value is fixed to**netLost**.<br>netLost: event indicating that the network is interrupted or normally disconnected.|
| type | string | Yes | Event type. This field has a fixed value of**netLost**.<br>netLost: event indicating that the network is interrupted or normally disconnected.|
| callback | Callback\<[NetHandle](#nethandle)> | Yes | Callback used to return the network handle (**netHandle**).|
**Example**
...
...
@@ -1545,7 +1744,7 @@ Registers a listener for **netUnavailable** events.
| type | string | Yes | Event type. The value is fixed to**netUnavailable**.<br>**netUnavailable**: event indicating that the network is unavailable.|
| type | string | Yes | Event type. This field has a fixed value of**netUnavailable**.<br>**netUnavailable**: event indicating that the network is unavailable.|
| callback | Callback\<void> | Yes | Callback used to return the result, which is empty.|
**Example**
...
...
@@ -1950,6 +2149,17 @@ Provides an instance that bears data network capabilities.
| 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).|
## NetCapabilityInfo<sup>10+</sup>
Provides an instance that bears data network capabilities.
| type | string | Yes |Event type. This field has a fixed value of **discoveryStart**.<br>**discoveryStart**: event of starting discovery of mDNS services on the LAN.|
| callback | Callback<{serviceInfo:[LocalServiceInfo](#localserviceinfo),errorCode?:[MdnsError](#mdnserror)}> | No | Callback used to return the mDNS service and error information. |
| type | string | Yes |Event type. This field has a fixed value of **discoveryStop**.<br>**discoveryStop**: event of stopping discovery of mDNS services on the LAN.|
| callback | Callback<{serviceInfo:[LocalServiceInfo](#localserviceinfo),errorCode?:[MdnsError](#mdnserror)}> | No | Callback used to return the mDNS service and error information. |
Obtains the singular-plural string corresponding to the specified resource name based on the specified number. This API returns the result synchronously.
Obtains the content of the media file (with the default or specified screen density) corresponding to the specified resource ID. This API returns the result synchronously.
Obtains the media file content (with the default or specified screen density) corresponding to the specified resource ID. This API returns the result synchronously.
Obtains the content of the media file (with the default or specified screen density) corresponding to the specified resource object. This API returns the result synchronously.
Obtains the media file content (with the default or specified screen density) corresponding to the specified resource object. This API returns the result synchronously.
Obtains the media file content (with the default or specified screen density) corresponding to the specified resource name. This API returns the result synchronously.
Obtains the content of the media file (with the specified screen density) corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
Obtains the media file content (with the specified 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 specified screen density) corresponding to the specified resource ID. This API uses a promise to return the result.
Obtains the media file content (with the specified 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 specified screen density) corresponding to the specified resource object. This API uses an asynchronous callback to return the result.
Obtains the media file content (with the specified 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 specified screen density) corresponding to the specified resource object. This API uses a promise to return the result.
Obtains the media file content (with the specified 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 specified screen density) corresponding to the specified resource ID. This API uses an asynchronous callback to return the result.
Obtains the media file content (with the specified 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 specified screen density) corresponding to the specified resource name. This API uses a promise to return the result.
Obtains the media file content (with the specified screen density) corresponding to the specified resource name. This API uses a promise to return the result.
The **update** module applies to updates throughout the entire system, including built-in resources and preset applications, but not third-party applications.
The **update** module implements update of the entire system, including built-in resources and preset applications, but not third-party applications.
There are two types of updates: SD card update and over the air (OTA) update.
Two upate modes, namely, SD card update and OTA (over the air) update.
- The SD card update depends on the update packages and SD cards.
- The OTA update depends on the server deployed by the device manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the device manufacturer.
> **NOTE**
...
...
@@ -31,7 +32,7 @@ Obtains an **OnlineUpdater** object.
| isExistNewVersion | bool | Yes | Whether a new version is available.|
| isExistNewVersion | boolean | Yes | Whether a new version is available.<br>The value **true** indicates that a new version is available, and the value **false** indicates the opposite.|
| newVersionInfo | [NewVersionInfo](#newversioninfo) | No | Information about the new version. |
## NewVersionInfo
...
...
@@ -1712,7 +1715,7 @@ Represents a version component.
| descriptionInfo | [DescriptionInfo](#descriptioninfo) | Yes | Information about the version description file.|
...
...
@@ -1790,7 +1793,7 @@ Represents options for pausing download.
| Name | Type| Mandatory | Description |
| ----------------- | ---- | ---- | -------- |
| isAllowAutoResume | bool | Yes | Whether to allow automatic resuming of download.|
| isAllowAutoResume | boolean | Yes | Whether to allow automatic resuming of download.<br>The value **true** indicates that automatic resuming is allowed, and the value **false** indicates the opposite.|
## UpgradeOptions
...
...
@@ -1820,8 +1823,8 @@ Represents an update policy.
| downloadStrategy | boolean | Yes | Automatic download policy.<br>The value **true** indicates that automatic download is supported, and the value **false** indicates the opposite.|
| autoUpgradeStrategy | boolean | Yes | Automatic update policy.<br>The value **true** indicates that automatic update is supported, and the value **false** indicates the opposite.|
| existTask | boolean | Yes | Whether a task exists.<br>The value **true** indicates that the task exists, and the value **false** indicates the opposite.|
Requests the temporary permission for the application to access a USB device. This API uses a promise to return the result.
Requests the temporary permission for the application to access a USB device. This API uses a promise to return the result. System applications are granted the device access permission by default, and you do not need to apply for the permission separately.
Requests the temporary permission for the application to access a USB device. This API uses a promise to return the result.
Requests the temporary device access permission for the application. This API uses a promise to return the result. System applications are granted the device access permission by default, and you do not need to apply for the permission separately.
Removes the permission for the application to access a USB device.
Removes the device access permission for the application. System applications are granted the device access permission by default, and calling this API will not revoke the permission.
Adds the permission for the application to access a USB device.
Adds the device access permission for the application. System applications are granted the device access permission by default, and calling this API will not revoke the permission.
[requestRight](#usbrequestright) triggers a dialog box to request for user authorization, whereas **addRight** adds the access permission directly without displaying a dialog box.
| type | string | Yes | Event type. <br/>**close**: event indicating that a WebSocket connection has been closed.|
| callback | AsyncCallback\<{ code: number, reason: string }\> | Yes | Callback used to return the result.<br>**close** indicates the close error code and **reason** indicates the error code description.|
| callback | AsyncCallback\<CloseResult\> | Yes | Callback used to return the result.<br>**close** indicates the close error code and **reason** indicates the error code description.|
| type | string | Yes | Event type. <br/>**close**: event indicating that a WebSocket connection has been closed.|
| callback | AsyncCallback\<{ code: number, reason: string }\> | No | Callback used to return the result.<br>**close** indicates the close error code and **reason** indicates the error code description.|
| callback | AsyncCallback\<CloseResult\> | No | Callback used to return the result.<br>**close** and **reason** indicate the error code and error cause for closing the connection, respectively.|
**Example**
...
...
@@ -655,6 +655,17 @@ Defines the optional parameters carried in the request for closing a WebSocket c
| code | number | No | Error code. Set this parameter based on the actual situation. The default value is **1000**.|
| reason | string | No | Error cause. Set this parameter based on the actual situation. The default value is an empty string ("").|
## CloseResult<sup>10+</sup>
Represents the result obtained from the **close** event reported when the WebSocket connection is closed.
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 22700101 Insufficient Memory
**Error Message**
No memory.
**Error Description**
This error code is reported if a memory allocation failure or null pointer occurs when an API is called.
**Possible Causes**
1. The system does not have sufficient memory for mapping.
2. Invalid instances are not destroyed in time to release the memory.
**Solution**
1. Stop the current operation or suspend other applications to free up memory.
2. Clear invalid instances to free up memory, and then create new instances as needed. If the problem persists, stop related operations.
## 22700102 Invalid Parameter
**Error Message**
Input parameter value error.
**Error Description**
This error code is reported if a certain parameter passed in the API is invalid.
**Possible Cause**
The parameter is invalid. For example, the parameter value is not within the range supported.
**Solution**
Pass the correct parameters in the API.
## 22700103 Initialization Failed
**Error Message**
Init failed.
**Error Description**
This error code is reported if an error occurs while the enrollment engine is initialized.
**Possible Cause**
1. Repeated initialization.
2. Lack of resources for initialization of the enrollment engine.
**Solution**
1. Avoid performing initialization repeatedly.
2. Ensure that the resources required for initialization, such as acoustic model files, are ready.
## 22700104 Enrollment Commit Failure
**Error Message**
Commit enroll failed.
**Error Description**
This error code is reported if an error occurs after the [commit()](../apis/js-apis-intelligentVoice.md#commit) API of the enrollment engine is called.
**Possible Cause**
The specified number of enrollment procedures are not completed.
**Solution**
Commit the enrollment after the specified number of enrollment procedures are completed.