mirror of
https://github.com/jankae/LibreVNA.git
synced 2026-04-06 06:53:37 +00:00
scpi/app: unify result name
When returning scpi values, there are common options that are shared between different commands. This change introduce a way to define those values in a single place. Signed-off-by: Kiara Navarro <sophiekovalevsky@fedoraproject.org>
This commit is contained in:
parent
506502ce02
commit
d392229c4d
6 changed files with 165 additions and 142 deletions
|
|
@ -70,10 +70,10 @@ void Generator::setupSCPI()
|
|||
add(new SCPICommand("FREQuency", [=](QStringList params) -> QString {
|
||||
unsigned long long newval;
|
||||
if(!SCPI::paramToULongLong(params, 0, newval)) {
|
||||
return "ERROR";
|
||||
return SCPI::getResultName(SCPI::Result::Error);
|
||||
} else {
|
||||
central->setFrequency(newval);
|
||||
return "";
|
||||
return SCPI::getResultName(SCPI::Result::Empty);
|
||||
}
|
||||
}, [=](QStringList) -> QString {
|
||||
return QString::number(central->getDeviceStatus().frequency);
|
||||
|
|
@ -82,10 +82,10 @@ void Generator::setupSCPI()
|
|||
double newval;
|
||||
if(!SCPI::paramToDouble(params, 0, newval)) {
|
||||
|
||||
return "ERROR";
|
||||
return SCPI::getResultName(SCPI::Result::Error);
|
||||
} else {
|
||||
central->setLevel(newval);
|
||||
return "";
|
||||
return SCPI::getResultName(SCPI::Result::Empty);
|
||||
}
|
||||
}, [=](QStringList) -> QString {
|
||||
return QString::number(central->getDeviceStatus().cdbm_level / 100.0);
|
||||
|
|
@ -93,10 +93,10 @@ void Generator::setupSCPI()
|
|||
add(new SCPICommand("PORT", [=](QStringList params) -> QString {
|
||||
unsigned long long newval;
|
||||
if(!SCPI::paramToULongLong(params, 0, newval) || newval > 2) {
|
||||
return "ERROR";
|
||||
return SCPI::getResultName(SCPI::Result::Error);
|
||||
} else {
|
||||
central->setPort(newval);
|
||||
return "";
|
||||
return SCPI::getResultName(SCPI::Result::Empty);
|
||||
}
|
||||
}, [=](QStringList) -> QString {
|
||||
return QString::number(central->getDeviceStatus().activePort);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue