moving 'scan' functionality from ebusctl into ebusd started.

This commit is contained in:
Roland Jax
2014-11-16 00:33:28 +01:00
parent 3273300893
commit 5db9c5c774
3 changed files with 35 additions and 16 deletions
+4 -3
View File
@@ -208,14 +208,14 @@ int main(int argc, char* argv[])
TCPSocket* socket = client->connect(A.getOptVal<const char*>("server"), A.getOptVal<int>("port"));
if (socket != NULL) {
/*
if (strcasecmp(A.getArg(0).c_str(), "scan") == 0) {
addManufacturer();
// send command to all slaves
for (size_t i = 0; i < s.size(); i++) {
// build message
std::string message("hex ms ");
std::string message("hex ");
message += s[i];
message += "070400";
@@ -255,6 +255,7 @@ int main(int argc, char* argv[])
sleep(2);
}
} else {
*/
// build message
std::string message(A.getArg(0));
for (int i = 1; i < A.numArgs(); i++) {
@@ -271,7 +272,7 @@ int main(int argc, char* argv[])
data[datalen] = '\0';
std::cout << data;
}
//~ }
delete socket;
} else {
+29 -13
View File
@@ -291,8 +291,22 @@ std::string BaseLoop::decodeMessage(const std::string& data)
break;
case scan:
if (cmd.size() < 1 || cmd.size() > 2) {
result << "usage: 'scan'" << std::endl
<< " 'scan full'";
break;
}
//~ if (strcasecmp(cmd[1].c_str(), "FULL") == 0)
//~ // scan(FULL);
//~ else
//~ // scan();
break;
case log:
if (cmd.size () != 3 ) {
if (cmd.size() != 3 ) {
result << "usage: 'log areas area,area,..' (areas: bas|net|bus|cyc|all)" << std::endl
<< " 'log level level' (level: error|event|trace|debug)";
break;
@@ -360,18 +374,20 @@ std::string BaseLoop::decodeMessage(const std::string& data)
case help:
result << "commands:" << std::endl
<< " get - fetch ebus data 'get class cmd (sub)'" << std::endl
<< " set - set ebus values 'set class cmd value'" << std::endl
<< " cyc - fetch cycle data 'cyc class cmd (sub)'" << std::endl
<< " hex - send given hex value 'hex type value' (value: ZZPBSBNNDx)" << std::endl << std::endl
<< " log - change log areas 'log areas area,area,..' (areas: bas|net|bus|cyc|all)" << std::endl
<< " - change log level 'log level level' (level: error|event|trace|debug)" << std::endl << std::endl
<< " raw - toggle log raw data" << std::endl
<< " dump - toggle dump state" << std::endl << std::endl
<< " reload - reload ebus configuration" << std::endl << std::endl
<< " stop - stop daemon" << std::endl
<< " quit - close connection" << std::endl << std::endl
<< " help - print this page";
<< " get - fetch ebus data 'get class cmd (sub)'" << std::endl
<< " set - set ebus values 'set class cmd value'" << std::endl
<< " cyc - fetch cycle data 'cyc class cmd (sub)'" << std::endl
<< " hex - send given hex value 'hex type value' (value: ZZPBSBNNDx)" << std::endl << std::endl
<< " scan - scan ebus kown addresses 'scan'" << std::endl
<< " - scan ebus all addresses 'scan full'" << std::endl << std::endl
<< " log - change log areas 'log areas area,area,..' (areas: bas|net|bus|cyc|all)" << std::endl
<< " - change log level 'log level level' (level: error|event|trace|debug)" << std::endl << std::endl
<< " raw - toggle log raw data 'raw'" << std::endl
<< " dump - toggle dump state 'dump'" << std::endl << std::endl
<< " reload - reload ebus configuration 'reload'" << std::endl << std::endl
<< " stop - stop daemon 'stop'" << std::endl
<< " quit - close connection 'quit'" << std::endl << std::endl
<< " help - print this page 'help";
break;
default:
+2
View File
@@ -50,6 +50,7 @@ private:
set, // set ebus value
cyc, // fetch cycle data
hex, // send hex value
scan, // scan ebus
log, // logger settings
raw, // toggle log raw data
dump, // toggle dump state
@@ -64,6 +65,7 @@ private:
if (strcasecmp(item.c_str(), "SET") == 0) return set;
if (strcasecmp(item.c_str(), "CYC") == 0) return cyc;
if (strcasecmp(item.c_str(), "HEX") == 0) return hex;
if (strcasecmp(item.c_str(), "SCAN") == 0) return scan;
if (strcasecmp(item.c_str(), "LOG") == 0) return log;
if (strcasecmp(item.c_str(), "RAW") == 0) return raw;
if (strcasecmp(item.c_str(), "DUMP") == 0) return dump;