Debian Codegraph @

3rdparty/hidapi/mac/hidapi_darwin.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_DARWIN_H__
27 #define HIDAPI_DARWIN_H__
28
29 #include <stdint.h>
30
31 #include "hidapi.h"
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 /** @brief Get the location ID for a HID device.
38
39 Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
40
41 @ingroup API
42 @param dev A device handle returned from hid_open().
43 @param location_id The device's location ID on return.
44
45 @returns
46 This function returns 0 on success and -1 on error.
47 */
48 int HID_API_EXPORT_CALL hid_darwin_get_location_id(hid_device *dev, uint32_t *location_id);
49
50
51 /** @brief Changes the behavior of all further calls to @ref hid_open or @ref hid_open_path.
52
53 By default on Darwin platform all devices opened by HIDAPI with @ref hid_open or @ref hid_open_path
54 are opened in exclusive mode (see kIOHIDOptionsTypeSeizeDevice).
55
56 Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
57
58 @ingroup API
59 @param open_exclusive When set to 0 - all further devices will be opened
60 in non-exclusive mode. Otherwise - all further devices will be opened
61 in exclusive mode.
62
63 @note During the initialisation by @ref hid_init - this property is set to 1 (TRUE).
64 This is done to preserve full backward compatibility with previous behavior.
65
66 @note Calling this function before @ref hid_init or after @ref hid_exit has no effect.
67 */
68 void HID_API_EXPORT_CALL hid_darwin_set_open_exclusive(int open_exclusive);
69
70 /** @brief Getter for option set by @ref hid_darwin_set_open_exclusive.
71
72 Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
73
74 @ingroup API
75 @return 1 if all further devices will be opened in exclusive mode.
76
77 @note Value returned by this function before calling to @ref hid_init or after @ref hid_exit
78 is not reliable.
79 */
80 int HID_API_EXPORT_CALL hid_darwin_get_open_exclusive(void);
81
82 /** @brief Check how the device was opened.
83
84 Since version 0.12.0, @ref HID_API_VERSION >= HID_API_MAKE_VERSION(0, 12, 0)
85
86 @ingroup API
87 @param dev A device to get property from.
88
89 @return 1 if the device is opened in exclusive mode, 0 - opened in non-exclusive,
90 -1 - if dev is invalid.
91 */
92 int HID_API_EXPORT_CALL hid_darwin_is_device_open_exclusive(hid_device *dev);
93
94 #ifdef __cplusplus
95 }
96 #endif
97
98 #endif