My Project
Loading...
Searching...
No Matches
SDL_hidapi.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2023 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
62#ifndef SDL_hidapi_h_
63#define SDL_hidapi_h_
64
65#include "SDL_stdinc.h"
66
67#include "begin_code.h"
68/* Set up for C function definitions, even when using C++ */
69#ifdef __cplusplus
70extern "C" {
71#endif
72
76struct SDL_hid_device_;
77typedef struct SDL_hid_device_ SDL_hid_device;
83typedef struct SDL_hid_device_info
84{
86 char *path;
88 unsigned short vendor_id;
90 unsigned short product_id;
92 wchar_t *serial_number;
95 unsigned short release_number;
102 unsigned short usage_page;
105 unsigned short usage;
113
117 int interface_subclass;
118 int interface_protocol;
119
123
124
142extern DECLSPEC int SDLCALL SDL_hid_init(void);
143
156extern DECLSPEC int SDLCALL SDL_hid_exit(void);
157
177extern DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void);
178
199extern DECLSPEC SDL_hid_device_info * SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id);
200
211extern DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs);
212
229extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number);
230
243extern DECLSPEC SDL_hid_device * SDLCALL SDL_hid_open_path(const char *path, int bExclusive /* = false */);
244
269extern DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length);
270
290extern DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds);
291
310extern DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length);
311
328extern DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock);
329
352extern DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length);
353
374extern DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length);
375
383extern DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev);
384
395extern DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
396
407extern DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
408
419extern DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen);
420
432extern DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen);
433
441extern DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active);
442
443/* Ends C function definitions when using C++ */
444#ifdef __cplusplus
445}
446#endif
447#include "close_code.h"
448
449#endif /* SDL_hidapi_h_ */
450
451/* vi: set sts=4 ts=4 sw=4 expandtab: */
struct SDL_hid_device_ SDL_hid_device
Definition: SDL_hidapi.h:77
DECLSPEC int SDLCALL SDL_hid_get_serial_number_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen)
DECLSPEC void SDLCALL SDL_hid_close(SDL_hid_device *dev)
DECLSPEC Uint32 SDLCALL SDL_hid_device_change_count(void)
DECLSPEC int SDLCALL SDL_hid_set_nonblocking(SDL_hid_device *dev, int nonblock)
DECLSPEC int SDLCALL SDL_hid_read_timeout(SDL_hid_device *dev, unsigned char *data, size_t length, int milliseconds)
DECLSPEC void SDLCALL SDL_hid_ble_scan(SDL_bool active)
DECLSPEC int SDLCALL SDL_hid_send_feature_report(SDL_hid_device *dev, const unsigned char *data, size_t length)
DECLSPEC SDL_hid_device_info *SDLCALL SDL_hid_enumerate(unsigned short vendor_id, unsigned short product_id)
DECLSPEC int SDLCALL SDL_hid_write(SDL_hid_device *dev, const unsigned char *data, size_t length)
DECLSPEC int SDLCALL SDL_hid_read(SDL_hid_device *dev, unsigned char *data, size_t length)
DECLSPEC int SDLCALL SDL_hid_exit(void)
DECLSPEC SDL_hid_device *SDLCALL SDL_hid_open_path(const char *path, int bExclusive)
DECLSPEC int SDLCALL SDL_hid_get_indexed_string(SDL_hid_device *dev, int string_index, wchar_t *string, size_t maxlen)
DECLSPEC int SDLCALL SDL_hid_get_feature_report(SDL_hid_device *dev, unsigned char *data, size_t length)
DECLSPEC int SDLCALL SDL_hid_get_manufacturer_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen)
DECLSPEC int SDLCALL SDL_hid_get_product_string(SDL_hid_device *dev, wchar_t *string, size_t maxlen)
DECLSPEC SDL_hid_device *SDLCALL SDL_hid_open(unsigned short vendor_id, unsigned short product_id, const wchar_t *serial_number)
DECLSPEC void SDLCALL SDL_hid_free_enumeration(SDL_hid_device_info *devs)
DECLSPEC int SDLCALL SDL_hid_init(void)
Information about a connected HID device.
Definition: SDL_hidapi.h:84
unsigned short usage_page
Definition: SDL_hidapi.h:102
struct SDL_hid_device_info * next
Definition: SDL_hidapi.h:121
char * path
Definition: SDL_hidapi.h:86
int interface_number
Definition: SDL_hidapi.h:112
unsigned short usage
Definition: SDL_hidapi.h:105
unsigned short product_id
Definition: SDL_hidapi.h:90
wchar_t * product_string
Definition: SDL_hidapi.h:99
unsigned short vendor_id
Definition: SDL_hidapi.h:88
wchar_t * serial_number
Definition: SDL_hidapi.h:92
unsigned short release_number
Definition: SDL_hidapi.h:95
wchar_t * manufacturer_string
Definition: SDL_hidapi.h:97
int interface_class
Definition: SDL_hidapi.h:116