17 #include <QtCore/QScopedPointer> 18 #include <QtCore/QThread> 19 #include <QtCore/QHash> 20 #include <QtCore/QSet> 21 #include <QtCore/QTimer> 47 void reset()
override;
55 int padX(
int pad)
const override;
57 int padY(
int pad)
const override;
59 int wheel()
const override;
66 void onNewData(
const QString &data);
68 void onButtonStateClearTimerTimeout();
79 void handlePadUp(
int padId);
81 void handleWheel(
int percent);
83 void handlePad(
int padId,
int x,
int y);
85 void handleButton(
int button,
int pressed);
87 void handleKeepalive(
int waitForMs);
89 void handleCustom(
const QString &message);
93 QSet<int> mButtonWasPressed;
94 QHash<int, bool> mButtonState;
99 QHash<int, QTimer*> mButtonStateClearTimers;
101 QHash<int, PadStatus> mPads;
102 int mWheelPercent { -101 };
104 QTimer mKeepaliveTimer;
105 QString mLastCustomMessage;
107 bool mConnected {
false };
int wheel() const override
Definition: gamepad.cpp:66
Gamepad(const trikKernel::Configurer &configurer, const trikHal::HardwareAbstractionInterface &hardwareAbstraction)
Constructor.
Definition: gamepad.cpp:21
void pad(int pad, int x, int y)
Emitted when user pushes or moves his finger on a pad.
void button(int button, int pressed)
Emitted when user pushes a button on gamepad.
Class that represents linux FIFO file, which is commonly used by various sensors. ...
Definition: fifo.h:35
void reset() override
Definition: gamepad.cpp:30
Status status() const override
Returns current status of the device.
Definition: gamepad.cpp:36
bool buttonIsPressed(int buttonNumber) override
Definition: gamepad.cpp:46
int padY(int pad) const override
Definition: gamepad.cpp:61
bool isConnected() const override
Definition: gamepad.cpp:71
Status
Device status.
Definition: deviceInterface.h:33
Definition: trikCommunicator.h:27
bool buttonWasPressed(int buttonNumber) override
Definition: gamepad.cpp:41
Remote control of a robot via Android gamepad.
Definition: gamepadInterface.h:24
~Gamepad() override=default
Implementation of remote control interface.
Definition: gamepad.h:33
int padX(int pad) const override
Definition: gamepad.cpp:56
TRIK device interface, base interface for everything that can be plugged to a brick or already on boa...
Definition: deviceInterface.h:23
var x
Definition: file-test.js:2
bool isPadPressed(int pad) const override
Definition: gamepad.cpp:51
var y
Definition: file-test.js:5
bool disconnect() override
Definition: gamepad.cpp:76
Hardware abstraction, provides devices that are used to communicate with robot hardware or emulate it...
Definition: hardwareAbstractionInterface.h:29