DUNE: Uniform Navigational Environment  2016.03.0
DUNE::Hardware::Buttons Class Reference

Public Member Functions

 Buttons (const std::string &source_dev)
 
void poll (double timeout)
 
bool changed (unsigned btn)
 
bool value (unsigned btn)
 

Constructor & Destructor Documentation

DUNE::Hardware::Buttons::Buttons ( const std::string &  source_dev)

Constructor.

Parameters
[in]source_devpath for the input event device file (for example /dev/input/event0)

Member Function Documentation

bool DUNE::Hardware::Buttons::changed ( unsigned  btn)
inline

Check if a button changed state.

Parameters
[in]btnbutton number.
Returns
true if changed state, false otherwise.
void DUNE::Hardware::Buttons::poll ( double  timeout)

Wait for new input.

Parameters
[in]timeouttimeout in seconds, negative for no timeout.

References DUNE::IO::Poll::poll(), and value().

bool DUNE::Hardware::Buttons::value ( unsigned  btn)
inline

Get the button state.

Parameters
[in]btnbutton number.
Returns
true if pressed, false otherwise.

Referenced by poll().

Collaboration diagram for DUNE::Hardware::Buttons:
Collaboration graph