當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript usb.InEndpoint類代碼示例

本文整理匯總了TypeScript中usb.InEndpoint的典型用法代碼示例。如果您正苦於以下問題:TypeScript InEndpoint類的具體用法?TypeScript InEndpoint怎麽用?TypeScript InEndpoint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了InEndpoint類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: Buffer

const endpointDesc: usb.EndpointDescriptor = new usb.EndpointDescriptor();

endpointDesc.bLength = 1;
endpointDesc.bDescriptorType = 1;
endpointDesc.bEndpointAddress = 1;
endpointDesc.bmAttributes = 1;
endpointDesc.wMaxPacketSize = 1;
endpointDesc.bInterval = 1;
endpointDesc.bRefresh = 1;
endpointDesc.bSynchAddress = 1;
endpointDesc.extra = new Buffer([]);

const ifaceInEndpoint: usb.Endpoint = iface.endpoint(1) as usb.InEndpoint;
const ifaceOutEndpoint: usb.Endpoint = iface.endpoint(1) as usb.OutEndpoint;

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: 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";
開發者ID:Jeremy-F,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:usb-tests.ts

示例2: Buffer

const endpointDesc: usb.EndpointDescriptor = new usb.EndpointDescriptor();

endpointDesc.bLength = 1;
endpointDesc.bDescriptorType = 1;
endpointDesc.bEndpointAddress = 1;
endpointDesc.bmAttributes = 1;
endpointDesc.wMaxPacketSize = 1;
endpointDesc.bInterval = 1;
endpointDesc.bRefresh = 1;
endpointDesc.bSynchAddress = 1;

const ifaceInEndpoint: usb.IEndpoint = iface.endpoint(1) as usb.InEndpoint;
const ifaceOutEndpoint: usb.IEndpoint = iface.endpoint(1) as usb.OutEndpoint;

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);
開發者ID:longlho,項目名稱:DefinitelyTyped,代碼行數:30,代碼來源:usb-tests.ts


注:本文中的usb.InEndpoint類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。