kn::Wiimote Class Reference

Class for Wiimote control. More...

#include <Wiimote.hpp>

Inherits kn::InputController.

Collaboration diagram for kn::Wiimote:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 Wiimote (void)
 Default constructor.
 Wiimote (wiimote *wiimote)
 Constructor.
 ~Wiimote (void)
 Destructor.
void addEvent (const unsigned int &event)
 Add a wiimote event to the event queue.
unsigned int popEvent (void)
 Pop the oldest event in the queue.
unsigned int topEvent (void)
 Pop the oldest event in the queue.
unsigned int popError (void)
 Return the oldest error of the queue.
unsigned int topError (void)
 Return the oldest error of the queue.
void clearEvents (void)
 Removes all events in the queue.
unsigned int getExpansion (void) const
 Returns the expansion connected to the wiimote.
void toggleRumble (void)
 Switches the rumble's status.
bool isRumbleSet (void) const
 Checkes if the rumble is on or off.
void toggleLED (const unsigned int &id)
 Switches the specific led's status.
bool isLEDSet (const unsigned int &id) const
 Returns the status of a specific led.
void toggleIR (void)
 Switches IR dots tracking status.
bool isIRSet (void) const
 Returns IR dots tracking status.
int getIRSensitivity (void) const
 Returns IR dots tracking sensitivity value.
void setIRSensitivity (const int &lvl)
 Sets IR dots tracking sensitivity value.
unsigned int getDotsNumber (void) const
 Returns the number of detected IR dots.
WiimoteIRDot getDot (const unsigned int &i) const
 Returns data about a specif detected IR dot.
WiimoteIRPointer getPointer (void) const
 Returns values corresponding to conversion of IR dots into a cursor.
void setIRParameters (const unsigned int &width, const unsigned int &height, const unsigned int &aspect=ASPECT_4_3, const unsigned int &position=IR_POSITION_BELOW)
 Defines parameters for IR dots conversion into a cursor.
void toggleMotion (void)
 Switches motion detection.
bool isMotionSet (void) const
 Returns if motion detection is on or off.
void toggleSmoothAccelerations (void)
 Switches to smooth motion detection.
float getRoll (void) const
 Return the roll value of the wiimote.
float getAbsoluteRoll (void) const
 Return the absolute roll value of the wiimote.
float getPitch (void) const
 Return the pitch value of the wiimote.
float getAbsolutePitch (void) const
 Return the absolute pitch value of the wiimote.
float getYaw (void) const
 Return the yaw value of the wiimote.
float getXForce (void) const
 Return acceleration on X axis.
float getYForce (void) const
 Return acceleration on Y axis.
float getZForce (void) const
 Return acceleration on Z axis.
void showStatus (void)
 Prints some information about the wiimote.
NunchukgetNunchuk (void)
 Returns the nunchuk connected to the wiimote.

Friends

std::ostream & operator<< (std::ostream &, const Wiimote &)
 Output Wiimote infos.


Detailed Description

Class for Wiimote control.

Author:
Frankoi

Definition at line 98 of file Wiimote.hpp.


Constructor & Destructor Documentation

kn::Wiimote::Wiimote ( void   )  [inline]

Default constructor.

Author:
Frankoi

Definition at line 156 of file Wiimote.hpp.

kn::Wiimote::Wiimote ( wiimote *  wiimote  ) 

Constructor.

Parameters:
wiimote a pointer to a wiiuse wiimote descriptor
Author:
Frankoi

Definition at line 27 of file Wiimote.cpp.

kn::Wiimote::~Wiimote ( void   )  [inline]

Destructor.

Author:
Frankoi

Definition at line 172 of file Wiimote.hpp.


Member Function Documentation

void kn::Wiimote::addEvent ( const unsigned int &  event  ) 

Add a wiimote event to the event queue.

Parameters:
event event descriptor
Author:
Frankoi

Definition at line 50 of file Wiimote.cpp.

void kn::Wiimote::clearEvents ( void   ) 

Removes all events in the queue.

Author:
Frankoi

Definition at line 59 of file Wiimote.cpp.

