PlutoSDR output: implemeted WEB API

This commit is contained in:
f4exb 2018-05-26 20:33:02 +02:00
parent 3f303a0c0d
commit be15aa7cb0
12 changed files with 445 additions and 123 deletions

View File

@ -18,6 +18,8 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGPlutoSdrOutputReport.h"
#include "dsp/dspcommands.h"
#include "dsp/dspengine.h"
@ -312,6 +314,22 @@ bool PlutoSDROutput::applySettings(const PlutoSDROutputSettings& settings, bool
bool ownThreadWasRunning = false;
bool suspendAllOtherThreads = false; // All others means Rx in fact
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
QLocale loc;
qDebug().noquote() << "PlutoSDROutput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
<< " m_devSampleRate: " << loc.toString(m_settings.m_devSampleRate) << "S/s"
<< " m_LOppmTenths: " << m_settings.m_LOppmTenths
<< " m_lpfFIREnable: " << m_settings.m_lpfFIREnable
<< " m_lpfFIRBW: " << loc.toString(m_settings.m_lpfFIRBW)
<< " m_lpfFIRlog2Interp: " << m_settings.m_lpfFIRlog2Interp
<< " m_lpfFIRGain: " << m_settings.m_lpfFIRGain
<< " m_log2Interp: " << loc.toString(1<<m_settings.m_log2Interp)
<< " m_lpfBW: " << loc.toString(m_settings.m_lpfBW)
<< " m_att: " << m_settings.m_att
<< " m_antennaPath: " << (int) m_settings.m_antennaPath
<< " m_transverterMode: " << m_settings.m_transverterMode
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
<< " force: " << force;
// determine if buddies threads or own thread need to be suspended
@ -555,3 +573,112 @@ int PlutoSDROutput::webapiRun(
return 200;
}
int PlutoSDROutput::webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage __attribute__((unused)))
{
response.setPlutoSdrOutputSettings(new SWGSDRangel::SWGPlutoSdrOutputSettings());
response.getPlutoSdrOutputSettings()->init();
webapiFormatDeviceSettings(response, m_settings);
return 200;
}
int PlutoSDROutput::webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage __attribute__((unused)))
{
PlutoSDROutputSettings settings = m_settings;
if (deviceSettingsKeys.contains("centerFrequency")) {
settings.m_centerFrequency = response.getPlutoSdrOutputSettings()->getCenterFrequency();
}
if (deviceSettingsKeys.contains("devSampleRate")) {
settings.m_devSampleRate = response.getPlutoSdrOutputSettings()->getDevSampleRate();
}
if (deviceSettingsKeys.contains("LOppmTenths")) {
settings.m_LOppmTenths = response.getPlutoSdrOutputSettings()->getLOppmTenths();
}
if (deviceSettingsKeys.contains("lpfFIREnable")) {
settings.m_lpfFIREnable = response.getPlutoSdrOutputSettings()->getLpfFirEnable() != 0;
}
if (deviceSettingsKeys.contains("lpfFIRBW")) {
settings.m_lpfFIRBW = response.getPlutoSdrOutputSettings()->getLpfFirbw();
}
if (deviceSettingsKeys.contains("lpfFIRlog2Interp")) {
settings.m_lpfFIRlog2Interp = response.getPlutoSdrOutputSettings()->getLpfFiRlog2Interp();
}
if (deviceSettingsKeys.contains("lpfFIRGain")) {
settings.m_lpfFIRGain = response.getPlutoSdrOutputSettings()->getLpfFirGain();
}
if (deviceSettingsKeys.contains("log2Interp")) {
settings.m_log2Interp = response.getPlutoSdrOutputSettings()->getLog2Interp();
}
if (deviceSettingsKeys.contains("lpfBW")) {
settings.m_lpfBW = response.getPlutoSdrOutputSettings()->getLpfBw();
}
if (deviceSettingsKeys.contains("att")) {
settings.m_att = response.getPlutoSdrOutputSettings()->getAtt();
}
if (deviceSettingsKeys.contains("antennaPath")) {
int antennaPath = response.getPlutoSdrOutputSettings()->getAntennaPath();
antennaPath = antennaPath < 0 ? 0 : antennaPath >= PlutoSDROutputSettings::RFPATH_END ? PlutoSDROutputSettings::RFPATH_END-1 : antennaPath;
settings.m_antennaPath = (PlutoSDROutputSettings::RFPath) antennaPath;
}
if (deviceSettingsKeys.contains("transverterDeltaFrequency")) {
settings.m_transverterDeltaFrequency = response.getPlutoSdrOutputSettings()->getTransverterDeltaFrequency();
}
if (deviceSettingsKeys.contains("transverterMode")) {
settings.m_transverterMode = response.getPlutoSdrOutputSettings()->getTransverterMode() != 0;
}
MsgConfigurePlutoSDR *msg = MsgConfigurePlutoSDR::create(settings, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigurePlutoSDR *msgToGUI = MsgConfigurePlutoSDR::create(settings, force);
m_guiMessageQueue->push(msgToGUI);
}
webapiFormatDeviceSettings(response, settings);
return 200;
}
int PlutoSDROutput::webapiReportGet(
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage __attribute__((unused)))
{
response.setPlutoSdrOutputReport(new SWGSDRangel::SWGPlutoSdrOutputReport());
response.getPlutoSdrOutputReport()->init();
webapiFormatDeviceReport(response);
return 200;
}
void PlutoSDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PlutoSDROutputSettings& settings)
{
response.getPlutoSdrOutputSettings()->setCenterFrequency(settings.m_centerFrequency);
response.getPlutoSdrOutputSettings()->setDevSampleRate(settings.m_devSampleRate);
response.getPlutoSdrOutputSettings()->setLOppmTenths(settings.m_LOppmTenths);
response.getPlutoSdrOutputSettings()->setLpfFirEnable(settings.m_lpfFIREnable ? 1 : 0);
response.getPlutoSdrOutputSettings()->setLpfFirbw(settings.m_lpfFIRBW);
response.getPlutoSdrOutputSettings()->setLpfFiRlog2Interp(settings.m_lpfFIRlog2Interp);
response.getPlutoSdrOutputSettings()->setLpfFirGain(settings.m_lpfFIRGain);
response.getPlutoSdrOutputSettings()->setLog2Interp(settings.m_log2Interp);
response.getPlutoSdrOutputSettings()->setLpfBw(settings.m_lpfBW);
response.getPlutoSdrOutputSettings()->setAtt(settings.m_att);
response.getPlutoSdrOutputSettings()->setAntennaPath((int) settings.m_antennaPath);
response.getPlutoSdrOutputSettings()->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
response.getPlutoSdrOutputSettings()->setTransverterMode(settings.m_transverterMode ? 1 : 0);
}
void PlutoSDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response)
{
response.getPlutoSdrOutputReport()->setDacRate(getDACSampleRate());
std::string rssiStr;
getRSSI(rssiStr);
response.getPlutoSdrOutputReport()->setRssi(new QString(rssiStr.c_str()));
fetchTemperature();
response.getPlutoSdrOutputReport()->setTemperature(getTemperature());
}

