23bool JoypadControl_nwc_yarp::getJoypadInfo()
79 b &= m_allJoyDataPort.
open(
m_local +
"/allJoyData:i");
137 button_count = ret.button_count;
144 axis_count = ret.axis_count;
151 Trackball_count = ret.Trackball_count;
158 Hat_count = ret.Hat_count;
165 touch_count = ret.touch_count;
172 stick_count = ret.stick_count;
180 auto ret = m_rpcMsgs.
getButton(button_id);
187 if(button_id <
tmp.ButtonDataVal.size())
189 value =
tmp.ButtonDataVal[button_id];
201 if(button_id <
tmp.value.size())
203 value =
tmp.value[button_id];
225 if(trackball_id <
tmp.TrackballDataVal.size())
227 value =
tmp.TrackballDataVal[trackball_id];
239 if(trackball_id <
tmp.value.size())
241 value =
tmp.value[trackball_id];
255 auto ret = m_rpcMsgs.
getHat(hat_id);
262 if(hat_id <
tmp.HatsDataVal.size())
264 value =
tmp.HatsDataVal[hat_id];
276 if (hat_id <
tmp.value.size())
278 value =
tmp.value[hat_id];
301 value =
tmp.AxisDataVal;
317 auto ret = m_rpcMsgs.
getAxis(axis_id);
324 if(axis_id <
tmp.value.size())
326 value =
tmp.value[axis_id];
332 if(axis_id <
tmp.AxisDataVal.size())
334 value =
tmp.AxisDataVal[axis_id];
355 auto ret = m_rpcMsgs.
getStick(stick_id,mode);
365 auto ret = m_rpcMsgs.
getStick(stick_id,mode);
370 if(stick_id <
tmp.StickDataVal.size())
372 value =
tmp.StickDataVal[stick_id];
387 auto ret = m_rpcMsgs.
getStick(stick_id,mode);
392 if(stick_id <
tmp.value.size())
394 value =
tmp.value[stick_id];
412 auto ret = m_rpcMsgs.
getTouch(touch_id);
419 if(touch_id <
tmp.TouchDataVal.size())
421 value =
tmp.TouchDataVal[touch_id].touches;
433 if(touch_id <
temp.value.size())
435 value.resize(
temp.value[touch_id].touches.size());
436 for (
size_t i = 0; i < value.size(); i++)
438 value[i] =
temp.value[touch_id].touches[i];
451 m_buttonsPort.
close();
453 m_trackballPort.
close();
460 m_allJoyDataPort.
close();
#define ReturnValue_error_method_failed
bool parseParams(const yarp::os::Searchable &config) override
Parse the DeviceDriver parameters.
yarp::dev::ReturnValue getTrackballCount(size_t &Trackball_count) override
Get number of trackballs.
bool close() override
Close the DeviceDriver.
yarp::dev::ReturnValue getAxisCount(size_t &axis_count) override
Get number of axes.
yarp::dev::ReturnValue getTouch(size_t touch_id, std::vector< yarp::dev::TouchData > &value) override
Get the value of a touch if present, return false otherwise.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
yarp::dev::ReturnValue getTouchSurfaceCount(size_t &touch_count) override
Get the number of touch surface.
yarp::dev::ReturnValue getButtonCount(size_t &button_count) override
Get number of buttons.
yarp::dev::ReturnValue getStick(size_t stick_id, yarp::dev::StickData &value, JoypadCtrl_coordinateMode coordinate_mode) override
Get the value of a stick if present, return false otherwise.
yarp::dev::ReturnValue getButton(size_t button_id, double &value) override
Get the value of a button.
yarp::dev::ReturnValue getAllAxes(std::vector< double > &values) override
Get the values of all available joystick axes.
yarp::dev::ReturnValue getHatCount(size_t &Hat_count) override
Get number of hats.
yarp::dev::ReturnValue getTrackball(size_t trackball_id, yarp::dev::TrackballData &value) override
Get the axes change of a Trackball.
yarp::dev::ReturnValue getAxis(size_t axis_id, double &value) override
Get the value of an axis if present, return false otherwise.
yarp::dev::ReturnValue getHat(size_t hat_id, unsigned char &value) override
Get the value of an Hat.
yarp::dev::ReturnValue getStickCount(size_t &stick_count) override
Get the number of the sticks.
virtual return_getAxis getAxis(const std::int32_t axis_id)
virtual return_getHat getHat(const std::int32_t hat_id)
virtual return_getHatCount getHatCount()
virtual return_getAllAxes getAllAxes()
virtual return_getAxisCount getAxisCount()
virtual return_getTrackballCount getTrackballCount()
virtual return_getStick getStick(const std::int32_t stick_id, const yarp::dev::IJoypadController::JoypadCtrl_coordinateMode mode)
virtual return_getButton getButton(const std::int32_t button_id)
virtual return_getTouchSurfaceCount getTouchSurfaceCount()
virtual return_getTouch getTouch(const std::int32_t touch_id)
virtual bool checkProtocolVersion()
virtual return_getButtonCount getButtonCount()
virtual return_getTrackball getTrackball(const std::int32_t trackball_id)
virtual return_getStickCount getStickCount()
JoypadCtrl_coordinateMode
A mini-server for performing network communication in the background.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
void useCallback(TypedReaderCallback< T > &callback) override
Set an object whose onRead method will be called when data is available.
static bool connect(const std::string &src, const std::string &dest, const std::string &carrier="", bool quiet=true)
Request that an output port connect to an input port.
void close() override
Stop port activity.
bool open(const std::string &name) override
Start port operation, with a specific name, with automatically-chosen network parameters.
A base class for nested structures that can be searched.
bool attachAsClient(yarp::os::UnbufferedContactable &port)
Tag this WireLink as a client, sending data via the specified port.
yarp::os::WireLink & yarp()
Get YARP state associated with this object.
#define yCInfo(component,...)
#define yCError(component,...)
#define YARP_LOG_COMPONENT(name,...)
For streams capable of holding different kinds of content, check what they actually have.
An interface to the operating system, including Port based communication.