UNPKG

2.44 kBTypeScriptView Raw
1import * as usb from '../usb';
2/**
3 * Wrapper to make a node-usb device look like a webusb device
4 */
5export declare class WebUSBDevice implements USBDevice {
6 private device;
7 static createInstance(device: usb.Device): Promise<WebUSBDevice>;
8 readonly usbVersionMajor: number;
9 readonly usbVersionMinor: number;
10 readonly usbVersionSubminor: number;
11 readonly deviceClass: number;
12 readonly deviceSubclass: number;
13 readonly deviceProtocol: number;
14 readonly vendorId: number;
15 readonly productId: number;
16 readonly deviceVersionMajor: number;
17 readonly deviceVersionMinor: number;
18 readonly deviceVersionSubminor: number;
19 manufacturerName?: string | undefined;
20 productName?: string | undefined;
21 serialNumber?: string | undefined;
22 configurations: USBConfiguration[];
23 private controlTransferAsync;
24 private setConfigurationAsync;
25 private resetAsync;
26 private getStringDescriptorAsync;
27 private constructor();
28 get configuration(): USBConfiguration | undefined;
29 get opened(): boolean;
30 open(): Promise<void>;
31 close(): Promise<void>;
32 selectConfiguration(configurationValue: number): Promise<void>;
33 claimInterface(interfaceNumber: number): Promise<void>;
34 releaseInterface(interfaceNumber: number): Promise<void>;
35 selectAlternateInterface(interfaceNumber: number, alternateSetting: number): Promise<void>;
36 controlTransferIn(setup: USBControlTransferParameters, length: number): Promise<USBInTransferResult>;
37 controlTransferOut(setup: USBControlTransferParameters, data?: ArrayBuffer): Promise<USBOutTransferResult>;
38 clearHalt(direction: USBDirection, endpointNumber: number): Promise<void>;
39 transferIn(endpointNumber: number, length: number): Promise<USBInTransferResult>;
40 transferOut(endpointNumber: number, data: ArrayBuffer): Promise<USBOutTransferResult>;
41 reset(): Promise<void>;
42 isochronousTransferIn(_endpointNumber: number, _packetLengths: number[]): Promise<USBIsochronousInTransferResult>;
43 isochronousTransferOut(_endpointNumber: number, _data: BufferSource, _packetLengths: number[]): Promise<USBIsochronousOutTransferResult>;
44 forget(): Promise<void>;
45 private initialize;
46 private decodeVersion;
47 private getStringDescriptor;
48 private getConfigurations;
49 private getEndpoint;
50 private controlTransferParamsToType;
51 private _releaseInterface;
52 private checkDeviceOpen;
53}