fawkes::JoystickInterface Class Reference
[Fawkes Interfaces]

JoystickInterface Fawkes BlackBoard Interface. More...

#include <interfaces/JoystickInterface.h>

Inheritance diagram for fawkes::JoystickInterface:
Inheritance graph
[legend]

List of all members.

Classes

struct  JoystickInterface_data_t
 Internal data storage, do NOT modify!

Public Member Functions

virtual bool message_valid (const Message *message) const
 Check if message is valid and can be enqueued.
uint8_t num_axes () const
 Get num_axes value.
void set_num_axes (const uint8_t new_num_axes)
 Set num_axes value.
size_t maxlenof_num_axes () const
 Get maximum length of num_axes value.
uint8_t num_buttons () const
 Get num_buttons value.
void set_num_buttons (const uint8_t new_num_buttons)
 Set num_buttons value.
size_t maxlenof_num_buttons () const
 Get maximum length of num_buttons value.
uint32_t pressed_buttons () const
 Get pressed_buttons value.
void set_pressed_buttons (const uint32_t new_pressed_buttons)
 Set pressed_buttons value.
size_t maxlenof_pressed_buttons () const
 Get maximum length of pressed_buttons value.
float * axis_x () const
 Get axis_x value.
float axis_x (unsigned int index) const
 Get axis_x value at given index.
void set_axis_x (unsigned int index, const float new_axis_x)
 Set axis_x value at given index.
void set_axis_x (const float *new_axis_x)
 Set axis_x value.
size_t maxlenof_axis_x () const
 Get maximum length of axis_x value.
float * axis_y () const
 Get axis_y value.
float axis_y (unsigned int index) const
 Get axis_y value at given index.
void set_axis_y (unsigned int index, const float new_axis_y)
 Set axis_y value at given index.
void set_axis_y (const float *new_axis_y)
 Set axis_y value.
size_t maxlenof_axis_y () const
 Get maximum length of axis_y value.
virtual Messagecreate_message (const char *type) const
 Create message based on type name.
virtual void copy_values (const Interface *other)
 Copy values from other interface.
virtual const char * enum_tostring (const char *enumtype, int val) const
 Convert arbitrary enum value to string.

Static Public Attributes

static const uint32_t BUTTON_1 = 1u
 BUTTON_1 constant.
static const uint32_t BUTTON_2 = 2u
 BUTTON_2 constant.
static const uint32_t BUTTON_3 = 4u
 BUTTON_3 constant.
static const uint32_t BUTTON_4 = 8u
 BUTTON_4 constant.
static const uint32_t BUTTON_5 = 16u
 BUTTON_5 constant.
static const uint32_t BUTTON_6 = 32u
 BUTTON_6 constant.
static const uint32_t BUTTON_7 = 64u
 BUTTON_7 constant.
static const uint32_t BUTTON_8 = 128u
 BUTTON_8 constant.
static const uint32_t BUTTON_9 = 256u
 BUTTON_9 constant.
static const uint32_t BUTTON_10 = 512u
 BUTTON_10 constant.
static const uint32_t BUTTON_11 = 1024u
 BUTTON_11 constant.
static const uint32_t BUTTON_12 = 2048u
 BUTTON_12 constant.
static const uint32_t BUTTON_13 = 4096u
 BUTTON_13 constant.
static const uint32_t BUTTON_14 = 8192u
 BUTTON_14 constant.
static const uint32_t BUTTON_15 = 16384u
 BUTTON_15 constant.
static const uint32_t BUTTON_16 = 32768u
 BUTTON_16 constant.
static const uint32_t BUTTON_17 = 65536u
 BUTTON_17 constant.
static const uint32_t BUTTON_18 = 131072u
 BUTTON_18 constant.
static const uint32_t BUTTON_19 = 262144u
 BUTTON_19 constant.
static const uint32_t BUTTON_20 = 524288u
 BUTTON_20 constant.
static const uint32_t BUTTON_21 = 1048576u
 BUTTON_21 constant.
