mirror of
https://github.com/AlexandreRouma/SDRPlusPlus.git
synced 2025-01-13 03:37:10 +01:00
Rearrange commands, add slash commands.
This commit is contained in:
parent
21f4c40e7f
commit
e27702c166
@ -361,7 +361,62 @@ private:
|
|||||||
|
|
||||||
// Execute commands
|
// Execute commands
|
||||||
if (parts.size() == 0) { return; }
|
if (parts.size() == 0) { return; }
|
||||||
else if (parts[0] == "F") {
|
else if (parts[0].at(0) == '\\') {
|
||||||
|
parts[0].replace(0,1,"");
|
||||||
|
else if (parts[0] == "recorder_start") {
|
||||||
|
std::lock_guard lck(recorderMtx);
|
||||||
|
// If not controlling the recorder, return
|
||||||
|
if (!recordingEnabled) {
|
||||||
|
resp = "RPRT 0\n";
|
||||||
|
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the command to the selected recorder
|
||||||
|
if (recorderType == RECORDER_TYPE_METEOR_DEMODULATOR) {
|
||||||
|
core::modComManager.callInterface(selectedRecorder, METEOR_DEMODULATOR_IFACE_CMD_START, NULL, NULL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core::modComManager.callInterface(selectedRecorder, RECORDER_IFACE_CMD_START, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Respond with a sucess
|
||||||
|
resp = "RPRT 0\n";
|
||||||
|
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||||
|
}
|
||||||
|
else if (parts[0] == "recorder_stop") {
|
||||||
|
std::lock_guard lck(recorderMtx);
|
||||||
|
// If not controlling the recorder, return
|
||||||
|
if (!recordingEnabled) {
|
||||||
|
resp = "RPRT 0\n";
|
||||||
|
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Send the command to the selected recorder
|
||||||
|
if (recorderType == RECORDER_TYPE_METEOR_DEMODULATOR) {
|
||||||
|
core::modComManager.callInterface(selectedRecorder, METEOR_DEMODULATOR_IFACE_CMD_STOP, NULL, NULL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
core::modComManager.callInterface(selectedRecorder, RECORDER_IFACE_CMD_STOP, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Respond with a sucess
|
||||||
|
resp = "RPRT 0\n";
|
||||||
|
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||||
|
}
|
||||||
|
else if (parts[0] == "quit") {
|
||||||
|
// Will close automatically
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
spdlog::error("Rigctl client sent invalid command: '{0}'", cmd);
|
||||||
|
resp = "RPRT 1\n";
|
||||||
|
client->write(resp.size(), (uint8_t*)resp.c_str());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (parts[0] == "F") {
|
||||||
std::lock_guard lck(vfoMtx);
|
std::lock_guard lck(vfoMtx);
|
||||||
|
|
||||||
// if number of arguments isn't correct, return error
|
// if number of arguments isn't correct, return error
|
||||||
@ -400,48 +455,6 @@ private:
|
|||||||
sprintf(buf, "%" PRIu64 "\n", (uint64_t)freq);
|
sprintf(buf, "%" PRIu64 "\n", (uint64_t)freq);
|
||||||
client->write(strlen(buf), (uint8_t*)buf);
|
client->write(strlen(buf), (uint8_t*)buf);
|
||||||
}
|
}
|
||||||
else if (parts[0] == "AOS") {
|
|
||||||
std::lock_guard lck(recorderMtx);
|
|
||||||
// If not controlling the recorder, return
|
|
||||||
if (!recordingEnabled) {
|
|
||||||
resp = "RPRT 0\n";
|
|
||||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send the command to the selected recorder
|
|
||||||
if (recorderType == RECORDER_TYPE_METEOR_DEMODULATOR) {
|
|
||||||
core::modComManager.callInterface(selectedRecorder, METEOR_DEMODULATOR_IFACE_CMD_START, NULL, NULL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core::modComManager.callInterface(selectedRecorder, RECORDER_IFACE_CMD_START, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Respond with a sucess
|
|
||||||
resp = "RPRT 0\n";
|
|
||||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
|
||||||
}
|
|
||||||
else if (parts[0] == "LOS") {
|
|
||||||
std::lock_guard lck(recorderMtx);
|
|
||||||
// If not controlling the recorder, return
|
|
||||||
if (!recordingEnabled) {
|
|
||||||
resp = "RPRT 0\n";
|
|
||||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send the command to the selected recorder
|
|
||||||
if (recorderType == RECORDER_TYPE_METEOR_DEMODULATOR) {
|
|
||||||
core::modComManager.callInterface(selectedRecorder, METEOR_DEMODULATOR_IFACE_CMD_STOP, NULL, NULL);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
core::modComManager.callInterface(selectedRecorder, RECORDER_IFACE_CMD_STOP, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Respond with a sucess
|
|
||||||
resp = "RPRT 0\n";
|
|
||||||
client->write(resp.size(), (uint8_t*)resp.c_str());
|
|
||||||
}
|
|
||||||
else if (parts[0] == "q") {
|
else if (parts[0] == "q") {
|
||||||
// Will close automatically
|
// Will close automatically
|
||||||
}
|
}
|
||||||
@ -452,6 +465,7 @@ private:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
std::string name;
|
std::string name;
|
||||||
bool enabled = true;
|
bool enabled = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user