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

@ -21,4 +21,4 @@ target_link_libraries(rigctl_server PRIVATE sdrpp_core)
set_target_properties(rigctl_server PROPERTIES PREFIX "")
# Install directives
install(TARGETS rigctl_server DESTINATION lib/sdrpp/plugins)
install(TARGETS rigctl_server DESTINATION lib/sdrpp/plugins)

View File

@ -420,6 +420,7 @@ private:
std::lock_guard lck(vfoMtx);
resp = "RPRT 0\n";
// If client is querying, respond accordingly
if (parts.size() >= 2 && parts[1] == "?") {
resp = "FM WFM AM DSB USB CW LSB RAW\n";
client->write(resp.size(), (uint8_t*)resp.c_str());
@ -550,8 +551,9 @@ private:
resp = "VFO\n";
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);
// If not controlling the recorder, return
if (!recordingEnabled) {
resp = "RPRT 0\n";
@ -571,8 +573,9 @@ private:
resp = "RPRT 0\n";
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);
// If not controlling the recorder, return
if (!recordingEnabled) {
resp = "RPRT 0\n";
@ -592,10 +595,11 @@ private:
resp = "RPRT 0\n";
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
}
else {
// If command is not recognized, return error
spdlog::error("Rigctl client sent invalid command: '{0}'", cmd);
resp = "RPRT 1\n";
client->write(resp.size(), (uint8_t*)resp.c_str());
@ -653,4 +657,4 @@ MOD_EXPORT void _DELETE_INSTANCE_(void* instance) {
MOD_EXPORT void _END_() {
config.disableAutoSave();
config.save();
}
}