j5.components.string_command module

Classes for the string command component.

class j5.components.string_command.StringCommandComponent(identifier: int, backend: j5.components.string_command.StringCommandComponentInterface)[source]

Bases: j5.components.component.Component

A string command component.

This component allows the sending and receiving of commands to a board, so that custom ASCII protocols can be implemented. This is primarily aimed at Boards which can have custom firmware installed by the students that are using them.

execute(command: str) → str[source]

Execute the string command and return the result.

This function can be synchronous and blocking.

Parameters:command – command to execute.
Returns:result of command.
Raises:ValueError – command is not valid.
identifier

An integer to identify the component on a board.

Returns:component identifier.
static interface_class() → Type[j5.components.component.Interface][source]

Get the interface class that is required to use this component.

Returns:interface class.
class j5.components.string_command.StringCommandComponentInterface[source]

Bases: j5.components.component.Interface

An interface containing the methods required for string commands.

execute_string_command(command: str) → str[source]

Execute the string command and return the result.

This function can be synchronous and blocking.

Parameters:command – command to execute.
Returns:result