From 896f1ea48b1e73b68e30764636f53ef4e44a118f Mon Sep 17 00:00:00 2001 From: luo-wei246 Date: Wed, 17 May 2023 22:39:44 -0700 Subject: [PATCH] fix:Document Format refresh Signed-off-by: luo-wei246 --- .../reference/apis/js-apis-usbManager.md | 19 +++++++++++++------ .../reference/apis/js-apis-usbManager.md | 19 +++++++++++++------ 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/en/application-dev/reference/apis/js-apis-usbManager.md b/en/application-dev/reference/apis/js-apis-usbManager.md index 211a623cce..ac6de75dd0 100644 --- a/en/application-dev/reference/apis/js-apis-usbManager.md +++ b/en/application-dev/reference/apis/js-apis-usbManager.md @@ -209,8 +209,8 @@ Removes the permission for the application to access a USB device. **Example** ```js -let devicesName="1-1"; -if usb.removeRight(devicesName) { +let devicesName= "1-1"; +if (usb.removeRight(devicesName)) { console.log(`Succeed in removing right`); } ``` @@ -245,7 +245,7 @@ Adds the permission for the application to access a USB device. ```js let devicesName = "1-1"; let bundleName = "com.example.hello"; -if usb.addRight(bundleName, devicesName) { +if (usb.addRight(bundleName, devicesName)) { console.log(`Succeed in adding right`); } ``` @@ -454,7 +454,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js -let param = new usb.USBControlParams(); +let param = { + request: 0, + reqType: 0, + target:0, + value: 0, + index: 0, + data: null +}; usb.controlTransfer(devicepipe, param).then((ret) => { console.log(`controlTransfer = ${ret}`); }) @@ -579,7 +586,7 @@ Converts the USB function list in the numeric mask format to a string in Device **Example** ```js -let funcs = usb.ACM | usb.ECM; +let funcs = usb.FunctionType.ACM | usb.FunctionType.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -608,7 +615,7 @@ Sets the current USB function list in Device mode. **Example** ```js -let funcs = usb.HDC; +let funcs = usb.FunctionType.HDC; usb.setCurrentFunctions(funcs).then(() => { console.info('usb setCurrentFunctions successfully.'); }).catch(err => { diff --git a/zh-cn/application-dev/reference/apis/js-apis-usbManager.md b/zh-cn/application-dev/reference/apis/js-apis-usbManager.md index 5b8d67b962..4d4b694f7d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-usbManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-usbManager.md @@ -209,8 +209,8 @@ removeRight(deviceName: string): boolean **示例:** ```js -let devicesName="1-1"; -if usb.removeRight(devicesName) { +let devicesName= "1-1"; +if (usb.removeRight(devicesName)) { console.log(`Succeed in removing right`); } ``` @@ -245,7 +245,7 @@ addRight(bundleName: string, deviceName: string): boolean ```js let devicesName = "1-1"; let bundleName = "com.example.hello"; -if usb.addRight(bundleName, devicesName) { +if (usb.addRight(bundleName, devicesName)) { console.log(`Succeed in adding right`); } ``` @@ -454,7 +454,14 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: **示例:** ```js -let param = new usb.USBControlParams(); +let param = { + request: 0, + reqType: 0, + target:0, + value: 0, + index: 0, + data: null +}; usb.controlTransfer(devicepipe, param).then((ret) => { console.log(`controlTransfer = ${ret}`); }) @@ -579,7 +586,7 @@ usbFunctionsToString(funcs: FunctionType): string **示例:** ```js -let funcs = usb.ACM | usb.ECM; +let funcs = usb.FunctionType.ACM | usb.FunctionType.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -608,7 +615,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\ **示例:** ```js -let funcs = usb.HDC; +let funcs = usb.FunctionType.HDC; usb.setCurrentFunctions(funcs).then(() => { console.info('usb setCurrentFunctions successfully.'); }).catch(err => { -- GitLab