static const uint32_t BUTTON_22 = 2097152u
 BUTTON_22 constant.
static const uint32_t BUTTON_23 = 4194304u
 BUTTON_23 constant.
static const uint32_t BUTTON_24 = 8388608u
 BUTTON_24 constant.
static const uint32_t BUTTON_25 = 16777216u
 BUTTON_25 constant.
static const uint32_t BUTTON_26 = 33554432u
 BUTTON_26 constant.
static const uint32_t BUTTON_27 = 67108864u
 BUTTON_27 constant.
static const uint32_t BUTTON_28 = 134217728u
 BUTTON_28 constant.
static const uint32_t BUTTON_29 = 268435456u
 BUTTON_29 constant.
static const uint32_t BUTTON_30 = 536870912u
 BUTTON_30 constant.
static const uint32_t BUTTON_31 = 1073741824u
 BUTTON_31 constant.
static const uint32_t BUTTON_32 = 2147483648u
 BUTTON_32 constant.

Detailed Description

JoystickInterface Fawkes BlackBoard Interface.

This interface provides access to a joystick. It provides up to five axes, where each has a X and a Y value between -1.0 and 1.0. Up to 32 buttons are support via an uint32 bit field.

Definition at line 33 of file JoystickInterface.h.


Member Function Documentation

float fawkes::JoystickInterface::axis_x ( unsigned int  index  )  const

Get axis_x value at given index.

X values of axes

Parameters:
index index of value
Returns:
axis_x value
Exceptions:
Exception thrown if index is out of bounds

Definition at line 258 of file JoystickInterface.cpp.

float * fawkes::JoystickInterface::axis_x (  )  const

Get axis_x value.

X values of axes

Returns:
axis_x value

Definition at line 246 of file JoystickInterface.cpp.

Referenced by JoystickBlackBoardLogger::bb_interface_data_changed().

float fawkes::JoystickInterface::axis_y ( unsigned int  index  )  const

Get axis_y value at given index.

Y values of axes

Parameters:
index index of value
Returns:
axis_y value
Exceptions:
Exception thrown if index is out of bounds

Definition at line 317 of file JoystickInterface.cpp.

float * fawkes::JoystickInterface::axis_y (  )  const

Get axis_y value.

Y values of axes

Returns:
axis_y value

Definition at line 305 of file JoystickInterface.cpp.

Referenced by JoystickBlackBoardLogger::bb_interface_data_changed().

void fawkes::JoystickInterface::copy_values ( const Interface other  )  [virtual]

Copy values from other interface.

Parameters:
other other interface to copy values from

Definition at line 372 of file JoystickInterface.cpp.

References fawkes::Interface::type().

Message * fawkes::JoystickInterface::create_message ( const char *  type  )  const [virtual]

Create message based on type name.

This will create a new message of the given type. The type must be given without the InterfaceName:: prefix but just the plain class name of the message.

Parameters:
type message type
Returns:
message of the given type, empty
Exceptions:
UnknownTypeException thrown if this interface cannot create a message of the given type.

Implements fawkes::Interface.

Definition at line 361 of file JoystickInterface.cpp.

const char * fawkes::JoystickInterface::enum_tostring ( const char *  enumtype,
int  val 
) const [virtual]

Convert arbitrary enum value to string.

Given the string representation of the enum type and the value this method returns the string representation of the specific value, or the string UNKNOWN if the value is not defined. An exception is thrown if the enum type is invalid.

Parameters:
enumtype enum type as string
val value to convert
Returns:
string representation of value
Exceptions:
UnknownTypeException thrown if enumtype is not specified for interface.

Implements fawkes::Interface.

Definition at line 383 of file JoystickInterface.cpp.

size_t fawkes::JoystickInterface::maxlenof_axis_x (  )  const

Get maximum length of axis_x value.

Returns:
length of axis_x value, can be length of the array or number of maximum number of characters for a string

Definition at line 271 of file JoystickInterface.cpp.

size_t fawkes::JoystickInterface::maxlenof_axis_y (  )  const

Get maximum length of axis_y value.

