-
Notifications
You must be signed in to change notification settings - Fork 5
/
GameController.h
106 lines (90 loc) · 3.17 KB
/
GameController.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
/*
* QForceStudio - Explore Force Feedback on Linux.
*
* Copyright (C) 2014 Logitech Europe S.A.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* To Contact Logitech Europe S.A. please send an email to
* [email protected] or via mail at EPFL - Quartier de
* l'Innovation Daniel Borel Innovation Center CH - 1015 Lausanne,
* Attention Roland Bosa.
*
*/
#ifndef GAMECONTROLLER_H
#define GAMECONTROLLER_H
#include <QSharedPointer>
class ForceEffect;
class GameController;
typedef QSharedPointer<GameController> GameControllerPtr;
typedef QList<GameControllerPtr> GameControllerPtrList;
class GameController : public QObject
{
Q_OBJECT
public:
explicit GameController(QObject *parent = 0);
virtual ~GameController(void);
// open/close
virtual bool open(const QString &filename = QString());
virtual void close(void);
virtual bool isOpen(void) const;
virtual QString name(void) const;
virtual QString filename(void) const;
virtual int numEffects(void) const;
// capabilities
bool canRenderConstant(void) const;
bool canRenderPeriodic(void) const;
bool canRenderSquare(void) const;
bool canRenderTriangle(void) const;
bool canRenderSine(void) const;
bool canRenderSawUp(void) const;
bool canRenderSawDown(void) const;
bool canRenderCustom(void) const;
bool canRenderRamp(void) const;
bool canRenderSpring(void) const;
bool canRenderFriction(void) const;
bool canRenderDamper(void) const;
bool canRenderRumble(void) const;
bool canRenderInertia(void) const;
bool canAdjustGain(void) const;
bool canAdjustAutocenter(void) const;
// enumeration
static GameControllerPtrList allControllers(void);
// forces on this device
virtual bool addForce(ForceEffect *force);
virtual bool startForce(ForceEffect *force);
virtual bool stopForce(ForceEffect *force);
virtual bool removeForce(ForceEffect *force);
virtual bool stopAllForces(void);
virtual bool pauseAllForces(void);
virtual bool continueAllForces(void);
virtual bool resetAllForces(void);
virtual bool enableActuators(bool enable);
virtual bool sendCommand(const QByteArray& command, QByteArray& response);
signals:
void errorMessage(const QString &newMessage);
public slots:
protected:
virtual bool hasSupportFor(int capability) const;
protected:
int m_fd;
QString m_filename;
QString m_name;
int m_effectCount;
int m_deviceCapsByteCount;
unsigned long *m_deviceCaps;
};
#endif // GAMECONTROLLER_H