9 #ifndef YARP_DEV_IJOYPADCONTROLLER_H
10 #define YARP_DEV_IJOYPADCONTROLLER_H
22 #define HAT_ACTIONS_ID_SHIFT 100
28 class IJoypadController;
30 class IJoypadEventDriven;
120 virtual bool getStickDoF(
unsigned int stick_id,
unsigned int& DoF) = 0;
129 virtual bool getButton(
unsigned int button_id,
float& value) = 0;
147 virtual bool getHat(
unsigned int hat_id,
unsigned char& value) = 0;
158 virtual bool getAxis(
unsigned int axis_id,
double& value) = 0;
212 bool EventDrivenEnabled;
229 virtual bool getRawHat(
unsigned int hat_id,
unsigned char& value) = 0;
230 virtual bool getRawAxis(
unsigned int axis_id,
double& value) = 0;
239 bool getAxisCount(
unsigned int& axis_count)
override final;
242 bool getHatCount(
unsigned int& Hat_count)
override final;
244 bool getStickCount(
unsigned int& stick_count)
override final;
245 bool getStickDoF(
unsigned int stick_id,
unsigned int& DoF)
override final;
246 bool getButton(
unsigned int button_id,
float& value)
override final;
248 bool getHat(
unsigned int hat_id,
unsigned char& value)
override final;
249 bool getAxis(
unsigned int axis_id,
double& value)
override final;
259 #ifndef YARP_NO_DEPRECATED
260 #if defined(_MSC_VER) && _MSC_VER <= 1900
269 bool threadInit() override final;
270 void run() override final;
272 bool eventDriven(
bool enable,
yarp::dev::
IJoypadEvent* event =
nullptr) override;
273 bool isEventDriven()
override {
return EventDrivenEnabled;}
277 #define YRPJOY_HAT_CENTERED 0x00
278 #define YRPJOY_HAT_UP 0x01
279 #define YRPJOY_HAT_RIGHT 0x02
280 #define YRPJOY_HAT_DOWN 0x04
281 #define YRPJOY_HAT_LEFT 0x08
282 #define YRPJOY_HAT_RIGHTUP (YRPJOY_HAT_RIGHT|YRPJOY_HAT_UP)
283 #define YRPJOY_HAT_RIGHTDOWN (YRPJOY_HAT_RIGHT|YRPJOY_HAT_DOWN)
284 #define YRPJOY_HAT_LEFTUP (YRPJOY_HAT_LEFT |YRPJOY_HAT_UP)
285 #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)
virtual ~IJoypadController()
Destructor.
JoypadCtrl_coordinateMode
virtual bool getStickDoF(unsigned int stick_id, unsigned int &DoF)=0
Get the Degree Of Freedom count for desired stick.
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
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...
constexpr yarp::conf::vocab32_t createVocab(char a, char b=0, char c=0, char d=0)
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.