1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-09-26 06:46:34 -04:00

Web API: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings PUT, PATCH for NFM demod and mod. Fixes (2)

This commit is contained in:
f4exb 2017-12-12 23:21:31 +01:00
parent 44346267fc
commit 0436848490
9 changed files with 36 additions and 3 deletions

View File

@ -489,6 +489,7 @@ int NFMMod::webapiSettingsGet(
response.getNfmModSettings()->setCtcssOn(m_settings.m_ctcssOn ? 1 : 0);
response.getNfmModSettings()->setFmDeviation(m_settings.m_fmDeviation);
response.getNfmModSettings()->setInputFrequencyOffset(m_settings.m_inputFrequencyOffset);
response.getNfmModSettings()->setModAfInput((int) m_settings.m_modAFInput);
response.getNfmModSettings()->setOutputSampleRate(m_settings.m_outputSampleRate);
response.getNfmModSettings()->setPlayLoop(m_settings.m_playLoop ? 1 : 0);
response.getNfmModSettings()->setRfBandwidth(m_settings.m_rfBandwidth);
@ -520,6 +521,7 @@ int NFMMod::webapiSettingsPutPatch(
settings.m_ctcssOn = response.getNfmModSettings()->getCtcssOn() != 0;
settings.m_fmDeviation = response.getNfmModSettings()->getFmDeviation();
settings.m_inputFrequencyOffset = response.getNfmModSettings()->getInputFrequencyOffset();
settings.m_modAFInput = (NFMModSettings::NFMModInputAF) response.getNfmModSettings()->getModAfInput();
settings.m_outputSampleRate = response.getNfmModSettings()->getOutputSampleRate();
settings.m_playLoop = response.getNfmModSettings()->getPlayLoop() != 0;
settings.m_rfBandwidth = response.getNfmModSettings()->getRfBandwidth();

View File

@ -461,7 +461,7 @@ void NFMModGUI::tick()
m_channelPowerDbAvg.feed(powDb);
ui->channelPower->setText(tr("%1 dB").arg(m_channelPowerDbAvg.average(), 0, 'f', 1));
if (((++m_tickCount & 0xf) == 0) && (m_settings.m_modAFInput == NFMMod::NFMModInputFile))
if (((++m_tickCount & 0xf) == 0) && (m_settings.m_modAFInput == NFMModSettings::NFMModInputFile))
{
NFMMod::MsgConfigureFileSourceStreamTiming* message = NFMMod::MsgConfigureFileSourceStreamTiming::create();
m_nfmMod->getInputMessageQueue()->push(message);

View File

@ -1324,6 +1324,9 @@ margin-bottom: 20px;
"title" : {
"type" : "string"
},
"modAFInput" : {
"type" : "integer"
},
"cwKeyer" : {
"$ref" : "#/definitions/CWKeyerSettings"
}
@ -13764,7 +13767,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2017-12-10T18:03:56.008+01:00
Generated 2017-12-12T23:11:28.100+01:00
</div>
</div>
</div>

View File

@ -1175,6 +1175,10 @@ bool WebAPIRequestMapper::validateChannelSettings(SWGSDRangel::SWGChannelSetting
return false;
}
}
else
{
return false;
}
}
void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings)

View File

@ -36,6 +36,8 @@ NFMModSettings:
type: integer
title:
type: string
modAFInput:
type: integer
cwKeyer:
$ref: "http://localhost:8081/CWKeyer.yaml#/CWKeyerSettings"

View File

@ -1324,6 +1324,9 @@ margin-bottom: 20px;
"title" : {
"type" : "string"
},
"modAFInput" : {
"type" : "integer"
},
"cwKeyer" : {
"$ref" : "#/definitions/CWKeyerSettings"
}
@ -13764,7 +13767,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2017-12-10T18:03:56.008+01:00
Generated 2017-12-12T23:11:28.100+01:00
</div>
</div>
</div>

View File

@ -52,6 +52,7 @@ SWGNFMModSettings::init() {
ctcss_index = 0;
rgb_color = 0;
title = new QString("");
mod_af_input = 0;
cw_keyer = new SWGCWKeyerSettings();
}
@ -76,6 +77,7 @@ SWGNFMModSettings::cleanup() {
delete title;
}
if(cw_keyer != nullptr) {
delete cw_keyer;
}
@ -107,6 +109,7 @@ SWGNFMModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&ctcss_index, pJson["ctcssIndex"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "qint32", "");
::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings");
}
@ -154,6 +157,8 @@ SWGNFMModSettings::asJsonObject() {
toJsonValue(QString("title"), title, obj, QString("QString"));
obj->insert("modAFInput", QJsonValue(mod_af_input));
toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));
return obj;
@ -294,6 +299,15 @@ SWGNFMModSettings::setTitle(QString* title) {
this->title = title;
}
qint32
SWGNFMModSettings::getModAfInput() {
return mod_af_input;
}
void
SWGNFMModSettings::setModAfInput(qint32 mod_af_input) {
this->mod_af_input = mod_af_input;
}
SWGCWKeyerSettings*
SWGNFMModSettings::getCwKeyer() {
return cw_keyer;

View File

@ -88,6 +88,9 @@ public:
QString* getTitle();
void setTitle(QString* title);
qint32 getModAfInput();
void setModAfInput(qint32 mod_af_input);
SWGCWKeyerSettings* getCwKeyer();
void setCwKeyer(SWGCWKeyerSettings* cw_keyer);
@ -108,6 +111,7 @@ private:
qint32 ctcss_index;
qint32 rgb_color;
QString* title;
qint32 mod_af_input;
SWGCWKeyerSettings* cw_keyer;
};

View File

@ -80,6 +80,7 @@ def main():
settings["NFMModSettings"]["cwKeyer"]["text"] = "VVV DE F4EXB "
settings["NFMModSettings"]["cwKeyer"]["loop"] = 1
settings["NFMModSettings"]["cwKeyer"]["mode"] = 1 # text
settings["NFMModSettings"]["modAFInput"] = 4
r = callAPI("/deviceset/1/channel/0/settings", "PATCH", None, settings, "Change NFM mod")
if r is None: