Instrument Neutral Distributed Interface INDI 2.2.5
indi_hidapi.h
Go to the documentation of this file.
1/*
2 HIDAPI - Multi-Platform library for communication with HID devices.
3
4 Copyright (c) 2009 by Alan Ott, Signal 11 Software (8/22/2009)
5 All Rights Reserved.
6
7 Changes for use with SX Filter Wheel INDI Driver by CloudMakers - 11/6/2012
8
9 This program is free software; you can redistribute it and/or modify it
10 under the terms of the GNU General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option)
12 any later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 more details.
18
19 You should have received a copy of the GNU General Public License along with
20 this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 The full GNU General Public License is included in this distribution in the
24 file called LICENSE.
25
26 These files may also be found in the public source code repository located:
27 http://github.com/signal11/hidapi
28*/
29
34#pragma once
35
36#include <wchar.h>
37
38#ifdef _WIN32
39#define HID_API_EXPORT __declspec(dllexport)
40#define HID_API_CALL
41#else
42#define HID_API_EXPORT
43#define HID_API_CALL
44#endif
45
46#define HID_API_EXPORT_CALL HID_API_EXPORT HID_API_CALL
48#ifdef __cplusplus
49extern "C" {
50#endif
51struct hid_device_;
52typedef struct hid_device_ hid_device;
56{
58 char *path;
60 unsigned short vendor_id;
62 unsigned short product_id;
64 wchar_t *serial_number;
67 unsigned short release_number;
74 unsigned short usage_page;
77 unsigned short usage;
83
86};
87
103
116
136struct hid_device_info HID_API_EXPORT *HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id);
137
147
164HID_API_EXPORT hid_device *HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id,
165 const wchar_t *serial_number);
166
181
208int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length);
209
228int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds);
229
247int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length);
248
268
295int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length);
296
316int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length);
317
324
335int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen);
336
347int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen);
348
359int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen);
360
372int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen);
373
384
385#ifdef __cplusplus
386}
387#endif
hid_device * device
HID_API_EXPORT hid_device *HID_API_CALL hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
Open a HID device using a Vendor ID (VID), Product ID (PID) and optionally a serial number.
Definition hid_libusb.c:612
int HID_API_EXPORT HID_API_CALL hid_read(hid_device *device, unsigned char *data, size_t length)
Read an Input report from a HID device.
int HID_API_EXPORT_CALL hid_get_indexed_string(hid_device *device, int string_index, wchar_t *string, size_t maxlen)
Get a string from a HID device, based on its string index.
int HID_API_EXPORT HID_API_CALL hid_exit()
Finalize the HIDAPI library.
Definition hid_libusb.c:407
int HID_API_EXPORT_CALL hid_get_manufacturer_string(hid_device *device, wchar_t *string, size_t maxlen)
Get The Manufacturer String from a HID device.
int HID_API_EXPORT HID_API_CALL hid_get_feature_report(hid_device *device, unsigned char *data, size_t length)
Get a feature report from a HID device.
int HID_API_EXPORT HID_API_CALL hid_init()
Initialize the HIDAPI library.
Definition hid_libusb.c:388
#define HID_API_EXPORT_CALL
Definition indi_hidapi.h:46
HID_API_EXPORT const wchar_t *HID_API_CALL hid_error(hid_device *device)
Get a string describing the last error which occurred.
int HID_API_EXPORT_CALL hid_get_serial_number_string(hid_device *device, wchar_t *string, size_t maxlen)
Get The Serial Number String from a HID device.
HID_API_EXPORT hid_device *HID_API_CALL hid_open_path(const char *path)
Open a HID device by its path name.
Definition hid_libusb.c:790
void HID_API_EXPORT HID_API_CALL hid_close(hid_device *device)
Close a HID device.
int HID_API_EXPORT HID_API_CALL hid_read_timeout(hid_device *dev, unsigned char *data, size_t length, int milliseconds)
Read an Input report from a HID device with timeout.
Definition hid_libusb.c:997
#define HID_API_EXPORT
Definition indi_hidapi.h:42
int HID_API_EXPORT_CALL hid_get_product_string(hid_device *device, wchar_t *string, size_t maxlen)
Get The Product String from a HID device.
struct hid_device_info HID_API_EXPORT *HID_API_CALL hid_enumerate(unsigned short vendor_id, unsigned short product_id)
Enumerate the HID Devices.
Definition hid_libusb.c:418
int HID_API_EXPORT HID_API_CALL hid_write(hid_device *device, const unsigned char *data, size_t length)
Write an Output report to a HID device.
Definition hid_libusb.c:929
int HID_API_EXPORT HID_API_CALL hid_send_feature_report(hid_device *device, const unsigned char *data, size_t length)
Send a Feature report to the device.
#define HID_API_CALL
Definition indi_hidapi.h:43
int HID_API_EXPORT HID_API_CALL hid_set_nonblocking(hid_device *device, int nonblock)
Set the device handle to be non-blocking.
void HID_API_EXPORT HID_API_CALL hid_free_enumeration(struct hid_device_info *devs)
Free an enumeration Linked List.
Definition hid_libusb.c:597
unsigned short product_id
Definition indi_hidapi.h:62
struct hid_device_info * next
Definition indi_hidapi.h:85
unsigned short usage
Definition indi_hidapi.h:77
wchar_t * manufacturer_string
Definition indi_hidapi.h:69
unsigned short vendor_id
Definition indi_hidapi.h:60
unsigned short release_number
Definition indi_hidapi.h:67
wchar_t * serial_number
Definition indi_hidapi.h:64
unsigned short usage_page
Definition indi_hidapi.h:74
wchar_t * product_string
Definition indi_hidapi.h:71