Merge branch 'master' of github.com:john30/ebusd

This commit is contained in:
john30
2021-01-10 15:13:21 +01:00
9 changed files with 184 additions and 158 deletions
-1
View File
@@ -1049,7 +1049,6 @@ result_t BusHandler::setState(BusState state, result_t result, bool firstRepetit
} else if (m_state == bs_noSignal) { } else if (m_state == bs_noSignal) {
logNotice(lf_bus, "signal acquired"); logNotice(lf_bus, "signal acquired");
} }
// logDebug(lf_bus, "state: from %s to %s with %s", getStateCode(m_state), getStateCode(state), getResultCode(result));
m_state = state; m_state = state;
if (state == bs_ready || state == bs_skip) { if (state == bs_ready || state == bs_skip) {
+9 -3
View File
@@ -655,11 +655,17 @@ void MqttHandler::notifyTopic(const string& topic, const string& data) {
if (namePrefix) { if (namePrefix) {
name = name.substr(0, name.length()-1); name = name.substr(0, name.length()-1);
} }
m_messages->findAll(circuit, name, m_levels, !(circuitPrefix || namePrefix), true, true, true, true, true, 0, 0, false, &messages); m_messages->findAll(circuit, name, m_levels, !(circuitPrefix || namePrefix), true, true,
true, true, true, 0, 0, false, &messages);
bool onlyWithData = !data.empty(); bool onlyWithData = !data.empty();
for (const auto message : messages) { for (const auto message : messages) {
if (circuitPrefix && (message->getCircuit().substr(0, circuit.length())!=circuit || !namePrefix && name.length()>0 && message->getName()!=name) if ((circuitPrefix && (
|| namePrefix && (message->getName().substr(0, name.length())!=name || !circuitPrefix && circuit.length()>0 && message->getCircuit()!=circuit)) { message->getCircuit().substr(0, circuit.length()) != circuit
|| (!namePrefix && name.length() > 0 && message->getName() != name)))
|| (namePrefix && (
message->getName().substr(0, name.length()) != name
|| (!circuitPrefix && circuit.length() > 0 && message->getCircuit() != circuit)))
) {
continue; continue;
} }
time_t lastup = message->getLastUpdateTime(); time_t lastup = message->getLastUpdateTime();
+3 -1
View File
@@ -39,6 +39,7 @@
#endif #endif
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <string>
#include <fstream> #include <fstream>
#include <ios> #include <ios>
#include <iomanip> #include <iomanip>
@@ -547,7 +548,8 @@ bool Device::read(symbol_t* value, bool isAvailable, ArbitrationState* arbitrati
default: default:
if (m_listener != nullptr) { if (m_listener != nullptr) {
ostringstream stream; ostringstream stream;
stream << "unexpected enhanced command 0x" << std::setw(2) << std::setfill('0') << std::hex << static_cast<unsigned>(cmd); stream << "unexpected enhanced command 0x" << std::setw(2) << std::setfill('0') << std::hex
<< static_cast<unsigned>(cmd);
string str = stream.str(); string str = stream.str();
m_listener->notifyStatus(true, str.c_str()); m_listener->notifyStatus(true, str.c_str());
} }
+2 -1
View File
@@ -45,7 +45,8 @@ class RotateFile {
* @param textMode whether to write each byte with prefixed timestamp and direction as text. * @param textMode whether to write each byte with prefixed timestamp and direction as text.
* @param flushBuffer the size of the flush buffer. * @param flushBuffer the size of the flush buffer.
*/ */
RotateFile(const string fileName, const unsigned int maxSize, const bool textMode = false, const unsigned int flushBuffer = 16) RotateFile(const string fileName, const unsigned int maxSize, const bool textMode = false,
const unsigned int flushBuffer = 16)
: m_enabled(false), m_fileName(fileName), m_maxSize(maxSize), m_textMode(textMode), m_stream(), m_fileSize(0), : m_enabled(false), m_fileName(fileName), m_maxSize(maxSize), m_textMode(textMode), m_stream(), m_fileSize(0),
m_flushSize(0), m_flushBuffer(flushBuffer) {} m_flushSize(0), m_flushBuffer(flushBuffer) {}
+21 -3
View File
@@ -1,5 +1,21 @@
#include <iostream> /*
#include <fstream> * ebusd - daemon for communication with eBUS heating systems.
* Copyright (C) 2020-2021 John Baier <ebusd@ebusd.eu>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fcntl.h> #include <fcntl.h>
#include <poll.h> #include <poll.h>
#include <sys/stat.h> #include <sys/stat.h>
@@ -7,11 +23,13 @@
#include <time.h> #include <time.h>
#include <termios.h> #include <termios.h>
#include <unistd.h> #include <unistd.h>
#include <argp.h>
#include <iostream>
#include <fstream>
#include <cstdlib> #include <cstdlib>
#include <iomanip> #include <iomanip>
#include <string> #include <string>
#include <cstring> #include <cstring>
#include <argp.h>
#include "intelhex/intelhexclass.h" #include "intelhex/intelhexclass.h"