From 430fe35ad9921769150fd3271748c5f45d05ac04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Thu, 24 Jul 2025 08:22:32 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=8F=E8=BF=B0=E8=A7=84=E8=8C=83=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- api/@ohos.usbManager.d.ts | 2 +- api/@ohos.usbManager.serial.d.ts | 52 +++++++++++++++++++++----------- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/api/@ohos.usbManager.d.ts b/api/@ohos.usbManager.d.ts index ab4f915f81..b2139a3bf1 100644 --- a/api/@ohos.usbManager.d.ts +++ b/api/@ohos.usbManager.d.ts @@ -2375,7 +2375,7 @@ declare namespace usbManager { * @returns { boolean } If the restart operation is successful, return {@code true}; if the restart operation fails, return {@code false}. * @throws { BusinessError } 801 - Capability not supported. * @throws { BusinessError } 14400001 - Access right denied. Call requestRight to get the USBDevicePipe access right first. - * @throws { BusinessError } 14400004 -Service exception. Possible causes: 1. No accessory is plugged in.. + * @throws { BusinessError } 14400004 -Service exception. Possible causes: 1. No accessory is plugged in. * @throws { BusinessError } 14400008 - No such device(it may have been disconnected) * @throws { BusinessError } 14400010 - Other USB error. Possible causes: *
1.Unrecognized discard error code. diff --git a/api/@ohos.usbManager.serial.d.ts b/api/@ohos.usbManager.serial.d.ts index 621b6a5918..f66402b2ee 100644 --- a/api/@ohos.usbManager.serial.d.ts +++ b/api/@ohos.usbManager.serial.d.ts @@ -38,7 +38,8 @@ declare namespace serialManager { * Checks whether a serial port device has the access right. The system applications have the access right by default. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @returns {boolean} Returns true if the device has the right; returns false otherwise. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14400005 Database operation exception. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. @@ -50,8 +51,11 @@ declare namespace serialManager { /** * Requests the right for accessing a serial port device from the user. The system applications do not need to call this API. * @param { number} portId ID of the target device. For details, see SerialPort.portId. - * @returns { Promise} Promise used to return the result. The value true means the user allows the access; the value false means the opposite. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @returns { Promise} Promise used to return the result. + * The value true means the user allows the access; + * the value false means the opposite. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14400005 Database operation exception. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. @@ -67,7 +71,8 @@ declare namespace serialManager { * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @throws { BusinessError } 201 Permission verification failed. The application does not have the permission required to call the API. * @throws { BusinessError } 202 Permission verification failed. A non-system application calls a system API. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14400005 Database operation exception. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. @@ -80,7 +85,8 @@ declare namespace serialManager { /** * Cancels the access right for a serial port device. This API will not cancel the default access right of system applications. * @param { number} portId ID of the target device. For details, see SerialPort.portId. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 14400005 Database operation exception. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400002 Access denied. Call requestSerialRight to request user authorization first. @@ -93,7 +99,8 @@ declare namespace serialManager { /** * Opens a serial port device. * @param { number} portId ID of the target device. For details, see SerialPort.portId. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400002 Access denied. Call requestSerialRight to request user authorization first. * @throws { BusinessError } 31400003 PortId does not exist. @@ -106,7 +113,8 @@ declare namespace serialManager { /** * Closes a serial port device. * @param { number} portId ID of the target device. For details, see SerialPort.portId. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. * @throws { BusinessError } 31400005 The serial port device is not opened. Call the open API first. @@ -119,7 +127,8 @@ declare namespace serialManager { * Obtains the communication parameters of a serial port device. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @returns { Readonly} Communication parameters obtained, which are read-only. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. * @throws { BusinessError } 31400005 The serial port device is not opened. Call the open API first. @@ -132,7 +141,8 @@ declare namespace serialManager { * Sets the communication parameters for a serial port device. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { SerialAttribute} attribute Communication parameters to set. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. * @throws { BusinessError } 31400005 The serial port device is not opened. Call the open API first. @@ -145,9 +155,11 @@ declare namespace serialManager { * Reads data from a serial port device. This API uses a promise to return the result. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { Uint8Array } buffer Buffer for storing the data read, with a maximum length of 8192 bytes. - * @param { number } timeout Timeout duration for reading data. The value is a non-negative number. The default value 0 indicates that there is no time limit for data reading. + * @param { number } timeout Timeout duration for reading data. The value is a non-negative number. + * The default value 0 indicates that there is no time limit for data reading. * @returns { Promise } Promise used to return the length of the data read. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. * @throws { BusinessError } 31400005 The serial port device is not opened. Call the open API first. @@ -164,9 +176,11 @@ declare namespace serialManager { * Reads data from a serial port device. This API returns the result synchronously. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { Uint8Array } buffer Buffer for storing the data read, with a maximum length of 8192 bytes. - * @param { number } timeout Timeout duration for reading data. The value is a non-negative number. The default value 0 indicates that there is no time limit for data reading. + * @param { number } timeout Timeout duration for reading data. The value is a non-negative number. + * The default value 0 indicates that there is no time limit for data reading. * @returns {number} Length of the data read. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. * @throws { BusinessError } 31400005 The serial port device is not opened. Call the open API first. @@ -183,9 +197,11 @@ declare namespace serialManager { * Writes data to a serial port device. This API uses a promise to return the result. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { Uint8Array } buffer Buffer for storing the data written, with a maximum length of 128 KB. - * @param { number } timeout Timeout duration for writing data. The value is a non-negative number. The default value 0 indicates that there is no time limit for data writing. + * @param { number } timeout Timeout duration for writing data. The value is a non-negative number. + * The default value 0 indicates that there is no time limit for data writing. * @returns { Promise } Promise used to return the length of the data written. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. * @throws { BusinessError } 31400005 The serial port device is not opened. Call the open API first. @@ -202,9 +218,11 @@ declare namespace serialManager { * Writes data to a serial port device. This API returns the result synchronously. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { Uint8Array } buffer Buffer for storing the data written, with a maximum length of 128 KB. - * @param { number } timeout Timeout duration for writing data. The value is a non-negative number. The default value 0 indicates that there is no time limit for data writing. + * @param { number } timeout Timeout duration for writing data. The value is a non-negative number. + * The default value 0 indicates that there is no time limit for data writing. * @returns { number } Length of the data written. - * @throws { BusinessError } 401 Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. + * @throws { BusinessError } 401 Parameter error. Possible causes: + * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. * @throws { BusinessError } 31400001 Serial port management exception. * @throws { BusinessError } 31400003 PortId does not exist. * @throws { BusinessError } 31400005 The serial port device is not opened. Call the open API first. -- Gitee From 97746ac89c43a7ffc0d9641c2377e7f1f9bc430c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E4=B8=B0?= Date: Thu, 24 Jul 2025 09:46:14 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=83=A8=E5=88=86?= =?UTF-8?q?=E6=8E=A5=E5=8F=A3=E6=8F=8F=E8=BF=B0=E8=A7=84=E8=8C=83=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 刘丰 --- api/@ohos.usbManager.serial.d.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/api/@ohos.usbManager.serial.d.ts b/api/@ohos.usbManager.serial.d.ts index f66402b2ee..5835faf219 100644 --- a/api/@ohos.usbManager.serial.d.ts +++ b/api/@ohos.usbManager.serial.d.ts @@ -52,7 +52,7 @@ declare namespace serialManager { * Requests the right for accessing a serial port device from the user. The system applications do not need to call this API. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @returns { Promise} Promise used to return the result. - * The value true means the user allows the access; + * The value true means the user allows the access; * the value false means the opposite. * @throws { BusinessError } 401 Parameter error. Possible causes: * 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. @@ -155,7 +155,7 @@ declare namespace serialManager { * Reads data from a serial port device. This API uses a promise to return the result. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { Uint8Array } buffer Buffer for storing the data read, with a maximum length of 8192 bytes. - * @param { number } timeout Timeout duration for reading data. The value is a non-negative number. + * @param { number } timeout Timeout duration for reading data. The value is a non-negative number. * The default value 0 indicates that there is no time limit for data reading. * @returns { Promise } Promise used to return the length of the data read. * @throws { BusinessError } 401 Parameter error. Possible causes: @@ -176,7 +176,7 @@ declare namespace serialManager { * Reads data from a serial port device. This API returns the result synchronously. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { Uint8Array } buffer Buffer for storing the data read, with a maximum length of 8192 bytes. - * @param { number } timeout Timeout duration for reading data. The value is a non-negative number. + * @param { number } timeout Timeout duration for reading data. The value is a non-negative number. * The default value 0 indicates that there is no time limit for data reading. * @returns {number} Length of the data read. * @throws { BusinessError } 401 Parameter error. Possible causes: @@ -197,7 +197,7 @@ declare namespace serialManager { * Writes data to a serial port device. This API uses a promise to return the result. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { Uint8Array } buffer Buffer for storing the data written, with a maximum length of 128 KB. - * @param { number } timeout Timeout duration for writing data. The value is a non-negative number. + * @param { number } timeout Timeout duration for writing data. The value is a non-negative number. * The default value 0 indicates that there is no time limit for data writing. * @returns { Promise } Promise used to return the length of the data written. * @throws { BusinessError } 401 Parameter error. Possible causes: @@ -218,7 +218,7 @@ declare namespace serialManager { * Writes data to a serial port device. This API returns the result synchronously. * @param { number} portId ID of the target device. For details, see SerialPort.portId. * @param { Uint8Array } buffer Buffer for storing the data written, with a maximum length of 128 KB. - * @param { number } timeout Timeout duration for writing data. The value is a non-negative number. + * @param { number } timeout Timeout duration for writing data. The value is a non-negative number. * The default value 0 indicates that there is no time limit for data writing. * @returns { number } Length of the data written. * @throws { BusinessError } 401 Parameter error. Possible causes: -- Gitee