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


TypeScript Interface.release方法代碼示例

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


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

示例1: Buffer

configDesc.wTotalLength = 1;
configDesc.bNumInterfaces = 1;
configDesc.bConfigurationValue = 1;
configDesc.iConfiguration = 1;
configDesc.bmAttributes = 1;
configDesc.bMaxPower = 1;
configDesc.extra = new Buffer([]);

const deviceInterface: usb.Interface = device.interface(1);

device.interfaces = [deviceInterface];

const iface = new usb.Interface(device, 1);

iface.claim();
iface.release((error: string) => null, (error: string) => null);
const kernelActive: boolean = iface.isKernelDriverActive();
const detachKernel: number = iface.detachKernelDriver();
const attachKernel: number = iface.attachKernelDriver();
iface.setAltSetting(1, (error: string) => null);

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

示例2: Buffer

configDesc.bMaxPower = 1;
configDesc.extra = new Buffer([]);

const deviceInterface: usb.Interface = device.interface(1);

device.interfaces = [deviceInterface];
device.parent = device;
device.configDescriptor = configDesc;
device.allConfigDescriptors = [configDesc];

const iface = new usb.Interface(device, 1);

iface.interfaceNumber = 1;
iface.altSetting = 0;
iface.claim();
iface.release((error: string) => null);
iface.release(false, (error: string) => null);
const kernelActive: boolean = iface.isKernelDriverActive();
const detachKernel: number = iface.detachKernelDriver();
const attachKernel: number = iface.attachKernelDriver();
iface.setAltSetting(1, (error: string) => null);

const ifaceDesc: usb.InterfaceDescriptor = new usb.InterfaceDescriptor();

ifaceDesc.bLength = 1;
ifaceDesc.bDescriptorType = 1;
ifaceDesc.bInterfaceNumber = 1;
ifaceDesc.bAlternateSetting = 1;
ifaceDesc.bNumEndpoints = 1;
ifaceDesc.bInterfaceClass = 1;
ifaceDesc.bInterfaceSubClass = 1;
開發者ID:Jeremy-F,項目名稱:DefinitelyTyped,代碼行數:31,代碼來源:usb-tests.ts


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