Returns:
length of axis_y value, can be length of the array or number of maximum number of characters for a string

Definition at line 330 of file JoystickInterface.cpp.

size_t fawkes::JoystickInterface::maxlenof_num_axes (  )  const

Get maximum length of num_axes value.

Returns:
length of num_axes value, can be length of the array or number of maximum number of characters for a string

Definition at line 149 of file JoystickInterface.cpp.

size_t fawkes::JoystickInterface::maxlenof_num_buttons (  )  const

Get maximum length of num_buttons value.

Returns:
length of num_buttons value, can be length of the array or number of maximum number of characters for a string

Definition at line 184 of file JoystickInterface.cpp.

size_t fawkes::JoystickInterface::maxlenof_pressed_buttons (  )  const

Get maximum length of pressed_buttons value.

Returns:
length of pressed_buttons value, can be length of the array or number of maximum number of characters for a string

Definition at line 221 of file JoystickInterface.cpp.

bool fawkes::JoystickInterface::message_valid ( const Message message  )  const [virtual]

Check if message is valid and can be enqueued.

Parameters:
message Message to check
Returns:
true if the message is valid, false otherwise.

Implements fawkes::Interface.

Definition at line 394 of file JoystickInterface.cpp.

uint8_t fawkes::JoystickInterface::num_axes (  )  const

Get num_axes value.

The number of axes of this joystick

Returns:
num_axes value

Definition at line 139 of file JoystickInterface.cpp.

Referenced by JoystickBlackBoardLogger::JoystickBlackBoardLogger().

uint8_t fawkes::JoystickInterface::num_buttons (  )  const

Get num_buttons value.

The number of buttons of this joystick.

Returns:
num_buttons value

Definition at line 174 of file JoystickInterface.cpp.

Referenced by JoystickBlackBoardLogger::JoystickBlackBoardLogger().

uint32_t fawkes::JoystickInterface::pressed_buttons (  )  const

Get pressed_buttons value.

A bit field of enabled buttons. For each currently clicked button the corresponding bit is set to 1. Use the BUTTON_* constants for bit-wise comparisons.

Returns:
pressed_buttons value

Definition at line 211 of file JoystickInterface.cpp.

Referenced by JoystickBlackBoardLogger::bb_interface_data_changed().

void fawkes::JoystickInterface::set_axis_x ( const float *  new_axis_x  ) 

Set axis_x value.

X values of axes

Parameters:
new_axis_x new axis_x value

Definition at line 281 of file JoystickInterface.cpp.

References fawkes::Interface::data_changed.

void fawkes::JoystickInterface::set_axis_x ( unsigned int  index,
const float  new_axis_x 
)

Set axis_x value at given index.

X values of axes

Parameters:
new_axis_x new axis_x value
index index for of the value

Definition at line 293 of file JoystickInterface.cpp.

Referenced by JoystickBlackBoardPoster::joystick_changed(), and JoystickSensorThread::loop().

void fawkes::JoystickInterface::set_axis_y ( const float *  new_axis_y  ) 

Set axis_y value.

Y values of axes

Parameters:
new_axis_y new axis_y value

Definition at line 340 of file JoystickInterface.cpp.

References fawkes::Interface::data_changed.

void fawkes::JoystickInterface::set_axis_y ( unsigned int  index,
const float  new_axis_y 
)

Set axis_y value at given index.

Y values of axes

Parameters:
new_axis_y new axis_y value
index index for of the value

Definition at line 352 of file JoystickInterface.cpp.

Referenced by JoystickBlackBoardPoster::joystick_changed(), and JoystickSensorThread::loop().

void fawkes::JoystickInterface::set_num_axes ( const uint8_t  new_num_axes  ) 

Set num_axes value.

The number of axes of this joystick

Parameters:
new_num_axes new num_axes value

Definition at line 161 of file JoystickInterface.cpp.

References fawkes::Interface::data_changed.

Referenced by JoystickBlackBoardPoster::joystick_plugged(), JoystickBlackBoardPoster::joystick_unplugged(), and JoystickSensorThread::loop().

