#include <class_gamepad.h>
|
| class_gamepad () |
| Class constructor. More...
|
|
int | CloseComm (void) |
|
int | Dispatch (bool debug=false) |
| This function checks the gamepad status and calls the respective callback. More...
|
|
void | plerr (int ret) |
| Print local error function This function prints the error present in the err variable (this is a private variable of the gamepad class). The ret number specifies what kind of error is this, -1 is a error that raises a SIGINT signal, -2 is an warning that allows the program to continue and -3 is a error that prints perror and raises SIGINT. More...
|
|
int | RegisterCallback (e_type type, int id, void(*callback)(int value, void *data), void *data) |
| Register a callback for a specific button or axis. More...
|
|
int | StartComm (const char *device) |
| Initialize comm with the gamepad. More...
|
|
int | UnRegisterCallback (e_type type, int id) |
|
| ~class_gamepad () |
| Class destructor. More...
|
|
Definition at line 43 of file class_gamepad.h.
class_gamepad::class_gamepad |
( |
| ) |
|
class_gamepad::~class_gamepad |
( |
| ) |
|
int class_gamepad::CloseComm |
( |
void |
| ) |
|
int class_gamepad::Dispatch |
( |
bool |
debug = false | ) |
|
This function checks the gamepad status and calls the respective callback.
- Parameters
-
debug | if set to true this function will print all events |
- Returns
- error code that can be analyzed with the function plerr
Definition at line 156 of file class_gamepad.cpp.
int class_gamepad::GetButtonMapping |
( |
void |
| ) |
|
|
private |
Get the button mapping from the device.
- Returns
- error code that can be analyzed with the function plerr
Definition at line 89 of file class_gamepad.cpp.
void class_gamepad::plerr |
( |
int |
ret | ) |
|
Print local error function This function prints the error present in the err variable (this is a private variable of the gamepad class). The ret number specifies what kind of error is this, -1 is a error that raises a SIGINT signal, -2 is an warning that allows the program to continue and -3 is a error that prints perror and raises SIGINT.
- Parameters
-
- Returns
- void
Definition at line 188 of file class_gamepad.cpp.
int class_gamepad::RegisterCallback |
( |
e_type |
type, |
|
|
int |
id, |
|
|
void(*)(int value, void *data) |
callback, |
|
|
void * |
data |
|
) |
| |
Register a callback for a specific button or axis.
- Parameters
-
type | AXIS or BUTTON (these enums are present in the gamepad class) |
id | number of the button or axis * |
callback | function to be called prototype is void (*callback)(int value,void*data), where the value is the button or axis value and data is the user data |
data | user data to pass to the callback |
- Returns
- error code that can be analyzed with the function plerr
Definition at line 127 of file class_gamepad.cpp.
int class_gamepad::SetButtonMapping |
( |
void |
| ) |
|
|
private |
Set the button mapping to the device.
- Returns
- error code that can be analyzed with the function plerr
Definition at line 108 of file class_gamepad.cpp.
int class_gamepad::StartComm |
( |
const char * |
device | ) |
|
Initialize comm with the gamepad.
- Parameters
-
device | Name of the device to use |
- Returns
- error code that can be analyzed with the function plerr
Definition at line 47 of file class_gamepad.cpp.
int class_gamepad::UnRegisterCallback |
( |
e_type |
type, |
|
|
int |
id |
|
) |
| |
char class_gamepad::err[1024] |
|
private |
__u8 class_gamepad::m_axes[ABS_CNT] |
|
private |
__u16 class_gamepad::m_buttons[KEY_MAX-BTN_MISC+1] |
|
private |
int class_gamepad::n_axes |
|
private |
int class_gamepad::n_buttons |
|
private |
char class_gamepad::name[1024] |
|
private |
char class_gamepad::text[1024] |
|
private |
The documentation for this class was generated from the following files: