Joystick acqusition thread for Linux joystick API. More...
#include "acquisition_thread.h"
Public Member Functions | |
JoystickAcquisitionThread () | |
Constructor. | |
JoystickAcquisitionThread (const char *device_file, JoystickBlackBoardHandler *handler, fawkes::Logger *logger) | |
Alternative constructor. | |
virtual void | init () |
virtual void | finalize () |
virtual void | loop () |
bool | lock_if_new_data () |
Lock data if fresh. | |
void | unlock () |
Unlock data. | |
char | num_axes () const |
Get number of axes. | |
char | num_buttons () const |
Get number of buttons. | |
const char * | joystick_name () const |
Get joystick name. | |
unsigned int | pressed_buttons () const |
Pressed buttons. | |
float * | axis_x_values () |
Get values for X axes. | |
float * | axis_y_values () |
Get values for Y axes. | |
Protected Member Functions | |
virtual void | run () |
Stub to see name in backtrace for easier debugging. |
Joystick acqusition thread for Linux joystick API.
Definition at line 49 of file acquisition_thread.h.
JoystickAcquisitionThread::JoystickAcquisitionThread | ( | ) |
Constructor.
Definition at line 74 of file acquisition_thread.cpp.
References fawkes::Thread::set_prepfin_conc_loop().
JoystickAcquisitionThread::JoystickAcquisitionThread | ( | const char * | device_file, | |
JoystickBlackBoardHandler * | handler, | |||
fawkes::Logger * | logger | |||
) |
Alternative constructor.
This constructor is meant to be used to create an instance that is used outside of Fawkes.
device_file | joystick device file | |
handler | BlackBoard handler that will post data to the BlackBoard | |
logger | logging instance |
Definition at line 91 of file acquisition_thread.cpp.
float * JoystickAcquisitionThread::axis_x_values | ( | ) |
Get values for X axes.
Definition at line 326 of file acquisition_thread.cpp.
float * JoystickAcquisitionThread::axis_y_values | ( | ) |
Get values for Y axes.
Definition at line 336 of file acquisition_thread.cpp.
const char * JoystickAcquisitionThread::joystick_name | ( | ) | const |
bool JoystickAcquisitionThread::lock_if_new_data | ( | ) |
Lock data if fresh.
If new data has been received since get_distance_data() or get_echo_data() was called last the data is locked, no new data can arrive until you call unlock(), otherwise the lock is immediately released after checking.
Definition at line 261 of file acquisition_thread.cpp.
References fawkes::Mutex::lock(), and fawkes::Mutex::unlock().
char JoystickAcquisitionThread::num_axes | ( | ) | const |
char JoystickAcquisitionThread::num_buttons | ( | ) | const |
Get number of buttons.
Definition at line 296 of file acquisition_thread.cpp.
unsigned int JoystickAcquisitionThread::pressed_buttons | ( | ) | const |
Pressed buttons.
Definition at line 316 of file acquisition_thread.cpp.
virtual void JoystickAcquisitionThread::run | ( | ) | [inline, protected, virtual] |
Stub to see name in backtrace for easier debugging.
Definition at line 75 of file acquisition_thread.h.
void JoystickAcquisitionThread::unlock | ( | ) |
Unlock data.
Definition at line 275 of file acquisition_thread.cpp.
References fawkes::Mutex::unlock().