Keyboard Class
Package: GHIElectronics.Endpoint.Devices.UsbHost
Namespace: GHIElectronics.Endpoint.Devices.UsbHost
Allows a usb device to be used as a keyboard.
class Keyboard : public BaseDevice {};
Remarks
The CharUp and CharDown events are only fired when a given key press has a corresponding ASCII key code (a US keyboard; Ctrl+A to Ctrl+Z give 1 to 26). A key held down gives one KeyDown. The events come on the keyboard's own thread.
Nested Types
| Type | Kind | Summary |
|---|---|---|
| Keyboard.KeyboardEventArgs | Class | Event arguments for the keyboard events. |
| Keyboard.KeyboardEventHandler | Delegate | The handler for used for keyboard callbacks. |
Constructors
Keyboard(string deviceName)
Keyboard(const std::string& deviceName);
Opens the keyboard that UsbHostController reported ("/dev/input/event1").
Methods
IsKeyPressed(Key key)
KeyState IsKeyPressed(Key key);
Gets the current state of a key.
| Parameter | Type | Description |
|---|---|---|
key | Key | The key to query. |
Returns KeyState: The state of the key.
Events
CharDown
Core::Event<...> CharDown;
Fired when a key is pressed and it can be converted to ASCII.
CharUp
Core::Event<...> CharUp;
Fired when a key is released and it can be converted to ASCII.
KeyDown
Core::Event<...> KeyDown;
Fired when a key is pressed.
KeyUp
Core::Event<...> KeyUp;
Fired when a key is released.