Fawkes API
Fawkes Development Version
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
All
Classes
Namespaces
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Groups
Pages
force_feedback.h
1
2
/***************************************************************************
3
* force_feedback.h - Force feedback for joysticks using Linux input API
4
*
5
* Created: Sun Feb 06 23:50:57 2011 (Super Bowl XLV)
6
* Copyright 2006-2011 Tim Niemueller [www.niemueller.de]
7
*
8
****************************************************************************/
9
10
/* This program is free software; you can redistribute it and/or modify
11
* it under the terms of the GNU General Public License as published by
12
* the Free Software Foundation; either version 2 of the License, or
13
* (at your option) any later version.
14
*
15
* This program is distributed in the hope that it will be useful,
16
* but WITHOUT ANY WARRANTY; without even the implied warranty of
17
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18
* GNU Library General Public License for more details.
19
*
20
* Read the full text in the LICENSE.GPL file in the doc directory.
21
*/
22
23
#ifndef __PLUGINS_JOYSTICK_FORCE_FEEDBACK_H_
24
#define __PLUGINS_JOYSTICK_FORCE_FEEDBACK_H_
25
26
#include <stdint.h>
27
#include <linux/input.h>
28
29
class
JoystickForceFeedback
30
{
31
public
:
32
/** Direction of the effect. */
33
typedef
enum
{
34
DIRECTION_DOWN
= 0x0000,
/**< Downward effect direction. */
35
DIRECTION_LEFT
= 0x4000,
/**< Left effect direction. */
36
DIRECTION_UP
= 0x8000,
/**< Upward effect direction. */
37
DIRECTION_RIGHT
= 0xC000
/**< Right effect direction. */
38
}
Direction
;
39
40
JoystickForceFeedback
(
const
char
*device_name);
41
~JoystickForceFeedback
();
42
43
void
rumble
(uint16_t strong_magnitude, uint16_t weak_magnitude,
44
Direction
direction =
DIRECTION_DOWN
,
45
uint16_t length = 0, uint16_t delay = 0);
46
47
void
stop_all
();
48
void
stop_rumble
();
49
50
bool
is_rumbling
() {
return
(__rumble.id != -1); }
51
bool
can_rumble
() {
return
__can_rumble; }
52
bool
can_periodic
() {
return
__can_periodic; }
53
bool
can_constant
() {
return
__can_constant; }
54
bool
can_spring
() {
return
__can_spring; }
55
bool
can_friction
() {
return
__can_friction; }
56
bool
can_damper
() {
return
__can_damper; }
57
bool
can_inertia
() {
return
__can_inertia; }
58
bool
can_ramp
() {
return
__can_ramp; }
59
bool
can_square
() {
return
__can_square; }
60
bool
can_triangle
() {
return
__can_triangle; }
61
bool
can_sine
() {
return
__can_sine; }
62
bool
can_saw_up
() {
return
__can_saw_up; }
63
bool
can_saw_down
() {
return
__can_saw_down; }
64
bool
can_custom
() {
return
__can_custom; }
65
66
private
:
67
int
__fd;
68
struct
ff_effect __rumble;
69
70
int
__num_effects;
71
72
bool
__can_rumble;
73
bool
__can_periodic;
74
bool
__can_constant;
75
bool
__can_spring;
76
bool
__can_friction;
77
bool
__can_damper;
78
bool
__can_inertia;
79
bool
__can_ramp;
80
bool
__can_square;
81
bool
__can_triangle;
82
bool
__can_sine;
83
bool
__can_saw_up;
84
bool
__can_saw_down;
85
bool
__can_custom;
86
87
};
88
89
90
#endif
src
plugins
joystick
force_feedback.h
Generated by
1.8.3.1