|
Alex exoskeleton
ALEX SoftwareDocumentation
|
Example InputDevice which takes input in from a keyboard. Useful for testing without any other input devices. More...
#include <Keyboard.h>


Public Member Functions | |
| Keyboard () | |
| Construct a new keyboard object. More... | |
| ~Keyboard () | |
| key_states | getStates () |
| getter method for key_states. More... | |
| void | setKeys () |
| reads one character from stdin and updates coresponding key state (if one occured) More... | |
| void | updateInput () |
| defintion of <class>Input</class> pure virtual function. Updates the keyboard input devices memory states from implemented keyboard input from user. E.g. A key has been pressed or not. More... | |
| void | clearCurrentStates () |
| clear the current key state variables More... | |
| void | printPressed () |
| Helper method, prints current keys registered as pressed. More... | |
| bool | getA () |
| Getter method for private A key state. More... | |
| bool | getS () |
| Getter method for private S key state. More... | |
| bool | getD () |
| Getter method for private D key state. More... | |
| bool | getW () |
| Getter method for private W key state. More... | |
| bool | getX () |
| Getter method for private X key state. More... | |
| bool | getQ () |
| Getter method for private Q key state. More... | |
| int | kbhit () |
| Check if keyboard has been hit - is stdin active. More... | |
| void | nonblock (int state) |
| Configure stdin to be nonblocking to rest of program. More... | |
| int | getKeyboardActive () |
| getter method for keyboard active flag, set by kbhit function. More... | |
| void | setKeyboardActive (int value) |
| setter method for keyboard active flag, set by kbhit function. More... | |
Public Member Functions inherited from InputDevice | |
| InputDevice () | |
Public Attributes | |
| struct termios original | noecho |
| Termios structs for turning on and off terminal echo. More... | |
| char | ch |
Private Attributes | |
| key_states | lastKeyStates = {false, false, false, false, false, false} |
| key_states | currentKeyStates = {false, false, false, false, false, false} |
| int | keyboardActive |
Example InputDevice which takes input in from a keyboard. Useful for testing without any other input devices.
Definition at line 36 of file Keyboard.h.
| Keyboard::Keyboard | ( | ) |
Construct a new keyboard object.
Definition at line 4 of file Keyboard.cpp.
| Keyboard::~Keyboard | ( | ) |
Definition at line 17 of file Keyboard.cpp.
| void Keyboard::clearCurrentStates | ( | ) |
clear the current key state variables
Definition at line 99 of file Keyboard.cpp.
| bool Keyboard::getA | ( | ) |
Getter method for private A key state.
Definition at line 106 of file Keyboard.cpp.
| bool Keyboard::getD | ( | ) |
Getter method for private D key state.
Definition at line 113 of file Keyboard.cpp.
| int Keyboard::getKeyboardActive | ( | ) |
getter method for keyboard active flag, set by kbhit function.
Definition at line 153 of file Keyboard.cpp.
| bool Keyboard::getQ | ( | ) |
Getter method for private Q key state.
Definition at line 122 of file Keyboard.cpp.
| bool Keyboard::getS | ( | ) |
Getter method for private S key state.
Definition at line 110 of file Keyboard.cpp.
| key_states Keyboard::getStates | ( | ) |
getter method for key_states.
Definition at line 72 of file Keyboard.cpp.
| bool Keyboard::getW | ( | ) |
Getter method for private W key state.
Definition at line 116 of file Keyboard.cpp.
| bool Keyboard::getX | ( | ) |
Getter method for private X key state.
Definition at line 119 of file Keyboard.cpp.
| int Keyboard::kbhit | ( | ) |
Check if keyboard has been hit - is stdin active.
Definition at line 125 of file Keyboard.cpp.
| void Keyboard::nonblock | ( | int | state | ) |
Configure stdin to be nonblocking to rest of program.
Definition at line 135 of file Keyboard.cpp.
| void Keyboard::printPressed | ( | ) |
Helper method, prints current keys registered as pressed.
Definition at line 77 of file Keyboard.cpp.
| void Keyboard::setKeyboardActive | ( | int | value | ) |
setter method for keyboard active flag, set by kbhit function.
Definition at line 156 of file Keyboard.cpp.
| void Keyboard::setKeys | ( | ) |
reads one character from stdin and updates coresponding key state (if one occured)
set last Key states
Definition at line 31 of file Keyboard.cpp.
|
virtual |
defintion of <class>Input</class> pure virtual function. Updates the keyboard input devices memory states from implemented keyboard input from user. E.g. A key has been pressed or not.
Implements InputDevice.
Definition at line 22 of file Keyboard.cpp.
| char Keyboard::ch |
Definition at line 114 of file Keyboard.h.
|
private |
Definition at line 39 of file Keyboard.h.
|
private |
Definition at line 40 of file Keyboard.h.
|
private |
Definition at line 38 of file Keyboard.h.
| struct termios original Keyboard::noecho |
Termios structs for turning on and off terminal echo.
Definition at line 113 of file Keyboard.h.
1.8.11