diff --git a/README b/README index 986de79e..fe5c6c19 100644 --- a/README +++ b/README @@ -8,21 +8,24 @@ which is used in various heating systems. Features -------- - * send and receive ebus commands - - message types: Broadcast, Master-Master and Master-Slave - - collect data of cycle messages + * send and receive ebus commands for all ebus message types + (message types are: Broadcast, Master-Master and Master-Slave) + * collect data of cycle messages + * poll messages and collect received data + * write raw data into dump files (for debugging purpose) - * tcp socket multi session server (daemon commands) + * available daemon commands: - get fetch data from ebus participant - set adjust data of ebus participant - cyc fetch data from collected cycle messages - - hex send given hex value to ebus (ZZ PB SB NN Dx) - - - dump toggle dump on/off + - hex send given hex value to ebus (ZZPBSBNNDx) - log areas change log areas - log level change log level + - raw toggle raw data logging + - dump toggle raw data dumping + - reload reload ebus configuration - stop stop daemon @@ -62,6 +65,15 @@ Tools ebusctl - client program for ebusd. +local commands: + * 'feed' ebusd with raw data from dump files (or telnet) to ebusd + * 'scan' ebus and identifies the participants + +remote commands: + * connect to ebusd (socket) and execute server commands (see above) + +See ./ebusctl -h + For usage and further information take a look on help page. diff --git a/src/ebusd/baseloop.cpp b/src/ebusd/baseloop.cpp index bf97f169..c23607fd 100644 --- a/src/ebusd/baseloop.cpp +++ b/src/ebusd/baseloop.cpp @@ -149,7 +149,7 @@ std::string BaseLoop::decodeMessage(const std::string& data) } std::string ebusCommand(A.getParam("p_address")); - ebusCommand += m_commands->getEbusCommand(index, false); + ebusCommand += m_commands->getEbusCommand(index); std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower); BusCommand* busCommand = new BusCommand(ebusCommand, false); @@ -190,7 +190,7 @@ std::string BaseLoop::decodeMessage(const std::string& data) if (index >= 0) { std::string ebusCommand(A.getParam("p_address")); - ebusCommand += m_commands->getEbusCommand(index, false); + ebusCommand += m_commands->getEbusCommand(index); // encode data Command* command = new Command(index, (*m_commands)[index], cmd[3]); diff --git a/src/ebusd/ebusloop.cpp b/src/ebusd/ebusloop.cpp index 79f0d778..6a2f04ab 100644 --- a/src/ebusd/ebusloop.cpp +++ b/src/ebusd/ebusloop.cpp @@ -111,11 +111,14 @@ void* EBusLoop::run() busCommand->setResult(std::string(), RESULT_OK); } else { - sendRetries = 0; + L.log(bus, event, " send retry failed", sendRetries); + if (busCommand->isPoll() == true) delete m_sendBuffer.remove(); else busCommand->sendSignal(); + + sendRetries = 0; } } else { @@ -267,7 +270,7 @@ void EBusLoop::addPollCommand() L.log(bus, event, " polling [%4d] %s", index, tmp.c_str()); std::string ebusCommand(A.getParam("p_address")); - ebusCommand += m_commands->getEbusCommand(index, false); + ebusCommand += m_commands->getEbusCommand(index); std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower); BusCommand* busCommand = new BusCommand(ebusCommand, true); diff --git a/src/lib/ebus/commands.cpp b/src/lib/ebus/commands.cpp index cee9ad91..855d6e73 100644 --- a/src/lib/ebus/commands.cpp +++ b/src/lib/ebus/commands.cpp @@ -127,13 +127,13 @@ int Commands::findCommand(const std::string& data) const return -1; } -std::string Commands::getEbusCommand(const int index, const bool cycle) const +std::string Commands::getEbusCommand(const int index) const { cmd_t command = m_cmdDB.at(index); std::string cmd; std::stringstream sstr; - if (cycle == true) + if (strcasecmp(command[0].c_str(), "C") == 0) cmd += command[4]; // QQ cmd += command[5]; // ZZ @@ -163,7 +163,7 @@ int Commands::storeCycData(const std::string& data) const // walk through commands for (; iter != m_cycDB.end(); iter++) { - std::string command = getEbusCommand(iter->first, true); + std::string command = getEbusCommand(iter->first); // skip wrong search string length if (command.length() > search.length()) @@ -216,7 +216,7 @@ void Commands::storePolData(const std::string& data) const // walk through commands for (; iter != m_polDB.end(); iter++) { - std::string command = getEbusCommand(iter->first, false); + std::string command = getEbusCommand(iter->first); // skip wrong search string length if (command.length() > search.length()) diff --git a/src/lib/ebus/commands.h b/src/lib/ebus/commands.h index 09c96a89..c43624b1 100644 --- a/src/lib/ebus/commands.h +++ b/src/lib/ebus/commands.h @@ -55,8 +55,7 @@ public: int findCommand(const std::string& data) const; std::string getCmdType(const int index) const { return std::string(m_cmdDB.at(index)[0]); } - std::string getEbusType(const int index) const { return std::string(m_cmdDB.at(index)[4]); } - std::string getEbusCommand(const int index, const bool cycle) const; + std::string getEbusCommand(const int index) const; int storeCycData(const std::string& data) const; std::string getCycData(int index) const;