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

IHIDParser Interface

This interface is implemented by HID Session object and allows you to parse the HID report received from the device.

Declaration

interface IHIDParser {

    // Methods
    ${getData}(reportType: ${HID.ReportType}, reportData: Uint8Array): ${IHIDData}[];
    ${getUsages}(reportType: ${HID.ReportType},
        usagePage: number,
        linkCollection: number,
        reportData: Uint8Array): number[];
    ${getUsagesEx}(reportType: ${HID.ReportType}, linkCollection: number, reportData: Uint8Array): ${IHIDUsageAndPage}[];
    ${getButtons}(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, reportData: Uint8Array): number[];
    ${getButtonsEx}(reportType: ${HID.ReportType}, linkCollection: number, reportData: Uint8Array): ${IHIDUsageAndPage}[];
    ${getUsageValue}(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number): number;
    ${getScaledUsageValue}(reportType: ${HID.ReportType},
        usagePage: number,
        usage: number,
        linkCollection: number,
        reportData: Uint8Array): number;
    ${getUsageValueArray}(reportType: ${HID.ReportType},
        usagePage: number,
        usage: number,
        linkCollection: number,
        reportData: Uint8Array): Uint8Array;
}
// This interface is not available in managed environment
// This interface is not available in native environment

IHIDParser Methods

getData

getData(reportType: ${HID.ReportType}, reportData: Uint8Array): ${IHIDData}[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
reportData
Raw HID report bytes.

Returns, for a specified report, an array of data objects that identify the data indices of all HID control buttons that are currently set to ON (1), and the data indices and data associated with all HID control values.

getUsages

getUsages(reportType: ${HID.ReportType},
    usagePage: number,
    linkCollection: number,
    reportData: Uint8Array): number[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
usagePage
Specifies the usage page of the button usages. The method only returns information about buttons on this usage page.
linkCollection
Specifies the link collection of the button usages. If linkCollection is nonzero, the routine only returns information about the buttons that this link collection contains; otherwise, if linkCollection is zero, the routine returns information about all the buttons in the top-level collection.
reportData
Raw HID report bytes.

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

getUsagesEx

getUsagesEx(reportType: ${HID.ReportType}, linkCollection: number, reportData: Uint8Array): ${IHIDUsageAndPage}[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
linkCollection
Specifies the link collection of the button usages. If linkCollection is nonzero, the routine only returns information about the buttons that this link collection contains; otherwise, if linkCollection is zero, the routine returns information about all the buttons in the top-level collection.
reportData
Raw HID report bytes.

Returns a list of the all the HID control button usages that are set to ON in a HID report.

getButtons

getButtons(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, reportData: Uint8Array): number[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
usagePage
Specifies the usage page of the button usages. The method only returns information about buttons on this usage page.
linkCollection
Specifies the link collection of the button usages. If linkCollection is nonzero, the routine only returns information about the buttons that this link collection contains; otherwise, if linkCollection is zero, the routine returns information about all the buttons in the top-level collection.
reportData
Raw HID report bytes.

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

getButtonsEx

getButtonsEx(reportType: ${HID.ReportType}, linkCollection: number, reportData: Uint8Array): ${IHIDUsageAndPage}[];
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
linkCollection
Specifies the link collection of the button usages. If linkCollection is nonzero, the routine only returns information about the buttons that this link collection contains; otherwise, if linkCollection is zero, the routine returns information about all the buttons in the top-level collection.
reportData
Raw HID report bytes.

Returns a list of the all the HID control button usages that are set to ON in a HID report.

getUsageValue

getUsageValue(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number): number;
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
usagePage
Specifies the value's usage page.
usage
Specifies the usage of the value.
linkCollection
Specifies the link collection that contains the value. If linkCollection is nonzero, the routine only searches for the usage in this link collection; otherwise, if linkCollection is zero, the routine searches for the usage in the top-level collection. reportData: Uint8ArrayRaw HID report bytes.

Extracts the data associated with a HID control value that matches the selection criteria in a HID report.

getScaledUsageValue

getScaledUsageValue(reportType: ${HID.ReportType},
    usagePage: number,
    usage: number,
    linkCollection: number,
    reportData: Uint8Array): number;
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
usagePage
Specifies the usage page of the value to extract.
usage
Specifies the usage of the value to extract.
linkCollection
Specifies the link collection identifier of the value to extract. A linkCollection value of zero identifies the top-level collection.
reportData
Raw HID report bytes.

Returns the signed and scaled result of a HID control value extracted from a HID report.

getUsageValueArray

getUsageValueArray(reportType: ${HID.ReportType},
    usagePage: number,
    usage: number,
    linkCollection: number,
    reportData: Uint8Array): Uint8Array;
// This method is not available in managed environment
// This method is not available in native environment
reportType
Type of the report.
usagePage
Specifies the usage page of the usage value array.
usage
Specifies the usage of the usage value array.
linkCollection
Specifies the link collection that contains the usage value array. If linkCollection is nonzero, the routine only searches for a usage value array in this link collection; otherwise, if linkCollection is zero, the routine searches for a usage value array in the top-level collection.
reportData
Raw HID report bytes.

Extracts the data associated with a HID control usage value array from a HID report.