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


TypeScript OutEndpoint.transfer方法代码示例

本文整理汇总了TypeScript中usb.OutEndpoint.transfer方法的典型用法代码示例。如果您正苦于以下问题:TypeScript OutEndpoint.transfer方法的具体用法?TypeScript OutEndpoint.transfer怎么用?TypeScript OutEndpoint.transfer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在usb.OutEndpoint的用法示例。


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

示例1: Buffer

const inEndpoint: usb.InEndpoint = new usb.InEndpoint(device, endpointDesc);

inEndpoint.direction = "in";
inEndpoint.transferType = 1;
inEndpoint.timeout = 1;
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;
开发者ID:ArtemZag,项目名称:DefinitelyTyped,代码行数:31,代码来源:usb-tests.ts

示例2: Buffer

inEndpoint.descriptor = endpointDesc;
const xferInEndpoint: usb.InEndpoint = inEndpoint.transfer(1, (error: usb.LibUSBException, data: Buffer) => inEndpoint);
inEndpoint.on("data", (data) => null);
inEndpoint.startPoll(1, 1);
inEndpoint.startPoll(1);
inEndpoint.startPoll();
inEndpoint.stopPoll(() => null);
inEndpoint.stopPoll();

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;
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:31,代码来源:usb-tests.ts


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