float kn::Wiimote::getAbsolutePitch ( void   )  const [inline]

Return the absolute pitch value of the wiimote.

In degree and between -180 to 180. It is the value directly emitted by the wiimote

Returns:
absolute pitch
Author:
Frankoi

Definition at line 418 of file Wiimote.hpp.

float kn::Wiimote::getAbsoluteRoll ( void   )  const [inline]

Return the absolute roll value of the wiimote.

In degree and between -180 to 180. It is the value directly emitted by the wiimote

Returns:
absolute roll
Author:
Frankoi

Definition at line 396 of file Wiimote.hpp.

WiimoteIRDot kn::Wiimote::getDot ( const unsigned int &  i  )  const

Returns data about a specif detected IR dot.

Parameters:
i id of a specific dot (lower than getDotsNumber())
Returns:
a specific dot information
Author:
Frankoi

Definition at line 90 of file Wiimote.cpp.

unsigned int kn::Wiimote::getDotsNumber ( void   )  const [inline]

Returns the number of detected IR dots.

Returns:
the number of detected IR dots
Author:
Frankoi

Definition at line 319 of file Wiimote.hpp.

unsigned int kn::Wiimote::getExpansion ( void   )  const [inline]

Returns the expansion connected to the wiimote.

Returns:
the expansion's descriptor
Author:
Frankoi

Definition at line 239 of file Wiimote.hpp.

int kn::Wiimote::getIRSensitivity ( void   )  const [inline]

Returns IR dots tracking sensitivity value.

Returns:
IR dots tracking sensitivity value
Author:
Frankoi

Definition at line 299 of file Wiimote.hpp.

Nunchuk& kn::Wiimote::getNunchuk ( void   )  [inline]

Returns the nunchuk connected to the wiimote.

You have to check if the nunchuck is really connected

Returns:
the nunchuck
Author:
Frankoi

Definition at line 477 of file Wiimote.hpp.

float kn::Wiimote::getPitch ( void   )  const [inline]

Return the pitch value of the wiimote.

In degree and between -180 to 180. Value is smoothed by the wiiuse interface

Returns:
pitch
Author:
Frankoi

Definition at line 407 of file Wiimote.hpp.

WiimoteIRPointer kn::Wiimote::getPointer ( void   )  const

Returns values corresponding to conversion of IR dots into a cursor.

Returns:
cursor information
Author:
Frankoi

Definition at line 102 of file Wiimote.cpp.

float kn::Wiimote::getRoll ( void   )  const [inline]

Return the roll value of the wiimote.

In degree and between -180 to 180. Value is smoothed by the wiiuse interface

Returns:
roll
Author:
Frankoi

Definition at line 385 of file Wiimote.hpp.

float kn::Wiimote::getXForce ( void   )  const [inline]

Return acceleration on X axis.

The accelerometer is sensitive to within +/- 3 gravity units.

Returns:
X axis acceleration
Author:
Frankoi

Definition at line 439 of file Wiimote.hpp.

float kn::Wiimote::getYaw ( void   )  const [inline]

Return the yaw value of the wiimote.

In degree and between -180 to 180. The value is computed using IR dots detection.

Returns:
yaw
Author:
Frankoi

Definition at line 429 of file Wiimote.hpp.

float kn::Wiimote::getYForce ( void   )  const [inline]

Return acceleration on Y axis.

The accelerometer is sensitive to within +/- 3 gravity units.

Returns:
Y axis acceleration
Author:
Frankoi

Definition at line 449 of file Wiimote.hpp.

float kn::Wiimote::getZForce ( void   )  const [inline]

Return acceleration on Z axis.

The accelerometer is sensitive to within +/- 3 gravity units.

Returns:
Z axis acceleration
Author:
Frankoi

Definition at line 459 of file Wiimote.hpp.

bool kn::Wiimote::isIRSet ( void   )  const [inline]

Returns IR dots tracking status.

Returns:
IR dots tracking status
Author:
Frankoi

Definition at line 290 of file Wiimote.hpp.

bool kn::Wiimote::isLEDSet ( const unsigned int &  id  )  const

Returns the status of a specific led.

