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

IHIDManager Interface

This interface is implemented by HID Manager.

Declaration

interface IHIDManager {
    // Properties
    readonly ${devices}: ${IHIDDevice}[];
    ${sessions}: ${IHIDSession}[];

    // Methods
    ${createSession#cs1}(device: ${IHIDDevice}): ${IHIDSession};
    ${createSession#cs2}(deviceKey: string): ${IHIDSession};
    ${createSession#cs3}(vendorId: number,
        productId: number,
        searchOptions?: { serialNumber?: string; usage?: number; usagePage?: number }): ${IHIDSession};
    ${closeAllSessions}(): void;
}
// This interface is not available in managed environment
// This interface is not available in native environment

IHIDManager Properties

devices

readonly devices: ${IHIDDevice}[];
// This property is not available in managed environment
// This property is not available in native environment

Returns the array of HID device objects.

Obtain a list of detected HID devices and their information:

var devices = hid.devices;
for (var i = 0; i < devices.length; ++i)
    alert(devices[i].vendorId + "." + devices[i].productId);

sessions

sessions: ${IHIDSession}[];
// This property is not available in managed environment
// This property is not available in native environment

Returns the array of HID session objects.

Obtain a list of HID sessions and print their corresponding device information:

var sessions = hid.sessions;
for (var i = 0; i < sessions.length; ++i)
    alert(devices[i].vendorId + "." + devices[i].productId);

IHIDManager Methods

createSession

createSession(device: ${IHIDDevice}): ${IHIDSession};
// This method is not available in managed environment
// This method is not available in native environment
device
A device object. Use the IHIDManager.devices property to get a reference to a device object.

Returns the reference to created session object.

Creates new HID session.

Create new HID session:

var session1 = hid.createSession(hid.devices[0]);

createSession

createSession(deviceKey: string): ${IHIDSession};
// This method is not available in managed environment
// This method is not available in native environment
deviceKey
A HID device identifier (also known as device key).

Returns the reference to created session object.

Creates new HID Session.

createSession

createSession(vendorId: number,
    productId: number,
    searchOptions?: { serialNumber?: string; usage?: number; usagePage?: number }): ${IHIDSession};
// This method is not available in managed environment
// This method is not available in native environment
vendorId
A HID device vendor ID.
productId
A HID device product ID.
searchOptions
Optional search parameters. Use it when there can be several devices of the same type connected to a computer. You can specify device serial number, usage or usage page.

Returns the reference to created session object.

Creates new HID Session.

Create new HID session:

var session = hid.createSession(0x1234, 0x5678, { serialNumber: "XXX0001" });

closeAllSessions

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

Stops and closes all running HID sessions.