Add RemoteCommand 'status' command.

As DMRGateway, it reports connection status.

Command sent: "status" to port: 7642
dstar:n/a dmr:conn ysf:n/a p25:n/a nxdn:n/a fm:n/a

RemoveCommand has been slighlty modified, as using Log on a read-only filesystem simply forbids the strings to be displayed.
Another solution would be to set LogInitialisse's filePath to "/tmp/" for *nix systems.
This commit is contained in:
Daniel Caujolle-Bert
2021-03-22 20:27:08 +01:00
parent 0088b0b225
commit 27b7d3fc41
21 changed files with 90 additions and 9 deletions

View File

@@ -17,6 +17,7 @@
*/
#include "RemoteControl.h"
#include "MMDVMHost.h"
#include "Log.h"
#include <cstdio>
@@ -32,7 +33,8 @@ const unsigned int CW_ARGS = 2U;
const unsigned int BUFFER_LENGTH = 100U;
CRemoteControl::CRemoteControl(const std::string address, unsigned int port) :
CRemoteControl::CRemoteControl(CMMDVMHost *host, const std::string address, unsigned int port) :
m_host(host),
m_socket(address, port),
m_command(RCD_NONE),
m_args()
@@ -131,7 +133,16 @@ REMOTE_COMMAND CRemoteControl::getCommand()
} else if (m_args.at(0U) == "reload") {
// Reload command is in the form of "reload"
m_command = RCD_RELOAD;
}
} else if (m_args.at(0U) == "status") {
if (m_host != NULL) {
m_host->buildNetworkStatusString(replyStr);
}
else {
replyStr = "KO";
}
m_command = RCD_CONNECTION_STATUS;
}
else
replyStr = "KO";