Merge branch 'master' of git://github.com/yuhu-/ebusd

This commit is contained in:
john30
2014-11-09 10:34:29 +01:00
5 changed files with 31 additions and 17 deletions
+19 -7
View File
@@ -8,21 +8,24 @@ which is used in various heating systems.
Features Features
-------- --------
* send and receive ebus commands * send and receive ebus commands for all ebus message types
- message types: Broadcast, Master-Master and Master-Slave (message types are: Broadcast, Master-Master and Master-Slave)
- collect data of cycle messages * 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 - get fetch data from ebus participant
- set adjust data of ebus participant - set adjust data of ebus participant
- cyc fetch data from collected cycle messages - cyc fetch data from collected cycle messages
- hex send given hex value to ebus (ZZ PB SB NN Dx) - hex send given hex value to ebus (ZZPBSBNNDx)
- dump toggle dump on/off
- log areas change log areas - log areas change log areas
- log level change log level - log level change log level
- raw toggle raw data logging
- dump toggle raw data dumping
- reload reload ebus configuration - reload reload ebus configuration
- stop stop daemon - stop stop daemon
@@ -62,6 +65,15 @@ Tools
ebusctl - client program for ebusd. 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. For usage and further information take a look on help page.
+2 -2
View File
@@ -149,7 +149,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
} }
std::string ebusCommand(A.getParam<const char*>("p_address")); std::string ebusCommand(A.getParam<const char*>("p_address"));
ebusCommand += m_commands->getEbusCommand(index, false); ebusCommand += m_commands->getEbusCommand(index);
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower); std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
BusCommand* busCommand = new BusCommand(ebusCommand, false); BusCommand* busCommand = new BusCommand(ebusCommand, false);
@@ -190,7 +190,7 @@ std::string BaseLoop::decodeMessage(const std::string& data)
if (index >= 0) { if (index >= 0) {
std::string ebusCommand(A.getParam<const char*>("p_address")); std::string ebusCommand(A.getParam<const char*>("p_address"));
ebusCommand += m_commands->getEbusCommand(index, false); ebusCommand += m_commands->getEbusCommand(index);
// encode data // encode data
Command* command = new Command(index, (*m_commands)[index], cmd[3]); Command* command = new Command(index, (*m_commands)[index], cmd[3]);
+5 -2
View File
@@ -111,11 +111,14 @@ void* EBusLoop::run()
busCommand->setResult(std::string(), RESULT_OK); busCommand->setResult(std::string(), RESULT_OK);
} }
else { else {
sendRetries = 0; L.log(bus, event, " send retry failed", sendRetries);
if (busCommand->isPoll() == true) if (busCommand->isPoll() == true)
delete m_sendBuffer.remove(); delete m_sendBuffer.remove();
else else
busCommand->sendSignal(); busCommand->sendSignal();
sendRetries = 0;
} }
} }
else { else {
@@ -267,7 +270,7 @@ void EBusLoop::addPollCommand()
L.log(bus, event, " polling [%4d] %s", index, tmp.c_str()); L.log(bus, event, " polling [%4d] %s", index, tmp.c_str());
std::string ebusCommand(A.getParam<const char*>("p_address")); std::string ebusCommand(A.getParam<const char*>("p_address"));
ebusCommand += m_commands->getEbusCommand(index, false); ebusCommand += m_commands->getEbusCommand(index);
std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower); std::transform(ebusCommand.begin(), ebusCommand.end(), ebusCommand.begin(), tolower);
BusCommand* busCommand = new BusCommand(ebusCommand, true); BusCommand* busCommand = new BusCommand(ebusCommand, true);
+4 -4
View File
@@ -127,13 +127,13 @@ int Commands::findCommand(const std::string& data) const
return -1; 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); cmd_t command = m_cmdDB.at(index);
std::string cmd; std::string cmd;
std::stringstream sstr; std::stringstream sstr;
if (cycle == true) if (strcasecmp(command[0].c_str(), "C") == 0)
cmd += command[4]; // QQ cmd += command[4]; // QQ
cmd += command[5]; // ZZ cmd += command[5]; // ZZ
@@ -163,7 +163,7 @@ int Commands::storeCycData(const std::string& data) const
// walk through commands // walk through commands
for (; iter != m_cycDB.end(); iter++) { for (; iter != m_cycDB.end(); iter++) {
std::string command = getEbusCommand(iter->first, true); std::string command = getEbusCommand(iter->first);
// skip wrong search string length // skip wrong search string length
if (command.length() > search.length()) if (command.length() > search.length())
@@ -216,7 +216,7 @@ void Commands::storePolData(const std::string& data) const
// walk through commands // walk through commands
for (; iter != m_polDB.end(); iter++) { for (; iter != m_polDB.end(); iter++) {
std::string command = getEbusCommand(iter->first, false); std::string command = getEbusCommand(iter->first);
// skip wrong search string length // skip wrong search string length
if (command.length() > search.length()) if (command.length() > search.length())
+1 -2
View File
@@ -55,8 +55,7 @@ public:
int findCommand(const std::string& data) const; int findCommand(const std::string& data) const;
std::string getCmdType(const int index) const { return std::string(m_cmdDB.at(index)[0]); } 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;
std::string getEbusCommand(const int index, const bool cycle) const;
int storeCycData(const std::string& data) const; int storeCycData(const std::string& data) const;
std::string getCycData(int index) const; std::string getCycData(int index) const;