Keyboard Class
Package: GHIElectronics.Endpoint.Devices.UsbHost
Namespace: GHIElectronics.Endpoint.Devices.UsbHost
Allows a usb device to be used as a keyboard.
public class Keyboard : 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)
public Keyboard(string deviceName)
Opens the keyboard that UsbHostController reported ("/dev/input/event1").
Methods
IsKeyPressed(Key key)
public 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
public event KeyboardEventHandler CharDown
Fired when a key is pressed and it can be converted to ASCII.
CharUp
public event KeyboardEventHandler CharUp
Fired when a key is released and it can be converted to ASCII.
KeyDown
public event KeyboardEventHandler KeyDown
Fired when a key is pressed.
KeyUp
public event KeyboardEventHandler KeyUp
Fired when a key is released.