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 30 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 40 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 123 of file force_feedback.cpp.
JoystickForceFeedback::~JoystickForceFeedback | ( | ) |
Destructor.
Definition at line 227 of file force_feedback.cpp.
|
inline |
Check if constant effect is supported.
Definition at line 75 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if custom effect is supported.
Definition at line 130 of file force_feedback.h.
|
inline |
Check if damper effect is supported.
Definition at line 90 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if friction effect is supported.
Definition at line 85 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if inertia effect is supported.
Definition at line 95 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if periodic effect is supported.
Definition at line 70 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if ramp effect is supported.
Definition at line 100 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if rumbling effect is supported.
Definition at line 65 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if downward saw effect is supported.
Definition at line 125 of file force_feedback.h.
|
inline |
Check if upward saw effect is supported.
Definition at line 120 of file force_feedback.h.
|
inline |
Check if sine effect is supported.
Definition at line 115 of file force_feedback.h.
|
inline |
Check if spring effect is supported.
Definition at line 80 of file force_feedback.h.
Referenced by JoystickActThread::MessageProcessor::process().
|
inline |
Check if square effect is supported.
Definition at line 105 of file force_feedback.h.
|
inline |
Check if triangle effect is supported.
Definition at line 110 of file force_feedback.h.
|
inline |
Check if rumbling effect is active.
Definition at line 60 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 246 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().
void JoystickForceFeedback::stop_all | ( | ) |
Stop all current effects.
Definition at line 291 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().
void JoystickForceFeedback::stop_rumble | ( | ) |
Stop rumbling.
Definition at line 279 of file force_feedback.cpp.
Referenced by JoystickActThread::MessageProcessor::process_message().