📄 hid.par
字号:
//
// Parameters:
// ReportType One of HidP_Input, HidP_Output or HidP_Feature.
//
// LinkCollection An optional value which can limit which usages are returned
// in the ButtonList to those usages that exist in a specific
// LinkCollection. A non-zero value indicates the index into
// the HIDP_LINK_COLLECITON_NODE list returned by
// HidP_GetLinkCollectionNodes of the link collection the
// usage should belong to. A value of 0 indicates this
// should value be ignored.
//
// ButtonList An array of USAGE_AND_PAGE structures describing all the
// buttons currently ``down'' in the device.
//
// UsageLength The length of the given array in terms of elements.
// On input, this value describes the length of the list. On
// output, HidP_GetUsagesEx sets this value to the number of
// usages that were found. Use HidP_MaxUsageListLength to
// determine the maximum length needed to return all the usages
// that a given report packet may contain.
//
// PreparsedData Preparsed data returned by HIDCLASS
//
// Report The report packet.
//
// ReportLength Length (in bytes) of the given report packet.
//
//
// Return Value
// HidP_GetUsagesEx returns the following error codes:
//
// - HIDP_STATUS_SUCCESS -- upon successfully retrieving all the
// usages from the report packet
// - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid.
// - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
// - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not
// equal to the length specified in
// the HIDP_CAPS structure for the given
// ReportType
// - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device
// for the given ReportType
// - HIDP_STATUS_BUFFER_TOO_SMALL -- if ButtonList is not big enough to
// hold all the usages found in the report
// packet. If this is returned, the buffer
// will contain UsageLength number of
// usages. Use HidP_MaxUsageListLength to
// find the maximum length needed
// - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if no usages were found but usages
// that match the specified LinkCollection
// exist in report with a different report
// ID.
// - HIDP_STATUS_USAGE_NOT_FOUND -- if there are no usages in any reports that
// match the LinkCollection parameter
function HidP_GetUsagesEx(ReportType: THIDPReportType; LinkCollection: Word;
UsageList: PUsageAndPage; var UsageLength: ULONG;
PreparsedData: PHIDPPreparsedData; var Report;
ReportLength: ULONG): NTSTATUS; stdcall;
{$EXTERNALSYM HidP_GetUsagesEx}
function HidP_GetButtonsEx(ReportType: THIDPReportType; LinkCollection: Word;
UsageList: PUsageAndPage; var UsageLength: ULONG;
PreparsedData: PHIDPPreparsedData; var Report;
ReportLength: ULONG): NTSTATUS; stdcall;
{$EXTERNALSYM HidP_GetButtonsEx}
// Routine Description:
// This function sets binary values (buttons) in a report. Given an
// initialized packet of correct length, it modifies the report packet so that
// each element in the given list of usages has been set in the report packet.
// For example, in an output report with 5 LED抯, each with a given usage,
// an application could turn on any subset of these lights by placing their
// usages in any order into the usage array (UsageList). HidP_SetUsages would,
// in turn, set the appropriate bit or add the corresponding byte into the
// HID Main Array Item.
//
// A properly initialized Report packet is one of the correct byte length,
// and all zeros.
//
// NOTE: A packet that has already been set with a call to a HidP_Set routine
// can also be passed in. This routine then sets processes the UsageList
// in the same fashion but verifies that the ReportID already set in
// Report matches the report ID for the given usages.
//
// Parameters:
// ReportType One of HidP_Input, HidP_Output or HidP_Feature.
//
// UsagePage All of the usages in the usage array, which HidP_SetUsages will
// set in the report, refer to this same usage page.
// If a client wishes to set usages in a report for multiple
// usage pages then that client needs to make multiple calls to
// HidP_SetUsages for each of the usage pages.
//
// UsageList A usage array containing the usages that HidP_SetUsages will set in
// the report packet.
//
// UsageLength The length of the given usage array in array elements.
// The parser will set this value to the position in the usage
// array where it stopped processing. If successful, UsageLength
// will be unchanged. In any error condition, this parameter
// reflects how many of the usages in the usage list have
// actually been set by the parser. This is useful for finding
// the usage in the list which caused the error.
//
// PreparsedData The preparsed data recevied from HIDCLASS
//
// Report The report packet.
//
// ReportLength Length of the given report packet...Must be equal to the
// value reported in the HIDP_CAPS structure for the device
// and corresponding report type.
//
// Return Value
// HidP_SetUsages returns the following error codes. On error, the report packet
// will be correct up until the usage element that caused the error.
//
// - HIDP_STATUS_SUCCESS -- upon successful insertion of all usages
// into the report packet.
// - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid.
// - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
// - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not
// equal to the length specified in
// the HIDP_CAPS structure for the given
// ReportType
// - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device
// for the given ReportType
// - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a
// different report. If the report is
// zero-initialized on entry the first
// usage in the list will determine which
// report ID is used. Otherwise, the
// parser will verify that usage matches
// the passed in report's ID
// - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any
// report (no matter what the report ID)
// for the given report type.
// - HIDP_STATUS_BUFFER_TOO_SMALL -- if there are not enough entries in a
// given Main Array Item to list all of
// the given usages. The caller needs
// to split his request into more than
// one call
function HidP_SetUsages(ReportType: THIDPReportType; UsagePage: TUsage;
LinkCollection: Word; UsageList: PUsage; var UsageLength: ULONG;
PreparsedData: PHIDPPreparsedData; var Report;
ReportLength: ULONG): NTSTATUS; stdcall;
{$EXTERNALSYM HidP_SetUsages}
function HidP_SetButtons(ReportType: THIDPReportType; UsagePage: TUsage;
LinkCollection: Word; ButtonList: PUsage; var ButtonLength: ULONG;
PreparsedData: PHIDPPreparsedData; var Report;
ReportLength: ULONG): NTSTATUS; stdcall;
{$EXTERNALSYM HidP_SetButtons}
// Routine Description:
// This function unsets (turns off) binary values (buttons) in the report. Given
// an initialized packet of correct length, it modifies the report packet so
// that each element in the given list of usages has been unset in the
// report packet.
//
// This function is the "undo" operation for SetUsages. If the given usage
// is not already set in the Report, it will return an error code of
// HIDP_STATUS_BUTTON_NOT_PRESSED. If the button is pressed, HidP_UnsetUsages
// will unset the appropriate bit or remove the corresponding index value from
// the HID Main Array Item.
//
// A properly initialized Report packet is one of the correct byte length,
// and all zeros..
//
// NOTE: A packet that has already been set with a call to a HidP_Set routine
// can also be passed in. This routine then processes the UsageList
// in the same fashion but verifies that the ReportID already set in
// Report matches the report ID for the given usages.
//
// Parameters:
// ReportType One of HidP_Input, HidP_Output or HidP_Feature.
//
// UsagePage All of the usages in the usage array, which HidP_UnsetUsages will
// unset in the report, refer to this same usage page.
// If a client wishes to unset usages in a report for multiple
// usage pages then that client needs to make multiple calls to
// HidP_UnsetUsages for each of the usage pages.
//
// UsageList A usage array containing the usages that HidP_UnsetUsages will
// unset in the report packet.
//
// UsageLength The length of the given usage array in array elements.
// The parser will set this value to the position in the usage
// array where it stopped processing. If successful, UsageLength
// will be unchanged. In any error condition, this parameter
// reflects how many of the usages in the usage list have
// actually been unset by the parser. This is useful for finding
// the usage in the list which caused the error.
//
// PreparsedData The preparsed data recevied from HIDCLASS
//
// Report The report packet.
//
// ReportLength Length of the given report packet...Must be equal to the
// value reported in the HIDP_CAPS structure for the device
// and corresponding report type.
//
// Return Value
// HidP_UnsetUsages returns the following error codes. On error, the report
// packet will be correct up until the usage element that caused the error.
//
// - HIDP_STATUS_SUCCESS -- upon successful "unsetting" of all usages
// in the report packet.
// - HIDP_STATUS_INVALID_REPORT_TYPE -- if ReportType is not valid.
// - HIDP_STATUS_INVALID_PREPARSED_DATA -- if PreparsedData is not valid
// - HIDP_STATUS_INVALID_REPORT_LENGTH -- the length of the report packet is not
// equal to the length specified in
// the HIDP_CAPS structure for the given
// ReportType
// - HIDP_STATUS_REPORT_DOES_NOT_EXIST -- if there are no reports on this device
// for the given ReportType
// - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- if a usage was found that exists in a
// different report. If the report is
// zero-initialized on entry the first
// usage in the list will determine which
// report ID is used. Otherwise, the
// parser will verify that usage matches
// the passed in report's ID
// - HIDP_STATUS_USAGE_NOT_FOUND -- if the usage does not exist for any
// report (no matter what the report ID)
// for the given report type.
// - HIDP_STATUS_BUTTON_NOT_PRESSED -- if a usage corresponds to a button that
// is not already set in the given report
function HidP_UnsetUsages(ReportType: THIDPReportType; UsagePage: TUsage;
LinkCollection: Word; UsageList: PUsage; var UsageLength: ULONG;
PreparsedData: PHIDPPreparsedData; var Report;
ReportLength: ULONG): NTSTATUS; stdcall;
{$EXTERNALSYM HidP_UnsetUsages}
function HidP_UnsetButtons(ReportType: THIDPReportType; UsagePage: TUsage;
LinkCollection: Word; ButtonList: PUsage; var ButtonLength: ULONG;
PreparsedData: PHIDPPreparsedData; var Report;
ReportLength: ULONG): NTSTATUS; stdcall;
{$EXTERNALSYM HidP_UnsetButtons}
// Routine Description:
// This function returns the maximum number of usages that a call to
// HidP_GetUsages or HidP_GetUsagesEx could return for a given HID report.
// If calling for number of usages returned by HidP_GetUsagesEx, use 0 as
// the UsagePage value.
//
// Parameters:
// ReportType One of HidP_Input, HidP_Output or HidP_Feature.
//
// UsagePage Specifies the optional UsagePage to query for. If 0, will
// return all the maximum number of usage values that could be
// returned for a given ReportType. If non-zero, will return
// the maximum number of usages that would be returned for the
// ReportType with the given UsagePage.
//
// PreparsedData Preparsed data returned from HIDCLASS
//
// Return Value:
// The length of the usage list array required for the HidP_GetUsages or
// HidP_GetUsagesEx function call. If an error occurs (such as
// HIDP_STATUS_INVALID_REPORT_TYPE or HIDP_INVALID_PREPARSED_DATA, this
// returns 0.
function HidP_MaxUsageListLength(ReportType: THIDPReportType; UsagePage: TUsage;
PreparsedData: PHIDPPreparsedData): ULONG; stdcall;
{$EXTERNALSYM HidP_MaxUsageListLength}
function HidP_MaxButtonListLength(ReportType: THIDPReportType; UsagePage: TUsage;
PreparsedData: PHIDPPreparsedData): ULONG; stdcall;
{$EXTERNALSYM HidP_MaxButtonListLength}
// Description
// HidP_GetUsageValue retrieves the value from the HID Report for the usage
// specified by the combination of usage page, usage and link collection.
// If a report packet contains two different fields with the same
// Usage and UsagePage, they
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -