Public Member Functions | Protected Member Functions

JoystickAcquisitionThread Class Reference

Joystick acqusition thread for Linux joystick API. More...

#include "acquisition_thread.h"

Inheritance diagram for JoystickAcquisitionThread:
Inheritance graph
[legend]

List of all members.

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.

Detailed Description

Joystick acqusition thread for Linux joystick API.

See also:
Linux Kernel Documentation (joystick-api.txt)
Author:
Tim Niemueller

Definition at line 49 of file acquisition_thread.h.


Constructor & Destructor Documentation

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.

Parameters:
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.


Member Function Documentation

float * JoystickAcquisitionThread::axis_x_values (  ) 

Get values for X axes.

Returns:
array of X axis values.

Definition at line 326 of file acquisition_thread.cpp.

float * JoystickAcquisitionThread::axis_y_values (  ) 

Get values for Y axes.

Returns:
array of Y axis values.

Definition at line 336 of file acquisition_thread.cpp.

const char * JoystickAcquisitionThread::joystick_name (  )  const

Get joystick name.

Returns:
joystick name

Definition at line 306 of file acquisition_thread.cpp.

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.

Returns:
true if the lock was acquired and there is new data, false otherwise

Definition at line 261 of file acquisition_thread.cpp.

References fawkes::Mutex::lock(), and fawkes::Mutex::unlock().

char JoystickAcquisitionThread::num_axes (  )  const

Get number of axes.

Returns:
number of axes.

Definition at line 286 of file acquisition_thread.cpp.

char JoystickAcquisitionThread::num_buttons (  )  const

Get number of buttons.

Returns:
number of buttons.

Definition at line 296 of file acquisition_thread.cpp.

unsigned int JoystickAcquisitionThread::pressed_buttons (  )  const

Pressed buttons.

Returns:
bit field where each set bit represents a pressed button.

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.

See also:
Thread::run()

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().


The documentation for this class was generated from the following files: