1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-22 08:04:49 -05:00

WFM demod: Web API: settings and report implementation

This commit is contained in:
f4exb 2018-04-09 00:37:17 +02:00
parent b2d153ed9e
commit b4d7a0a905
25 changed files with 1338 additions and 65 deletions

View File

@ -23,6 +23,7 @@ set(modwfm_FORMS
include_directories(
.
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/swagger/sdrangel/code/qt5/client
)
add_definitions(${QT_DEFINITIONS})
@ -41,6 +42,7 @@ target_link_libraries(modwfm
${QT_LIBRARIES}
sdrbase
sdrgui
swagger
)
qt5_use_modules(modwfm Core Widgets)

View File

@ -22,11 +22,16 @@
#include <complex.h>
#include <algorithm>
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
#include "SWGAMModReport.h"
#include "dsp/upchannelizer.h"
#include "dsp/dspengine.h"
#include "dsp/threadedbasebandsamplesource.h"
#include "dsp/dspcommands.h"
#include "device/devicesinkapi.h"
#include "util/db.h"
#include "wfmmod.h"
@ -34,7 +39,6 @@ MESSAGE_CLASS_DEFINITION(WFMMod::MsgConfigureWFMMod, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgConfigureChannelizer, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgConfigureFileSourceName, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgConfigureFileSourceSeek, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgConfigureAFInput, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgConfigureFileSourceStreamTiming, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgReportFileSourceStreamData, Message)
MESSAGE_CLASS_DEFINITION(WFMMod::MsgReportFileSourceStreamTiming, Message)
@ -56,7 +60,6 @@ WFMMod::WFMMod(DeviceSinkAPI *deviceAPI) :
m_fileSize(0),
m_recordLength(0),
m_sampleRate(48000),
m_afInput(WFMModInputNone),
m_levelCalcCount(0),
m_peakLevel(0.0f),
m_levelSum(0.0f)
@ -119,7 +122,8 @@ void WFMMod::pull(Sample& sample)
m_settingsMutex.lock();
if ((m_afInput == WFMModInputFile) || (m_afInput == WFMModInputAudio))
if ((m_settings.m_modAFInput == WFMModSettings::WFMModInputFile)
|| (m_settings.m_modAFInput == WFMModSettings::WFMModInputAudio))
{
if (m_interpolator.interpolate(&m_interpolatorDistanceRemain, m_modSample, &ri))
{
@ -178,13 +182,13 @@ void WFMMod::pullAudio(int nbSamples)
void WFMMod::pullAF(Complex& sample)
{
switch (m_afInput)
switch (m_settings.m_modAFInput)
{
case WFMModInputTone:
case WFMModSettings::WFMModInputTone:
sample.real(m_toneNcoRF.next() * m_settings.m_volumeFactor);
sample.imag(0.0f);
break;
case WFMModInputFile:
case WFMModSettings::WFMModInputFile:
// sox f4exb_call.wav --encoding float --endian little f4exb_call.raw
// ffplay -f f32le -ar 48k -ac 1 f4exb_call.raw
if (m_ifstream.is_open())
@ -217,13 +221,13 @@ void WFMMod::pullAF(Complex& sample)
sample.imag(0.0f);
}
break;
case WFMModInputAudio:
case WFMModSettings::WFMModInputAudio:
{
sample.real(((m_audioBuffer[m_audioBufferFill].l + m_audioBuffer[m_audioBufferFill].r) / 65536.0f) * m_settings.m_volumeFactor);
sample.imag(0.0f);
}
break;
case WFMModInputCWTone:
case WFMModSettings::WFMModInputCWTone:
Real fadeFactor;
if (m_cwKeyer.getSample())
@ -247,7 +251,7 @@ void WFMMod::pullAF(Complex& sample)
}
}
break;
case WFMModInputNone:
case WFMModSettings::WFMModInputNone:
default:
sample.real(0.0f);
sample.imag(0.0f);
@ -337,13 +341,6 @@ bool WFMMod::handleMessage(const Message& cmd)
return true;
}
else if (MsgConfigureAFInput::match(cmd))
{
MsgConfigureAFInput& conf = (MsgConfigureAFInput&) cmd;
m_afInput = conf.getAFInput();
return true;
}
else if (MsgConfigureFileSourceStreamTiming::match(cmd))
{
std::size_t samplesCount;
@ -545,3 +542,177 @@ bool WFMMod::deserialize(const QByteArray& data)
return false;
}
}
int WFMMod::webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage __attribute__((unused)))
{
response.setWfmModSettings(new SWGSDRangel::SWGWFMModSettings());
response.getWfmModSettings()->init();
webapiFormatChannelSettings(response, m_settings);
return 200;
}
int WFMMod::webapiSettingsPutPatch(
bool force,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage __attribute__((unused)))
{
WFMModSettings settings;
bool channelizerChange = false;
if (channelSettingsKeys.contains("channelMute")) {
settings.m_channelMute = response.getWfmModSettings()->getChannelMute() != 0;
}
if (channelSettingsKeys.contains("inputFrequencyOffset"))
{
settings.m_inputFrequencyOffset = response.getWfmModSettings()->getInputFrequencyOffset();
channelizerChange = true;
}
if (channelSettingsKeys.contains("modAFInput")) {
settings.m_modAFInput = (WFMModSettings::WFMModInputAF) response.getWfmModSettings()->getModAfInput();
}
if (channelSettingsKeys.contains("playLoop")) {
settings.m_playLoop = response.getWfmModSettings()->getPlayLoop() != 0;
}
if (channelSettingsKeys.contains("rfBandwidth")) {
settings.m_rfBandwidth = response.getWfmModSettings()->getRfBandwidth();
channelizerChange = true;
}
if (channelSettingsKeys.contains("afBandwidth")) {
settings.m_afBandwidth = response.getWfmModSettings()->getAfBandwidth();
}
if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getWfmModSettings()->getRgbColor();
}
if (channelSettingsKeys.contains("title")) {
settings.m_title = *response.getWfmModSettings()->getTitle();
}
if (channelSettingsKeys.contains("toneFrequency")) {
settings.m_toneFrequency = response.getWfmModSettings()->getToneFrequency();
}
if (channelSettingsKeys.contains("volumeFactor")) {
settings.m_volumeFactor = response.getWfmModSettings()->getVolumeFactor();
}
if (channelSettingsKeys.contains("fmDeviation")) {
settings.m_fmDeviation = response.getWfmModSettings()->getFmDeviation();
}
if (channelSettingsKeys.contains("cwKeyer"))
{
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getWfmModSettings()->getCwKeyer();
CWKeyerSettings cwKeyerSettings = m_cwKeyer.getSettings();
if (channelSettingsKeys.contains("cwKeyer.loop")) {
cwKeyerSettings.m_loop = apiCwKeyerSettings->getLoop() != 0;
}
if (channelSettingsKeys.contains("cwKeyer.mode")) {
cwKeyerSettings.m_mode = (CWKeyerSettings::CWMode) apiCwKeyerSettings->getMode();
}
if (channelSettingsKeys.contains("cwKeyer.text")) {
cwKeyerSettings.m_text = *apiCwKeyerSettings->getText();
}
if (channelSettingsKeys.contains("cwKeyer.sampleRate")) {
cwKeyerSettings.m_sampleRate = apiCwKeyerSettings->getSampleRate();
}
if (channelSettingsKeys.contains("cwKeyer.wpm")) {
cwKeyerSettings.m_wpm = apiCwKeyerSettings->getWpm();
}
m_cwKeyer.setLoop(cwKeyerSettings.m_loop);
m_cwKeyer.setMode(cwKeyerSettings.m_mode);
m_cwKeyer.setSampleRate(cwKeyerSettings.m_sampleRate);
m_cwKeyer.setText(cwKeyerSettings.m_text);
m_cwKeyer.setWPM(cwKeyerSettings.m_wpm);
if (m_guiMessageQueue) // forward to GUI if any
{
CWKeyer::MsgConfigureCWKeyer *msgCwKeyer = CWKeyer::MsgConfigureCWKeyer::create(cwKeyerSettings, force);
m_guiMessageQueue->push(msgCwKeyer);
}
}
if (channelizerChange)
{
WFMMod::MsgConfigureChannelizer *msgChan = WFMMod::MsgConfigureChannelizer::create(
settings.m_rfBandwidth, settings.m_inputFrequencyOffset);
m_inputMessageQueue.push(msgChan);
}
MsgConfigureWFMMod *msg = MsgConfigureWFMMod::create(settings, force);
m_inputMessageQueue.push(msg);
if (m_guiMessageQueue) // forward to GUI if any
{
MsgConfigureWFMMod *msgToGUI = MsgConfigureWFMMod::create(settings, force);
m_guiMessageQueue->push(msgToGUI);
}
webapiFormatChannelSettings(response, settings);
return 200;
}
int WFMMod::webapiReportGet(
SWGSDRangel::SWGChannelReport& response,
QString& errorMessage __attribute__((unused)))
{
response.setWfmModReport(new SWGSDRangel::SWGWFMModReport());
response.getWfmModReport()->init();
webapiFormatChannelReport(response);
return 200;
}
void WFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const WFMModSettings& settings)
{
response.getWfmModSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
response.getWfmModSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
response.getWfmModSettings()->setModAfInput((int) settings.m_modAFInput);
response.getWfmModSettings()->setPlayLoop(settings.m_playLoop ? 1 : 0);
response.getWfmModSettings()->setRfBandwidth(settings.m_rfBandwidth);
response.getWfmModSettings()->setAfBandwidth(settings.m_afBandwidth);
response.getWfmModSettings()->setFmDeviation(settings.m_fmDeviation);
response.getWfmModSettings()->setRgbColor(settings.m_rgbColor);
if (response.getWfmModSettings()->getTitle()) {
*response.getWfmModSettings()->getTitle() = settings.m_title;
} else {
response.getWfmModSettings()->setTitle(new QString(settings.m_title));
}
response.getWfmModSettings()->setToneFrequency(settings.m_toneFrequency);
response.getWfmModSettings()->setVolumeFactor(settings.m_volumeFactor);
if (!response.getWfmModSettings()->getCwKeyer()) {
response.getWfmModSettings()->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings);
}
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getWfmModSettings()->getCwKeyer();
const CWKeyerSettings& cwKeyerSettings = m_cwKeyer.getSettings();
apiCwKeyerSettings->setLoop(cwKeyerSettings.m_loop ? 1 : 0);
apiCwKeyerSettings->setMode((int) cwKeyerSettings.m_mode);
apiCwKeyerSettings->setSampleRate(cwKeyerSettings.m_sampleRate);
if (apiCwKeyerSettings->getText()) {
*apiCwKeyerSettings->getText() = cwKeyerSettings.m_text;
} else {
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
}
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
if (response.getWfmModSettings()->getAudioDeviceName()) {
*response.getWfmModSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
} else {
response.getWfmModSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
}
}
void WFMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
{
response.getWfmModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
response.getWfmModReport()->setAudioSampleRate(m_audioSampleRate);
response.getWfmModReport()->setChannelSampleRate(m_outputSampleRate);
}

