diff --git a/rigctl_server/CMakeLists.txt b/rigctl_server/CMakeLists.txt index c80eca00..5c81e77a 100644 --- a/rigctl_server/CMakeLists.txt +++ b/rigctl_server/CMakeLists.txt @@ -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) \ No newline at end of file +install(TARGETS rigctl_server DESTINATION lib/sdrpp/plugins) diff --git a/rigctl_server/src/main.cpp b/rigctl_server/src/main.cpp index a78feea6..4139c6b0 100644 --- a/rigctl_server/src/main.cpp +++ b/rigctl_server/src/main.cpp @@ -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(); -} \ No newline at end of file +}