Parameters:
id led's id (must be 1, 2, 3 or 4)
Author:
Frankoi

Definition at line 66 of file Wiimote.cpp.

bool kn::Wiimote::isMotionSet ( void   )  const [inline]

Returns if motion detection is on or off.

Returns:
if motion detection is set
Author:
Frankoi

Definition at line 367 of file Wiimote.hpp.

bool kn::Wiimote::isRumbleSet ( void   )  const [inline]

Checkes if the rumble is on or off.

Returns:
rumble status
Author:
Frankoi

Definition at line 255 of file Wiimote.hpp.

unsigned int kn::Wiimote::popError ( void   )  [inline, virtual]

Return the oldest error of the queue.

Error managing is not implemented because there is no error message for the moment. However the method is required because of InputController class heritage

Returns:
0
Author:
Frankoi

Implements kn::InputController.

Definition at line 212 of file Wiimote.hpp.

unsigned int kn::Wiimote::popEvent ( void   )  [inline, virtual]

Pop the oldest event in the queue.

The event is removed from the queue

Returns:
the oldest event
Author:
Frankoi

Implements kn::InputController.

Definition at line 191 of file Wiimote.hpp.

void kn::Wiimote::setIRParameters ( const unsigned int &  width,
const unsigned int &  height,
const unsigned int &  aspect = ASPECT_4_3,
const unsigned int &  position = IR_POSITION_BELOW 
)

Defines parameters for IR dots conversion into a cursor.

Parameters:
width window width
height window height
aspect window ratio (either ASPECT_4_3 or ASPECT_16_9)
position sensor bar position related to screen (either IR_POSITION_BELOW or IR_POSITION_ABOVE)
Author:
Frankoi

Definition at line 110 of file Wiimote.cpp.

void kn::Wiimote::setIRSensitivity ( const int &  lvl  )  [inline]

Sets IR dots tracking sensitivity value.

The camera sensitivity is a degree between 1 (lowest) and 5 (highest). The default is 3.

Parameters:
lvl IR dots tracking sensitivity value
Author:
Frankoi

Definition at line 310 of file Wiimote.hpp.

void kn::Wiimote::showStatus ( void   ) 

Prints some information about the wiimote.

Author:
Frankoi

Definition at line 141 of file Wiimote.cpp.

void kn::Wiimote::toggleIR ( void   )  [inline]

Switches IR dots tracking status.

Author:
Frankoi

Definition at line 281 of file Wiimote.hpp.

void kn::Wiimote::toggleLED ( const unsigned int &  id  ) 

Switches the specific led's status.

Parameters:
id led's id (must be 1, 2, 3 or 4)
Author:
Frankoi

Definition at line 79 of file Wiimote.cpp.

void kn::Wiimote::toggleMotion ( void   )  [inline]

Switches motion detection.

Author:
Frankoi

Definition at line 358 of file Wiimote.hpp.

void kn::Wiimote::toggleRumble ( void   )  [inline]

Switches the rumble's status.

Author:
Frankoi

Definition at line 246 of file Wiimote.hpp.

void kn::Wiimote::toggleSmoothAccelerations ( void   )  [inline]

Switches to smooth motion detection.

Author:
Frankoi

Definition at line 374 of file Wiimote.hpp.

unsigned int kn::Wiimote::topError ( void   )  [inline, virtual]

Return the oldest error of the queue.

Error managing is not implemented because there is no error message for the moment. However the method is required because of InputController class heritage

Returns:
0
Author:
Frankoi

Implements kn::InputController.

Definition at line 223 of file Wiimote.hpp.

unsigned int kn::Wiimote::topEvent ( void   )  [inline, virtual]

Pop the oldest event in the queue.

The event is kept in the queue

Returns:
the oldest event
Author:
Frankoi

Implements kn::InputController.

Definition at line 201 of file Wiimote.hpp.


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const Wiimote wiimote 
) [friend]

Output Wiimote infos.

Returns:
the stream
Author:
Pierre

Definition at line 145 of file Wiimote.cpp.


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

Generated on Thu Nov 12 16:06:36 2009 for OpenKraken-controller by  doxygen 1.5.8