View File

@ -44,15 +44,6 @@ class WFMMod : public BasebandSampleSource, public ChannelSourceAPI {
Q_OBJECT
public:
typedef enum
{
WFMModInputNone,
WFMModInputTone,
WFMModInputFile,
WFMModInputAudio,
WFMModInputCWTone
} WFMModInputAF;
class MsgConfigureWFMMod : public Message {
MESSAGE_CLASS_DECLARATION
@ -158,27 +149,6 @@ public:
{ }
};
class MsgConfigureAFInput : public Message
{
MESSAGE_CLASS_DECLARATION
public:
WFMModInputAF getAFInput() const { return m_afInput; }
static MsgConfigureAFInput* create(WFMModInputAF afInput)
{
return new MsgConfigureAFInput(afInput);
}
private:
WFMModInputAF m_afInput;
MsgConfigureAFInput(WFMModInputAF afInput) :
Message(),
m_afInput(afInput)
{ }
};
class MsgReportFileSourceStreamTiming : public Message
{
MESSAGE_CLASS_DECLARATION
@ -246,6 +216,20 @@ public:
virtual QByteArray serialize() const;
virtual bool deserialize(const QByteArray& data);
virtual int webapiSettingsGet(
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage);
virtual int webapiSettingsPutPatch(
bool force,
const QStringList& channelSettingsKeys,
SWGSDRangel::SWGChannelSettings& response,
QString& errorMessage);
virtual int webapiReportGet(
SWGSDRangel::SWGChannelReport& response,
QString& errorMessage);
double getMagSq() const { return m_magsq; }
CWKeyer *getCWKeyer() { return &m_cwKeyer; }
@ -309,7 +293,6 @@ private:
quint32 m_recordLength; //!< record length in seconds computed from file size
int m_sampleRate;
WFMModInputAF m_afInput;
quint32 m_levelCalcCount;
Real m_peakLevel;
Real m_levelSum;
@ -323,6 +306,8 @@ private:
void calculateLevel(const Real& sample);
void openFileStream();
void seekFileStream(int seekPercentage);
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const WFMModSettings& settings);
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
};

View File

