added listen stop

This commit is contained in:
john30
2015-01-18 12:23:16 +01:00
parent 1868e66c8b
commit fb99ac55a1
+11 -7
View File
@@ -493,14 +493,18 @@ string BaseLoop::decodeMessage(const string& data, bool& listening)
break; break;
} }
case ct_listen: { case ct_listen: {
if (args.size() != argPos) { if (args.size() == argPos) {
result << "usage: 'listen'"; if (listening == true)
break; return "listen continued";
listening = true;
return "listen started";
} }
bool enabled = !listening; // TODO switch to argument "stop" if (args.size() != argPos+1 || args[argPos] != "stop")
listening = enabled; return "usage: 'listen [stop]'";
return (enabled ? "listen started" : "listen stopped");
listening = false;
return "listen stopped";
} }
case ct_scan: { case ct_scan: {
if (args.size() == argPos) { if (args.size() == argPos) {
@@ -599,7 +603,7 @@ string BaseLoop::decodeMessage(const string& data, bool& listening)
<< " read - read ebus values 'read [-v] [-f] [-m seconds] [-c class] name [field]'" << endl << " read - read ebus values 'read [-v] [-f] [-m seconds] [-c class] name [field]'" << endl
<< " write - write ebus values 'write class name value[;value]*' or 'write -h ZZPBSBNNDx'" << endl << " write - write ebus values 'write class name value[;value]*' or 'write -h ZZPBSBNNDx'" << endl
<< " find - find ebus values 'find [-v] [-r] [-w] [-p] [-d] [-c class] [name]'" << endl << " find - find ebus values 'find [-v] [-r] [-w] [-p] [-d] [-c class] [name]'" << endl
<< " listen - listen for updates 'listen'" << endl << " listen - listen for updates 'listen [stop]'" << endl
<< " scan - scan ebus known addresses 'scan'" << endl << " scan - scan ebus known addresses 'scan'" << endl
<< " - scan ebus all addresses 'scan full'" << endl << " - scan ebus all addresses 'scan full'" << endl
<< " - show scan results 'scan result'" << endl << " - show scan results 'scan result'" << endl