direcs  2012-09-30
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Joystick Class Reference

This class is for controling the robot with a joystick. More...

#include <joystick.h>

List of all members.

Signals

void joystickButtonPressed (int axisNumber, bool buttonState)
void joystickMoved (int axisNumber, int axisValue)
void joystickPOVButtonPressed (int buttonsState)
void message (QString text)

Public Member Functions

bool isConnected ()
 Joystick ()
virtual void run ()
void setPort (QString port)
void stop ()
 ~Joystick ()

Private Attributes

QString joystickPort
volatile bool stopped

Static Private Attributes

static const int JOYSTICKAXISX3 = 3
static const int JOYSTICKAXISX4 = 4
static const int JOYSTICKAXISY2 = 2
static const int JOYSTICKAXISY5 = 5
static const unsigned long THREADSLEEPTIME = 250

Detailed Description

This class is for controling the robot with a joystick.

Author:
Markus Knapp It opens a joystick device and emits signals on joystick movements or when a button is pressed.

Definition at line 58 of file joystick.h.


Constructor & Destructor Documentation

Joystick::Joystick ( )

Definition at line 25 of file joystick.cpp.

Joystick::~Joystick ( )

Definition at line 35 of file joystick.cpp.


Member Function Documentation

bool Joystick::isConnected ( void  )

Returns the state of a connected joystick.

Returns:
true, if connected

Definition at line 255 of file joystick.cpp.

Here is the call graph for this function:

Here is the caller graph for this function:

void Joystick::joystickButtonPressed ( int  axisNumber,
bool  buttonState 
)
signal

Emits a signal when an joystick button-pressed event occured.

Parameters:
axisNumberis the number of the joysticks button
buttonStateis the buttons state (true when button is down)

Here is the caller graph for this function:

void Joystick::joystickMoved ( int  axisNumber,
int  axisValue 
)
signal

Emits a signal when an joystick move event occured.

Parameters:
axisNumberis the number of the joysticks axis
axisValueis the axis value

Here is the caller graph for this function:

void Joystick::joystickPOVButtonPressed ( int  buttonsState)
signal

Emits a signal when a POV / hat switch joystick button-pressed event occured.

Parameters:
buttonsStateis the buttons state (normally 0 to 8 on a POV / hat switch)

And this is the POV button layout:

1
8 2
7 0 3
6 4
5

Here is the caller graph for this function:

void Joystick::message ( QString  text)
signal

Emits a info or error message to a slot. This slot can be used to display a text on a splash screen, log file, to print it to a console...

Parameters:
textis the message to be emitted

Here is the caller graph for this function:

void Joystick::run ( )
virtual

Definition at line 46 of file joystick.cpp.

Here is the call graph for this function:

void Joystick::setPort ( QString  port)

Sets the joystick port.

Parameters:
portis the joystick port (e.g. /dev/input/js0)

Definition at line 286 of file joystick.cpp.

Here is the caller graph for this function:

void Joystick::stop ( )

Definition at line 40 of file joystick.cpp.

Here is the caller graph for this function:


Member Data Documentation

const int Joystick::JOYSTICKAXISX3 = 3
staticprivate

Definition at line 145 of file joystick.h.

const int Joystick::JOYSTICKAXISX4 = 4
staticprivate

Definition at line 146 of file joystick.h.

const int Joystick::JOYSTICKAXISY2 = 2
staticprivate

Joystick axis numbers

See also:
JoystickDialog()
Direcs::ExecuteJoyStickCommand()

Definition at line 144 of file joystick.h.

const int Joystick::JOYSTICKAXISY5 = 5
staticprivate

Definition at line 147 of file joystick.h.

QString Joystick::joystickPort
private

Definition at line 120 of file joystick.h.

volatile bool Joystick::stopped
private

Definition at line 119 of file joystick.h.

const unsigned long Joystick::THREADSLEEPTIME = 250
staticprivate

Definition at line 139 of file joystick.h.


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