@ -106,6 +106,21 @@ bool WFMModGUI::handleMessage(const Message& message)
updateWithStreamTime();
return true;
}
else if (WFMMod::MsgConfigureWFMMod::match(message))
{
const WFMMod::MsgConfigureWFMMod& cfg = (WFMMod::MsgConfigureWFMMod&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else if (CWKeyer::MsgConfigureCWKeyer::match(message))
{
const CWKeyer::MsgConfigureCWKeyer& cfg = (CWKeyer::MsgConfigureCWKeyer&) message;
ui->cwKeyerGUI->displaySettings(cfg.getSettings());
return true;
}
else
{
return false;
@ -192,9 +207,8 @@ void WFMModGUI::on_play_toggled(bool checked)
ui->tone->setEnabled(!checked); // release other source inputs
ui->mic->setEnabled(!checked);
ui->morseKeyer->setEnabled(!checked);
m_modAFInput = checked ? WFMMod::WFMModInputFile : WFMMod::WFMModInputNone;
WFMMod::MsgConfigureAFInput* message = WFMMod::MsgConfigureAFInput::create(m_modAFInput);
m_wfmMod->getInputMessageQueue()->push(message);
m_settings.m_modAFInput = checked ? WFMModSettings::WFMModInputFile : WFMModSettings::WFMModInputNone;
applySettings();
ui->navTimeSlider->setEnabled(!checked);
m_enableNavTime = !checked;
}
@ -204,9 +218,8 @@ void WFMModGUI::on_tone_toggled(bool checked)
ui->play->setEnabled(!checked); // release other source inputs
ui->mic->setEnabled(!checked);
ui->morseKeyer->setEnabled(!checked);
m_modAFInput = checked ? WFMMod::WFMModInputTone : WFMMod::WFMModInputNone;
WFMMod::MsgConfigureAFInput* message = WFMMod::MsgConfigureAFInput::create(m_modAFInput);
m_wfmMod->getInputMessageQueue()->push(message);
m_settings.m_modAFInput = checked ? WFMModSettings::WFMModInputTone : WFMModSettings::WFMModInputNone;
applySettings();
}
void WFMModGUI::on_morseKeyer_toggled(bool checked)
@ -214,9 +227,8 @@ void WFMModGUI::on_morseKeyer_toggled(bool checked)
ui->tone->setEnabled(!checked); // release other source inputs
ui->mic->setEnabled(!checked);
ui->play->setEnabled(!checked);
m_modAFInput = checked ? WFMMod::WFMModInputCWTone : WFMMod::WFMModInputNone;
WFMMod::MsgConfigureAFInput* message = WFMMod::MsgConfigureAFInput::create(m_modAFInput);
m_wfmMod->getInputMessageQueue()->push(message);
m_settings.m_modAFInput = checked ? WFMModSettings::WFMModInputCWTone : WFMModSettings::WFMModInputNone;
applySettings();
}
void WFMModGUI::on_mic_toggled(bool checked)
@ -224,9 +236,8 @@ void WFMModGUI::on_mic_toggled(bool checked)
ui->play->setEnabled(!checked); // release other source inputs
ui->tone->setEnabled(!checked); // release other source inputs
ui->morseKeyer->setEnabled(!checked);
m_modAFInput = checked ? WFMMod::WFMModInputAudio : WFMMod::WFMModInputNone;
WFMMod::MsgConfigureAFInput* message = WFMMod::MsgConfigureAFInput::create(m_modAFInput);
m_wfmMod->getInputMessageQueue()->push(message);
m_settings.m_modAFInput = checked ? WFMModSettings::WFMModInputAudio : WFMModSettings::WFMModInputNone;
applySettings();
}
void WFMModGUI::on_navTimeSlider_valueChanged(int value)
@ -278,8 +289,7 @@ WFMModGUI::WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
m_recordSampleRate(48000),
m_samplesCount(0),
m_tickCount(0),
m_enableNavTime(false),
m_modAFInput(WFMMod::WFMModInputNone)
m_enableNavTime(false)
{
ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose, true);
@ -401,6 +411,16 @@ void WFMModGUI::displaySettings()
ui->channelMute->setChecked(m_settings.m_channelMute);
ui->playLoop->setChecked(m_settings.m_playLoop);
ui->tone->setEnabled((m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputTone) || (m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputNone));
ui->mic->setEnabled((m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputAudio) || (m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputNone));
ui->play->setEnabled((m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputFile) || (m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputNone));
ui->morseKeyer->setEnabled((m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputCWTone) || (m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputNone));
ui->tone->setChecked(m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputTone);
ui->mic->setChecked(m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputAudio);
ui->play->setChecked(m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputFile);
ui->morseKeyer->setChecked(m_settings.m_modAFInput == WFMModSettings::WFMModInputAF::WFMModInputCWTone);
blockApplySettings(false);
}
@ -433,7 +453,7 @@ void WFMModGUI::tick()
m_channelPowerDbAvg(powDb);
ui->channelPower->setText(tr("%1 dB").arg(m_channelPowerDbAvg.asDouble(), 0, 'f', 1));
if (((++m_tickCount & 0xf) == 0) && (m_modAFInput == WFMMod::WFMModInputFile))
if (((++m_tickCount & 0xf) == 0) && (m_settings.m_modAFInput == WFMModSettings::WFMModInputFile))
{
WFMMod::MsgConfigureFileSourceStreamTiming* message = WFMMod::MsgConfigureFileSourceStreamTiming::create();
m_wfmMod->getInputMessageQueue()->push(message);

View File

@ -76,7 +76,6 @@ private:
int m_samplesCount;
std::size_t m_tickCount;
bool m_enableNavTime;
WFMMod::WFMModInputAF m_modAFInput;
MessageQueue m_inputMessageQueue;
explicit WFMModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx, QWidget* parent = 0);

View File

@ -47,6 +47,7 @@ void WFMModSettings::resetToDefaults()
m_playLoop = false;
m_rgbColor = QColor(0, 0, 255).rgb();
m_title = "WFM Modulator";
m_modAFInput = WFMModInputNone;
m_audioDeviceName = AudioDeviceManager::m_defaultDeviceName;
}
@ -72,6 +73,7 @@ QByteArray WFMModSettings::serialize() const
s.writeString(10, m_title);
s.writeString(11, m_audioDeviceName);
s.writeS32(12, (int) m_modAFInput);
return s.final();
}
@ -113,6 +115,13 @@ bool WFMModSettings::deserialize(const QByteArray& data)
d.readString(10, &m_title, "WFM Modulator");
d.readString(11, &m_audioDeviceName, AudioDeviceManager::m_defaultDeviceName);
d.readS32(12, &tmp, 0);
if ((tmp < 0) || (tmp > (int) WFMModInputAF::WFMModInputTone)) {
m_modAFInput = WFMModInputNone;
} else {
m_modAFInput = (WFMModInputAF) tmp;
}
return true;
}
else

View File

@ -23,6 +23,15 @@ class Serializable;
struct WFMModSettings
{
typedef enum
{
WFMModInputNone,
WFMModInputTone,
WFMModInputFile,
WFMModInputAudio,
WFMModInputCWTone
} WFMModInputAF;
static const int m_nbRfBW;
static const int m_rfBW[];
@ -36,6 +45,7 @@ struct WFMModSettings
bool m_playLoop;
quint32 m_rgbColor;
QString m_title;
WFMModInputAF m_modAFInput;
QString m_audioDeviceName;
Serializable *m_channelMarker;

View File

@ -12,6 +12,7 @@
<file>webapi/doc/swagger/include/AMMod.yaml</file>
<file>webapi/doc/swagger/include/NFMDemod.yaml</file>
<file>webapi/doc/swagger/include/NFMMod.yaml</file>
<file>webapi/doc/swagger/include/WFMMod.yaml</file>
<file>webapi/doc/swagger/include/RtlSdr.yaml</file>
<file>webapi/doc/swagger-ui/swagger-ui.js.map</file>
<file>webapi/doc/swagger-ui/swagger-ui.js</file>

View File

@ -1129,6 +1129,9 @@ margin-bottom: 20px;
},
"NFMModReport" : {
"$ref" : "#/definitions/NFMModReport"
},
"WFMModReport" : {
"$ref" : "#/definitions/WFMModReport"
}
},
"description" : "Base channel report. The specific channel report present depends on channelType or paremt context."
@ -1156,6 +1159,9 @@ margin-bottom: 20px;
},
"NFMModSettings" : {
"$ref" : "#/definitions/NFMModSettings"
},
"WFMModSettings" : {
"$ref" : "#/definitions/WFMModSettings"
}
},
"description" : "Base channel settings. The specific channel settings present depends on channelType."
@ -2028,6 +2034,72 @@ margin-bottom: 20px;
"type" : "string"
}
}
};
defs.WFMModReport = {
"properties" : {
"channelPowerDB" : {
"type" : "number",
"format" : "float",
"description" : "power transmitted in channel (dB)"
},
"audioSampleRate" : {
"type" : "integer"
},
"channelSampleRate" : {
"type" : "integer"
}
},
"description" : "WFMMod"
};
defs.WFMModSettings = {
"properties" : {
"inputFrequencyOffset" : {
"type" : "integer",
"format" : "int64"
},
"rfBandwidth" : {
"type" : "number",
"format" : "float"
},
"afBandwidth" : {
"type" : "number",
"format" : "float"
},
"fmDeviation" : {
"type" : "number",
"format" : "float"
},
"toneFrequency" : {
"type" : "number",
"format" : "float"
},
"volumeFactor" : {
"type" : "number",
"format" : "float"
},
"channelMute" : {
"type" : "integer"
},
"playLoop" : {
"type" : "integer"
},
"rgbColor" : {
"type" : "integer"
},
"title" : {
"type" : "string"
},
"audioDeviceName" : {
"type" : "string"
},
"modAFInput" : {
"type" : "integer"
},
"cwKeyer" : {
"$ref" : "#/definitions/CWKeyerSettings"
}
},
"description" : "WFMMod"
};
</script>
@ -20262,7 +20334,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-04-06T00:10:47.664+02:00
Generated 2018-04-08T18:14:01.611+02:00
</div>
</div>
</div>

View File

@ -0,0 +1,48 @@
WFMModSettings:
description: WFMMod
properties:
inputFrequencyOffset:
type: integer
format: int64
rfBandwidth:
type: number
format: float
afBandwidth:
type: number
format: float
fmDeviation:
type: number
format: float
toneFrequency:
type: number
format: float
volumeFactor:
type: number
format: float
channelMute:
type: integer
playLoop:
type: integer
rgbColor:
type: integer
title:
type: string
audioDeviceName:
type: string
modAFInput:
type: integer
cwKeyer:
$ref: "/doc/swagger/include/CWKeyer.yaml#/CWKeyerSettings"
WFMModReport:
description: WFMMod
properties:
channelPowerDB:
description: power transmitted in channel (dB)
type: number
format: float
audioSampleRate:
type: integer
channelSampleRate:
type: integer

View File

@ -1753,6 +1753,8 @@ definitions:
$ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodSettings"
NFMModSettings:
$ref: "/doc/swagger/include/NFMMod.yaml#/NFMModSettings"
WFMModSettings:
$ref: "/doc/swagger/include/WFMMod.yaml#/WFMModSettings"
ChannelReport:
description: Base channel report. The specific channel report present depends on channelType or paremt context.
@ -1772,6 +1774,8 @@ definitions:
$ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodReport"
NFMModReport:
$ref: "/doc/swagger/include/NFMMod.yaml#/NFMModReport"
WFMModReport:
$ref: "/doc/swagger/include/WFMMod.yaml#/WFMModReport"
responses:

View File

@ -1896,6 +1896,27 @@ bool WebAPIRequestMapper::validateChannelSettings(
return false;
}
}
else if (*channelType == "WFMMod")
{
if (channelSettings.getTx() != 0)
{
QJsonObject wfmModSettingsJsonObject = jsonObject["WFMModSettings"].toObject();
channelSettingsKeys = wfmModSettingsJsonObject.keys();
if (channelSettingsKeys.contains("cwKeyer"))
{
QJsonObject cwKeyerSettingsJsonObject;
appendSettingsSubKeys(wfmModSettingsJsonObject, cwKeyerSettingsJsonObject, "cwKeyer", channelSettingsKeys);
}
channelSettings.setWfmModSettings(new SWGSDRangel::SWGWFMModSettings());
channelSettings.getWfmModSettings()->fromJsonObject(wfmModSettingsJsonObject);
return true;
}
else {
return false;
}
}
else
{
return false;
@ -1977,6 +1998,20 @@ bool WebAPIRequestMapper::validateChannelReport(
return false;
}
}
else if (*channelType == "WFMMod")
{
if (channelReport.getTx() != 0)
{
QJsonObject wfmModReportJsonObject = jsonObject["WFMModReport"].toObject();
channelReportKeys = wfmModReportJsonObject.keys();
channelReport.setWfmModReport(new SWGSDRangel::SWGWFMModReport());
channelReport.getWfmModReport()->fromJsonObject(wfmModReportJsonObject);
return true;
}
else {
return false;
}
}
else
{
return false;

View File

@ -0,0 +1,48 @@
WFMModSettings:
description: WFMMod
properties:
inputFrequencyOffset:
type: integer
format: int64
rfBandwidth:
type: number
format: float
afBandwidth:
type: number
format: float
fmDeviation:
type: number
format: float
toneFrequency:
type: number
format: float
volumeFactor:
type: number
format: float
channelMute:
type: integer
playLoop:
type: integer
rgbColor:
type: integer
title:
type: string
audioDeviceName:
type: string
modAFInput:
type: integer
cwKeyer:
$ref: "http://localhost:8081/api/swagger/include/CWKeyer.yaml#/CWKeyerSettings"
WFMModReport:
description: WFMMod
properties:
channelPowerDB:
description: power transmitted in channel (dB)
type: number
format: float
audioSampleRate:
type: integer
channelSampleRate:
type: integer

View File

@ -1753,6 +1753,8 @@ definitions:
$ref: "http://localhost:8081/api/swagger/include/NFMDemod.yaml#/NFMDemodSettings"
NFMModSettings:
$ref: "http://localhost:8081/api/swagger/include/NFMMod.yaml#/NFMModSettings"
WFMModSettings:
$ref: "http://localhost:8081/api/swagger/include/WFMMod.yaml#/WFMModSettings"
ChannelReport:
description: Base channel report. The specific channel report present depends on channelType or paremt context.
@ -1772,6 +1774,8 @@ definitions:
$ref: "http://localhost:8081/api/swagger/include/NFMDemod.yaml#/NFMDemodReport"
NFMModReport:
$ref: "http://localhost:8081/api/swagger/include/NFMMod.yaml#/NFMModReport"
WFMModReport:
$ref: "http://localhost:8081/api/swagger/include/WFMMod.yaml#/WFMModReport"
responses:

View File

@ -1129,6 +1129,9 @@ margin-bottom: 20px;
},
"NFMModReport" : {
"$ref" : "#/definitions/NFMModReport"
},
"WFMModReport" : {
"$ref" : "#/definitions/WFMModReport"
}
},
"description" : "Base channel report. The specific channel report present depends on channelType or paremt context."
@ -1156,6 +1159,9 @@ margin-bottom: 20px;
},
"NFMModSettings" : {
"$ref" : "#/definitions/NFMModSettings"
},
"WFMModSettings" : {
"$ref" : "#/definitions/WFMModSettings"
}
},
"description" : "Base channel settings. The specific channel settings present depends on channelType."
@ -2028,6 +2034,72 @@ margin-bottom: 20px;
"type" : "string"
}
}
};
defs.WFMModReport = {
"properties" : {
"channelPowerDB" : {
"type" : "number",
"format" : "float",
"description" : "power transmitted in channel (dB)"
},
"audioSampleRate" : {
"type" : "integer"
},
"channelSampleRate" : {
"type" : "integer"
}
},
"description" : "WFMMod"
};
defs.WFMModSettings = {
"properties" : {
"inputFrequencyOffset" : {
"type" : "integer",
"format" : "int64"
},
"rfBandwidth" : {
"type" : "number",
"format" : "float"
},
"afBandwidth" : {
"type" : "number",
"format" : "float"
},
"fmDeviation" : {
"type" : "number",
"format" : "float"
},
"toneFrequency" : {
"type" : "number",
"format" : "float"
},
"volumeFactor" : {
"type" : "number",
"format" : "float"
},
"channelMute" : {
"type" : "integer"
},
"playLoop" : {
"type" : "integer"
},
"rgbColor" : {
"type" : "integer"
},
"title" : {
"type" : "string"
},
"audioDeviceName" : {
"type" : "string"
},
"modAFInput" : {
"type" : "integer"
},
"cwKeyer" : {
"$ref" : "#/definitions/CWKeyerSettings"
}
},
"description" : "WFMMod"
};
</script>
@ -20262,7 +20334,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-04-06T00:10:47.664+02:00
Generated 2018-04-08T18:14:01.611+02:00
</div>
</div>
</div>

View File

@ -40,6 +40,8 @@ SWGChannelReport::SWGChannelReport() {
m_nfm_demod_report_isSet = false;
nfm_mod_report = nullptr;
m_nfm_mod_report_isSet = false;
wfm_mod_report = nullptr;
m_wfm_mod_report_isSet = false;
}
SWGChannelReport::~SWGChannelReport() {
@ -60,6 +62,8 @@ SWGChannelReport::init() {
m_nfm_demod_report_isSet = false;
nfm_mod_report = new SWGNFMModReport();
m_nfm_mod_report_isSet = false;
wfm_mod_report = new SWGWFMModReport();
m_wfm_mod_report_isSet = false;
}
void
@ -80,6 +84,9 @@ SWGChannelReport::cleanup() {
if(nfm_mod_report != nullptr) {
delete nfm_mod_report;
}
if(wfm_mod_report != nullptr) {
delete wfm_mod_report;
}
}
SWGChannelReport*
@ -105,6 +112,8 @@ SWGChannelReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&nfm_mod_report, pJson["NFMModReport"], "SWGNFMModReport", "SWGNFMModReport");
::SWGSDRangel::setValue(&wfm_mod_report, pJson["WFMModReport"], "SWGWFMModReport", "SWGWFMModReport");
}
QString
@ -139,6 +148,9 @@ SWGChannelReport::asJsonObject() {
if((nfm_mod_report != nullptr) && (nfm_mod_report->isSet())){
toJsonValue(QString("NFMModReport"), nfm_mod_report, obj, QString("SWGNFMModReport"));
}
if((wfm_mod_report != nullptr) && (wfm_mod_report->isSet())){
toJsonValue(QString("WFMModReport"), wfm_mod_report, obj, QString("SWGWFMModReport"));
}
return obj;
}
@ -203,6 +215,16 @@ SWGChannelReport::setNfmModReport(SWGNFMModReport* nfm_mod_report) {
this->m_nfm_mod_report_isSet = true;
}
SWGWFMModReport*
SWGChannelReport::getWfmModReport() {
return wfm_mod_report;
}
void
SWGChannelReport::setWfmModReport(SWGWFMModReport* wfm_mod_report) {
this->wfm_mod_report = wfm_mod_report;
this->m_wfm_mod_report_isSet = true;
}
bool
SWGChannelReport::isSet(){
@ -214,6 +236,7 @@ SWGChannelReport::isSet(){
if(am_mod_report != nullptr && am_mod_report->isSet()){ isObjectUpdated = true; break;}
if(nfm_demod_report != nullptr && nfm_demod_report->isSet()){ isObjectUpdated = true; break;}
if(nfm_mod_report != nullptr && nfm_mod_report->isSet()){ isObjectUpdated = true; break;}
if(wfm_mod_report != nullptr && wfm_mod_report->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}

View File

@ -26,6 +26,7 @@
#include "SWGAMModReport.h"
#include "SWGNFMDemodReport.h"
#include "SWGNFMModReport.h"
#include "SWGWFMModReport.h"
#include <QString>
#include "SWGObject.h"
@ -64,6 +65,9 @@ public:
SWGNFMModReport* getNfmModReport();
void setNfmModReport(SWGNFMModReport* nfm_mod_report);
SWGWFMModReport* getWfmModReport();
void setWfmModReport(SWGWFMModReport* wfm_mod_report);
virtual bool isSet() override;
@ -86,6 +90,9 @@ private:
SWGNFMModReport* nfm_mod_report;
bool m_nfm_mod_report_isSet;
SWGWFMModReport* wfm_mod_report;
bool m_wfm_mod_report_isSet;
};
}

View File

@ -40,6 +40,8 @@ SWGChannelSettings::SWGChannelSettings() {
m_nfm_demod_settings_isSet = false;
nfm_mod_settings = nullptr;
m_nfm_mod_settings_isSet = false;
wfm_mod_settings = nullptr;
m_wfm_mod_settings_isSet = false;
}
SWGChannelSettings::~SWGChannelSettings() {
@ -60,6 +62,8 @@ SWGChannelSettings::init() {
m_nfm_demod_settings_isSet = false;
nfm_mod_settings = new SWGNFMModSettings();
m_nfm_mod_settings_isSet = false;
wfm_mod_settings = new SWGWFMModSettings();
m_wfm_mod_settings_isSet = false;
}
void
@ -80,6 +84,9 @@ SWGChannelSettings::cleanup() {
if(nfm_mod_settings != nullptr) {
delete nfm_mod_settings;
}
if(wfm_mod_settings != nullptr) {
delete wfm_mod_settings;
}
}
SWGChannelSettings*
@ -105,6 +112,8 @@ SWGChannelSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&nfm_mod_settings, pJson["NFMModSettings"], "SWGNFMModSettings", "SWGNFMModSettings");
::SWGSDRangel::setValue(&wfm_mod_settings, pJson["WFMModSettings"], "SWGWFMModSettings", "SWGWFMModSettings");
}
QString
@ -139,6 +148,9 @@ SWGChannelSettings::asJsonObject() {
if((nfm_mod_settings != nullptr) && (nfm_mod_settings->isSet())){
toJsonValue(QString("NFMModSettings"), nfm_mod_settings, obj, QString("SWGNFMModSettings"));
}
if((wfm_mod_settings != nullptr) && (wfm_mod_settings->isSet())){
toJsonValue(QString("WFMModSettings"), wfm_mod_settings, obj, QString("SWGWFMModSettings"));
}
return obj;
}
@ -203,6 +215,16 @@ SWGChannelSettings::setNfmModSettings(SWGNFMModSettings* nfm_mod_settings) {
this->m_nfm_mod_settings_isSet = true;
}
SWGWFMModSettings*
SWGChannelSettings::getWfmModSettings() {
return wfm_mod_settings;
}
void
SWGChannelSettings::setWfmModSettings(SWGWFMModSettings* wfm_mod_settings) {
this->wfm_mod_settings = wfm_mod_settings;
this->m_wfm_mod_settings_isSet = true;
}
bool
SWGChannelSettings::isSet(){
@ -214,6 +236,7 @@ SWGChannelSettings::isSet(){
if(am_mod_settings != nullptr && am_mod_settings->isSet()){ isObjectUpdated = true; break;}
if(nfm_demod_settings != nullptr && nfm_demod_settings->isSet()){ isObjectUpdated = true; break;}
if(nfm_mod_settings != nullptr && nfm_mod_settings->isSet()){ isObjectUpdated = true; break;}
if(wfm_mod_settings != nullptr && wfm_mod_settings->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}

View File

@ -26,6 +26,7 @@
#include "SWGAMModSettings.h"
#include "SWGNFMDemodSettings.h"
#include "SWGNFMModSettings.h"
#include "SWGWFMModSettings.h"
#include <QString>
#include "SWGObject.h"
@ -64,6 +65,9 @@ public:
SWGNFMModSettings* getNfmModSettings();
void setNfmModSettings(SWGNFMModSettings* nfm_mod_settings);
SWGWFMModSettings* getWfmModSettings();
void setWfmModSettings(SWGWFMModSettings* wfm_mod_settings);
virtual bool isSet() override;
@ -86,6 +90,9 @@ private:
SWGNFMModSettings* nfm_mod_settings;
bool m_nfm_mod_settings_isSet;
SWGWFMModSettings* wfm_mod_settings;
bool m_wfm_mod_settings_isSet;
};
}

View File

@ -62,6 +62,8 @@
#include "SWGRtlSdrSettings.h"
#include "SWGSamplingDevice.h"
#include "SWGSuccessResponse.h"
#include "SWGWFMModReport.h"
#include "SWGWFMModSettings.h"
namespace SWGSDRangel {
@ -210,6 +212,12 @@ namespace SWGSDRangel {
if(QString("SWGSuccessResponse").compare(type) == 0) {
return new SWGSuccessResponse();
}
if(QString("SWGWFMModReport").compare(type) == 0) {
return new SWGWFMModReport();
}
if(QString("SWGWFMModSettings").compare(type) == 0) {
return new SWGWFMModSettings();
}
return nullptr;
}

View File

@ -0,0 +1,148 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGWFMModReport.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGWFMModReport::SWGWFMModReport(QString* json) {
init();
this->fromJson(*json);
}
SWGWFMModReport::SWGWFMModReport() {
channel_power_db = 0.0f;
m_channel_power_db_isSet = false;
audio_sample_rate = 0;
m_audio_sample_rate_isSet = false;
channel_sample_rate = 0;
m_channel_sample_rate_isSet = false;
}
SWGWFMModReport::~SWGWFMModReport() {
this->cleanup();
}
void
SWGWFMModReport::init() {
channel_power_db = 0.0f;
m_channel_power_db_isSet = false;
audio_sample_rate = 0;
m_audio_sample_rate_isSet = false;
channel_sample_rate = 0;
m_channel_sample_rate_isSet = false;
}
void
SWGWFMModReport::cleanup() {
}
SWGWFMModReport*
SWGWFMModReport::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGWFMModReport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&channel_power_db, pJson["channelPowerDB"], "float", "");
::SWGSDRangel::setValue(&audio_sample_rate, pJson["audioSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&channel_sample_rate, pJson["channelSampleRate"], "qint32", "");
}
QString
SWGWFMModReport::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGWFMModReport::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_channel_power_db_isSet){
obj->insert("channelPowerDB", QJsonValue(channel_power_db));
}
if(m_audio_sample_rate_isSet){
obj->insert("audioSampleRate", QJsonValue(audio_sample_rate));
}
if(m_channel_sample_rate_isSet){
obj->insert("channelSampleRate", QJsonValue(channel_sample_rate));
}
return obj;
}
float
SWGWFMModReport::getChannelPowerDb() {
return channel_power_db;
}
void
SWGWFMModReport::setChannelPowerDb(float channel_power_db) {
this->channel_power_db = channel_power_db;
this->m_channel_power_db_isSet = true;
}
qint32
SWGWFMModReport::getAudioSampleRate() {
return audio_sample_rate;
}
void
SWGWFMModReport::setAudioSampleRate(qint32 audio_sample_rate) {
this->audio_sample_rate = audio_sample_rate;
this->m_audio_sample_rate_isSet = true;
}
qint32
SWGWFMModReport::getChannelSampleRate() {
return channel_sample_rate;
}
void
SWGWFMModReport::setChannelSampleRate(qint32 channel_sample_rate) {
this->channel_sample_rate = channel_sample_rate;
this->m_channel_sample_rate_isSet = true;
}
bool
SWGWFMModReport::isSet(){
bool isObjectUpdated = false;
do{
if(m_channel_power_db_isSet){ isObjectUpdated = true; break;}
if(m_audio_sample_rate_isSet){ isObjectUpdated = true; break;}
if(m_channel_sample_rate_isSet){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,70 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGWFMModReport.h
*
* WFMMod
*/
#ifndef SWGWFMModReport_H_
#define SWGWFMModReport_H_
#include <QJsonObject>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGWFMModReport: public SWGObject {
public:
SWGWFMModReport();
SWGWFMModReport(QString* json);
virtual ~SWGWFMModReport();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGWFMModReport* fromJson(QString &jsonString) override;
float getChannelPowerDb();
void setChannelPowerDb(float channel_power_db);
qint32 getAudioSampleRate();
void setAudioSampleRate(qint32 audio_sample_rate);
qint32 getChannelSampleRate();
void setChannelSampleRate(qint32 channel_sample_rate);
virtual bool isSet() override;
private:
float channel_power_db;
bool m_channel_power_db_isSet;
qint32 audio_sample_rate;
bool m_audio_sample_rate_isSet;
qint32 channel_sample_rate;
bool m_channel_sample_rate_isSet;
};
}
#endif /* SWGWFMModReport_H_ */

View File

@ -0,0 +1,364 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
#include "SWGWFMModSettings.h"
#include "SWGHelpers.h"
#include <QJsonDocument>
#include <QJsonArray>
#include <QObject>
#include <QDebug>
namespace SWGSDRangel {
SWGWFMModSettings::SWGWFMModSettings(QString* json) {
init();
this->fromJson(*json);
}
SWGWFMModSettings::SWGWFMModSettings() {
input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false;
af_bandwidth = 0.0f;
m_af_bandwidth_isSet = false;
fm_deviation = 0.0f;
m_fm_deviation_isSet = false;
tone_frequency = 0.0f;
m_tone_frequency_isSet = false;
volume_factor = 0.0f;
m_volume_factor_isSet = false;
channel_mute = 0;
m_channel_mute_isSet = false;
play_loop = 0;
m_play_loop_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = nullptr;
m_title_isSet = false;
audio_device_name = nullptr;
m_audio_device_name_isSet = false;
mod_af_input = 0;
m_mod_af_input_isSet = false;
cw_keyer = nullptr;
m_cw_keyer_isSet = false;
}
SWGWFMModSettings::~SWGWFMModSettings() {
this->cleanup();
}
void
SWGWFMModSettings::init() {
input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false;
af_bandwidth = 0.0f;
m_af_bandwidth_isSet = false;
fm_deviation = 0.0f;
m_fm_deviation_isSet = false;
tone_frequency = 0.0f;
m_tone_frequency_isSet = false;
volume_factor = 0.0f;
m_volume_factor_isSet = false;
channel_mute = 0;
m_channel_mute_isSet = false;
play_loop = 0;
m_play_loop_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = new QString("");
m_title_isSet = false;
audio_device_name = new QString("");
m_audio_device_name_isSet = false;
mod_af_input = 0;
m_mod_af_input_isSet = false;
cw_keyer = new SWGCWKeyerSettings();
m_cw_keyer_isSet = false;
}
void
SWGWFMModSettings::cleanup() {
if(title != nullptr) {
delete title;
}
if(audio_device_name != nullptr) {
delete audio_device_name;
}
if(cw_keyer != nullptr) {
delete cw_keyer;
}
}
SWGWFMModSettings*
SWGWFMModSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object();
this->fromJsonObject(jsonObject);
return this;
}
void
SWGWFMModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
::SWGSDRangel::setValue(&af_bandwidth, pJson["afBandwidth"], "float", "");
::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "float", "");
::SWGSDRangel::setValue(&tone_frequency, pJson["toneFrequency"], "float", "");
::SWGSDRangel::setValue(&volume_factor, pJson["volumeFactor"], "float", "");
::SWGSDRangel::setValue(&channel_mute, pJson["channelMute"], "qint32", "");
::SWGSDRangel::setValue(&play_loop, pJson["playLoop"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
::SWGSDRangel::setValue(&audio_device_name, pJson["audioDeviceName"], "QString", "QString");
::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "qint32", "");
::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings");
}
QString
SWGWFMModSettings::asJson ()
{
QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes);
}
QJsonObject*
SWGWFMModSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_input_frequency_offset_isSet){
obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
}
if(m_rf_bandwidth_isSet){
obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
}
if(m_af_bandwidth_isSet){
obj->insert("afBandwidth", QJsonValue(af_bandwidth));
}
if(m_fm_deviation_isSet){
obj->insert("fmDeviation", QJsonValue(fm_deviation));
}
if(m_tone_frequency_isSet){
obj->insert("toneFrequency", QJsonValue(tone_frequency));
}
if(m_volume_factor_isSet){
obj->insert("volumeFactor", QJsonValue(volume_factor));
}
if(m_channel_mute_isSet){
obj->insert("channelMute", QJsonValue(channel_mute));
}
if(m_play_loop_isSet){
obj->insert("playLoop", QJsonValue(play_loop));
}
if(m_rgb_color_isSet){
obj->insert("rgbColor", QJsonValue(rgb_color));
}
if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString"));
}
if(audio_device_name != nullptr && *audio_device_name != QString("")){
toJsonValue(QString("audioDeviceName"), audio_device_name, obj, QString("QString"));
}
if(m_mod_af_input_isSet){
obj->insert("modAFInput", QJsonValue(mod_af_input));
}
if((cw_keyer != nullptr) && (cw_keyer->isSet())){
toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));
}
return obj;
}
qint64
SWGWFMModSettings::getInputFrequencyOffset() {
return input_frequency_offset;
}
void
SWGWFMModSettings::setInputFrequencyOffset(qint64 input_frequency_offset) {
this->input_frequency_offset = input_frequency_offset;
this->m_input_frequency_offset_isSet = true;
}
float
SWGWFMModSettings::getRfBandwidth() {
return rf_bandwidth;
}
void
SWGWFMModSettings::setRfBandwidth(float rf_bandwidth) {
this->rf_bandwidth = rf_bandwidth;
this->m_rf_bandwidth_isSet = true;
}
float
SWGWFMModSettings::getAfBandwidth() {
return af_bandwidth;
}
void
SWGWFMModSettings::setAfBandwidth(float af_bandwidth) {
this->af_bandwidth = af_bandwidth;
this->m_af_bandwidth_isSet = true;
}
float
SWGWFMModSettings::getFmDeviation() {
return fm_deviation;
}
void
SWGWFMModSettings::setFmDeviation(float fm_deviation) {
this->fm_deviation = fm_deviation;
this->m_fm_deviation_isSet = true;
}
float
SWGWFMModSettings::getToneFrequency() {
return tone_frequency;
}
void
SWGWFMModSettings::setToneFrequency(float tone_frequency) {
this->tone_frequency = tone_frequency;
this->m_tone_frequency_isSet = true;
}
float
SWGWFMModSettings::getVolumeFactor() {
return volume_factor;
}
void
SWGWFMModSettings::setVolumeFactor(float volume_factor) {
this->volume_factor = volume_factor;
this->m_volume_factor_isSet = true;
}
qint32
SWGWFMModSettings::getChannelMute() {
return channel_mute;
}
void
SWGWFMModSettings::setChannelMute(qint32 channel_mute) {
this->channel_mute = channel_mute;
this->m_channel_mute_isSet = true;
}
qint32
SWGWFMModSettings::getPlayLoop() {
return play_loop;
}
void
SWGWFMModSettings::setPlayLoop(qint32 play_loop) {
this->play_loop = play_loop;
this->m_play_loop_isSet = true;
}
qint32
SWGWFMModSettings::getRgbColor() {
return rgb_color;
}
void
SWGWFMModSettings::setRgbColor(qint32 rgb_color) {
this->rgb_color = rgb_color;
this->m_rgb_color_isSet = true;
}
QString*
SWGWFMModSettings::getTitle() {
return title;
}
void
SWGWFMModSettings::setTitle(QString* title) {
this->title = title;
this->m_title_isSet = true;
}
QString*
SWGWFMModSettings::getAudioDeviceName() {
return audio_device_name;
}
void
SWGWFMModSettings::setAudioDeviceName(QString* audio_device_name) {
this->audio_device_name = audio_device_name;
this->m_audio_device_name_isSet = true;
}
qint32
SWGWFMModSettings::getModAfInput() {
return mod_af_input;
}
void
SWGWFMModSettings::setModAfInput(qint32 mod_af_input) {
this->mod_af_input = mod_af_input;
this->m_mod_af_input_isSet = true;
}
SWGCWKeyerSettings*
SWGWFMModSettings::getCwKeyer() {
return cw_keyer;
}
void
SWGWFMModSettings::setCwKeyer(SWGCWKeyerSettings* cw_keyer) {
this->cw_keyer = cw_keyer;
this->m_cw_keyer_isSet = true;
}
bool
SWGWFMModSettings::isSet(){
bool isObjectUpdated = false;
do{
if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_af_bandwidth_isSet){ isObjectUpdated = true; break;}
if(m_fm_deviation_isSet){ isObjectUpdated = true; break;}
if(m_tone_frequency_isSet){ isObjectUpdated = true; break;}
if(m_volume_factor_isSet){ isObjectUpdated = true; break;}
if(m_channel_mute_isSet){ isObjectUpdated = true; break;}
if(m_play_loop_isSet){ isObjectUpdated = true; break;}
if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
if(m_mod_af_input_isSet){ isObjectUpdated = true; break;}
if(cw_keyer != nullptr && cw_keyer->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}
}

