hidapi
 All Data Structures Files Functions Variables Typedefs Macros Groups
hidapi.h
Go to the documentation of this file.
1 /*******************************************************
2  HIDAPI - Multi-Platform library for
3  communication with HID devices.
4 
5  Alan Ott
6  Signal 11 Software
7 
8  8/22/2009
9 
10  Copyright 2009, All Rights Reserved.
11 
12  At the discretion of the user of this library,
13  this software may be licensed under the terms of the
14  GNU General Public License v3, a BSD-Style license, or the
15  original HIDAPI license as outlined in the LICENSE.txt,
16  LICENSE-gpl3.txt, LICENSE-bsd.txt, and LICENSE-orig.txt
17  files located at the root of the source distribution.
18  These files may also be found in the public source
19  code repository located at:
20  http://github.com/signal11/hidapi .
21 ********************************************************/
22 
27 #ifndef HIDAPI_H__
28 #define HIDAPI_H__
29 
30 #include <wchar.h>
31 
32 #ifdef _WIN32
33  #define HID_API_EXPORT __declspec(dllexport)
34  #define HID_API_CALL
35 #else
36  #define HID_API_EXPORT
37  #define HID_API_CALL
38 #endif
39 
40 #define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45  struct hid_device_;
46  typedef struct hid_device_ hid_device;
49  struct hid_device_info {
51  char *path;
53  unsigned short vendor_id;
55  unsigned short product_id;
57  wchar_t *serial_number;
60  unsigned short release_number;
64  wchar_t *product_string;
67  unsigned short usage_page;
70  unsigned short usage;
80 
83  };
84 
85 
101 
114 
136  struct hid_device_info HID_API_EXPORT * HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id);
137 
147 
164  HID_API_EXPORT hid_device * HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
165 
180 
207  int HID_API_EXPORT HID_API_CALL hid_write(hid_device *dev, const unsigned char *data, size_t length);
208 
228  int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
229 
248  int HID_API_EXPORT HID_API_CALL hid_read(hid_device *dev, unsigned char *data, size_t length);
249 
269 
296  int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *dev, const unsigned char *data, size_t length);
297 
321  int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *dev, unsigned char *data, size_t length);
322 
329 
340  int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *dev, wchar_t *string, size_t maxlen);
341 
352  int HID_API_EXPORT_CALL hid_get_product_string(hid_device *dev, wchar_t *string, size_t maxlen);
353 
364  int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *dev, wchar_t *string, size_t maxlen);
365 
377  int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
378 
388  HID_API_EXPORT const wchar_t* HID_API_CALL hid_error(hid_device *dev);
389 
390 #ifdef __cplusplus
391 }
392 #endif
393 
394 #endif
395