Add support for compound commands

This commit is contained in:
Dr. Rubisco 2021-07-26 20:06:33 -04:00 committed by GitHub
parent e27702c166
commit 4092874f5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -416,7 +416,8 @@ private:
} }
} }
else { else {
if (parts[0] == "F") { for(int i = 0; i < parts[0].length(); i++){
if (parts[0].at(i) == '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
@ -439,7 +440,7 @@ 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] == "f") { else if (parts[0].at(i) == 'f') {
std::lock_guard lck(vfoMtx); std::lock_guard lck(vfoMtx);
// Get center frequency of the SDR // Get center frequency of the SDR
@ -455,7 +456,7 @@ 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] == "q") { else if (parts[0].at(i) == 'q') {
// Will close automatically // Will close automatically
} }
else { else {
@ -466,6 +467,7 @@ private:
} }
} }
} }
}
std::string name; std::string name;
bool enabled = true; bool enabled = true;