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. |
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. |
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.