Instrument Neutral Distributed Interface INDI 2.2.5
Classes | Macros | Enumerations
joystickdriver.h File Reference
#include <iostream>
#include <functional>
#include <algorithm>
#include <fcntl.h>
#include <pthread.h>
#include <cmath>
#include <cstdint>
#include <linux/joystick.h>
#include <vector>
#include <unistd.h>

Go to the source code of this file.

Classes

struct  joystick_position
 
struct  joystick_state
 
struct  JoyAxisPair
 A matched pair of axis indices that together form a joystick. More...
 
class  JoyStickDriver
 The JoyStickDriver class provides basic functionality to read events from supported game pads under Linux. More...
 

Macros

#define JOYSTICK_DEV   "/dev/input/js0"
 
#define ABS_X   0x00
 
#define ABS_Y   0x01
 
#define ABS_Z   0x02
 L2 / left trigger.
 
#define ABS_RX   0x03
 
#define ABS_RY   0x04
 
#define ABS_RZ   0x05
 R2 / right trigger.
 
#define ABS_THROTTLE   0x06
 
#define ABS_RUDDER   0x07
 
#define ABS_WHEEL   0x08
 
#define ABS_GAS   0x09
 
#define ABS_BRAKE   0x0a
 
#define ABS_HAT0X   0x10
 
#define ABS_HAT0Y   0x11
 
#define ABS_HAT1X   0x12
 
#define ABS_HAT1Y   0x13
 
#define ABS_HAT2X   0x14
 
#define ABS_HAT2Y   0x15
 
#define ABS_HAT3X   0x16
 
#define ABS_HAT3Y   0x17
 

Enumerations

enum class  JoyAxisType { STICK , TRIGGER , HAT , UNKNOWN }
 Axis type classification inferred from JSIOCGAXMAP. More...
 

Macro Definition Documentation

◆ ABS_BRAKE

#define ABS_BRAKE   0x0a

Definition at line 55 of file joystickdriver.h.

◆ ABS_GAS

#define ABS_GAS   0x09

Definition at line 54 of file joystickdriver.h.

◆ ABS_HAT0X

#define ABS_HAT0X   0x10

Definition at line 56 of file joystickdriver.h.

◆ ABS_HAT0Y

#define ABS_HAT0Y   0x11

Definition at line 57 of file joystickdriver.h.

◆ ABS_HAT1X

#define ABS_HAT1X   0x12

Definition at line 58 of file joystickdriver.h.

◆ ABS_HAT1Y

#define ABS_HAT1Y   0x13

Definition at line 59 of file joystickdriver.h.

◆ ABS_HAT2X

#define ABS_HAT2X   0x14

Definition at line 60 of file joystickdriver.h.

◆ ABS_HAT2Y

#define ABS_HAT2Y   0x15

Definition at line 61 of file joystickdriver.h.

◆ ABS_HAT3X

#define ABS_HAT3X   0x16

Definition at line 62 of file joystickdriver.h.

◆ ABS_HAT3Y

#define ABS_HAT3Y   0x17

Definition at line 63 of file joystickdriver.h.

◆ ABS_RUDDER

#define ABS_RUDDER   0x07

Definition at line 52 of file joystickdriver.h.

◆ ABS_RX

#define ABS_RX   0x03

Definition at line 48 of file joystickdriver.h.

◆ ABS_RY

#define ABS_RY   0x04

Definition at line 49 of file joystickdriver.h.

◆ ABS_RZ

#define ABS_RZ   0x05

R2 / right trigger.

Definition at line 50 of file joystickdriver.h.

◆ ABS_THROTTLE

#define ABS_THROTTLE   0x06

Definition at line 51 of file joystickdriver.h.

◆ ABS_WHEEL

#define ABS_WHEEL   0x08

Definition at line 53 of file joystickdriver.h.

◆ ABS_X

#define ABS_X   0x00

Definition at line 45 of file joystickdriver.h.

◆ ABS_Y

#define ABS_Y   0x01

Definition at line 46 of file joystickdriver.h.

◆ ABS_Z

#define ABS_Z   0x02

L2 / left trigger.

Definition at line 47 of file joystickdriver.h.

◆ JOYSTICK_DEV

#define JOYSTICK_DEV   "/dev/input/js0"

Definition at line 38 of file joystickdriver.h.

Enumeration Type Documentation

◆ JoyAxisType

enum class JoyAxisType
strong

Axis type classification inferred from JSIOCGAXMAP.

Enumerator
STICK 

Analog stick (ABS_X/Y, ABS_RX/RY, throttle, rudder, wheel)

TRIGGER 

Analog trigger — single-axis input (ABS_Z/RZ, gas, brake)

HAT 

Digital hat / d-pad (ABS_HAT0X/Y … ABS_HAT3Y)

UNKNOWN 

Definition at line 80 of file joystickdriver.h.