diff --git a/zh-cn/application-dev/device/usb-guidelines.md b/zh-cn/application-dev/device/usb-guidelines.md index 4743a90dd8a3bd7b072054c19fd00bd5b314f2ff..8c836de6508cd2a01eeb76f4a74b93bba695db9c 100644 --- a/zh-cn/application-dev/device/usb-guidelines.md +++ b/zh-cn/application-dev/device/usb-guidelines.md @@ -17,19 +17,19 @@ USB类开放能力如下,具体请查阅[API参考文档](../reference/apis/js | 接口名 | 描述 | | -------- | -------- | -| hasRight(deviceName: string): boolean | 如果“使用者”(如各种App或系统)有权访问设备则返回true;无权访问设备则返回false。 | -| requestRight(deviceName: string): Promise<boolean> | 请求给定软件包的临时权限以访问设备。 | -| connectDevice(device: USBDevice): Readonly<USBDevicePipe> | 根据getDevices()返回的设备信息打开USB设备。 | -| getDevices(): Array<Readonly<USBDevice>> | 返回USB设备的列表。 | -| setConfiguration(pipe: USBDevicePipe, config: USBConfig): number | 设置设备的配置。 | -| setInterface(pipe: USBDevicePipe, iface: USBInterface): number | 设置设备的接口。 | -| claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number | 获取接口。 | -|bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout?: number): Promise<number> | 批量传输。 | -| closePipe(pipe: USBDevicePipe): number | 关闭设备消息控制通道。 | -| releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number | 释放接口。 | -| getFileDescriptor(pipe: USBDevicePipe): number | 获取文件描述符。 | -| getRawDescriptor(pipe: USBDevicePipe): Uint8Array | 获取原始的USB描述符。 | -| controlTransfer(pipe: USBDevicePipe, contrlparam: USBControlParams, timeout?: number): Promise<number> | 控制传输。 | +| hasRight(deviceName:string):boolean | 如果“使用者”(如各种App或系统)有权访问设备则返回true;无权访问设备则返回false。 | +| requestRight(deviceName:string):Promise<boolean> | 请求给定软件包的临时权限以访问设备。 | +| connectDevice(device:USBDevice):Readonly<USBDevicePipe> | 根据`getDevices()`返回的设备信息打开USB设备。 | +| getDevices():Array<Readonly<USBDevice>> | 返回USB设备列表。 | +| setConfiguration(pipe:USBDevicePipe,config:USBConfig):number | 设置设备的配置。 | +| setInterface(pipe:USBDevicePipe,iface:USBInterface):number | 设置设备的接口。 | +| claimInterface(pipe:USBDevicePipe,iface:USBInterface,force?:boolean):number | 获取接口。 | +|bulkTransfer(pipe:USBDevicePipe,endpoint:USBEndpoint,buffer:Uint8Array,timeout?:number):Promise<number> | 批量传输。 | +| closePipe(pipe:USBDevicePipe):number | 关闭设备消息控制通道。 | +| releaseInterface(pipe:USBDevicePipe,iface:USBInterface):number | 释放接口。 | +| getFileDescriptor(pipe:USBDevicePipe):number | 获取文件描述符。 | +| getRawDescriptor(pipe:USBDevicePipe):Uint8Array | 获取原始的USB描述符。 | +| controlTransfer(pipe:USBDevicePipe,contrlparam:USBControlParams,timeout?:number):Promise<number> | 控制传输。 | ## 开发步骤 @@ -115,7 +115,7 @@ USB设备可作为Host设备连接Device设备进行数据传输。开发示例 打开对应接口,在设备信息(deviceList)中选取对应的interface。 interface1为设备配置中的一个接口。 */ - usb.claimInterface(pipe , interface1, true); + usb.claimInterface(pipe, interface1, true); ``` 4. 数据传输。