View File

@ -0,0 +1,132 @@
/**
* SDRangel
* This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Stopping instance i.e. /sdrangel with DELETE method is a server only feature. It allows stopping the instance nicely. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV demodulator, Channel Analyzer, Channel Analyzer NG, LoRa demodulator, TCP source * The content type returned is always application/json except in the following cases: * An incorrect URL was specified: this document is returned as text/html with a status 400 ---
*
* OpenAPI spec version: 4.0.0
* Contact: f4exb06@gmail.com
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
/*
* SWGWFMModSettings.h
*
* WFMMod
*/
#ifndef SWGWFMModSettings_H_
#define SWGWFMModSettings_H_
#include <QJsonObject>
#include "SWGCWKeyerSettings.h"
#include <QString>
#include "SWGObject.h"
#include "export.h"
namespace SWGSDRangel {
class SWG_API SWGWFMModSettings: public SWGObject {
public:
SWGWFMModSettings();
SWGWFMModSettings(QString* json);
virtual ~SWGWFMModSettings();
void init();
void cleanup();
virtual QString asJson () override;
virtual QJsonObject* asJsonObject() override;
virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGWFMModSettings* fromJson(QString &jsonString) override;
qint64 getInputFrequencyOffset();
void setInputFrequencyOffset(qint64 input_frequency_offset);
float getRfBandwidth();
void setRfBandwidth(float rf_bandwidth);
float getAfBandwidth();
void setAfBandwidth(float af_bandwidth);
float getFmDeviation();
void setFmDeviation(float fm_deviation);
float getToneFrequency();
void setToneFrequency(float tone_frequency);
float getVolumeFactor();
void setVolumeFactor(float volume_factor);
qint32 getChannelMute();
void setChannelMute(qint32 channel_mute);
qint32 getPlayLoop();
void setPlayLoop(qint32 play_loop);
qint32 getRgbColor();
void setRgbColor(qint32 rgb_color);
QString* getTitle();
void setTitle(QString* title);
QString* getAudioDeviceName();
void setAudioDeviceName(QString* audio_device_name);
qint32 getModAfInput();
void setModAfInput(qint32 mod_af_input);
SWGCWKeyerSettings* getCwKeyer();
void setCwKeyer(SWGCWKeyerSettings* cw_keyer);
virtual bool isSet() override;
private:
qint64 input_frequency_offset;
bool m_input_frequency_offset_isSet;
float rf_bandwidth;
bool m_rf_bandwidth_isSet;
float af_bandwidth;
bool m_af_bandwidth_isSet;
float fm_deviation;
bool m_fm_deviation_isSet;
float tone_frequency;
bool m_tone_frequency_isSet;
float volume_factor;
bool m_volume_factor_isSet;
qint32 channel_mute;
bool m_channel_mute_isSet;
qint32 play_loop;
bool m_play_loop_isSet;
qint32 rgb_color;
bool m_rgb_color_isSet;
QString* title;
bool m_title_isSet;
QString* audio_device_name;
bool m_audio_device_name_isSet;
qint32 mod_af_input;
bool m_mod_af_input_isSet;
SWGCWKeyerSettings* cw_keyer;
bool m_cw_keyer_isSet;
};
}
#endif /* SWGWFMModSettings_H_ */

View File

@ -162,6 +162,17 @@ def setupChannel(options):
settings["AMModSettings"]["toneFrequency"] = 600
settings["AMModSettings"]["modFactor"] = 0.9
settings["AMModSettings"]["rfBandwidth"] = 7500
elif options.channel_id == "WFMMod":
settings["WFMModSettings"]["title"] = "Test WFM"
settings["WFMModSettings"]["inputFrequencyOffset"] = options.channel_freq
settings["WFMModSettings"]["cwKeyer"]["text"] = "VVV DE F4EXB "
settings["WFMModSettings"]["cwKeyer"]["loop"] = 1
settings["WFMModSettings"]["cwKeyer"]["mode"] = 1 # text
settings["WFMModSettings"]["modAFInput"] = 4 # CW text
settings["WFMModSettings"]["toneFrequency"] = 600
settings["WFMModSettings"]["fmDeviation"] = 25000
settings["WFMModSettings"]["rfBandwidth"] = 75000
settings["WFMModSettings"]["afBandwidth"] = 3000
r = callAPI(deviceset_url + "/channel/0/settings", "PATCH", None, settings, "Change modulator")
if r is None: