added bluetooth console

This commit is contained in:
2022-03-03 15:13:48 +01:00
parent 552c98c71a
commit e127009601
4 changed files with 76 additions and 33 deletions
-30
View File
@@ -1,30 +0,0 @@
/**
* @file outputBufMqtt.cpp
* @author Alexander Klein (alex@kleiax.de)
* @brief Contains the implementation of the class OutputBufMqtt
* @version 0.1
* @date 2022-02-14
*
* @copyright Copyright (c) 2022
*
*/
#include "outputBufMqtt.h"
OutputBufMqtt::OutputBufMqtt(DebugMqtt* debugMqtt)
: std::streambuf() {
this->debugMqtt = debugMqtt;
}
std::streambuf::int_type OutputBufMqtt::overflow(std::streambuf::int_type c) {
if (c != EOF) {
// c = std::toupper(static_cast<char>(c), getloc());
this->debugMqtt->addCharacter((char) c);
Serial.print((char) c);
// if (putchar(c) == EOF) {
// return EOF;
// }
}
return c;
}
-55
View File
@@ -1,55 +0,0 @@
/**
* @file outputBufMqtt.h
* @author Alexander Klein (alex@kleiax.de)
* @brief Contains a small class that provide a streambuf
*
* The streambuf is used to double the std::cout to consol
* and MQTT.
*
* @version 0.1
* @date 2022-02-14
*
* @copyright Copyright (c) 2022
*
*/
#ifndef OUTPUT_STREAM_MQTT_H
#define OUTPUT_STREAM_MQTT_H
#include <iostream>
#include <streambuf>
#include <locale>
#include <cstdio>
#include "debugMqtt.h"
/**
* @brief A alternativ streambuf for std::cout
*
* The streambuf is used to double the std::cout to consol
* and MQTT.
*
*/
class OutputBufMqtt : public std::streambuf {
public:
/**
* @brief Construct a new Output Buf Mqtt object
*
* @param debugMqtt
*/
OutputBufMqtt(DebugMqtt* debugMqtt);
protected:
/**
* @brief
*
* @param c
* @return std::streambuf::int_type
*/
virtual std::streambuf::int_type overflow(std::streambuf::int_type c);
public:
DebugMqtt* debugMqtt;
};
#endif // OUTPUT_STREAM_MQTT_H