当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript usb.getDeviceList函数代码示例

本文整理汇总了TypeScript中usb.getDeviceList函数的典型用法代码示例。如果您正苦于以下问题:TypeScript getDeviceList函数的具体用法?TypeScript getDeviceList怎么用?TypeScript getDeviceList使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getDeviceList函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: Buffer

inEndpoint.descriptor = endpointDesc;
const xferInEndpoint: usb.InEndpoint = inEndpoint.transfer(1, (error: string, data: Buffer) => { return inEndpoint; });
inEndpoint.startPoll(1, 1);
inEndpoint.stopPoll(() => null);

const outEndpoint: usb.OutEndpoint = new usb.OutEndpoint(device, endpointDesc);
outEndpoint.direction = "out";
outEndpoint.transferType = 1;
outEndpoint.timeout = 1;
outEndpoint.descriptor = endpointDesc;
const xferOutEndpoint: usb.OutEndpoint = outEndpoint.transfer(new Buffer([]), (error: string) => null);
outEndpoint.transferWithZLP(new Buffer([]), (error: string) => null);

const findByDevice: usb.Device = usb.findByIds(1, 1);
usb.on("hey", (device: usb.Device) => null);
const deviceList: Array<usb.Device> = usb.getDeviceList();
usb.setDebugLevel(1);

const CHECK_LIBUSB_CLASS_PER_INTERFACE: number = usb.LIBUSB_CLASS_PER_INTERFACE;
const CHECK_LIBUSB_CLASS_AUDIO: number = usb.LIBUSB_CLASS_AUDIO;
const CHECK_LIBUSB_CLASS_COMM: number = usb.LIBUSB_CLASS_COMM;
const CHECK_LIBUSB_CLASS_HID: number = usb.LIBUSB_CLASS_HID;
const CHECK_LIBUSB_CLASS_PRINTER: number = usb.LIBUSB_CLASS_PRINTER;
const CHECK_LIBUSB_CLASS_PTP: number = usb.LIBUSB_CLASS_PTP;
const CHECK_LIBUSB_CLASS_MASS_STORAGE: number = usb.LIBUSB_CLASS_MASS_STORAGE;
const CHECK_LIBUSB_CLASS_HUB: number = usb.LIBUSB_CLASS_HUB;
const CHECK_LIBUSB_CLASS_DATA: number = usb.LIBUSB_CLASS_DATA;
const CHECK_LIBUSB_CLASS_WIRELESS: number = usb.LIBUSB_CLASS_WIRELESS;
const CHECK_LIBUSB_CLASS_APPLICATION: number = usb.LIBUSB_CLASS_APPLICATION;
const CHECK_LIBUSB_CLASS_VENDOR_SPEC: number = usb.LIBUSB_CLASS_VENDOR_SPEC;
// libusb_standard_request
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:31,代码来源:usb-tests.ts

示例2: Buffer

const outEndpoint: usb.OutEndpoint = new usb.OutEndpoint(device, endpointDesc);
outEndpoint.direction = "out";
outEndpoint.transferType = 1;
outEndpoint.timeout = 1;
outEndpoint.descriptor = endpointDesc;
inEndpoint.on("error", (err) => null);
const xferOutEndpoint: usb.OutEndpoint = outEndpoint.transfer(new Buffer([]), (error: usb.LibUSBException) => null);
outEndpoint.transferWithZLP(new Buffer([]), (error: usb.LibUSBException) => null);

iface.endpoints = [inEndpoint, outEndpoint];

const findByDevice: usb.Device = usb.findByIds(1, 1);
usb.on("hey", (device: usb.Device) => null);
usb.removeListener("hey", (device: usb.Device) => null);
const deviceList: usb.Device[] = usb.getDeviceList();
usb.setDebugLevel(1);

const CHECK_LIBUSB_CLASS_PER_INTERFACE: number = usb.LIBUSB_CLASS_PER_INTERFACE;
const CHECK_LIBUSB_CLASS_AUDIO: number = usb.LIBUSB_CLASS_AUDIO;
const CHECK_LIBUSB_CLASS_COMM: number = usb.LIBUSB_CLASS_COMM;
const CHECK_LIBUSB_CLASS_HID: number = usb.LIBUSB_CLASS_HID;
const CHECK_LIBUSB_CLASS_PRINTER: number = usb.LIBUSB_CLASS_PRINTER;
const CHECK_LIBUSB_CLASS_PTP: number = usb.LIBUSB_CLASS_PTP;
const CHECK_LIBUSB_CLASS_MASS_STORAGE: number = usb.LIBUSB_CLASS_MASS_STORAGE;
const CHECK_LIBUSB_CLASS_HUB: number = usb.LIBUSB_CLASS_HUB;
const CHECK_LIBUSB_CLASS_DATA: number = usb.LIBUSB_CLASS_DATA;
const CHECK_LIBUSB_CLASS_WIRELESS: number = usb.LIBUSB_CLASS_WIRELESS;
const CHECK_LIBUSB_CLASS_APPLICATION: number = usb.LIBUSB_CLASS_APPLICATION;
const CHECK_LIBUSB_CLASS_VENDOR_SPEC: number = usb.LIBUSB_CLASS_VENDOR_SPEC;
// libusb_standard_request
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:30,代码来源:usb-tests.ts


注:本文中的usb.getDeviceList函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。