1
0
forked from fsfw/fsfw

more improvements:

1. New optional flag to redirect print to stderr. THis can be useful on
host environemtns (e.g linux)
2. non-buffered mode if this flag is true: the preamble msut be printed
manually
2. Getter function for preamble for that case.
3. printChar function: specify whether to print to stderr or stdout
This commit is contained in:
2020-06-03 23:14:17 +02:00
parent e5cea3ead0
commit 7259a13569
4 changed files with 131 additions and 62 deletions

View File

@ -1,11 +1,15 @@
#include <framework/serviceinterface/ServiceInterfaceStream.h>
ServiceInterfaceStream::ServiceInterfaceStream(std::string setMessage,
bool errStream, bool addCrToPreamble, uint16_t port) :
std::ostream(&buf),
buf(setMessage, errStream, addCrToPreamble, port) {
}
void ServiceInterfaceStream::setActive( bool myActive) {
this->buf.isActive = myActive;
}
ServiceInterfaceStream::ServiceInterfaceStream(std::string set_message,
bool addCrToPreamble, uint16_t port) :
std::basic_ostream<char, std::char_traits<char>>(&buf),
buf(set_message, port, addCrToPreamble) {
std::string ServiceInterfaceStream::getPreamble() {
return buf.getPreamble();
}