Merge pull request #190 from thedocruby/patch-1

Further progress the rigctl server towards full feature parity
This commit is contained in:
AlexandreRouma 2021-07-29 22:27:31 +02:00 committed by GitHub
commit 1aa2c064f7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

View File

@ -420,6 +420,7 @@ private:
std::lock_guard lck(vfoMtx); std::lock_guard lck(vfoMtx);
resp = "RPRT 0\n"; resp = "RPRT 0\n";
// If client is querying, respond accordingly
if (parts.size() >= 2 && parts[1] == "?") { if (parts.size() >= 2 && parts[1] == "?") {
resp = "FM WFM AM DSB USB CW LSB RAW\n"; resp = "FM WFM AM DSB USB CW LSB RAW\n";
client->write(resp.size(), (uint8_t*)resp.c_str()); client->write(resp.size(), (uint8_t*)resp.c_str());
@ -550,8 +551,9 @@ private:
resp = "VFO\n"; resp = "VFO\n";
client->write(resp.size(), (uint8_t*)resp.c_str()); client->write(resp.size(), (uint8_t*)resp.c_str());
} }
else if (parts[0] == "AOS") { else if (parts[0] == "AOS" || parts[0] == "\\recorder_start") {
std::lock_guard lck(recorderMtx); std::lock_guard lck(recorderMtx);
// If not controlling the recorder, return // If not controlling the recorder, return
if (!recordingEnabled) { if (!recordingEnabled) {
resp = "RPRT 0\n"; resp = "RPRT 0\n";
@ -571,8 +573,9 @@ private:
resp = "RPRT 0\n"; resp = "RPRT 0\n";
client->write(resp.size(), (uint8_t*)resp.c_str()); client->write(resp.size(), (uint8_t*)resp.c_str());
} }
else if (parts[0] == "LOS") { else if (parts[0] == "LOS" || parts[0] == "\\recorder_stop") {
std::lock_guard lck(recorderMtx); std::lock_guard lck(recorderMtx);
// If not controlling the recorder, return // If not controlling the recorder, return
if (!recordingEnabled) { if (!recordingEnabled) {
resp = "RPRT 0\n"; resp = "RPRT 0\n";
@ -592,10 +595,11 @@ private:
resp = "RPRT 0\n"; resp = "RPRT 0\n";
client->write(resp.size(), (uint8_t*)resp.c_str()); client->write(resp.size(), (uint8_t*)resp.c_str());
} }
else if (parts[0] == "q") { else if (parts[0] == "q" || parts[0] == "\\quit") {
// Will close automatically // Will close automatically
} }
else { else {
// If command is not recognized, return error
spdlog::error("Rigctl client sent invalid command: '{0}'", cmd); spdlog::error("Rigctl client sent invalid command: '{0}'", cmd);
resp = "RPRT 1\n"; resp = "RPRT 1\n";
client->write(resp.size(), (uint8_t*)resp.c_str()); client->write(resp.size(), (uint8_t*)resp.c_str());