USB Sniffer - Software USB packets sniffer & protocol analyzer for Windows
Download Device Monitoring Studio Hide this button

IHIDSession Interface

This interface is implemented by HID Session Object.

Declaration

interface IHIDSession {
    // Properties
    ${vendorId}: number;
    ${productId}: number;
    ${device}: ${IHIDDevice};
    ${inputBuffersCount}: number;

    // Methods
    ${start}(): void;
    ${stop}(): void;
    ${setFeature}(reportId: number, v: number[] | ArrayBuffer | DataView | Uint8Array): void;
    ${getFeature}(reportId: number): Uint8Array;
    ${send#send1}(byte: number): Promise<void>;
    ${send#send2}(bytes: number [] | Uint8Array | Uint16Array | Uint32Array | ArrayBuffer | DataView): Promise<void>;
    ${send#send2#send#send21}(text: string): Promise<void>;
    ${receive}(): Promise<Uint8Array>;
    ${getReport}(reportId: number): Uint8Array;
    ${setReport}(reportId: number, v: number[] | ArrayBuffer | DataView | Uint8Array): void;
    ${getLinkCollectionNodes}(): ${IHIDNode}[];
    ${getValueCaps}(reportType: ${HID.ReportType}): ${IHIDValueCaps}[];
    ${getSpecificValueCaps}(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number): ${IHIDValueCaps}[];
    ${getButtonCaps}(reportType: ${HID.ReportType}): ${IHIDButtonCaps}[];
    ${getSpecificButtonCaps}(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number): ${IHIDButtonCaps}[];
    ${createBuilder}(): ${IHIDBuilder};
    ${createParser}(): ${IHIDParser};
}
// This interface is not available in managed environment
// This interface is not available in native environment

IHIDSession Properties

vendorId

vendorId: number;
// This property is not available in managed environment
// This property is not available in native environment

HID device vendor identifier.

productId

productId: number;
// This property is not available in managed environment
// This property is not available in native environment

HID device product identifier.

device

device: ${IHIDDevice};
// This property is not available in managed environment
// This property is not available in native environment

Reference to the HID device object.

inputBuffersCount

inputBuffersCount: number;
// This property is not available in managed environment
// This property is not available in native environment

Number of input buffers.

IHIDSession Methods

start

start(): void;
// This method is not available in managed environment
// This method is not available in native environment

Starts a HID session.

stop

stop(): void;
// This method is not available in managed environment
// This method is not available in native environment

Stops a HID session.

setFeature

setFeature(reportId: number, v: number[] | ArrayBuffer | DataView | Uint8Array): void;
// This method is not available in managed environment
// This method is not available in native environment
reportId
Feature report ID.
v
Raw feature report bytes.

Sends feature report.

getFeature

getFeature(reportId: number): Uint8Array;
// This method is not available in managed environment
// This method is not available in native environment
reportId
Feature report id.

Raw feature report bytes.

Receive feature report.

send

send(byte: number): Promise<void>;
// This method is not available in managed environment
// This method is not available in native environment
byte
Single byte to send.

Send data to a HID session.

send

send(bytes: number [] | Uint8Array | Uint16Array | Uint32Array | ArrayBuffer | DataView): Promise<void>;
// This method is not available in managed environment
// This method is not available in native environment
bytes
A JavaScript array of integer numbers to be sent to the session.

Send data to a HID session.

send

send(text: string): Promise<void>;
// This method is not available in managed environment
// This method is not available in native environment
text
A text string to send (ASCII encoding).

Send data to a HID session.

receive

receive(): Promise<Uint8Array>;
// This method is not available in managed environment
// This method is not available in native environment

Receive (read) data from the session. This function returns a promise that produces a byte array when ready.

getReport

getReport(reportId: number): Uint8Array;
// This method is not available in managed environment
// This method is not available in native environment
reportId
Feature report ID.

Raw input report bytes.

Receive input report.

setReport

setReport(reportId: number, v: number[] | ArrayBuffer | DataView | Uint8Array): void;
// This method is not available in managed environment
// This method is not available in native environment
reportId
Output report ID.
v
Raw output report bytes.

Sends output report.

getLinkCollectionNodes

getLinkCollectionNodes(): ${IHIDNode}[];
// This method is not available in managed environment
// This method is not available in native environment

Returns a top-level collection's link collection array.

getValueCaps

getValueCaps(reportType: ${HID.ReportType}): ${IHIDValueCaps}[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.

Returns a value capability array that describes all the HID control values in a top-level collection for a specified type of HID report.

getSpecificValueCaps

getSpecificValueCaps(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number): ${IHIDValueCaps}[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
usagePage
Specifies a usage page as a search criteria. If usagePage is nonzero, only buttons that specify this usage page are returned.
usage
Specifies a HID usage as a search criteria. If usage is nonzero, only buttons that specify this usage will be returned.
linkCollection
Specifies a link collection as a search criteria. If linkCollection is nonzero, only buttons that are part of this link collection are returned.

Returns a value capability array that describes all HID control values that meet a specified selection criteria.

getButtonCaps

getButtonCaps(reportType: ${HID.ReportType}): ${IHIDButtonCaps}[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.

Returns a button capability array that describes all the HID control buttons in a top-level collection for a specified type of HID report.

getSpecificButtonCaps

getSpecificButtonCaps(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number): ${IHIDButtonCaps}[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
usagePage
Specifies a usage page as a search criteria. If usagePage is nonzero, only buttons that specify this usage page are returned.
usage
Specifies a HID usage as a search criteria. If usage is nonzero, only buttons that specify this usage will be returned.
linkCollection
Specifies a link collection as a search criteria. If linkCollection is nonzero, only buttons that are part of this link collection are returned.

Returns a button capability array that describes all HID control buttons in a top-level collection that meet a specified selection criteria.

createBuilder

createBuilder(): ${IHIDBuilder};
// This method is not available in managed environment
// This method is not available in native environment

Create a HID report builder object. This object implements IHIDBuilder interface and allows you to construct HID reports given the required parameters.

createParser

createParser(): ${IHIDParser};
// This method is not available in managed environment
// This method is not available in native environment

Create a HID report parser object. This object implements IHIDParser interface and allows you to parse reports received from the device.