Debian Codegraph @

3rdparty/hidapi/windows/hidapi_winapi.h

raw symbols SCIP
1 /*******************************************************
2 HIDAPI - Multi-Platform library for
3 communication with HID devices.
4
5 libusb/hidapi Team
6
7 Copyright 2022, All Rights Reserved.
8
9 At the discretion of the user of this library,
10 this software may be licensed under the terms of the
11 GNU General Public License v3, a BSD-Style license, or the
12 original HIDAPI license as outlined in the LICENSE.txt,
13 LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
14 files located at the root of the source distribution.
15 These files may also be found in the public source
16 code repository located at:
17 https://github.com/libusb/hidapi .
18 ********************************************************/
19
20 /** @file
21 * @defgroup API hidapi API
22 *
23 * Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
24 */
25
26 #ifndef HIDAPI_WINAPI_H__
27 #define HIDAPI_WINAPI_H__
28
29 #include <stdint.h>
30
31 #include <guiddef.h>
32
33 #include "hidapi.h"
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 /** @brief Get the container ID for a HID device.
40
41 Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
42
43 This function returns the `DEVPKEY_Device_ContainerId` property of
44 the given device. This can be used to correlate different
45 interfaces/ports on the same hardware device.
46
47 @ingroup API
48 @param dev A device handle returned from hid_open().
49 @param container_id The device's container ID on return.
50
51 @returns
52 This function returns 0 on success and -1 on error.
53 */
54 int HID_API_EXPORT_CALL hid_winapi_get_container_id(hid_device *dev, GUID *container_id);
55
56 /**
57 * @brief Reconstructs a HID Report Descriptor from a Win32 HIDP_PREPARSED_DATA structure.
58 * This reconstructed report descriptor is logical identical to the real report descriptor,
59 * but not byte wise identical.
60 *
61 * @param[in] hidp_preparsed_data Pointer to the HIDP_PREPARSED_DATA to read, i.e.: the value of PHIDP_PREPARSED_DATA,
62 * as returned by HidD_GetPreparsedData WinAPI function.
63 * @param buf Pointer to the buffer where the report descriptor should be stored.
64 * @param[in] buf_size Size of the buffer. The recommended size for the buffer is @ref HID_API_MAX_REPORT_DESCRIPTOR_SIZE bytes.
65 *
66 * @return Returns size of reconstructed report descriptor if successful, -1 for error.
67 */
68 int HID_API_EXPORT_CALL hid_winapi_descriptor_reconstruct_pp_data(void *hidp_preparsed_data, unsigned char *buf, size_t buf_size);
69
70 /**
71 * @brief Sets the timeout for hid_write operation.
72 *
73 * Since version 0.15.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 15, 0)
74 *
75 * The default timeout is 1sec for winapi backend.
76 *
77 * In case if 1sec is not enough, on in case of multi-platform development,
78 * the recommended value is 5sec, e.g. to match (unconfigurable) 5sec timeout
79 * set for hidraw (linux kernel) implementation.
80 *
81 * When the timeout is set to 0, hid_write function becomes non-blocking and would exit immediately.
82 * When the timeout is set to INFINITE ((DWORD)-1), the function will not exit,
83 * until the write operation is performed or an error occured.
84 * See dwMilliseconds parameter documentation of WaitForSingleObject function.
85 *
86 * @param timeout New timeout value in milliseconds.
87 */
88 void HID_API_EXPORT_CALL hid_winapi_set_write_timeout(hid_device *dev, unsigned long timeout);
89
90 #ifdef __cplusplus
91 }
92 #endif
93
94 #endif