trikRuntime
trikControl::GamepadInterface Class Referenceabstract

Remote control of a robot via Android gamepad. More...

#include <gamepadInterface.h>

Inheritance diagram for trikControl::GamepadInterface:
Collaboration diagram for trikControl::GamepadInterface:

Public Slots

virtual void reset ()=0
 Clear data about previous pad events. More...
 
virtual bool buttonWasPressed (int buttonNumber)=0
 Returns true, if given pad button is pressed, and clears "pressed" state for that button. More...
 
virtual bool buttonIsPressed (int buttonNumber)=0
 Returns true, if given pad button is pressed now. Buttons have indexes from 1 to 5. More...
 
virtual bool isPadPressed (int pad) const =0
 Returns current state of the pad, true if pressed. More...
 
virtual int padX (int pad) const =0
 Returns current X coordinate of given pad or -1 if this pad is not pressed. More...
 
virtual int padY (int pad) const =0
 Returns current Y coordinate of given pad or -1 if this pad is not pressed. More...
 
virtual int wheel () const =0
 Returns current tilt angle of Android device when "wheel" is turned on. More...
 
virtual bool isConnected () const =0
 Returns true if a gamepad is currently connected to a robot. More...
 
virtual bool disconnect ()=0
 Disconnects a gamepad. More...
 

Signals

void padUp (int pad)
 Emitted when user pulls finger off a pad. More...
 
void wheelEvent (int percent)
 Emitted when user tilts his Android device with "wheel" turned on. More...
 
void pad (int pad, int x, int y)
 Emitted when user pushes or moves his finger on a pad. More...
 
void button (int button, int pressed)
 Emitted when user pushes a button on gamepad. More...
 
void custom (const QString &s)
 Any custom message for simple extention via gamepad protocol/TCP port custom my message is delivered as "my message". More...
 
void connected ()
 Emitted when a gamepad connects to robot. More...
 
void disconnected ()
 Emitted when last gamepad disconnects from robot. More...
 

Detailed Description

Remote control of a robot via Android gamepad.

Member Function Documentation

void trikControl::GamepadInterface::button ( int  button,
int  pressed 
)
signal

Emitted when user pushes a button on gamepad.

Parameters
button- button number.
pressed- 1 if button was pressed, 0 if it was released.
virtual bool trikControl::GamepadInterface::buttonIsPressed ( int  buttonNumber)
pure virtualslot

Returns true, if given pad button is pressed now. Buttons have indexes from 1 to 5.

virtual bool trikControl::GamepadInterface::buttonWasPressed ( int  buttonNumber)
pure virtualslot

Returns true, if given pad button is pressed, and clears "pressed" state for that button.

Buttons have indexes from 1 to 5.

void trikControl::GamepadInterface::connected ( )
signal

Emitted when a gamepad connects to robot.

Note that robot may have several connected gamepads, and this signal will be emitted only when the first gamepad connects to robot.

void trikControl::GamepadInterface::custom ( const QString &  s)
signal

Any custom message for simple extention via gamepad protocol/TCP port custom my message is delivered as "my message".

virtual bool trikControl::GamepadInterface::disconnect ( )
pure virtualslot

Disconnects a gamepad.

Emits disconnected signal and then resets button state if a gamepad was connected to a robot. Returns true if a gamepad was connected

void trikControl::GamepadInterface::disconnected ( )
signal

Emitted when last gamepad disconnects from robot.

Note that robot may have several connected gamepads at the same time, so when one gamepad disconnects, this signal will not be emitted.

virtual bool trikControl::GamepadInterface::isConnected ( ) const
pure virtualslot

Returns true if a gamepad is currently connected to a robot.

virtual bool trikControl::GamepadInterface::isPadPressed ( int  pad) const
pure virtualslot

Returns current state of the pad, true if pressed.

void trikControl::GamepadInterface::pad ( int  pad,
int  x,
int  y 
)
signal

Emitted when user pushes or moves his finger on a pad.

Parameters
pad- id of a pad on which the event occurs.
x- x coordinate of an event.
y- y coordinate of an event.
void trikControl::GamepadInterface::padUp ( int  pad)
signal

Emitted when user pulls finger off a pad.

Parameters
pad- id of a pad on which the event occurs.
virtual int trikControl::GamepadInterface::padX ( int  pad) const
pure virtualslot

Returns current X coordinate of given pad or -1 if this pad is not pressed.

virtual int trikControl::GamepadInterface::padY ( int  pad) const
pure virtualslot

Returns current Y coordinate of given pad or -1 if this pad is not pressed.

virtual void trikControl::GamepadInterface::reset ( )
pure virtualslot

Clear data about previous pad events.

virtual int trikControl::GamepadInterface::wheel ( ) const
pure virtualslot

Returns current tilt angle of Android device when "wheel" is turned on.

void trikControl::GamepadInterface::wheelEvent ( int  percent)
signal

Emitted when user tilts his Android device with "wheel" turned on.

Parameters
percent- percent of a tilt angle.

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