6#ifndef YARP_DEV_IJOYPADCONTROLLER_H
7#define YARP_DEV_IJOYPADCONTROLLER_H
19#define HAT_ACTIONS_ID_SHIFT 100
22class IJoypadController;
24class IJoypadEventDriven;
113 virtual bool getStickDoF(
unsigned int stick_id,
unsigned int& DoF) = 0;
125 virtual bool getButton(
unsigned int button_id,
float& value) = 0;
143 virtual bool getHat(
unsigned int hat_id,
unsigned char& value) = 0;
154 virtual bool getAxis(
unsigned int axis_id,
double& value) = 0;
208 bool EventDrivenEnabled;
225 virtual bool getRawHat(
unsigned int hat_id,
unsigned char& value) = 0;
226 virtual bool getRawAxis(
unsigned int axis_id,
double& value) = 0;
229 using IJoypadController::m_actions;
230 using IJoypadController::executeAction;
231 using IJoypadController::parseActions;
235 bool getAxisCount(
unsigned int& axis_count)
override final;
238 bool getHatCount(
unsigned int& Hat_count)
override final;
240 bool getStickCount(
unsigned int& stick_count)
override final;
241 bool getStickDoF(
unsigned int stick_id,
unsigned int& DoF)
override final;
242 bool getButton(
unsigned int button_id,
float& value)
override final;
244 bool getHat(
unsigned int hat_id,
unsigned char& value)
override final;
245 bool getAxis(
unsigned int axis_id,
double& value)
override final;
249 using IJoypadController::JypCtrlcoord_CARTESIAN;
250 using IJoypadController::JypCtrlcoord_POLAR;
255#ifndef YARP_NO_DEPRECATED
256#if defined(_MSC_VER) && _MSC_VER <= 1900
265 bool threadInit() override final;
266 void run() override final;
268 bool eventDriven(
bool enable,
yarp::dev::
IJoypadEvent* event =
nullptr) override;
269 bool isEventDriven()
override {
return EventDrivenEnabled;}
273#define YRPJOY_HAT_CENTERED 0x00
274#define YRPJOY_HAT_UP 0x01
275#define YRPJOY_HAT_RIGHT 0x02
276#define YRPJOY_HAT_DOWN 0x04
277#define YRPJOY_HAT_LEFT 0x08
278#define YRPJOY_HAT_RIGHTUP (YRPJOY_HAT_RIGHT|YRPJOY_HAT_UP)
279#define YRPJOY_HAT_RIGHTDOWN (YRPJOY_HAT_RIGHT|YRPJOY_HAT_DOWN)
280#define YRPJOY_HAT_LEFTUP (YRPJOY_HAT_LEFT |YRPJOY_HAT_UP)
281#define YRPJOY_HAT_LEFTDOWN (YRPJOY_HAT_LEFT |YRPJOY_HAT_DOWN)
constexpr yarp::conf::vocab32_t VOCAB_BUTTON
constexpr yarp::conf::vocab32_t VOCAB_IJOYPADCTRL
constexpr yarp::conf::vocab32_t VOCAB_TOUCH
constexpr yarp::conf::vocab32_t VOCAB_HAT
constexpr yarp::conf::vocab32_t VOCAB_TRACKBALL
constexpr yarp::conf::vocab32_t VOCAB_CARTESIAN
constexpr yarp::conf::vocab32_t VOCAB_STICKDOF
constexpr yarp::conf::vocab32_t VOCAB_AXIS
constexpr yarp::conf::vocab32_t VOCAB_POLAR
constexpr yarp::conf::vocab32_t VOCAB_STICK
contains the definition of a Vector type
virtual bool getHatCount(unsigned int &Hat_count)=0
Get number of hats.
virtual bool getTrackballCount(unsigned int &Trackball_count)=0
Get number of trackballs.
virtual bool eventDriven(bool enable, yarp::dev::IJoypadEvent *event=nullptr)
Activate event Driven mode.
virtual bool isEventDriven()
std::map< int, std::string > m_actions
virtual bool getTouchSurfaceCount(unsigned int &touch_count)=0
Get the number of touch surface.
virtual bool executeAction(int action_id)
virtual bool getButton(unsigned int button_id, float &value)=0
Get the value of a button.
virtual bool getAxisCount(unsigned int &axis_count)=0
Get number of axes.
virtual bool getAxis(unsigned int axis_id, double &value)=0
Get the value of an axis if present, return false otherwise.
virtual bool getStickCount(unsigned int &stick_count)=0
Get the number of the sticks.
virtual bool getTrackball(unsigned int trackball_id, yarp::sig::Vector &value)=0
Get the axes change of a Trackball.
virtual bool getStick(unsigned int stick_id, yarp::sig::Vector &value, JoypadCtrl_coordinateMode coordinate_mode)=0
Get the value of a stick if present, return false otherwise.
virtual bool parseActions(const yarp::os::Searchable &cfg, int *count=nullptr)
JoypadCtrl_coordinateMode
virtual bool getStickDoF(unsigned int stick_id, unsigned int &DoF)=0
Get the Degree Of Freedom count for desired stick.
virtual ~IJoypadController()=default
Destructor.
virtual bool getHat(unsigned int hat_id, unsigned char &value)=0
Get the value of an Hat.
virtual bool getButtonCount(unsigned int &button_count)=0
Get number of buttons.
virtual bool getTouch(unsigned int touch_id, yarp::sig::Vector &value)=0
Get the value of a touch if present, return false otherwise.
virtual bool getRawTouch(unsigned int touch_id, yarp::sig::Vector &value)=0
virtual bool getRawAxis(unsigned int axis_id, double &value)=0
virtual bool getRawHat(unsigned int hat_id, unsigned char &value)=0
virtual bool getRawAxisCount(unsigned int &axis_count)=0
virtual bool getRawTrackballCount(unsigned int &Trackball_count)=0
virtual bool getRawStickDoF(unsigned int stick_id, unsigned int &DoF)=0
virtual bool getRawStick(unsigned int stick_id, yarp::sig::Vector &value, JoypadCtrl_coordinateMode coordinate_mode)=0
virtual bool getRawButton(unsigned int button_id, float &value)=0
virtual bool getRawTrackball(unsigned int trackball_id, yarp::sig::Vector &value)=0
JoypadCtrl_coordinateMode
virtual bool getRawStickCount(unsigned int &stick_count)=0
virtual bool getRawHatCount(unsigned int &Hat_count)=0
virtual bool getRawTouchSurfaceCount(unsigned int &touch_count)=0
virtual bool getRawButtonCount(unsigned int &button_count)=0
virtual void action(std::vector< joyData< float > > buttons, std::vector< joyData< double > > axes, std::vector< joyData< unsigned char > > hats, std::vector< joyData< yarp::sig::Vector > > trackBalls, std::vector< joyData< yarp::sig::Vector > > sticks, std::vector< joyData< yarp::sig::Vector > > Touch)=0
An abstraction for a periodic thread.
A base class for nested structures that can be searched.
#define YARP_DEPRECATED_MSG(MSG)
Expands to either the standard [[deprecated]] attribute or a compiler-specific decorator such as __at...
For streams capable of holding different kinds of content, check what they actually have.
constexpr yarp::conf::vocab32_t createVocab32(char a, char b=0, char c=0, char d=0)
Create a vocab from chars.
The main, catch-all namespace for YARP.
joyData(unsigned int id, const T &datum)
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARG(x)
Suppress MSVC C4251 warning for the declaration.
#define YARP_SUPPRESS_DLL_INTERFACE_WARNING_ARGS(...)
Suppress MSVC C4251 warning for the declaration.