mirror of
https://github.com/g4klx/MMDVMHost
synced 2025-12-21 15:09:23 +08:00
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:
@@ -75,7 +75,7 @@ int CRemoteCommand::send(const std::string& command)
|
||||
int retStatus = 0;
|
||||
|
||||
if (CUDPSocket::lookup("127.0.0.1", m_port, addr, addrLen) != 0) {
|
||||
LogError("Unable to resolve the address of the host");
|
||||
::fprintf(stderr, "Unable to resolve the address of the host\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -91,14 +91,14 @@ int CRemoteCommand::send(const std::string& command)
|
||||
return 1;
|
||||
}
|
||||
|
||||
LogMessage("Command sent: \"%s\" to port: %u", command.c_str(), m_port);
|
||||
::fprintf(stdout, "Command sent: \"%s\" to port: %u\n", command.c_str(), m_port);
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
|
||||
int len = socket.read((unsigned char*)&buffer[0], BUFFER_LENGTH, addr, addrLen);
|
||||
int len = socket.read((unsigned char*)buffer, BUFFER_LENGTH, addr, addrLen);
|
||||
if (len > 0) {
|
||||
buffer[len] = '\0';
|
||||
LogMessage("%s", buffer);
|
||||
::fprintf(stdout, "%s\n", buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user