clangtidy corrections part 2
This commit is contained in:
+39
-22
@@ -4,56 +4,73 @@
|
||||
* @brief Contains the implementation of the class OutputBufMqtt
|
||||
* @version 0.1
|
||||
* @date 2022-02-14
|
||||
*
|
||||
*
|
||||
* @copyright Copyright (c) 2022
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
#include "OutputBuf/outputBuf.h"
|
||||
|
||||
OutputBuf::OutputBuf(DebugMqtt* debugMqtt, BluetoothSerial* serialBT)
|
||||
: std::streambuf() {
|
||||
this->debugMqtt = debugMqtt;
|
||||
this->serialBT = serialBT;
|
||||
|
||||
if (debugMqtt)
|
||||
OutputBuf::OutputBuf(DebugMqtt *debugMqtt, BluetoothSerial *serialBT)
|
||||
: debugMqtt{debugMqtt}, serialBT{serialBT}
|
||||
{
|
||||
if (static_cast<bool>(debugMqtt))
|
||||
{
|
||||
this->isMqttActive = true;
|
||||
}
|
||||
|
||||
if (serialBT)
|
||||
if (static_cast<bool>(serialBT))
|
||||
{
|
||||
this->isMqttActive = true;
|
||||
}
|
||||
}
|
||||
|
||||
void OutputBuf::activateMqtt(bool status) {
|
||||
if (debugMqtt)
|
||||
void OutputBuf::activateMqtt(bool status)
|
||||
{
|
||||
if (static_cast<bool>(debugMqtt))
|
||||
{
|
||||
this->isMqttActive = status;
|
||||
}
|
||||
}
|
||||
|
||||
void OutputBuf::activateSerialBT(bool status) {
|
||||
if (serialBT)
|
||||
void OutputBuf::activateSerialBT(bool status)
|
||||
{
|
||||
if (static_cast<bool>(serialBT))
|
||||
{
|
||||
this->isSerialBTActive = status;
|
||||
}
|
||||
}
|
||||
|
||||
void OutputBuf::setDebugMqtt(DebugMqtt* debugMqtt) {
|
||||
void OutputBuf::setDebugMqtt(DebugMqtt *debugMqtt)
|
||||
{
|
||||
this->debugMqtt = debugMqtt;
|
||||
this->isMqttActive = true;
|
||||
}
|
||||
|
||||
void OutputBuf::setSerialBT(BluetoothSerial* serialBT) {
|
||||
void OutputBuf::setSerialBT(BluetoothSerial *serialBT)
|
||||
{
|
||||
this->serialBT = serialBT;
|
||||
this->isSerialBTActive = true;;
|
||||
this->isSerialBTActive = true;
|
||||
;
|
||||
}
|
||||
|
||||
std::streambuf::int_type OutputBuf::overflow(std::streambuf::int_type c) {
|
||||
if (c != EOF) {
|
||||
std::streambuf::int_type OutputBuf::overflow(std::streambuf::int_type character)
|
||||
{
|
||||
if (character != EOF)
|
||||
{
|
||||
// c = std::toupper(static_cast<char>(c), getloc());
|
||||
|
||||
if (this->debugMqtt && this->isMqttActive)
|
||||
this->debugMqtt->addCharacter((char) c);
|
||||
{
|
||||
this->debugMqtt->addCharacter(static_cast<char>(character));
|
||||
}
|
||||
|
||||
if (this->serialBT && this->isSerialBTActive && this->serialBT->connected())
|
||||
this->serialBT->print((char) c);
|
||||
{
|
||||
this->serialBT->print(static_cast<char>(character));
|
||||
}
|
||||
|
||||
Serial.print((char) c);
|
||||
Serial.print(static_cast<char>(character));
|
||||
}
|
||||
return c;
|
||||
return character;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user