REDAC HybridController
Firmware for LUCIDAC/REDAC Teensy
|
A "multiplexer" for Print targets. More...
#include <print-multiplexer.h>


Public Member Functions | |
void | add (Print *target) |
void | add (EthernetClient *target) |
void | add_Serial () |
void | remove (Print *target) |
void | remove (EthernetClient *target) |
size_t | size () const |
virtual size_t | write (uint8_t b) override |
Printables which go to all clients. | |
size_t | write (const uint8_t *buffer, size_t size) override |
virtual void | flush () override |
Public Attributes | |
bool | optimistic = false |
whether you prefer to send too much or too few | |
Detailed Description
A "multiplexer" for Print targets.
This class tries to do something which does not properly work this way, as it would require buffering. This code naively keeps "fingers crossed" because even our error reporting (logging) eventually calls it, so there is no suitable error reporting anyway.
Methods in this class lie about their return value. This will soak up data silently. Or result in multiple prints, depending on your preference.
TODO: This code is awful. Improve in any manner.
See also https://github.com/bblanchon/ArduinoStreamUtils for something more sane.
Definition at line 38 of file print-multiplexer.h.
Member Function Documentation
◆ add() [1/2]
|
inline |
Definition at line 47 of file print-multiplexer.h.
◆ add() [2/2]
|
inline |
Definition at line 46 of file print-multiplexer.h.
Referenced by msg::JsonlServer::loop(), and setup().
◆ add_Serial()
|
inline |
Definition at line 48 of file print-multiplexer.h.
Referenced by msg::activate_serial_log(), msg::JsonLinesProtocol::JsonLinesProtocol(), and setup().
◆ flush()
|
inlineoverridevirtual |
Definition at line 76 of file print-multiplexer.h.
◆ remove() [1/2]
|
inline |
Definition at line 51 of file print-multiplexer.h.
◆ remove() [2/2]
|
inline |
Definition at line 50 of file print-multiplexer.h.
Referenced by msg::JsonlServer::loop().
◆ size()
|
inline |
Definition at line 53 of file print-multiplexer.h.
Referenced by write().
◆ write() [1/2]
|
inlineoverride |
Definition at line 64 of file print-multiplexer.h.
References optimistic, size(), and success.
◆ write() [2/2]
|
inlineoverridevirtual |
Printables which go to all clients.
Definition at line 56 of file print-multiplexer.h.
References optimistic, and success.
Member Data Documentation
◆ optimistic
bool utils::PrintMultiplexer::optimistic = false |
whether you prefer to send too much or too few
Definition at line 44 of file print-multiplexer.h.
The documentation for this class was generated from the following file:
- lib/controller/src/utils/print-multiplexer.h