semf
semf::esh::Printer Class Reference

Class for string related UART communication. Using this class outside of an esh-context can make sense too and is encouraged. More...

#include <printer.h>

Collaboration diagram for semf::esh::Printer:
Collaboration graph

Public Types

enum class  ErrorCode : uint8_t { Print_IsBusy = 0 }
 Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring). More...
 

Public Member Functions

 Printer (semf::UartHardware &uart)
 Constructor. More...
 
 Printer (const Printer &other)=delete
 
virtual ~Printer ()=default
 
void print (char character, size_t count)
 Prints a single character count times. More...
 
void print (std::string_view text, size_t count=1)
 Prints a string count times. More...
 
void readCharacter ()
 Triggers a read cyle for reading a single character. More...
 
bool isBusy () const
 Indicates wether the printer is busy. More...
 
 SEMF_SIGNAL (dataWritten)
 
 SEMF_SIGNAL (dataAvailable, char)
 
 SEMF_SIGNAL (error, Error)
 

Detailed Description

Class for string related UART communication. Using this class outside of an esh-context can make sense too and is encouraged.

Definition at line 24 of file printer.h.

Member Enumeration Documentation

◆ ErrorCode

enum class semf::esh::Printer::ErrorCode : uint8_t
strong

Error codes for this class. Error ID identify a unique error() / onError call (excluding transferring).

Enumerator
Print_IsBusy 

Definition at line 30 of file printer.h.

Constructor & Destructor Documentation

◆ Printer() [1/2]

semf::esh::Printer::Printer ( semf::UartHardware uart)
explicit

Constructor.

Parameters
uartUART to use.

Definition at line 14 of file printer.cpp.

◆ Printer() [2/2]

semf::esh::Printer::Printer ( const Printer other)
delete

◆ ~Printer()

virtual semf::esh::Printer::~Printer ( )
virtualdefault

Member Function Documentation

◆ isBusy()

bool semf::esh::Printer::isBusy ( ) const

Indicates wether the printer is busy.

Returns
true if busy.

Definition at line 64 of file printer.cpp.

◆ print() [1/2]

void semf::esh::Printer::print ( char  character,
size_t  count 
)

Prints a single character count times.

Parameters
characterCharacter to print.
countAmout of print cycles.
Exceptions
Print_IsBusyIf object is busy.

Definition at line 20 of file printer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ print() [2/2]

void semf::esh::Printer::print ( std::string_view  text,
size_t  count = 1 
)

Prints a string count times.

Parameters
textString to print.
countAmount of print cycles.
Exceptions
Print_IsBusyIf object is busy.

Definition at line 36 of file printer.cpp.

Here is the call graph for this function:

◆ readCharacter()

void semf::esh::Printer::readCharacter ( )

Triggers a read cyle for reading a single character.

Definition at line 58 of file printer.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SEMF_SIGNAL() [1/3]

semf::esh::Printer::SEMF_SIGNAL ( dataAvailable  ,
char   
)

Emitted after character was received.

◆ SEMF_SIGNAL() [2/3]

semf::esh::Printer::SEMF_SIGNAL ( dataWritten  )

Emitted after print finished successfully.

◆ SEMF_SIGNAL() [3/3]

semf::esh::Printer::SEMF_SIGNAL ( error  ,
Error   
)

Emitted on error.