OpenRoadCode
Public API reference for OpenRoadCode
Loading...
Searching...
No Matches
hardware_io.keyboard.keyboard_reader_if.KeyboardReaderIf Class Reference

Read normalized key names from a physical keyboard source. More...

Inheritance diagram for hardware_io.keyboard.keyboard_reader_if.KeyboardReaderIf:
hardware_io.keyboard.keyboard_reader.KeyboardReader

Public Member Functions

str|None device_path (self)
 Return the selected device path, if one has been selected.
 
str|None device_name (self)
 Return the connected device name, if available.
 
bool is_running (self)
 Return whether background key monitoring is active.
 
None open (self)
 Open or select the underlying keyboard source.
 
None close (self)
 Stop monitoring and release the underlying source.
 
Iterator[str] read_keys (self)
 Yield normalized key names from the source until it closes.
 
None start (self, KeyCallback|None callback=None)
 Start background monitoring using the configured callback.
 
None stop (self)
 Stop background monitoring without discarding configuration.
 

Detailed Description

Read normalized key names from a physical keyboard source.

Member Function Documentation

◆ device_name()

str | None hardware_io.keyboard.keyboard_reader_if.KeyboardReaderIf.device_name (   self)

Return the connected device name, if available.

Returns
Connected device name, or None when unavailable.

Reimplemented in hardware_io.keyboard.keyboard_reader.KeyboardReader.

◆ device_path()

str | None hardware_io.keyboard.keyboard_reader_if.KeyboardReaderIf.device_path (   self)

Return the selected device path, if one has been selected.

Returns
Selected device path, or None before device selection.

Reimplemented in hardware_io.keyboard.keyboard_reader.KeyboardReader.

◆ is_running()

bool hardware_io.keyboard.keyboard_reader_if.KeyboardReaderIf.is_running (   self)

Return whether background key monitoring is active.

Returns
True while background monitoring is active.

Reimplemented in hardware_io.keyboard.keyboard_reader.KeyboardReader.

◆ read_keys()

Iterator[str] hardware_io.keyboard.keyboard_reader_if.KeyboardReaderIf.read_keys (   self)

Yield normalized key names from the source until it closes.

Returns
Iterator of normalized key names.

Reimplemented in hardware_io.keyboard.keyboard_reader.KeyboardReader.

◆ start()

None hardware_io.keyboard.keyboard_reader_if.KeyboardReaderIf.start (   self,
KeyCallback | None   callback = None 
)

Start background monitoring using the configured callback.

Parameters
callbackOptional consumer invoked for each normalized key.

Reimplemented in hardware_io.keyboard.keyboard_reader.KeyboardReader.


The documentation for this class was generated from the following file: