1 #ifndef _GAMS_UTILITY_LINUXJOYSTICK_H
2 #define _GAMS_UTILITY_LINUXJOYSTICK_H
15 namespace gams {
namespace utility {
41 "gams::utility::Joystick::open: " \
42 "attempting close on existing file %x\n",
56 "gams::utility::Joystick::open: " \
67 "gams::utility::Joystick::open: " \
68 "attempting close on file %x\n",
75 "gams::utility::Joystick::open: " \
76 "calling fopen on %s\n",
79 file_ = fopen(handle.c_str(),
"rb");
83 "gams::utility::Joystick::open: " \
84 "return of fopen is %x\n",
116 events = fread(&event,
sizeof(event), 1,
file_);
121 "gams::utility::Joystick::open: " \
122 "fread returned %zu events\n",
131 return (event.
type & 0x02) != 0;
137 return (event.
type & 0x01) != 0;
142 return event.number == 0;
147 return event.number == 1;
152 return event.number == 3;
157 return event.number == 4;
162 return (event.
type & 0x80) != 0;
167 double result =
event.value;
bool is_x_move(const JoystickEvent &event) const
bool is_rotate(const JoystickEvent &event) const
bool is_y_move(const JoystickEvent &event) const
bool is_button(const JoystickEvent &event) const
bool open_handle(const std::string &handle)
Joystick(const std::string &handle)
bool is_z_move(const JoystickEvent &event) const
bool is_axis(const JoystickEvent &event) const
bool is_init(const JoystickEvent &event) const
double to_double(const JoystickEvent &event) const
bool get(JoystickEvent &event)
GAMS_EXPORT madara::utility::Refcounter< madara::logger::Logger > global_logger
Contains all GAMS-related tools, classes and code.