Fawkes API
Fawkes Development Version
|
#include "force_feedback.h"
Public Types | |
enum | Direction { DIRECTION_DOWN = 0x0000, DIRECTION_LEFT = 0x4000, DIRECTION_UP = 0x8000, DIRECTION_RIGHT = 0xC000 } |
Direction of the effect. More... | |
Public Member Functions | |
JoystickForceFeedback (const char *device_name) | |
Constructor. More... | |
~JoystickForceFeedback () | |
Destructor. More... | |
void | rumble (uint16_t strong_magnitude, uint16_t weak_magnitude, Direction direction=DIRECTION_DOWN, uint16_t length=0, uint16_t delay=0) |
Rumble the joystick. More... | |
void | stop_all () |
Stop all current effects. More... | |
void | stop_rumble () |
Stop rumbling. More... | |
bool | is_rumbling () |
bool | can_rumble () |
bool | can_periodic () |
bool | can_constant () |
bool | can_spring () |
bool | can_friction () |
bool | can_damper () |
bool | can_inertia () |
bool | can_ramp () |
bool | can_square () |
bool | can_triangle () |
bool | can_sine () |
bool | can_saw_up () |
bool | can_saw_down () |
bool | can_custom () |
Cause force feedback on a joystick. An instance of this class opens an input device which belongs to the given device name. It searches all input devices to find the correct device file. Once opened, it detects the available features of the joystick and provides conventient access to it allowing for rumbling effects, for instance.
Definition at line 29 of file force_feedback.h.
Direction of the effect.
Enumerator | |
---|---|
DIRECTION_DOWN | Downward effect direction. |
DIRECTION_LEFT | Left effect direction. |
DIRECTION_UP | Upward effect direction. |
DIRECTION_RIGHT | Right effect direction. |
Definition at line 38 of file force_feedback.h.
JoystickForceFeedback::JoystickForceFeedback | ( | const char * | device_name | ) |
Constructor.
device_name | device name, note that this is not the device file, but rather the event files are tried and the device name is compared. |
Definition at line 122 of file force_feedback.cpp.
JoystickForceFeedback::~JoystickForceFeedback | ( | ) |
Destructor.
Definition at line 226 of file force_feedback.cpp.
|
inline |
Check if constant effect is supported.
Definition at line 73 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if custom effect is supported.
Definition at line 128 of file force_feedback.h.
|
inline |
Check if damper effect is supported.
Definition at line 88 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if friction effect is supported.
Definition at line 83 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if inertia effect is supported.
Definition at line 93 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if periodic effect is supported.
Definition at line 68 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if ramp effect is supported.
Definition at line 98 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if rumbling effect is supported.
Definition at line 63 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if downward saw effect is supported.
Definition at line 123 of file force_feedback.h.
|
inline |
Check if upward saw effect is supported.
Definition at line 118 of file force_feedback.h.
|
inline |
Check if sine effect is supported.
Definition at line 113 of file force_feedback.h.
|
inline |
Check if spring effect is supported.
Definition at line 78 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if square effect is supported.
Definition at line 103 of file force_feedback.h.
|
inline |
Check if triangle effect is supported.
Definition at line 108 of file force_feedback.h.
|
inline |
Check if rumbling effect is active.
Definition at line 58 of file force_feedback.h.
void JoystickForceFeedback::rumble | ( | uint16_t | strong_magnitude, |
uint16_t | weak_magnitude, | ||
Direction | direction = DIRECTION_DOWN , |
||
uint16_t | length = 0 , |
||
uint16_t | delay = 0 |
||
) |
Rumble the joystick.
This is the most basic force feedback for example in force feedback joypads. Often such joysticks provide two effect magnitudes, a strong heavier motor for larger effects, and a smaller one for vibrating effects.
strong_magnitude | magnitude to use on the larger motor |
weak_magnitude | magnitude to use on the smaller motor |
direction | direction of the effect, meaningful on joysticks (rather than joypads) |
length | length of the effect in ms |
delay | delay before the effect starts in ms |
Definition at line 245 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().
void JoystickForceFeedback::stop_all | ( | ) |
Stop all current effects.
Definition at line 290 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().
void JoystickForceFeedback::stop_rumble | ( | ) |
Stop rumbling.
Definition at line 278 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().