本文整理汇总了TypeScript中usb.Device类的典型用法代码示例。如果您正苦于以下问题:TypeScript Device类的具体用法?TypeScript Device怎么用?TypeScript Device使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Device类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1:
import * as usb from "usb";
const device = new usb.Device();
device.timeout = 1;
device.busNumber = 1;
device.deviceAddress = 1;
device.portNumbers = [1, 2, 3];
device.__open();
device.__claimInterface(0);
device.open(true);
device.close();
const xferDevice: usb.Device = device.controlTransfer(1, 1, 1, 1, 1, (error: string, buf: Buffer): usb.Device => new usb.Device());
device.getStringDescriptor(1, (error: string, buf: Buffer) => null);
device.setConfiguration(1, (error: string) => null);
device.reset((error: string) => null);
const deviceDesc: usb.DeviceDescriptor = new usb.DeviceDescriptor();
deviceDesc.bLength = 1;
deviceDesc.bDescriptorType = 1;
deviceDesc.bcdUSB = 1;
deviceDesc.bDeviceClass = 1;
deviceDesc.bDeviceSubClass = 1;
deviceDesc.bDeviceProtocol = 1;
deviceDesc.bMaxPacketSize = 1;
deviceDesc.idVendor = 1;
deviceDesc.idProduct = 1;
deviceDesc.bcdDevice = 1;
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:31,代码来源:usb-tests.ts
示例2:
import * as usb from "usb";
const device = new usb.Device();
device.timeout = 1;
device.busNumber = 1;
device.deviceAddress = 1;
device.portNumbers = [1, 2, 3];
device.__open();
device.__claimInterface(0);
device.open(true);
device.close();
const xferDevice: usb.Device = device.controlTransfer(1, 1, 1, 1, 1, (error: usb.LibUSBException, buf: Buffer): usb.Device => new usb.Device());
device.getStringDescriptor(1, (error: string, buf: Buffer) => null);
device.getBosDescriptor((error: string, descriptor: usb.BosDescriptor) => null);
device.getCapabilities((error: string, capabilities: usb.Capability[]) => null);
device.setConfiguration(1, (error: string) => null);
device.reset((error: string) => null);
const deviceDesc: usb.DeviceDescriptor = new usb.DeviceDescriptor();
deviceDesc.bLength = 1;
deviceDesc.bDescriptorType = 1;
deviceDesc.bcdUSB = 1;
deviceDesc.bDeviceClass = 1;
deviceDesc.bDeviceSubClass = 1;
deviceDesc.bDeviceProtocol = 1;
deviceDesc.bMaxPacketSize0 = 1;
deviceDesc.idVendor = 1;
开发者ID:MrBigDog2U,项目名称:DefinitelyTyped,代码行数:31,代码来源:usb-tests.ts
注:本文中的usb.Device类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论