void fawkes::JoystickInterface::set_num_buttons ( const uint8_t  new_num_buttons  ) 

Set num_buttons value.

The number of buttons of this joystick.

Parameters:
new_num_buttons new num_buttons value

Definition at line 196 of file JoystickInterface.cpp.

References fawkes::Interface::data_changed.

Referenced by JoystickBlackBoardPoster::joystick_plugged(), JoystickBlackBoardPoster::joystick_unplugged(), and JoystickSensorThread::loop().

void fawkes::JoystickInterface::set_pressed_buttons ( const uint32_t  new_pressed_buttons  ) 

Set pressed_buttons value.

A bit field of enabled buttons. For each currently clicked button the corresponding bit is set to 1. Use the BUTTON_* constants for bit-wise comparisons.

Parameters:
new_pressed_buttons new pressed_buttons value

Definition at line 235 of file JoystickInterface.cpp.

References fawkes::Interface::data_changed.

Referenced by JoystickBlackBoardPoster::joystick_changed(), and JoystickSensorThread::loop().


Member Data Documentation

const uint32_t fawkes::JoystickInterface::BUTTON_1 = 1u [static]

BUTTON_1 constant.

Definition at line 40 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_10 = 512u [static]

BUTTON_10 constant.

Definition at line 49 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_11 = 1024u [static]

BUTTON_11 constant.

Definition at line 50 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_12 = 2048u [static]

BUTTON_12 constant.

Definition at line 51 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_13 = 4096u [static]

BUTTON_13 constant.

Definition at line 52 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_14 = 8192u [static]

BUTTON_14 constant.

Definition at line 53 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_15 = 16384u [static]

BUTTON_15 constant.

Definition at line 54 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_16 = 32768u [static]

BUTTON_16 constant.

Definition at line 55 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_17 = 65536u [static]

BUTTON_17 constant.

Definition at line 56 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_18 = 131072u [static]

BUTTON_18 constant.

Definition at line 57 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_19 = 262144u [static]

BUTTON_19 constant.

Definition at line 58 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_2 = 2u [static]

BUTTON_2 constant.

Definition at line 41 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_20 = 524288u [static]

BUTTON_20 constant.

Definition at line 59 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_21 = 1048576u [static]

BUTTON_21 constant.

Definition at line 60 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_22 = 2097152u [static]

BUTTON_22 constant.

Definition at line 61 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_23 = 4194304u [static]

BUTTON_23 constant.

Definition at line 62 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_24 = 8388608u [static]

BUTTON_24 constant.

Definition at line 63 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_25 = 16777216u [static]

BUTTON_25 constant.

Definition at line 64 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_26 = 33554432u [static]

BUTTON_26 constant.

Definition at line 65 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_27 = 67108864u [static]

BUTTON_27 constant.

Definition at line 66 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_28 = 134217728u [static]

BUTTON_28 constant.

Definition at line 67 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_29 = 268435456u [static]

BUTTON_29 constant.

Definition at line 68 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_3 = 4u [static]

BUTTON_3 constant.

Definition at line 42 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_30 = 536870912u [static]

BUTTON_30 constant.

Definition at line 69 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_31 = 1073741824u [static]

BUTTON_31 constant.

Definition at line 70 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_32 = 2147483648u [static]

BUTTON_32 constant.

Definition at line 71 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_4 = 8u [static]

BUTTON_4 constant.

Definition at line 43 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_5 = 16u [static]

BUTTON_5 constant.

Definition at line 44 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_6 = 32u [static]

BUTTON_6 constant.

Definition at line 45 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_7 = 64u [static]

BUTTON_7 constant.

Definition at line 46 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_8 = 128u [static]

BUTTON_8 constant.

Definition at line 47 of file JoystickInterface.h.

const uint32_t fawkes::JoystickInterface::BUTTON_9 = 256u [static]

BUTTON_9 constant.

Definition at line 48 of file JoystickInterface.h.


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

Generated on 1 Mar 2011 for Fawkes API by  doxygen 1.6.1