提交 896f1ea4 编写于 作者: L luo-wei246

fix:Document Format refresh

Signed-off-by: Nluo-wei246 <luowei137@huawei.com>
上级 e475a982
...@@ -209,8 +209,8 @@ Removes the permission for the application to access a USB device. ...@@ -209,8 +209,8 @@ Removes the permission for the application to access a USB device.
**Example** **Example**
```js ```js
let devicesName="1-1"; let devicesName= "1-1";
if usb.removeRight(devicesName) { if (usb.removeRight(devicesName)) {
console.log(`Succeed in removing right`); console.log(`Succeed in removing right`);
} }
``` ```
...@@ -245,7 +245,7 @@ Adds the permission for the application to access a USB device. ...@@ -245,7 +245,7 @@ Adds the permission for the application to access a USB device.
```js ```js
let devicesName = "1-1"; let devicesName = "1-1";
let bundleName = "com.example.hello"; let bundleName = "com.example.hello";
if usb.addRight(bundleName, devicesName) { if (usb.addRight(bundleName, devicesName)) {
console.log(`Succeed in adding right`); console.log(`Succeed in adding right`);
} }
``` ```
...@@ -454,7 +454,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ...@@ -454,7 +454,14 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi
**Example** **Example**
```js ```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) => { usb.controlTransfer(devicepipe, param).then((ret) => {
console.log(`controlTransfer = ${ret}`); console.log(`controlTransfer = ${ret}`);
}) })
...@@ -579,7 +586,7 @@ Converts the USB function list in the numeric mask format to a string in Device ...@@ -579,7 +586,7 @@ Converts the USB function list in the numeric mask format to a string in Device
**Example** **Example**
```js ```js
let funcs = usb.ACM | usb.ECM; let funcs = usb.FunctionType.ACM | usb.FunctionType.ECM;
let ret = usb.usbFunctionsToString(funcs); let ret = usb.usbFunctionsToString(funcs);
``` ```
...@@ -608,7 +615,7 @@ Sets the current USB function list in Device mode. ...@@ -608,7 +615,7 @@ Sets the current USB function list in Device mode.
**Example** **Example**
```js ```js
let funcs = usb.HDC; let funcs = usb.FunctionType.HDC;
usb.setCurrentFunctions(funcs).then(() => { usb.setCurrentFunctions(funcs).then(() => {
console.info('usb setCurrentFunctions successfully.'); console.info('usb setCurrentFunctions successfully.');
}).catch(err => { }).catch(err => {
......
...@@ -209,8 +209,8 @@ removeRight(deviceName: string): boolean ...@@ -209,8 +209,8 @@ removeRight(deviceName: string): boolean
**示例:** **示例:**
```js ```js
let devicesName="1-1"; let devicesName= "1-1";
if usb.removeRight(devicesName) { if (usb.removeRight(devicesName)) {
console.log(`Succeed in removing right`); console.log(`Succeed in removing right`);
} }
``` ```
...@@ -245,7 +245,7 @@ addRight(bundleName: string, deviceName: string): boolean ...@@ -245,7 +245,7 @@ addRight(bundleName: string, deviceName: string): boolean
```js ```js
let devicesName = "1-1"; let devicesName = "1-1";
let bundleName = "com.example.hello"; let bundleName = "com.example.hello";
if usb.addRight(bundleName, devicesName) { if (usb.addRight(bundleName, devicesName)) {
console.log(`Succeed in adding right`); console.log(`Succeed in adding right`);
} }
``` ```
...@@ -454,7 +454,14 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: ...@@ -454,7 +454,14 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?:
**示例:** **示例:**
```js ```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) => { usb.controlTransfer(devicepipe, param).then((ret) => {
console.log(`controlTransfer = ${ret}`); console.log(`controlTransfer = ${ret}`);
}) })
...@@ -579,7 +586,7 @@ usbFunctionsToString(funcs: FunctionType): string ...@@ -579,7 +586,7 @@ usbFunctionsToString(funcs: FunctionType): string
**示例:** **示例:**
```js ```js
let funcs = usb.ACM | usb.ECM; let funcs = usb.FunctionType.ACM | usb.FunctionType.ECM;
let ret = usb.usbFunctionsToString(funcs); let ret = usb.usbFunctionsToString(funcs);
``` ```
...@@ -608,7 +615,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\<void\> ...@@ -608,7 +615,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\<void\>
**示例:** **示例:**
```js ```js
let funcs = usb.HDC; let funcs = usb.FunctionType.HDC;
usb.setCurrentFunctions(funcs).then(() => { usb.setCurrentFunctions(funcs).then(() => {
console.info('usb setCurrentFunctions successfully.'); console.info('usb setCurrentFunctions successfully.');
}).catch(err => { }).catch(err => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册