trikRuntime
trikControl::Gamepad Class Reference

Implementation of remote control interface. More...

#include <gamepad.h>

Inheritance diagram for trikControl::Gamepad:
Collaboration diagram for trikControl::Gamepad:

Public Slots

void reset () override
 
bool buttonWasPressed (int buttonNumber) override
 
bool buttonIsPressed (int buttonNumber) override
 
bool isPadPressed (int pad) const override
 
int padX (int pad) const override
 
int padY (int pad) const override
 
int wheel () const override
 
bool isConnected () const override
 
bool disconnect () override
 
- Public Slots inherited from trikControl::GamepadInterface
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...
 

Public Member Functions

 Gamepad (const trikKernel::Configurer &configurer, const trikHal::HardwareAbstractionInterface &hardwareAbstraction)
 Constructor. More...
 
 ~Gamepad () override=default
 
Status status () const override
 Returns current status of the device. More...
 
- Public Member Functions inherited from trikControl::DeviceInterface
 DeviceInterface ()=default
 
virtual ~DeviceInterface ()=default
 

Additional Inherited Members

- Public Types inherited from trikControl::DeviceInterface
enum  Status {
  Status::permanentFailure, Status::temporaryFailure, Status::off, Status::starting,
  Status::ready, Status::stopping
}
 Device status. More...
 
- Signals inherited from trikControl::GamepadInterface
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...
 
- Static Public Member Functions inherited from trikControl::DeviceInterface
static Status combine (const DeviceInterface &underlying, const DeviceInterface::Status &dependent)
 Helper method to return status of a device relying on other device to work. More...
 

Detailed Description

Implementation of remote control interface.

Constructor & Destructor Documentation

Gamepad::Gamepad ( const trikKernel::Configurer configurer,
const trikHal::HardwareAbstractionInterface hardwareAbstraction 
)

Constructor.

trikControl::Gamepad::~Gamepad ( )
overridedefault

Member Function Documentation

bool Gamepad::buttonIsPressed ( int  buttonNumber)
overrideslot
bool Gamepad::buttonWasPressed ( int  buttonNumber)
overrideslot
bool Gamepad::disconnect ( )
overrideslot
bool Gamepad::isConnected ( ) const
overrideslot
bool Gamepad::isPadPressed ( int  pad) const
overrideslot
int Gamepad::padX ( int  pad) const
overrideslot
int Gamepad::padY ( int  pad) const
overrideslot
void Gamepad::reset ( )
overrideslot
Gamepad::Status Gamepad::status ( ) const
overridevirtual

Returns current status of the device.

Implements trikControl::DeviceInterface.

int Gamepad::wheel ( ) const
overrideslot

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