USB Sniffer - Software USB packets sniffer & protocol analyzer for Windows
Docs

IHIDBuilder Interface

This interface is implemented by HID Session object and allows you to construct HID reports to be sent to the device.

Declaration

interface IHIDBuilder {
    // Methods
    ${setData}(reportType: ${HID.ReportType}, data: ${IHIDData}[]): Uint8Array;
    ${setUsageValue}(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number, v: number): Uint8Array;
    ${setScaledUsageValue}(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number, v: number): Uint8Array;
    ${setUsageValueArray}(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number, data: Uint8Array): Uint8Array;
    ${setUsages}(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, data: number[] | Uint16Array): Uint8Array;
    ${setButtons}(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, data: number[] | Uint16Array): Uint8Array;
    ${unsetUsages}(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, data: number[] | Uint16Array): Uint8Array;
    ${unsetButtons}(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, data: number[] | Uint16Array): Uint8Array;
}
// This interface is not available in managed environment
// This interface is not available in native environment

IHIDBuilder Methods

setData

setData(reportType: ${HID.ReportType}, data: ${IHIDData}[]): Uint8Array;
// This method is not available in managed environment
// This method is not available in native environment
reportType
The type of the report.
data
Array of data objects that specify which buttons and usage values to set.

Sets a specified set of HID control button and value usages in a HID report.

setUsageValue

setUsageValue(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number, v: number): 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 a usage.
usage
Specifies the usage.
linkCollection
Specifies the link collection that contains the usage. If linkCollection is nonzero, the routine only sets the usage, if one exists, in this link collection. If linkCollection is zero, the routine sets the first usage it finds in the top-level collection.
v
The value to set.

Sets a HID control value in a specified HID report.

setScaledUsageValue

setScaledUsageValue(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number, v: number): 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 a usage.
usage
Specifies the usage.
linkCollection
Specifies the link collection that contains the usage. If linkCollection is nonzero, the routine only sets the usage, if one exists, in this link collection. If linkCollection is zero, the routine sets the first usage it finds in the top-level collection.
v
The value to set.

Converts a signed and scaled physical number to a HID usage's logical value, and sets the usage value in a specified HID report.

setUsageValueArray

setUsageValueArray(reportType: ${HID.ReportType}, usagePage: number, usage: number, linkCollection: number, data: 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 a usage.
usage
Specifies the usage.
linkCollection
Specifies the link collection that contains the usage. If linkCollection is nonzero, the routine only sets the usage, if one exists, in this link collection. If linkCollection is zero, the routine sets the first usage it finds in the top-level collection.
data
The value array to set.

Sets a HID control usage value array in a specified HID report.

setUsages

setUsages(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, data: number[] | Uint16Array): 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 for the usages.
linkCollection
Specifies the link collection that contains the usages. If linkCollection is nonzero, the routine only sets the usages, if they exist, in this link collection. If linkCollection is zero, the routine sets the first usage for each specified usage in the top-level collection.
data
Data array to set.

Sets specified HID control buttons ON (1) in a HID report.

setButtons

setButtons(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, data: number[] | Uint16Array): 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 for the usages.
linkCollection
Specifies the link collection that contains the usages. If linkCollection is nonzero, the routine only sets the usages, if they exist, in this link collection. If linkCollection is zero, the routine sets the first usage for each specified usage in the top-level collection.
data
Data array to set.

Sets specified HID control buttons ON (1) in a HID report.

unsetUsages

unsetUsages(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, data: number[] | Uint16Array): 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 for the usages.
linkCollection
Specifies the link collection that contains the usages. If linkCollection is nonzero, the routine only sets the usages, if they exist, in this link collection. If linkCollection is zero, the routine sets the first usage for each specified usage in the top-level collection.
data
Data array to set.

Sets specified HID control button usages OFF (zero) in a HID report.

unsetButtons

unsetButtons(reportType: ${HID.ReportType}, usagePage: number, linkCollection: number, data: number[] | Uint16Array): 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 for the usages.
linkCollection
Specifies the link collection that contains the usages. If linkCollection is nonzero, the routine only sets the usages, if they exist, in this link collection. If linkCollection is zero, the routine sets the first usage for each specified usage in the top-level collection.
data
Data array to set.

Sets specified HID control button usages OFF (zero) in a HID report.