Kodi Development  19.0
for Binary and Script based Add-Ons
peripheral.h
1 /*
2  * Copyright (C) 2014-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #ifndef C_API_ADDONINSTANCE_PERIPHERAL_H
12 #define C_API_ADDONINSTANCE_PERIPHERAL_H
13 
14 #include "../addon_base.h"
15 
16 /* indicates a joystick has no preference for port number */
17 #define NO_PORT_REQUESTED (-1)
18 
19 /* joystick's driver button/hat/axis index is unknown */
20 #define DRIVER_INDEX_UNKNOWN (-1)
21 
22 #ifdef __cplusplus
23 extern "C"
24 {
25 #endif /* __cplusplus */
26 
27  //============================================================================
37  typedef enum PERIPHERAL_ERROR
38  {
41 
44 
47 
50 
53 
56 
61  //----------------------------------------------------------------------------
62 
63  // @name Peripheral types
64  //{
65 
66  //============================================================================
72  typedef enum PERIPHERAL_TYPE
73  {
76 
79 
84  //----------------------------------------------------------------------------
85 
89  typedef struct PERIPHERAL_INFO
90  {
92  char* name;
93  uint16_t vendor_id;
94  uint16_t product_id;
95  unsigned int index;
96  } ATTRIBUTE_PACKED PERIPHERAL_INFO;
97 
101  typedef struct PERIPHERAL_CAPABILITIES
102  {
104  bool provides_joystick_rumble;
105  bool provides_joystick_power_off;
107  } ATTRIBUTE_PACKED PERIPHERAL_CAPABILITIES;
108 
109  //}
110 
111  // @name Event types
112  //{
113 
114  //============================================================================
121  {
124 
127 
130 
133 
138  //----------------------------------------------------------------------------
139 
140  //============================================================================
147  {
150 
155  //----------------------------------------------------------------------------
156 
157  //============================================================================
163  typedef enum JOYSTICK_STATE_HAT
164  {
167 
170 
173 
176 
179 
182 
185 
188 
193  //----------------------------------------------------------------------------
194 
195  //============================================================================
203  typedef float JOYSTICK_STATE_AXIS;
204  //----------------------------------------------------------------------------
205 
206  //============================================================================
209  typedef float JOYSTICK_STATE_MOTOR;
210  //----------------------------------------------------------------------------
211 
215  typedef struct PERIPHERAL_EVENT
216  {
218  unsigned int peripheral_index;
219 
222 
224  unsigned int driver_index;
225 
226  JOYSTICK_STATE_BUTTON driver_button_state;
227  JOYSTICK_STATE_HAT driver_hat_state;
228  JOYSTICK_STATE_AXIS driver_axis_state;
229  JOYSTICK_STATE_MOTOR motor_state;
230  } ATTRIBUTE_PACKED PERIPHERAL_EVENT;
231 
232  //}
233 
234  // @name Joystick types
235  //{
236 
240  typedef struct JOYSTICK_INFO
241  {
243  char* provider;
245  unsigned int button_count;
246  unsigned int hat_count;
247  unsigned int axis_count;
248  unsigned int motor_count;
250  } ATTRIBUTE_PACKED JOYSTICK_INFO;
251 
252  //============================================================================
266  {
269 
272 
275 
278 
281 
284 
287 
292  //----------------------------------------------------------------------------
293 
297  typedef struct JOYSTICK_DRIVER_BUTTON
298  {
299  int index;
300  } ATTRIBUTE_PACKED JOYSTICK_DRIVER_BUTTON;
301 
302  //============================================================================
309  {
312 
315 
318 
321 
326  //----------------------------------------------------------------------------
327 
331  typedef struct JOYSTICK_DRIVER_HAT
332  {
333  int index;
335  } ATTRIBUTE_PACKED JOYSTICK_DRIVER_HAT;
336 
337  //============================================================================
344  {
347 
350 
355  //----------------------------------------------------------------------------
356 
361  {
362  int index;
363  int center;
365  unsigned int range;
366  } ATTRIBUTE_PACKED JOYSTICK_DRIVER_SEMIAXIS;
367 
371  typedef struct JOYSTICK_DRIVER_MOTOR
372  {
373  int index;
374  } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOTOR;
375 
379  typedef struct JOYSTICK_DRIVER_KEY
380  {
381  char keycode[16];
382  } ATTRIBUTE_PACKED JOYSTICK_DRIVER_KEY;
383 
384  //============================================================================
391  {
394 
397 
400 
403 
406 
409 
412 
415 
418 
423  //----------------------------------------------------------------------------
424 
429  {
431  } ATTRIBUTE_PACKED JOYSTICK_DRIVER_MOUSE_BUTTON;
432 
433  //============================================================================
440  {
443 
446 
449 
452 
457  //----------------------------------------------------------------------------
458 
463  {
465  } ATTRIBUTE_PACKED JOYSTICK_DRIVER_RELPOINTER;
466 
471  {
473  union
474  {
475  struct JOYSTICK_DRIVER_BUTTON button;
476  struct JOYSTICK_DRIVER_HAT hat;
477  struct JOYSTICK_DRIVER_SEMIAXIS semiaxis;
478  struct JOYSTICK_DRIVER_MOTOR motor;
479  struct JOYSTICK_DRIVER_KEY key;
480  struct JOYSTICK_DRIVER_MOUSE_BUTTON mouse;
481  struct JOYSTICK_DRIVER_RELPOINTER relpointer;
482  };
483  } ATTRIBUTE_PACKED JOYSTICK_DRIVER_PRIMITIVE;
484 
485  //============================================================================
496  {
499 
502 
505 
508 
511 
514 
517 
520 
523 
528  //----------------------------------------------------------------------------
529 
530  //============================================================================
538  {
541 
550 
557 
560 
565 
570 
573 
576 
585 
590  //----------------------------------------------------------------------------
591 
595  typedef struct JOYSTICK_FEATURE
596  {
597  char* name;
600  } ATTRIBUTE_PACKED JOYSTICK_FEATURE;
601  //}
602 
603  typedef struct AddonProps_Peripheral
604  {
605  const char* user_path;
606  const char* addon_path;
607  } ATTRIBUTE_PACKED AddonProps_Peripheral;
608 
610 
612  {
613  KODI_HANDLE kodiInstance;
614  void (*trigger_scan)(void* kodiInstance);
615  void (*refresh_button_maps)(void* kodiInstance,
616  const char* device_name,
617  const char* controller_id);
618  unsigned int (*feature_count)(void* kodiInstance,
619  const char* controller_id,
620  JOYSTICK_FEATURE_TYPE type);
621  JOYSTICK_FEATURE_TYPE(*feature_type)
622  (void* kodiInstance, const char* controller_id, const char* feature_name);
624 
626 
628  {
629  KODI_HANDLE addonInstance;
630 
631  void(__cdecl* get_capabilities)(const struct AddonInstance_Peripheral* addonInstance,
632  struct PERIPHERAL_CAPABILITIES* capabilities);
633  PERIPHERAL_ERROR(__cdecl* perform_device_scan)
634  (const struct AddonInstance_Peripheral* addonInstance,
635  unsigned int* peripheral_count,
636  struct PERIPHERAL_INFO** scan_results);
637  void(__cdecl* free_scan_results)(const struct AddonInstance_Peripheral* addonInstance,
638  unsigned int peripheral_count,
639  struct PERIPHERAL_INFO* scan_results);
640  PERIPHERAL_ERROR(__cdecl* get_events)
641  (const struct AddonInstance_Peripheral* addonInstance,
642  unsigned int* event_count,
643  struct PERIPHERAL_EVENT** events);
644  void(__cdecl* free_events)(const struct AddonInstance_Peripheral* addonInstance,
645  unsigned int event_count,
646  struct PERIPHERAL_EVENT* events);
647  bool(__cdecl* send_event)(const struct AddonInstance_Peripheral* addonInstance,
648  const struct PERIPHERAL_EVENT* event);
649 
652  PERIPHERAL_ERROR(__cdecl* get_joystick_info)
653  (const struct AddonInstance_Peripheral* addonInstance,
654  unsigned int index,
655  struct JOYSTICK_INFO* info);
656  void(__cdecl* free_joystick_info)(const struct AddonInstance_Peripheral* addonInstance,
657  struct JOYSTICK_INFO* info);
658  PERIPHERAL_ERROR(__cdecl* get_features)
659  (const struct AddonInstance_Peripheral* addonInstance,
660  const struct JOYSTICK_INFO* joystick,
661  const char* controller_id,
662  unsigned int* feature_count,
663  struct JOYSTICK_FEATURE** features);
664  void(__cdecl* free_features)(const struct AddonInstance_Peripheral* addonInstance,
665  unsigned int feature_count,
666  struct JOYSTICK_FEATURE* features);
667  PERIPHERAL_ERROR(__cdecl* map_features)
668  (const struct AddonInstance_Peripheral* addonInstance,
669  const struct JOYSTICK_INFO* joystick,
670  const char* controller_id,
671  unsigned int feature_count,
672  const struct JOYSTICK_FEATURE* features);
673  PERIPHERAL_ERROR(__cdecl* get_ignored_primitives)
674  (const struct AddonInstance_Peripheral* addonInstance,
675  const struct JOYSTICK_INFO* joystick,
676  unsigned int* feature_count,
677  struct JOYSTICK_DRIVER_PRIMITIVE** primitives);
678  void(__cdecl* free_primitives)(const struct AddonInstance_Peripheral* addonInstance,
679  unsigned int,
680  struct JOYSTICK_DRIVER_PRIMITIVE* primitives);
681  PERIPHERAL_ERROR(__cdecl* set_ignored_primitives)
682  (const struct AddonInstance_Peripheral* addonInstance,
683  const struct JOYSTICK_INFO* joystick,
684  unsigned int primitive_count,
685  const struct JOYSTICK_DRIVER_PRIMITIVE* primitives);
686  void(__cdecl* save_button_map)(const struct AddonInstance_Peripheral* addonInstance,
687  const struct JOYSTICK_INFO* joystick);
688  void(__cdecl* revert_button_map)(const struct AddonInstance_Peripheral* addonInstance,
689  const struct JOYSTICK_INFO* joystick);
690  void(__cdecl* reset_button_map)(const struct AddonInstance_Peripheral* addonInstance,
691  const struct JOYSTICK_INFO* joystick,
692  const char* controller_id);
693  void(__cdecl* power_off_joystick)(const struct AddonInstance_Peripheral* addonInstance,
694  unsigned int index);
697 
699  {
700  struct AddonProps_Peripheral* props;
701  struct AddonToKodiFuncTable_Peripheral* toKodi;
702  struct KodiToAddonFuncTable_Peripheral* toAddon;
704 
705 #ifdef __cplusplus
706 } /* extern "C" */
707 #endif /* __cplusplus */
708 
709 #endif /* !C_API_ADDONINSTANCE_PERIPHERAL_H */
JOYSTICK_ACCELEROMETER_POSITIVE_X
@ JOYSTICK_ACCELEROMETER_POSITIVE_X
Accelerometer X.
Definition: peripheral.h:552
JOYSTICK_DRIVER_HAT_DIRECTION
JOYSTICK_DRIVER_HAT_DIRECTION
Definition: peripheral.h:309
PERIPHERAL_EVENT::driver_index
unsigned int driver_index
The index of the event source.
Definition: peripheral.h:224
JOYSTICK_FEATURE_PRIMITIVE
JOYSTICK_FEATURE_PRIMITIVE
Definition: peripheral.h:538
PERIPHERAL_NO_ERROR
@ PERIPHERAL_NO_ERROR
0 : No error occurred
Definition: peripheral.h:40
JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION
@ JOYSTICK_DRIVER_PRIMITIVE_TYPE_RELPOINTER_DIRECTION
Driver input primitive type relative pointer direction.
Definition: peripheral.h:289
JOYSTICK_FEATURE_TYPE_ANALOG_STICK
@ JOYSTICK_FEATURE_TYPE_ANALOG_STICK
Type analog stick.
Definition: peripheral.h:504
PERIPHERAL_CAPABILITIES::provides_joysticks
bool provides_joysticks
Definition: peripheral.h:103
JOYSTICK_ANALOG_STICK_RIGHT
@ JOYSTICK_ANALOG_STICK_RIGHT
Analog stick right.
Definition: peripheral.h:547
KodiToAddonFuncTable_Peripheral
Definition: peripheral.h:628
JOYSTICK_THROTTLE_UP
@ JOYSTICK_THROTTLE_UP
Throttle up.
Definition: peripheral.h:567
PERIPHERAL_ERROR_NOT_CONNECTED
@ PERIPHERAL_ERROR_NOT_CONNECTED
-5 : No peripherals are connected
Definition: peripheral.h:55
JOYSTICK_DRIVER_SEMIAXIS
Semiaxis primitive.
Definition: peripheral.h:361
PERIPHERAL_ERROR_CONNECTION_FAILED
@ PERIPHERAL_ERROR_CONNECTION_FAILED
-6 : Peripherals are connected, but command was interrupted
Definition: peripheral.h:58
JOYSTICK_MOTOR_PRIMITIVE
@ JOYSTICK_MOTOR_PRIMITIVE
Motor.
Definition: peripheral.h:559
PERIPHERAL_ERROR_FAILED
@ PERIPHERAL_ERROR_FAILED
-2 : The command failed
Definition: peripheral.h:46
JOYSTICK_DRIVER_RELPOINTER_LEFT
@ JOYSTICK_DRIVER_RELPOINTER_LEFT
Relative pointer direction left.
Definition: peripheral.h:445
JOYSTICK_FEATURE_TYPE_SCALAR
@ JOYSTICK_FEATURE_TYPE_SCALAR
Type scalar.
Definition: peripheral.h:501
JOYSTICK_RELPOINTER_UP
@ JOYSTICK_RELPOINTER_UP
Relative pointer direction up.
Definition: peripheral.h:578
JOYSTICK_SCALAR_PRIMITIVE
@ JOYSTICK_SCALAR_PRIMITIVE
Scalar feature (a button, hat direction or semiaxis)
Definition: peripheral.h:540
JOYSTICK_DRIVER_MOUSE_BUTTON
Mouse button primitive.
Definition: peripheral.h:429
JOYSTICK_DRIVER_RELPOINTER_DIRECTION
JOYSTICK_DRIVER_RELPOINTER_DIRECTION
Definition: peripheral.h:440
PERIPHERAL_INFO::index
unsigned int index
Definition: peripheral.h:95
AddonProps_Peripheral::user_path
const char * user_path
path to the user profile
Definition: peripheral.h:605
JOYSTICK_WHEEL_LEFT
@ JOYSTICK_WHEEL_LEFT
Wheel left.
Definition: peripheral.h:562
PERIPHERAL_EVENT_TYPE_NONE
@ PERIPHERAL_EVENT_TYPE_NONE
unknown event
Definition: peripheral.h:123
PERIPHERAL_INFO::type
PERIPHERAL_TYPE type
Definition: peripheral.h:91
JOYSTICK_FEATURE_TYPE
JOYSTICK_FEATURE_TYPE
Definition: peripheral.h:496
JOYSTICK_DRIVER_SEMIAXIS_DIRECTION
JOYSTICK_DRIVER_SEMIAXIS_DIRECTION
Definition: peripheral.h:344
PERIPHERAL_INFO::vendor_id
uint16_t vendor_id
Definition: peripheral.h:93
PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON
@ PERIPHERAL_EVENT_TYPE_DRIVER_BUTTON
state changed for joystick driver button
Definition: peripheral.h:126
JOYSTICK_DRIVER_MOUSE_INDEX
JOYSTICK_DRIVER_MOUSE_INDEX
Definition: peripheral.h:391
JOYSTICK_FEATURE_TYPE_MOTOR
@ JOYSTICK_FEATURE_TYPE_MOTOR
Type motor.
Definition: peripheral.h:510
AddonProps_Peripheral::addon_path
const char * addon_path
path to this add-on
Definition: peripheral.h:606
JOYSTICK_INFO::peripheral
PERIPHERAL_INFO peripheral
peripheral info for this joystick
Definition: peripheral.h:242
JOYSTICK_FEATURE_TYPE_WHEEL
@ JOYSTICK_FEATURE_TYPE_WHEEL
Type wheel.
Definition: peripheral.h:519
JOYSTICK_STATE_BUTTON
JOYSTICK_STATE_BUTTON
Definition: peripheral.h:147
AddonProps_Peripheral
Definition: peripheral.h:604
JOYSTICK_DRIVER_RELPOINTER_DOWN
@ JOYSTICK_DRIVER_RELPOINTER_DOWN
Relative pointer direction down.
Definition: peripheral.h:454
JOYSTICK_FEATURE_TYPE_RELPOINTER
@ JOYSTICK_FEATURE_TYPE_RELPOINTER
Type relative pointer.
Definition: peripheral.h:513
JOYSTICK_FEATURE_TYPE_KEY
@ JOYSTICK_FEATURE_TYPE_KEY
Type key.
Definition: peripheral.h:525
JOYSTICK_DRIVER_HAT_LEFT
@ JOYSTICK_DRIVER_HAT_LEFT
Driver hat left.
Definition: peripheral.h:314
JOYSTICK_DRIVER_MOUSE_INDEX_WHEEL_DOWN
@ JOYSTICK_DRIVER_MOUSE_INDEX_WHEEL_DOWN
Mouse index wheel down.
Definition: peripheral.h:414
JOYSTICK_DRIVER_RELPOINTER_UNKNOWN
@ JOYSTICK_DRIVER_RELPOINTER_UNKNOWN
Relative pointer direction unknown.
Definition: peripheral.h:442
JOYSTICK_RELPOINTER_RIGHT
@ JOYSTICK_RELPOINTER_RIGHT
Relative pointer direction right.
Definition: peripheral.h:582
JOYSTICK_DRIVER_HAT_DOWN
@ JOYSTICK_DRIVER_HAT_DOWN
Driver hat down.
Definition: peripheral.h:323
JOYSTICK_INFO::motor_count
unsigned int motor_count
number of motors reported by the driver
Definition: peripheral.h:248
JOYSTICK_DRIVER_MOUSE_INDEX_HORIZ_WHEEL_LEFT
@ JOYSTICK_DRIVER_MOUSE_INDEX_HORIZ_WHEEL_LEFT
Mouse index horizontal wheel left.
Definition: peripheral.h:417
JOYSTICK_INFO::axis_count
unsigned int axis_count
number of axes reported by the driver
Definition: peripheral.h:247
JOYSTICK_DRIVER_MOUSE_INDEX_RIGHT
@ JOYSTICK_DRIVER_MOUSE_INDEX_RIGHT
Mouse index right.
Definition: peripheral.h:399
PERIPHERAL_CAPABILITIES::provides_buttonmaps
bool provides_buttonmaps
Definition: peripheral.h:106
JOYSTICK_STATE_HAT
JOYSTICK_STATE_HAT
Definition: peripheral.h:164
JOYSTICK_STATE_HAT_DOWN
@ JOYSTICK_STATE_HAT_DOWN
only down is pressed
Definition: peripheral.h:178
JOYSTICK_FEATURE_TYPE_ABSPOINTER
@ JOYSTICK_FEATURE_TYPE_ABSPOINTER
Type absolut pointer.
Definition: peripheral.h:516
JOYSTICK_DRIVER_HAT_UNKNOWN
@ JOYSTICK_DRIVER_HAT_UNKNOWN
Driver hat unknown.
Definition: peripheral.h:311
JOYSTICK_STATE_HAT_RIGHT_UP
@ JOYSTICK_STATE_HAT_RIGHT_UP
right and up is pressed
Definition: peripheral.h:187
AddonToKodiFuncTable_Peripheral
Definition: peripheral.h:612
AddonInstance_Peripheral
Definition: peripheral.h:699
PERIPHERAL_INFO::product_id
uint16_t product_id
Definition: peripheral.h:94
JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN
@ JOYSTICK_DRIVER_SEMIAXIS_UNKNOWN
unknown direction
Definition: peripheral.h:349
PERIPHERAL_EVENT
Event information.
Definition: peripheral.h:216
JOYSTICK_INFO
Info specific to joystick peripherals.
Definition: peripheral.h:241
JOYSTICK_DRIVER_RELPOINTER_UP
@ JOYSTICK_DRIVER_RELPOINTER_UP
Relative pointer direction up.
Definition: peripheral.h:451
JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION
@ JOYSTICK_DRIVER_PRIMITIVE_TYPE_HAT_DIRECTION
Driver input primitive type hat direction.
Definition: peripheral.h:274
JOYSTICK_DRIVER_MOUSE_INDEX_UNKNOWN
@ JOYSTICK_DRIVER_MOUSE_INDEX_UNKNOWN
Mouse index unknown.
Definition: peripheral.h:393
PERIPHERAL_TYPE_UNKNOWN
@ PERIPHERAL_TYPE_UNKNOWN
Type declared as unknown.
Definition: peripheral.h:75
JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR
@ JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOTOR
Driver input primitive type motor.
Definition: peripheral.h:280
JOYSTICK_DRIVER_MOUSE_INDEX_BUTTON5
@ JOYSTICK_DRIVER_MOUSE_INDEX_BUTTON5
Mouse index button 5.
Definition: peripheral.h:408
JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY
@ JOYSTICK_DRIVER_PRIMITIVE_TYPE_KEY
Driver input primitive type key.
Definition: peripheral.h:283
JOYSTICK_STATE_HAT_UNPRESSED
@ JOYSTICK_STATE_HAT_UNPRESSED
no directions are pressed
Definition: peripheral.h:166
JOYSTICK_FEATURE_TYPE_ACCELEROMETER
@ JOYSTICK_FEATURE_TYPE_ACCELEROMETER
Type accelerometer.
Definition: peripheral.h:507
JOYSTICK_STATE_HAT_LEFT_DOWN
@ JOYSTICK_STATE_HAT_LEFT_DOWN
left and down is pressed
Definition: peripheral.h:184
PERIPHERAL_ERROR_INVALID_PARAMETERS
@ PERIPHERAL_ERROR_INVALID_PARAMETERS
-3 : The parameters of the method are invalid for this operation
Definition: peripheral.h:49
PERIPHERAL_EVENT_TYPE_SET_MOTOR
@ PERIPHERAL_EVENT_TYPE_SET_MOTOR
set the state for joystick rumble motor
Definition: peripheral.h:135
JOYSTICK_DRIVER_SEMIAXIS_POSITIVE
@ JOYSTICK_DRIVER_SEMIAXIS_POSITIVE
positive half of the axis
Definition: peripheral.h:352
JOYSTICK_ANALOG_STICK_UP
@ JOYSTICK_ANALOG_STICK_UP
Analog stick up.
Definition: peripheral.h:543
PERIPHERAL_TYPE_KEYBOARD
@ PERIPHERAL_TYPE_KEYBOARD
Type declared as keyboard.
Definition: peripheral.h:81
JOYSTICK_INFO::provider
char * provider
name of the driver or interface providing the joystick
Definition: peripheral.h:243
JOYSTICK_DRIVER_HAT_RIGHT
@ JOYSTICK_DRIVER_HAT_RIGHT
Driver hat right.
Definition: peripheral.h:317
PERIPHERAL_INFO::name
char * name
Definition: peripheral.h:92
JOYSTICK_STATE_AXIS
float JOYSTICK_STATE_AXIS
Axis value in the closed interval [-1.0, 1.0].
Definition: peripheral.h:203
JOYSTICK_FEATURE_TYPE_THROTTLE
@ JOYSTICK_FEATURE_TYPE_THROTTLE
Type throttle.
Definition: peripheral.h:522
JOYSTICK_INFO::button_count
unsigned int button_count
number of buttons reported by the driver
Definition: peripheral.h:245
PERIPHERAL_ERROR
PERIPHERAL_ERROR
Definition: peripheral.h:38
PERIPHERAL_EVENT::peripheral_index
unsigned int peripheral_index
Index of the peripheral handling/receiving the event.
Definition: peripheral.h:218
JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN
@ JOYSTICK_DRIVER_PRIMITIVE_TYPE_UNKNOWN
Driver input primitive type unknown.
Definition: peripheral.h:268
JOYSTICK_DRIVER_RELPOINTER_RIGHT
@ JOYSTICK_DRIVER_RELPOINTER_RIGHT
Relative pointer direction right.
Definition: peripheral.h:448
PERIPHERAL_ERROR_UNKNOWN
@ PERIPHERAL_ERROR_UNKNOWN
-1 : An unknown error occurred
Definition: peripheral.h:43
JOYSTICK_DRIVER_MOUSE_INDEX_BUTTON4
@ JOYSTICK_DRIVER_MOUSE_INDEX_BUTTON4
Mouse index button 4.
Definition: peripheral.h:405
JOYSTICK_THROTTLE_DOWN
@ JOYSTICK_THROTTLE_DOWN
Throttle down.
Definition: peripheral.h:569
JOYSTICK_STATE_BUTTON_UNPRESSED
@ JOYSTICK_STATE_BUTTON_UNPRESSED
button is released
Definition: peripheral.h:149
PERIPHERAL_EVENT::type
PERIPHERAL_EVENT_TYPE type
Type of the event used to determine which enum field to access below.
Definition: peripheral.h:221
JOYSTICK_DRIVER_MOUSE_INDEX_LEFT
@ JOYSTICK_DRIVER_MOUSE_INDEX_LEFT
Mouse index left.
Definition: peripheral.h:396
JOYSTICK_RELPOINTER_LEFT
@ JOYSTICK_RELPOINTER_LEFT
Relative pointer direction left.
Definition: peripheral.h:584
PERIPHERAL_TYPE
PERIPHERAL_TYPE
Definition: peripheral.h:73
PERIPHERAL_EVENT_TYPE_DRIVER_HAT
@ PERIPHERAL_EVENT_TYPE_DRIVER_HAT
state changed for joystick driver hat
Definition: peripheral.h:129
JOYSTICK_MOUSE_BUTTON
@ JOYSTICK_MOUSE_BUTTON
Mouse button.
Definition: peripheral.h:575
JOYSTICK_INFO::requested_port
int requested_port
requested port number (such as for 360 controllers), or NO_PORT_REQUESTED
Definition: peripheral.h:244
PERIPHERAL_INFO
Information shared between peripherals.
Definition: peripheral.h:90
JOYSTICK_STATE_HAT_RIGHT
@ JOYSTICK_STATE_HAT_RIGHT
only right is pressed
Definition: peripheral.h:172
JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON
@ JOYSTICK_DRIVER_PRIMITIVE_TYPE_BUTTON
Driver input primitive type button.
Definition: peripheral.h:271
JOYSTICK_STATE_HAT_LEFT_UP
@ JOYSTICK_STATE_HAT_LEFT_UP
left and up is pressed
Definition: peripheral.h:181
JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON
@ JOYSTICK_DRIVER_PRIMITIVE_TYPE_MOUSE_BUTTON
Driver input primitive type mouse button.
Definition: peripheral.h:286
JOYSTICK_FEATURE
Mapping between higher-level controller feature and its driver primitives.
Definition: peripheral.h:596
PERIPHERAL_ERROR_NOT_IMPLEMENTED
@ PERIPHERAL_ERROR_NOT_IMPLEMENTED
-4 : The method that the frontend called is not implemented
Definition: peripheral.h:52
JOYSTICK_STATE_HAT_UP
@ JOYSTICK_STATE_HAT_UP
only up is pressed
Definition: peripheral.h:175
JOYSTICK_STATE_BUTTON_PRESSED
@ JOYSTICK_STATE_BUTTON_PRESSED
button is pressed
Definition: peripheral.h:152
JOYSTICK_DRIVER_PRIMITIVE_TYPE
JOYSTICK_DRIVER_PRIMITIVE_TYPE
Definition: peripheral.h:266
JOYSTICK_ANALOG_STICK_LEFT
@ JOYSTICK_ANALOG_STICK_LEFT
Analog stick left.
Definition: peripheral.h:549
JOYSTICK_DRIVER_SEMIAXIS_NEGATIVE
@ JOYSTICK_DRIVER_SEMIAXIS_NEGATIVE
negative half of the axis
Definition: peripheral.h:346
JOYSTICK_DRIVER_MOTOR
Motor primitive.
Definition: peripheral.h:372
JOYSTICK_KEY_PRIMITIVE
@ JOYSTICK_KEY_PRIMITIVE
Key.
Definition: peripheral.h:572
PERIPHERAL_EVENT_TYPE
PERIPHERAL_EVENT_TYPE
Definition: peripheral.h:121
JOYSTICK_DRIVER_KEY
Keyboard key primitive.
Definition: peripheral.h:380
JOYSTICK_DRIVER_MOUSE_INDEX_MIDDLE
@ JOYSTICK_DRIVER_MOUSE_INDEX_MIDDLE
Mouse index middle.
Definition: peripheral.h:402
JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS
@ JOYSTICK_DRIVER_PRIMITIVE_TYPE_SEMIAXIS
Driver input primitive type semiaxis.
Definition: peripheral.h:277
JOYSTICK_DRIVER_HAT
Hat direction primitive.
Definition: peripheral.h:332
JOYSTICK_DRIVER_HAT_UP
@ JOYSTICK_DRIVER_HAT_UP
Driver hat up.
Definition: peripheral.h:320
JOYSTICK_INFO::supports_poweroff
bool supports_poweroff
whether the joystick supports being powered off
Definition: peripheral.h:249
JOYSTICK_DRIVER_PRIMITIVE
Driver primitive struct.
Definition: peripheral.h:471
PERIPHERAL_EVENT_TYPE_DRIVER_AXIS
@ PERIPHERAL_EVENT_TYPE_DRIVER_AXIS
state changed for joystick driver axis
Definition: peripheral.h:132
JOYSTICK_ANALOG_STICK_DOWN
@ JOYSTICK_ANALOG_STICK_DOWN
Analog stick down.
Definition: peripheral.h:545
JOYSTICK_ACCELEROMETER_POSITIVE_Z
@ JOYSTICK_ACCELEROMETER_POSITIVE_Z
Accelerometer Z.
Definition: peripheral.h:556
JOYSTICK_DRIVER_MOUSE_INDEX_WHEEL_UP
@ JOYSTICK_DRIVER_MOUSE_INDEX_WHEEL_UP
Mouse index wheel up.
Definition: peripheral.h:411
JOYSTICK_PRIMITIVE_MAX
@ JOYSTICK_PRIMITIVE_MAX
Maximum number of primitives.
Definition: peripheral.h:587
JOYSTICK_DRIVER_RELPOINTER
Relative pointer direction primitive.
Definition: peripheral.h:463
PERIPHERAL_TYPE_JOYSTICK
@ PERIPHERAL_TYPE_JOYSTICK
Type declared as joystick.
Definition: peripheral.h:78
PERIPHERAL_CAPABILITIES
Peripheral add-on capabilities.
Definition: peripheral.h:102
JOYSTICK_DRIVER_MOUSE_INDEX_HORIZ_WHEEL_RIGHT
@ JOYSTICK_DRIVER_MOUSE_INDEX_HORIZ_WHEEL_RIGHT
Mouse index horizontal wheel right.
Definition: peripheral.h:420
JOYSTICK_STATE_HAT_RIGHT_DOWN
@ JOYSTICK_STATE_HAT_RIGHT_DOWN
right and down is pressed
Definition: peripheral.h:190
JOYSTICK_WHEEL_RIGHT
@ JOYSTICK_WHEEL_RIGHT
Wheel right.
Definition: peripheral.h:564
JOYSTICK_DRIVER_BUTTON
Button primitive.
Definition: peripheral.h:298
JOYSTICK_STATE_HAT_LEFT
@ JOYSTICK_STATE_HAT_LEFT
only left is pressed
Definition: peripheral.h:169
JOYSTICK_ACCELEROMETER_POSITIVE_Y
@ JOYSTICK_ACCELEROMETER_POSITIVE_Y
Accelerometer Y.
Definition: peripheral.h:554
JOYSTICK_FEATURE_TYPE_UNKNOWN
@ JOYSTICK_FEATURE_TYPE_UNKNOWN
Unknown type.
Definition: peripheral.h:498
JOYSTICK_STATE_MOTOR
float JOYSTICK_STATE_MOTOR
Motor value in the closed interval [0.0, 1.0].
Definition: peripheral.h:209
JOYSTICK_RELPOINTER_DOWN
@ JOYSTICK_RELPOINTER_DOWN
Relative pointer direction down.
Definition: peripheral.h:580
JOYSTICK_INFO::hat_count
unsigned int hat_count
number of hats reported by the driver
Definition: peripheral.h:246