⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hid.pas

📁 human interface devices.zip 一套组件
💻 PAS
📖 第 1 页 / 共 5 页
字号:
function HidP_SetUsages(ReportType: THIDPReportType; UsagePage: TUsage;
  LinkCollection: Word; UsageList: PUsage; var UsageLength: ULONG;
  PreparsedData: PHIDPPreparsedData; var Report;
  ReportLength: ULONG): NTSTATUS; stdcall;

function HidP_SetButtons(ReportType: THIDPReportType; UsagePage: TUsage;
  LinkCollection: Word; ButtonList: PUsage; var ButtonLength: ULONG;
  PreparsedData: PHIDPPreparsedData; var Report;
  ReportLength: ULONG): NTSTATUS; stdcall;

// 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;

function HidP_UnsetButtons(ReportType: THIDPReportType; UsagePage: TUsage;
  LinkCollection: Word; ButtonList: PUsage; var ButtonLength: ULONG;
  PreparsedData: PHIDPPreparsedData; var Report;
  ReportLength: ULONG): NTSTATUS; stdcall;

// 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;

function HidP_MaxButtonListLength(ReportType: THIDPReportType; UsagePage: TUsage;
  PreparsedData: PHIDPPreparsedData): ULONG; stdcall;

// 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 can be distinguished with the optional
//     LinkCollection field value.
// 
// Parameters:
// 
//     ReportType  One of HidP_Input or HidP_Feature.
// 
//     UsagePage   The usage page to which the given usage refers.
// 
//     LinkCollection  (Optional)  This value can be used to differentiate
//                                 between two fields that may have the same
//                                 UsagePage and Usage but exist in different
//                                 collections.  If the link collection value
//                                 is zero, this function will set the first field
//                                 it finds that matches the usage page and
//                                 usage.
// 
//     Usage       The usage whose value HidP_GetUsageValue will retrieve
// 
//     UsageValue  The raw value that is set for the specified field in the report
//                 buffer. This value will either fall within the logical range
//                 or if NULL values are allowed, a number outside the range to
//                 indicate a NULL
// 
//     PreparsedData The preparsed data returned for HIDCLASS
// 
//     Report      The report packet.
// 
//     ReportLength Length (in bytes) of the given report packet.
// 
// 
// Return Value:
//     HidP_GetUsageValue returns the following error codes:
// 
// - HIDP_STATUS_SUCCESS                -- upon successfully retrieving the value
//                                         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_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
//                                         link collection exist but exists in
//                                         a report with a different report ID
//                                         than the report being passed in.  To
//                                         set this value, call HidP_GetUsageValue
//                                         again with a different report packet
// - HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
//                                         collection combination does not exist
//                                         in any reports for this ReportType

function HidP_GetUsageValue(ReportType: THIDPReportType; UsagePage: TUsage;
  LinkCollection: Word; Usage: TUsage; var UsageValue: ULONG;
  PreparsedData: PHIDPPreparsedData; var Report;
  ReportLength: ULONG): NTSTATUS; stdcall;

// Description
//     HidP_GetScaledUsageValue retrieves a UsageValue from the HID report packet
//     in the field corresponding to the given usage page and usage.  If a report
//     packet contains two different fields with the same Usage and UsagePage,
//     they can be distinguished with the optional LinkCollection field value.
//
//     If the specified field has a defined physical range, this function converts
//     the logical value that exists in the report packet to the corresponding
//     physical value.  If a physical range does not exist, the function will
//     return the logical value.  This function will check to verify that the
//     logical value in the report falls within the declared logical range.
// 
//     When doing the conversion between logical and physical values, this
//     function assumes a linear extrapolation between the physical max/min and
//     the logical max/min. (Where logical is the values reported by the device
//     and physical is the value returned by this function).  If the data field
//     size is less than 32 bits, then HidP_GetScaledUsageValue will sign extend
//     the value to 32 bits.
// 
//     If the range checking fails but the field has NULL values, the function
//     will set UsageValue to 0 and return HIDP_STATUS_NULL.  Otherwise, it
//     returns a HIDP_STATUS_OUT_OF_RANGE error.
// 
// Parameters:
// 
//     ReportType  One of HidP_Output or HidP_Feature.
// 
//     UsagePage   The usage page to which the given usage refers.
// 
//     LinkCollection  (Optional)  This value can be used to differentiate
//                                 between two fields that may have the same
//                                 UsagePage and Usage but exist in different
//                                 collections.  If the link collection value
//                                 is zero, this function will retrieve the first
//                                 field it finds that matches the usage page
//                                 and usage.
// 
//     Usage       The usage whose value HidP_GetScaledUsageValue will retrieve
// 
//     UsageValue  The value retrieved from the report buffer.  See the routine
//                 description above for the different interpretations of this
//                 value
// 
//     PreparsedData The preparsed data returned from HIDCLASS
// 
//     Report      The report packet.
// 
//     ReportLength Length (in bytes) of the given report packet.
// 
// 
// Return Value:
//    HidP_GetScaledUsageValue returns the following error codes:
// 
// - HIDP_STATUS_SUCCESS                -- upon successfully retrieving the value
//                                         from the report packet
// - HIDP_STATUS_NULL                   -- if the report packet had a NULL value
//                                         set
// - 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_VALUE_OUT_OF_RANGE     -- if the value retrieved from the packet
//                                         falls outside the logical range and
//                                         the field does not support NULL values
// - HIDP_STATUS_BAD_LOG_PHY_VALUES     -- if the field has a physical range but
//                                         either the logical range is invalid
//                                         (max <= min) or the physical range is
//                                         invalid
// - HIDP_STATUS_INCOMPATIBLE_REPORT_ID -- the specified usage page, usage and
//                                         link collection exist but exists in
//                                         a report with a different report ID
//                                         than the report being passed in.  To
//                                         set this value, call
//                                         HidP_GetScaledUsageValue with a
//                                         different report packet
// - HIDP_STATUS_USAGE_NOT_FOUND        -- if the usage page, usage, and link
//                                         collection combination does not exist
//                                         in any reports for this ReportType

function HidP_GetScaledUsageValue(ReportType: THIDPReportType; UsagePage: TUsage;
  LinkCollection: Word; Usage: TUsage; var UsageValue: Integer;
  PreparsedData: PHIDPPreparsedData; var Report;
  ReportLength: ULONG): NTSTATUS; stdcall;

// Routine Descripton:
//     A usage value array occurs when the last usage in the list of usages
//     des

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -