added info command
This commit is contained in:
@@ -22,6 +22,7 @@
|
|||||||
* added data type HCD (for Ochsner)
|
* added data type HCD (for Ochsner)
|
||||||
* added log entry for scan completion
|
* added log entry for scan completion
|
||||||
* automatically invalidate cached data of messages with same name+circuit (ignoring level)
|
* automatically invalidate cached data of messages with same name+circuit (ignoring level)
|
||||||
|
* added "info" command
|
||||||
|
|
||||||
## Changed files
|
## Changed files
|
||||||
https://github.com/john30/ebusd/compare/v1.2.0...master
|
https://github.com/john30/ebusd/compare/v1.2.0...master
|
||||||
|
|||||||
@@ -202,6 +202,8 @@ string MainLoop::decodeMessage(const string& data, const bool isHttp, bool& conn
|
|||||||
return executeStop(args, running);
|
return executeStop(args, running);
|
||||||
if (strcasecmp(str, "Q") == 0 || strcasecmp(str, "QUIT") == 0)
|
if (strcasecmp(str, "Q") == 0 || strcasecmp(str, "QUIT") == 0)
|
||||||
return executeQuit(args, connected);
|
return executeQuit(args, connected);
|
||||||
|
if (strcasecmp(str, "I") == 0 || strcasecmp(str, "INFO") == 0)
|
||||||
|
return executeInfo(args);
|
||||||
if (strcasecmp(str, "H") == 0 || strcasecmp(str, "HELP") == 0)
|
if (strcasecmp(str, "H") == 0 || strcasecmp(str, "HELP") == 0)
|
||||||
return executeHelp();
|
return executeHelp();
|
||||||
return "ERR: command not found";
|
return "ERR: command not found";
|
||||||
@@ -829,6 +831,26 @@ string MainLoop::executeStop(vector<string> &args, bool& running)
|
|||||||
" Stop the daemon.";
|
" Stop the daemon.";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
string MainLoop::executeInfo(vector<string> &args)
|
||||||
|
{
|
||||||
|
if (args.size() == 0)
|
||||||
|
return "usage: info\n"
|
||||||
|
" Report information about the daemon.";
|
||||||
|
|
||||||
|
ostringstream result;
|
||||||
|
result << "version: " << PACKAGE_STRING << "\n";
|
||||||
|
if (m_busHandler->hasSignal()) {
|
||||||
|
result << "signal: acquired\n";
|
||||||
|
result << "symbol rate: " << static_cast<unsigned>(m_busHandler->getSymbolRate()) << "\n";
|
||||||
|
} else {
|
||||||
|
result << "signal: no signal\n";
|
||||||
|
}
|
||||||
|
result << "masters: " << static_cast<unsigned>(m_busHandler->getMasterCount()) << "\n";
|
||||||
|
result << "messages: " << static_cast<unsigned>(m_messages->size());
|
||||||
|
|
||||||
|
return result.str();
|
||||||
|
}
|
||||||
|
|
||||||
string MainLoop::executeQuit(vector<string> &args, bool& connected)
|
string MainLoop::executeQuit(vector<string> &args, bool& connected)
|
||||||
{
|
{
|
||||||
if (args.size() == 1) {
|
if (args.size() == 1) {
|
||||||
@@ -862,6 +884,7 @@ string MainLoop::executeHelp()
|
|||||||
" dump Toggle dumping raw bytes\n"
|
" dump Toggle dumping raw bytes\n"
|
||||||
" reload Reload CSV config files\n"
|
" reload Reload CSV config files\n"
|
||||||
" stop Stop the daemon\n"
|
" stop Stop the daemon\n"
|
||||||
|
" info|i Report information about the daemon\n"
|
||||||
" quit|q Close connection\n"
|
" quit|q Close connection\n"
|
||||||
" help|h Print help help [COMMAND]";
|
" help|h Print help help [COMMAND]";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,6 +201,13 @@ private:
|
|||||||
*/
|
*/
|
||||||
string executeStop(vector<string> &args, bool& running);
|
string executeStop(vector<string> &args, bool& running);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Execute the info command.
|
||||||
|
* @param args the arguments passed to the command (starting with the command itself), or empty for help.
|
||||||
|
* @return the result string.
|
||||||
|
*/
|
||||||
|
string executeInfo(vector<string> &args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Execute the quit command.
|
* Execute the quit command.
|
||||||
* @param args the arguments passed to the command (starting with the command itself), or empty for help.
|
* @param args the arguments passed to the command (starting with the command itself), or empty for help.
|
||||||
|
|||||||
Reference in New Issue
Block a user