View File

@ -91,6 +91,20 @@ public:
virtual bool handleMessage(const Message& message);
virtual int webapiSettingsGet(
SWGSDRangel::SWGDeviceSettings& response,
QString& errorMessage);
virtual int webapiSettingsPutPatch(
bool force,
const QStringList& deviceSettingsKeys,
SWGSDRangel::SWGDeviceSettings& response, // query + response
QString& errorMessage);
virtual int webapiReportGet(
SWGSDRangel::SWGDeviceReport& response,
QString& errorMessage);
virtual int webapiRunGet(
SWGSDRangel::SWGDeviceState& response,
QString& errorMessage);
@ -122,6 +136,8 @@ public:
void suspendBuddies();
void resumeBuddies();
bool applySettings(const PlutoSDROutputSettings& settings, bool force = false);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PlutoSDROutputSettings& settings);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
};

View File

@ -351,6 +351,23 @@ bool PlutoSDRInput::applySettings(const PlutoSDRInputSettings& settings, bool fo
bool ownThreadWasRunning = false;
bool suspendAllOtherThreads = false; // All others means Tx in fact
DevicePlutoSDRBox *plutoBox = m_deviceShared.m_deviceParams->getBox();
QLocale loc;
qDebug().noquote() << "PlutoSDRInput::applySettings: center freq: " << m_settings.m_centerFrequency << " Hz"
<< " m_devSampleRate: " << loc.toString(m_settings.m_devSampleRate) << "S/s"
<< " m_LOppmTenths: " << m_settings.m_LOppmTenths
<< " m_lpfFIREnable: " << m_settings.m_lpfFIREnable
<< " m_lpfFIRBW: " << loc.toString(m_settings.m_lpfFIRBW)
<< " m_lpfFIRlog2Decim: " << m_settings.m_lpfFIRlog2Decim
<< " m_lpfFIRGain: " << m_settings.m_lpfFIRGain
<< " m_log2Decim: " << loc.toString(1<<m_settings.m_log2Decim)
<< " m_lpfBW: " << loc.toString(m_settings.m_lpfBW)
<< " m_gain: " << m_settings.m_gain
<< " m_antennaPath: " << (int) m_settings.m_antennaPath
<< " m_gainMode: " << (int) m_settings.m_gainMode
<< " m_transverterMode: " << m_settings.m_transverterMode
<< " m_transverterDeltaFrequency: " << m_settings.m_transverterDeltaFrequency
<< " force: " << force;
// determine if buddies threads or own thread need to be suspended

View File

@ -2656,22 +2656,37 @@ margin-bottom: 20px;
"devSampleRate" : {
"type" : "integer"
},
"log2HardInterp" : {
"type" : "integer"
},
"log2SoftInterp" : {
"type" : "integer"
},
"lpfBW" : {
"LOppmTenths" : {
"type" : "integer"
},
"lpfFIREnable" : {
"type" : "integer"
"type" : "integer",
"description" : "Low pass FIR filter enable (1 if enabled else 0)"
},
"lpfFIRBW" : {
"type" : "integer",
"description" : "digital lowpass FIR filter bandwidth (Hz)"
},
"lpfFIRlog2Interp" : {
"type" : "integer",
"description" : "digital lowpass FIR filter log2 of interpolation factor (0..2)"
},
"lpfFIRGain" : {
"type" : "integer",
"description" : "digital lowpass FIR filter gain (dB)"
},
"log2Interp" : {
"type" : "integer"
},
"gain" : {
"lpfBW" : {
"type" : "integer",
"description" : "Analog lowpass filter bandwidth (Hz)"
},
"att" : {
"type" : "integer",
"description" : "Hardware attenuator gain in decibel fourths (negative)"
},
"antennaPath" : {
"type" : "integer"
},
"transverterMode" : {
@ -22189,7 +22204,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-05-26T16:46:01.765+02:00
Generated 2018-05-26T20:31:05.824+02:00
</div>
</div>
</div>

View File

@ -55,17 +55,29 @@ PlutoSdrOutputSettings:
format: int64
devSampleRate:
type: integer
log2HardInterp:
LOppmTenths:
type: integer
log2SoftInterp:
lpfFIREnable:
description: Low pass FIR filter enable (1 if enabled else 0)
type: integer
lpfBW:
lpfFIRBW:
description: digital lowpass FIR filter bandwidth (Hz)
type: integer
lpfFIREnable:
lpfFIRlog2Interp:
description: digital lowpass FIR filter log2 of interpolation factor (0..2)
type: integer
lpfFIRBW:
lpfFIRGain:
description: digital lowpass FIR filter gain (dB)
type: integer
gain:
log2Interp:
type: integer
lpfBW:
description: Analog lowpass filter bandwidth (Hz)
type: integer
att:
description: Hardware attenuator gain in decibel fourths (negative)
type: integer
antennaPath:
type: integer
transverterMode:
type: integer

View File

@ -1901,6 +1901,21 @@ bool WebAPIRequestMapper::validateDeviceSettings(
return false;
}
}
else if ((*deviceHwType == "PlutoSDR") && (deviceSettings.getTx() != 0))
{
if (jsonObject.contains("plutoSdrOutputSettings") && jsonObject["plutoSdrOutputSettings"].isObject())
{
QJsonObject plutoSdrOutputSettingsJsonObject = jsonObject["plutoSdrOutputSettings"].toObject();
deviceSettingsKeys = plutoSdrOutputSettingsJsonObject.keys();
deviceSettings.setPlutoSdrOutputSettings(new SWGSDRangel::SWGPlutoSdrOutputSettings());
deviceSettings.getPlutoSdrOutputSettings()->fromJsonObject(plutoSdrOutputSettingsJsonObject);
return true;
}
else
{
return false;
}
}
else if (*deviceHwType == "RTLSDR")
{
if (jsonObject.contains("rtlSdrSettings") && jsonObject["rtlSdrSettings"].isObject())

View File

@ -55,17 +55,29 @@ PlutoSdrOutputSettings:
format: int64
devSampleRate:
type: integer
log2HardInterp:
LOppmTenths:
type: integer
log2SoftInterp:
lpfFIREnable:
description: Low pass FIR filter enable (1 if enabled else 0)
type: integer
lpfBW:
lpfFIRBW:
description: digital lowpass FIR filter bandwidth (Hz)
type: integer
lpfFIREnable:
lpfFIRlog2Interp:
description: digital lowpass FIR filter log2 of interpolation factor (0..2)
type: integer
lpfFIRBW:
lpfFIRGain:
description: digital lowpass FIR filter gain (dB)
type: integer
gain:
log2Interp:
type: integer
lpfBW:
description: Analog lowpass filter bandwidth (Hz)
type: integer
att:
description: Hardware attenuator gain in decibel fourths (negative)
type: integer
antennaPath:
type: integer
transverterMode:
type: integer

View File

@ -2656,22 +2656,37 @@ margin-bottom: 20px;
"devSampleRate" : {
"type" : "integer"
},
"log2HardInterp" : {
"type" : "integer"
},
"log2SoftInterp" : {
"type" : "integer"
},
"lpfBW" : {
"LOppmTenths" : {
"type" : "integer"
},
"lpfFIREnable" : {
"type" : "integer"
"type" : "integer",
"description" : "Low pass FIR filter enable (1 if enabled else 0)"
},
"lpfFIRBW" : {
"type" : "integer",
"description" : "digital lowpass FIR filter bandwidth (Hz)"
},
"lpfFIRlog2Interp" : {
"type" : "integer",
"description" : "digital lowpass FIR filter log2 of interpolation factor (0..2)"
},
"lpfFIRGain" : {
"type" : "integer",
"description" : "digital lowpass FIR filter gain (dB)"
},
"log2Interp" : {
"type" : "integer"
},
"gain" : {
"lpfBW" : {
"type" : "integer",
"description" : "Analog lowpass filter bandwidth (Hz)"
},
"att" : {
"type" : "integer",
"description" : "Hardware attenuator gain in decibel fourths (negative)"
},
"antennaPath" : {
"type" : "integer"
},
"transverterMode" : {
@ -22189,7 +22204,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-05-26T16:46:01.765+02:00
Generated 2018-05-26T20:31:05.824+02:00
</div>
</div>
</div>

View File

@ -32,18 +32,24 @@ SWGPlutoSdrOutputSettings::SWGPlutoSdrOutputSettings() {
m_center_frequency_isSet = false;
dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
log2_hard_interp = 0;
m_log2_hard_interp_isSet = false;
log2_soft_interp = 0;
m_log2_soft_interp_isSet = false;
lpf_bw = 0;
m_lpf_bw_isSet = false;
l_oppm_tenths = 0;
m_l_oppm_tenths_isSet = false;
lpf_fir_enable = 0;
m_lpf_fir_enable_isSet = false;
lpf_firbw = 0;
m_lpf_firbw_isSet = false;
gain = 0;
m_gain_isSet = false;
lpf_fi_rlog2_interp = 0;
m_lpf_fi_rlog2_interp_isSet = false;
lpf_fir_gain = 0;
m_lpf_fir_gain_isSet = false;
log2_interp = 0;
m_log2_interp_isSet = false;
lpf_bw = 0;
m_lpf_bw_isSet = false;
att = 0;
m_att_isSet = false;
antenna_path = 0;
m_antenna_path_isSet = false;
transverter_mode = 0;
m_transverter_mode_isSet = false;
transverter_delta_frequency = 0L;
@ -60,18 +66,24 @@ SWGPlutoSdrOutputSettings::init() {
m_center_frequency_isSet = false;
dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
log2_hard_interp = 0;
m_log2_hard_interp_isSet = false;
log2_soft_interp = 0;
m_log2_soft_interp_isSet = false;
lpf_bw = 0;
m_lpf_bw_isSet = false;
l_oppm_tenths = 0;
m_l_oppm_tenths_isSet = false;
lpf_fir_enable = 0;
m_lpf_fir_enable_isSet = false;
lpf_firbw = 0;
m_lpf_firbw_isSet = false;
gain = 0;
m_gain_isSet = false;
lpf_fi_rlog2_interp = 0;
m_lpf_fi_rlog2_interp_isSet = false;
lpf_fir_gain = 0;
m_lpf_fir_gain_isSet = false;
log2_interp = 0;
m_log2_interp_isSet = false;
lpf_bw = 0;
m_lpf_bw_isSet = false;
att = 0;
m_att_isSet = false;
antenna_path = 0;
m_antenna_path_isSet = false;
transverter_mode = 0;
m_transverter_mode_isSet = false;
transverter_delta_frequency = 0L;
@ -90,6 +102,9 @@ SWGPlutoSdrOutputSettings::cleanup() {
}
SWGPlutoSdrOutputSettings*
@ -107,17 +122,23 @@ SWGPlutoSdrOutputSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&log2_hard_interp, pJson["log2HardInterp"], "qint32", "");
::SWGSDRangel::setValue(&log2_soft_interp, pJson["log2SoftInterp"], "qint32", "");
::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
::SWGSDRangel::setValue(&lpf_fir_enable, pJson["lpfFIREnable"], "qint32", "");
::SWGSDRangel::setValue(&lpf_firbw, pJson["lpfFIRBW"], "qint32", "");
::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
::SWGSDRangel::setValue(&lpf_fi_rlog2_interp, pJson["lpfFIRlog2Interp"], "qint32", "");
::SWGSDRangel::setValue(&lpf_fir_gain, pJson["lpfFIRGain"], "qint32", "");
::SWGSDRangel::setValue(&log2_interp, pJson["log2Interp"], "qint32", "");
::SWGSDRangel::setValue(&lpf_bw, pJson["lpfBW"], "qint32", "");
::SWGSDRangel::setValue(&att, pJson["att"], "qint32", "");
::SWGSDRangel::setValue(&antenna_path, pJson["antennaPath"], "qint32", "");
::SWGSDRangel::setValue(&transverter_mode, pJson["transverterMode"], "qint32", "");
@ -145,14 +166,8 @@ SWGPlutoSdrOutputSettings::asJsonObject() {
if(m_dev_sample_rate_isSet){
obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
}
if(m_log2_hard_interp_isSet){
obj->insert("log2HardInterp", QJsonValue(log2_hard_interp));
}
if(m_log2_soft_interp_isSet){
obj->insert("log2SoftInterp", QJsonValue(log2_soft_interp));
}
if(m_lpf_bw_isSet){
obj->insert("lpfBW", QJsonValue(lpf_bw));
if(m_l_oppm_tenths_isSet){
obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
}
if(m_lpf_fir_enable_isSet){
obj->insert("lpfFIREnable", QJsonValue(lpf_fir_enable));
@ -160,8 +175,23 @@ SWGPlutoSdrOutputSettings::asJsonObject() {
if(m_lpf_firbw_isSet){
obj->insert("lpfFIRBW", QJsonValue(lpf_firbw));
}
if(m_gain_isSet){
obj->insert("gain", QJsonValue(gain));
if(m_lpf_fi_rlog2_interp_isSet){
obj->insert("lpfFIRlog2Interp", QJsonValue(lpf_fi_rlog2_interp));
}
if(m_lpf_fir_gain_isSet){
obj->insert("lpfFIRGain", QJsonValue(lpf_fir_gain));
}
if(m_log2_interp_isSet){
obj->insert("log2Interp", QJsonValue(log2_interp));
}
if(m_lpf_bw_isSet){
obj->insert("lpfBW", QJsonValue(lpf_bw));
}
if(m_att_isSet){
obj->insert("att", QJsonValue(att));
}
if(m_antenna_path_isSet){
obj->insert("antennaPath", QJsonValue(antenna_path));
}
if(m_transverter_mode_isSet){
obj->insert("transverterMode", QJsonValue(transverter_mode));
@ -194,33 +224,13 @@ SWGPlutoSdrOutputSettings::setDevSampleRate(qint32 dev_sample_rate) {
}
qint32
SWGPlutoSdrOutputSettings::getLog2HardInterp() {
return log2_hard_interp;
SWGPlutoSdrOutputSettings::getLOppmTenths() {
return l_oppm_tenths;
}
void
SWGPlutoSdrOutputSettings::setLog2HardInterp(qint32 log2_hard_interp) {
this->log2_hard_interp = log2_hard_interp;
this->m_log2_hard_interp_isSet = true;
}
qint32
SWGPlutoSdrOutputSettings::getLog2SoftInterp() {
return log2_soft_interp;
}
void
SWGPlutoSdrOutputSettings::setLog2SoftInterp(qint32 log2_soft_interp) {
this->log2_soft_interp = log2_soft_interp;
this->m_log2_soft_interp_isSet = true;
}
qint32
SWGPlutoSdrOutputSettings::getLpfBw() {
return lpf_bw;
}
void
SWGPlutoSdrOutputSettings::setLpfBw(qint32 lpf_bw) {
this->lpf_bw = lpf_bw;
this->m_lpf_bw_isSet = true;
SWGPlutoSdrOutputSettings::setLOppmTenths(qint32 l_oppm_tenths) {
this->l_oppm_tenths = l_oppm_tenths;
this->m_l_oppm_tenths_isSet = true;
}
qint32
@ -244,13 +254,63 @@ SWGPlutoSdrOutputSettings::setLpfFirbw(qint32 lpf_firbw) {
}
qint32
SWGPlutoSdrOutputSettings::getGain() {
return gain;
SWGPlutoSdrOutputSettings::getLpfFiRlog2Interp() {
return lpf_fi_rlog2_interp;
}
void
SWGPlutoSdrOutputSettings::setGain(qint32 gain) {
this->gain = gain;
this->m_gain_isSet = true;
SWGPlutoSdrOutputSettings::setLpfFiRlog2Interp(qint32 lpf_fi_rlog2_interp) {
this->lpf_fi_rlog2_interp = lpf_fi_rlog2_interp;
this->m_lpf_fi_rlog2_interp_isSet = true;
}
qint32
SWGPlutoSdrOutputSettings::getLpfFirGain() {
return lpf_fir_gain;
}
void
SWGPlutoSdrOutputSettings::setLpfFirGain(qint32 lpf_fir_gain) {
this->lpf_fir_gain = lpf_fir_gain;
this->m_lpf_fir_gain_isSet = true;
}
qint32
SWGPlutoSdrOutputSettings::getLog2Interp() {
return log2_interp;
}
void
SWGPlutoSdrOutputSettings::setLog2Interp(qint32 log2_interp) {
this->log2_interp = log2_interp;
this->m_log2_interp_isSet = true;
}
qint32
SWGPlutoSdrOutputSettings::getLpfBw() {
return lpf_bw;
}
void
SWGPlutoSdrOutputSettings::setLpfBw(qint32 lpf_bw) {
this->lpf_bw = lpf_bw;
this->m_lpf_bw_isSet = true;
}
qint32
SWGPlutoSdrOutputSettings::getAtt() {
return att;
}
void
SWGPlutoSdrOutputSettings::setAtt(qint32 att) {
this->att = att;
this->m_att_isSet = true;
}
qint32
SWGPlutoSdrOutputSettings::getAntennaPath() {
return antenna_path;
}
void
SWGPlutoSdrOutputSettings::setAntennaPath(qint32 antenna_path) {
this->antenna_path = antenna_path;
this->m_antenna_path_isSet = true;
}
qint32
@ -280,12 +340,15 @@ SWGPlutoSdrOutputSettings::isSet(){
do{
if(m_center_frequency_isSet){ isObjectUpdated = true; break;}
if(m_dev_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_log2_hard_interp_isSet){ isObjectUpdated = true; break;}
if(m_log2_soft_interp_isSet){ isObjectUpdated = true; break;}
if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
if(m_l_oppm_tenths_isSet){ isObjectUpdated = true; break;}
if(m_lpf_fir_enable_isSet){ isObjectUpdated = true; break;}
if(m_lpf_firbw_isSet){ isObjectUpdated = true; break;}
if(m_gain_isSet){ isObjectUpdated = true; break;}
if(m_lpf_fi_rlog2_interp_isSet){ isObjectUpdated = true; break;}
if(m_lpf_fir_gain_isSet){ isObjectUpdated = true; break;}
if(m_log2_interp_isSet){ isObjectUpdated = true; break;}
if(m_lpf_bw_isSet){ isObjectUpdated = true; break;}
if(m_att_isSet){ isObjectUpdated = true; break;}
if(m_antenna_path_isSet){ isObjectUpdated = true; break;}
if(m_transverter_mode_isSet){ isObjectUpdated = true; break;}
if(m_transverter_delta_frequency_isSet){ isObjectUpdated = true; break;}
}while(false);

View File

@ -47,14 +47,8 @@ public:
qint32 getDevSampleRate();
void setDevSampleRate(qint32 dev_sample_rate);
qint32 getLog2HardInterp();
void setLog2HardInterp(qint32 log2_hard_interp);
qint32 getLog2SoftInterp();
void setLog2SoftInterp(qint32 log2_soft_interp);
qint32 getLpfBw();
void setLpfBw(qint32 lpf_bw);
qint32 getLOppmTenths();
void setLOppmTenths(qint32 l_oppm_tenths);
qint32 getLpfFirEnable();
void setLpfFirEnable(qint32 lpf_fir_enable);
@ -62,8 +56,23 @@ public:
qint32 getLpfFirbw();
void setLpfFirbw(qint32 lpf_firbw);
qint32 getGain();
void setGain(qint32 gain);
qint32 getLpfFiRlog2Interp();
void setLpfFiRlog2Interp(qint32 lpf_fi_rlog2_interp);
qint32 getLpfFirGain();
void setLpfFirGain(qint32 lpf_fir_gain);
qint32 getLog2Interp();
void setLog2Interp(qint32 log2_interp);
qint32 getLpfBw();
void setLpfBw(qint32 lpf_bw);
qint32 getAtt();
void setAtt(qint32 att);
qint32 getAntennaPath();
void setAntennaPath(qint32 antenna_path);
qint32 getTransverterMode();
void setTransverterMode(qint32 transverter_mode);
@ -81,14 +90,8 @@ private:
qint32 dev_sample_rate;
bool m_dev_sample_rate_isSet;
qint32 log2_hard_interp;
bool m_log2_hard_interp_isSet;
qint32 log2_soft_interp;
bool m_log2_soft_interp_isSet;
qint32 lpf_bw;
bool m_lpf_bw_isSet;
qint32 l_oppm_tenths;
bool m_l_oppm_tenths_isSet;
qint32 lpf_fir_enable;
bool m_lpf_fir_enable_isSet;
@ -96,8 +99,23 @@ private:
qint32 lpf_firbw;
bool m_lpf_firbw_isSet;
qint32 gain;
bool m_gain_isSet;
qint32 lpf_fi_rlog2_interp;
bool m_lpf_fi_rlog2_interp_isSet;
qint32 lpf_fir_gain;
bool m_lpf_fir_gain_isSet;
qint32 log2_interp;
bool m_log2_interp_isSet;
qint32 lpf_bw;
bool m_lpf_bw_isSet;
qint32 att;
bool m_att_isSet;
qint32 antenna_path;
bool m_antenna_path_isSet;
qint32 transverter_mode;
bool m_transverter_mode_isSet;

0
swagger/sdrangel/examples/rx_test.py Normal file → Executable file
View File

22
swagger/sdrangel/examples/tx_test.py Normal file → Executable file
View File

@ -112,6 +112,10 @@ def setupDevice(options):
print(options.sample_rate)
# calculate RF analog and FIR optimal bandpass filters bandwidths
lpFIRBW = options.sample_rate / (1<<options.log2_interp)
lpfBW = lpFIRBW * 1.2
if options.device_hwid == "BladeRF":
settings['bladeRFOutputSettings']['centerFrequency'] = options.device_freq*1000
settings['bladeRFOutputSettings']['devSampleRate'] = options.sample_rate
@ -125,15 +129,23 @@ def setupDevice(options):
elif options.device_hwid == "LimeSDR":
settings["limeSdrOutputSettings"]["antennaPath"] = options.antenna_path
settings["limeSdrOutputSettings"]["devSampleRate"] = options.sample_rate
settings["limeSdrOutputSettings"]["log2HardInterp"] = options.log2_interp_hard
settings["limeSdrOutputSettings"]["log2SoftInterp"] = options.log2_interp
settings["limeSdrOutputSettings"]["centerFrequency"] = options.device_freq*1000 + 500000
settings["limeSdrOutputSettings"]["ncoEnable"] = 1
settings["limeSdrOutputSettings"]["ncoFrequency"] = -500000
settings["limeSdrOutputSettings"]["lpfFIRlog2Interp"] = options.log2_interp_hard
settings["limeSdrOutputSettings"]["log2Interp"] = options.log2_interp
settings["limeSdrOutputSettings"]["centerFrequency"] = options.device_freq*1000
settings["limeSdrOutputSettings"]["lpfBW"] = 4050000
settings["limeSdrOutputSettings"]["lpfFIRBW"] = 100000
settings["limeSdrOutputSettings"]["lpfFIREnable"] = 1
settings["limeSdrOutputSettings"]["gain"] = 17
elif options.device_hwid == "PlutoSDR":
settings["plutoSdrOutputSettings"]["antennaPath"] = options.antenna_path
settings["plutoSdrOutputSettings"]["devSampleRate"] = options.sample_rate
settings["plutoSdrOutputSettings"]["lpfFIRlog2Interp"] = options.log2_interp_hard
settings["plutoSdrOutputSettings"]["log2Interp"] = options.log2_interp
settings["plutoSdrOutputSettings"]["centerFrequency"] = options.device_freq*1000
settings["plutoSdrOutputSettings"]["lpfBW"] = lpfBW
settings["plutoSdrOutputSettings"]["lpfFIRBW"] = lpFIRBW
settings["plutoSdrOutputSettings"]["lpfFIREnable"] = 1
settings["plutoSdrOutputSettings"]["att"] = -24 # -6 dB
elif options.device_hwid == "HackRF":
settings['hackRFOutputSettings']['LOppmTenths'] = round(options.lo_ppm*10)
settings['hackRFOutputSettings']['centerFrequency'] = options.device_freq*1000