mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 16:08:39 -05:00
AM demod: Web API: settings and report implementation. NFM demod: fixes
This commit is contained in:
parent
376e0d9b1f
commit
0ba86c0d22
@ -23,6 +23,7 @@ set(modam_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(modam
|
||||
${QT_LIBRARIES}
|
||||
sdrbase
|
||||
sdrgui
|
||||
swagger
|
||||
)
|
||||
|
||||
qt5_use_modules(modam Core Widgets)
|
||||
|
@ -23,11 +23,16 @@
|
||||
#include <stdio.h>
|
||||
#include <complex.h>
|
||||
|
||||
#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"
|
||||
|
||||
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureAMMod, Message)
|
||||
MESSAGE_CLASS_DEFINITION(AMMod::MsgConfigureChannelizer, Message)
|
||||
@ -505,3 +510,172 @@ bool AMMod::deserialize(const QByteArray& data)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int AMMod::webapiSettingsGet(
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setAmModSettings(new SWGSDRangel::SWGAMModSettings());
|
||||
response.getAmModSettings()->init();
|
||||
webapiFormatChannelSettings(response, m_settings);
|
||||
return 200;
|
||||
}
|
||||
|
||||
int AMMod::webapiSettingsPutPatch(
|
||||
bool force,
|
||||
const QStringList& channelSettingsKeys,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
AMModSettings settings;
|
||||
bool frequencyOffsetChanged = false;
|
||||
|
||||
if (channelSettingsKeys.contains("channelMute")) {
|
||||
settings.m_channelMute = response.getAmModSettings()->getChannelMute() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("inputFrequencyOffset"))
|
||||
{
|
||||
settings.m_inputFrequencyOffset = response.getAmModSettings()->getInputFrequencyOffset();
|
||||
frequencyOffsetChanged = true;
|
||||
}
|
||||
if (channelSettingsKeys.contains("modAFInput")) {
|
||||
settings.m_modAFInput = (AMModSettings::AMModInputAF) response.getAmModSettings()->getModAfInput();
|
||||
}
|
||||
if (channelSettingsKeys.contains("playLoop")) {
|
||||
settings.m_playLoop = response.getAmModSettings()->getPlayLoop() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("rfBandwidth")) {
|
||||
settings.m_rfBandwidth = response.getAmModSettings()->getRfBandwidth();
|
||||
}
|
||||
if (channelSettingsKeys.contains("rgbColor")) {
|
||||
settings.m_rgbColor = response.getAmModSettings()->getRgbColor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("title")) {
|
||||
settings.m_title = *response.getAmModSettings()->getTitle();
|
||||
}
|
||||
if (channelSettingsKeys.contains("toneFrequency")) {
|
||||
settings.m_toneFrequency = response.getAmModSettings()->getToneFrequency();
|
||||
}
|
||||
if (channelSettingsKeys.contains("volumeFactor")) {
|
||||
settings.m_volumeFactor = response.getAmModSettings()->getVolumeFactor();
|
||||
}
|
||||
if (channelSettingsKeys.contains("modFactor")) {
|
||||
settings.m_modFactor = response.getAmModSettings()->getModFactor();
|
||||
}
|
||||
|
||||
if (channelSettingsKeys.contains("cwKeyer"))
|
||||
{
|
||||
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->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 (frequencyOffsetChanged)
|
||||
{
|
||||
AMMod::MsgConfigureChannelizer *msgChan = AMMod::MsgConfigureChannelizer::create(
|
||||
m_audioSampleRate, settings.m_inputFrequencyOffset);
|
||||
m_inputMessageQueue.push(msgChan);
|
||||
}
|
||||
|
||||
MsgConfigureAMMod *msg = MsgConfigureAMMod::create(settings, force);
|
||||
m_inputMessageQueue.push(msg);
|
||||
|
||||
if (m_guiMessageQueue) // forward to GUI if any
|
||||
{
|
||||
MsgConfigureAMMod *msgToGUI = MsgConfigureAMMod::create(settings, force);
|
||||
m_guiMessageQueue->push(msgToGUI);
|
||||
}
|
||||
|
||||
webapiFormatChannelSettings(response, settings);
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
int AMMod::webapiReportGet(
|
||||
SWGSDRangel::SWGChannelReport& response,
|
||||
QString& errorMessage __attribute__((unused)))
|
||||
{
|
||||
response.setAmModReport(new SWGSDRangel::SWGAMModReport());
|
||||
response.getAmModReport()->init();
|
||||
webapiFormatChannelReport(response);
|
||||
return 200;
|
||||
}
|
||||
|
||||
void AMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const AMModSettings& settings)
|
||||
{
|
||||
response.getAmModSettings()->setChannelMute(settings.m_channelMute ? 1 : 0);
|
||||
response.getAmModSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
||||
response.getAmModSettings()->setModAfInput((int) settings.m_modAFInput);
|
||||
response.getAmModSettings()->setPlayLoop(settings.m_playLoop ? 1 : 0);
|
||||
response.getAmModSettings()->setRfBandwidth(settings.m_rfBandwidth);
|
||||
response.getAmModSettings()->setModFactor(settings.m_modFactor);
|
||||
response.getAmModSettings()->setRgbColor(settings.m_rgbColor);
|
||||
|
||||
if (response.getAmModSettings()->getTitle()) {
|
||||
*response.getAmModSettings()->getTitle() = settings.m_title;
|
||||
} else {
|
||||
response.getAmModSettings()->setTitle(new QString(settings.m_title));
|
||||
}
|
||||
|
||||
response.getAmModSettings()->setToneFrequency(settings.m_toneFrequency);
|
||||
response.getAmModSettings()->setVolumeFactor(settings.m_volumeFactor);
|
||||
|
||||
if (!response.getAmModSettings()->getCwKeyer()) {
|
||||
response.getAmModSettings()->setCwKeyer(new SWGSDRangel::SWGCWKeyerSettings);
|
||||
}
|
||||
|
||||
SWGSDRangel::SWGCWKeyerSettings *apiCwKeyerSettings = response.getAmModSettings()->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.getAmModSettings()->getAudioDeviceName()) {
|
||||
*response.getAmModSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
|
||||
} else {
|
||||
response.getAmModSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
||||
}
|
||||
}
|
||||
|
||||
void AMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
{
|
||||
response.getAmModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
|
||||
response.getAmModReport()->setAudioSampleRate(m_audioSampleRate);
|
||||
response.getAmModReport()->setChannelSampleRate(m_outputSampleRate);
|
||||
}
|
||||
|
@ -215,6 +215,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; }
|
||||
@ -287,6 +301,8 @@ private:
|
||||
void modulateSample();
|
||||
void openFileStream();
|
||||
void seekFileStream(int seekPercentage);
|
||||
void webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const AMModSettings& settings);
|
||||
void webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response);
|
||||
};
|
||||
|
||||
|
||||
|
@ -106,6 +106,21 @@ bool AMModGUI::handleMessage(const Message& message)
|
||||
updateWithStreamTime();
|
||||
return true;
|
||||
}
|
||||
else if (AMMod::MsgConfigureAMMod::match(message))
|
||||
{
|
||||
const AMMod::MsgConfigureAMMod& cfg = (AMMod::MsgConfigureAMMod&) 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;
|
||||
@ -376,6 +391,16 @@ void AMModGUI::displaySettings()
|
||||
ui->channelMute->setChecked(m_settings.m_channelMute);
|
||||
ui->playLoop->setChecked(m_settings.m_playLoop);
|
||||
|
||||
ui->tone->setEnabled((m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputTone) || (m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputNone));
|
||||
ui->mic->setEnabled((m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputAudio) || (m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputNone));
|
||||
ui->play->setEnabled((m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputFile) || (m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputNone));
|
||||
ui->morseKeyer->setEnabled((m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputCWTone) || (m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputNone));
|
||||
|
||||
ui->tone->setChecked(m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputTone);
|
||||
ui->mic->setChecked(m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputAudio);
|
||||
ui->play->setChecked(m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputFile);
|
||||
ui->morseKeyer->setChecked(m_settings.m_modAFInput == AMModSettings::AMModInputAF::AMModInputCWTone);
|
||||
|
||||
blockApplySettings(false);
|
||||
}
|
||||
|
||||
|
@ -653,7 +653,7 @@ int NFMMod::webapiSettingsPutPatch(
|
||||
if (frequencyOffsetChanged)
|
||||
{
|
||||
NFMMod::MsgConfigureChannelizer *msgChan = NFMMod::MsgConfigureChannelizer::create(
|
||||
48000, settings.m_inputFrequencyOffset);
|
||||
m_audioSampleRate, settings.m_inputFrequencyOffset);
|
||||
m_inputMessageQueue.push(msgChan);
|
||||
}
|
||||
|
||||
@ -719,10 +719,10 @@ void NFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
|
||||
apiCwKeyerSettings->setText(new QString(cwKeyerSettings.m_text));
|
||||
}
|
||||
|
||||
if (response.getNfmDemodSettings()->getAudioDeviceName()) {
|
||||
*response.getNfmDemodSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
|
||||
if (response.getNfmModSettings()->getAudioDeviceName()) {
|
||||
*response.getNfmModSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
|
||||
} else {
|
||||
response.getNfmDemodSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
||||
response.getNfmModSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
||||
}
|
||||
|
||||
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
|
||||
|
@ -9,6 +9,7 @@
|
||||
<file>webapi/doc/swagger/include/HackRF.yaml</file>
|
||||
<file>webapi/doc/swagger/include/LimeSdr.yaml</file>
|
||||
<file>webapi/doc/swagger/include/AMDemod.yaml</file>
|
||||
<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/RtlSdr.yaml</file>
|
||||
|
@ -755,6 +755,69 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "AMDemod"
|
||||
};
|
||||
defs.AMModReport = {
|
||||
"properties" : {
|
||||
"channelPowerDB" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "power transmitted in channel (dB)"
|
||||
},
|
||||
"audioSampleRate" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"channelSampleRate" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "AMMod"
|
||||
};
|
||||
defs.AMModSettings = {
|
||||
"properties" : {
|
||||
"inputFrequencyOffset" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"rfBandwidth" : {
|
||||
"type" : "number",
|
||||
"format" : "float"
|
||||
},
|
||||
"modFactor" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "modulation factor from 0.0 to 1.0"
|
||||
},
|
||||
"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" : "AMMod"
|
||||
};
|
||||
defs.AirspyHFSettings = {
|
||||
"properties" : {
|
||||
@ -1058,6 +1121,9 @@ margin-bottom: 20px;
|
||||
"AMDemodReport" : {
|
||||
"$ref" : "#/definitions/AMDemodReport"
|
||||
},
|
||||
"AMModReport" : {
|
||||
"$ref" : "#/definitions/AMModReport"
|
||||
},
|
||||
"NFMDemodReport" : {
|
||||
"$ref" : "#/definitions/NFMDemodReport"
|
||||
},
|
||||
@ -1082,6 +1148,9 @@ margin-bottom: 20px;
|
||||
"AMDemodSettings" : {
|
||||
"$ref" : "#/definitions/AMDemodSettings"
|
||||
},
|
||||
"AMModSettings" : {
|
||||
"$ref" : "#/definitions/AMModSettings"
|
||||
},
|
||||
"NFMDemodSettings" : {
|
||||
"$ref" : "#/definitions/NFMDemodSettings"
|
||||
},
|
||||
@ -1723,6 +1792,9 @@ margin-bottom: 20px;
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"audioDeviceName" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"modAFInput" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
@ -20190,7 +20262,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-04-04T22:16:33.651+02:00
|
||||
Generated 2018-04-06T00:10:47.664+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
46
sdrbase/resources/webapi/doc/swagger/include/AMMod.yaml
Normal file
46
sdrbase/resources/webapi/doc/swagger/include/AMMod.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
AMModSettings:
|
||||
description: AMMod
|
||||
properties:
|
||||
inputFrequencyOffset:
|
||||
type: integer
|
||||
format: int64
|
||||
rfBandwidth:
|
||||
type: number
|
||||
format: float
|
||||
modFactor:
|
||||
description: modulation factor from 0.0 to 1.0
|
||||
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"
|
||||
|
||||
AMModReport:
|
||||
description: AMMod
|
||||
properties:
|
||||
channelPowerDB:
|
||||
description: power transmitted in channel (dB)
|
||||
type: number
|
||||
format: float
|
||||
audioSampleRate:
|
||||
type: integer
|
||||
channelSampleRate:
|
||||
type: integer
|
||||
|
@ -31,6 +31,8 @@ NFMModSettings:
|
||||
type: integer
|
||||
title:
|
||||
type: string
|
||||
audioDeviceName:
|
||||
type: string
|
||||
modAFInput:
|
||||
type: integer
|
||||
cwKeyer:
|
||||
|
@ -1747,6 +1747,8 @@ definitions:
|
||||
type: integer
|
||||
AMDemodSettings:
|
||||
$ref: "/doc/swagger/include/AMDemod.yaml#/AMDemodSettings"
|
||||
AMModSettings:
|
||||
$ref: "/doc/swagger/include/AMMod.yaml#/AMModSettings"
|
||||
NFMDemodSettings:
|
||||
$ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodSettings"
|
||||
NFMModSettings:
|
||||
@ -1764,6 +1766,8 @@ definitions:
|
||||
type: integer
|
||||
AMDemodReport:
|
||||
$ref: "/doc/swagger/include/AMDemod.yaml#/AMDemodReport"
|
||||
AMModReport:
|
||||
$ref: "/doc/swagger/include/AMMod.yaml#/AMModReport"
|
||||
NFMDemodReport:
|
||||
$ref: "/doc/swagger/include/NFMDemod.yaml#/NFMDemodReport"
|
||||
NFMModReport:
|
||||
|
@ -1840,6 +1840,27 @@ bool WebAPIRequestMapper::validateChannelSettings(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "AMMod")
|
||||
{
|
||||
if (channelSettings.getTx() != 0)
|
||||
{
|
||||
QJsonObject amModSettingsJsonObject = jsonObject["AMModSettings"].toObject();
|
||||
channelSettingsKeys = amModSettingsJsonObject.keys();
|
||||
|
||||
if (channelSettingsKeys.contains("cwKeyer"))
|
||||
{
|
||||
QJsonObject cwKeyerSettingsJsonObject;
|
||||
appendSettingsSubKeys(amModSettingsJsonObject, cwKeyerSettingsJsonObject, "cwKeyer", channelSettingsKeys);
|
||||
}
|
||||
|
||||
channelSettings.setAmModSettings(new SWGSDRangel::SWGAMModSettings());
|
||||
channelSettings.getAmModSettings()->fromJsonObject(amModSettingsJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "NFMDemod")
|
||||
{
|
||||
if (channelSettings.getTx() == 0)
|
||||
@ -1914,6 +1935,20 @@ bool WebAPIRequestMapper::validateChannelReport(
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "AMMod")
|
||||
{
|
||||
if (channelReport.getTx() != 0)
|
||||
{
|
||||
QJsonObject amModReportJsonObject = jsonObject["AMModReport"].toObject();
|
||||
channelReportKeys = amModReportJsonObject.keys();
|
||||
channelReport.setAmModReport(new SWGSDRangel::SWGAMModReport());
|
||||
channelReport.getAmModReport()->fromJsonObject(amModReportJsonObject);
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (*channelType == "NFMDemod")
|
||||
{
|
||||
if (channelReport.getTx() == 0)
|
||||
|
46
swagger/sdrangel/api/swagger/include/AMMod.yaml
Normal file
46
swagger/sdrangel/api/swagger/include/AMMod.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
AMModSettings:
|
||||
description: AMMod
|
||||
properties:
|
||||
inputFrequencyOffset:
|
||||
type: integer
|
||||
format: int64
|
||||
rfBandwidth:
|
||||
type: number
|
||||
format: float
|
||||
modFactor:
|
||||
description: modulation factor from 0.0 to 1.0
|
||||
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"
|
||||
|
||||
AMModReport:
|
||||
description: AMMod
|
||||
properties:
|
||||
channelPowerDB:
|
||||
description: power transmitted in channel (dB)
|
||||
type: number
|
||||
format: float
|
||||
audioSampleRate:
|
||||
type: integer
|
||||
channelSampleRate:
|
||||
type: integer
|
||||
|
@ -31,6 +31,8 @@ NFMModSettings:
|
||||
type: integer
|
||||
title:
|
||||
type: string
|
||||
audioDeviceName:
|
||||
type: string
|
||||
modAFInput:
|
||||
type: integer
|
||||
cwKeyer:
|
||||
|
@ -1747,6 +1747,8 @@ definitions:
|
||||
type: integer
|
||||
AMDemodSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/AMDemod.yaml#/AMDemodSettings"
|
||||
AMModSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/AMMod.yaml#/AMModSettings"
|
||||
NFMDemodSettings:
|
||||
$ref: "http://localhost:8081/api/swagger/include/NFMDemod.yaml#/NFMDemodSettings"
|
||||
NFMModSettings:
|
||||
@ -1764,6 +1766,8 @@ definitions:
|
||||
type: integer
|
||||
AMDemodReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/AMDemod.yaml#/AMDemodReport"
|
||||
AMModReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/AMMod.yaml#/AMModReport"
|
||||
NFMDemodReport:
|
||||
$ref: "http://localhost:8081/api/swagger/include/NFMDemod.yaml#/NFMDemodReport"
|
||||
NFMModReport:
|
||||
|
@ -755,6 +755,69 @@ margin-bottom: 20px;
|
||||
}
|
||||
},
|
||||
"description" : "AMDemod"
|
||||
};
|
||||
defs.AMModReport = {
|
||||
"properties" : {
|
||||
"channelPowerDB" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "power transmitted in channel (dB)"
|
||||
},
|
||||
"audioSampleRate" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"channelSampleRate" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "AMMod"
|
||||
};
|
||||
defs.AMModSettings = {
|
||||
"properties" : {
|
||||
"inputFrequencyOffset" : {
|
||||
"type" : "integer",
|
||||
"format" : "int64"
|
||||
},
|
||||
"rfBandwidth" : {
|
||||
"type" : "number",
|
||||
"format" : "float"
|
||||
},
|
||||
"modFactor" : {
|
||||
"type" : "number",
|
||||
"format" : "float",
|
||||
"description" : "modulation factor from 0.0 to 1.0"
|
||||
},
|
||||
"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" : "AMMod"
|
||||
};
|
||||
defs.AirspyHFSettings = {
|
||||
"properties" : {
|
||||
@ -1058,6 +1121,9 @@ margin-bottom: 20px;
|
||||
"AMDemodReport" : {
|
||||
"$ref" : "#/definitions/AMDemodReport"
|
||||
},
|
||||
"AMModReport" : {
|
||||
"$ref" : "#/definitions/AMModReport"
|
||||
},
|
||||
"NFMDemodReport" : {
|
||||
"$ref" : "#/definitions/NFMDemodReport"
|
||||
},
|
||||
@ -1082,6 +1148,9 @@ margin-bottom: 20px;
|
||||
"AMDemodSettings" : {
|
||||
"$ref" : "#/definitions/AMDemodSettings"
|
||||
},
|
||||
"AMModSettings" : {
|
||||
"$ref" : "#/definitions/AMModSettings"
|
||||
},
|
||||
"NFMDemodSettings" : {
|
||||
"$ref" : "#/definitions/NFMDemodSettings"
|
||||
},
|
||||
@ -1723,6 +1792,9 @@ margin-bottom: 20px;
|
||||
"title" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"audioDeviceName" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"modAFInput" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
@ -20190,7 +20262,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-04-04T22:16:33.651+02:00
|
||||
Generated 2018-04-06T00:10:47.664+02:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
148
swagger/sdrangel/code/qt5/client/SWGAMModReport.cpp
Normal file
148
swagger/sdrangel/code/qt5/client/SWGAMModReport.cpp
Normal 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 "SWGAMModReport.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGAMModReport::SWGAMModReport(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGAMModReport::SWGAMModReport() {
|
||||
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;
|
||||
}
|
||||
|
||||
SWGAMModReport::~SWGAMModReport() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGAMModReport::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
|
||||
SWGAMModReport::cleanup() {
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGAMModReport*
|
||||
SWGAMModReport::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGAMModReport::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
|
||||
SWGAMModReport::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGAMModReport::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
|
||||
SWGAMModReport::getChannelPowerDb() {
|
||||
return channel_power_db;
|
||||
}
|
||||
void
|
||||
SWGAMModReport::setChannelPowerDb(float channel_power_db) {
|
||||
this->channel_power_db = channel_power_db;
|
||||
this->m_channel_power_db_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMModReport::getAudioSampleRate() {
|
||||
return audio_sample_rate;
|
||||
}
|
||||
void
|
||||
SWGAMModReport::setAudioSampleRate(qint32 audio_sample_rate) {
|
||||
this->audio_sample_rate = audio_sample_rate;
|
||||
this->m_audio_sample_rate_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMModReport::getChannelSampleRate() {
|
||||
return channel_sample_rate;
|
||||
}
|
||||
void
|
||||
SWGAMModReport::setChannelSampleRate(qint32 channel_sample_rate) {
|
||||
this->channel_sample_rate = channel_sample_rate;
|
||||
this->m_channel_sample_rate_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGAMModReport::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;
|
||||
}
|
||||
}
|
||||
|
70
swagger/sdrangel/code/qt5/client/SWGAMModReport.h
Normal file
70
swagger/sdrangel/code/qt5/client/SWGAMModReport.h
Normal 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGAMModReport.h
|
||||
*
|
||||
* AMMod
|
||||
*/
|
||||
|
||||
#ifndef SWGAMModReport_H_
|
||||
#define SWGAMModReport_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGAMModReport: public SWGObject {
|
||||
public:
|
||||
SWGAMModReport();
|
||||
SWGAMModReport(QString* json);
|
||||
virtual ~SWGAMModReport();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGAMModReport* 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 /* SWGAMModReport_H_ */
|
343
swagger/sdrangel/code/qt5/client/SWGAMModSettings.cpp
Normal file
343
swagger/sdrangel/code/qt5/client/SWGAMModSettings.cpp
Normal file
@ -0,0 +1,343 @@
|
||||
/**
|
||||
* 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 "SWGAMModSettings.h"
|
||||
|
||||
#include "SWGHelpers.h"
|
||||
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QObject>
|
||||
#include <QDebug>
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
SWGAMModSettings::SWGAMModSettings(QString* json) {
|
||||
init();
|
||||
this->fromJson(*json);
|
||||
}
|
||||
|
||||
SWGAMModSettings::SWGAMModSettings() {
|
||||
input_frequency_offset = 0L;
|
||||
m_input_frequency_offset_isSet = false;
|
||||
rf_bandwidth = 0.0f;
|
||||
m_rf_bandwidth_isSet = false;
|
||||
mod_factor = 0.0f;
|
||||
m_mod_factor_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;
|
||||
}
|
||||
|
||||
SWGAMModSettings::~SWGAMModSettings() {
|
||||
this->cleanup();
|
||||
}
|
||||
|
||||
void
|
||||
SWGAMModSettings::init() {
|
||||
input_frequency_offset = 0L;
|
||||
m_input_frequency_offset_isSet = false;
|
||||
rf_bandwidth = 0.0f;
|
||||
m_rf_bandwidth_isSet = false;
|
||||
mod_factor = 0.0f;
|
||||
m_mod_factor_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
|
||||
SWGAMModSettings::cleanup() {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(title != nullptr) {
|
||||
delete title;
|
||||
}
|
||||
if(audio_device_name != nullptr) {
|
||||
delete audio_device_name;
|
||||
}
|
||||
|
||||
if(cw_keyer != nullptr) {
|
||||
delete cw_keyer;
|
||||
}
|
||||
}
|
||||
|
||||
SWGAMModSettings*
|
||||
SWGAMModSettings::fromJson(QString &json) {
|
||||
QByteArray array (json.toStdString().c_str());
|
||||
QJsonDocument doc = QJsonDocument::fromJson(array);
|
||||
QJsonObject jsonObject = doc.object();
|
||||
this->fromJsonObject(jsonObject);
|
||||
return this;
|
||||
}
|
||||
|
||||
void
|
||||
SWGAMModSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
|
||||
|
||||
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
|
||||
|
||||
::SWGSDRangel::setValue(&mod_factor, pJson["modFactor"], "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
|
||||
SWGAMModSettings::asJson ()
|
||||
{
|
||||
QJsonObject* obj = this->asJsonObject();
|
||||
|
||||
QJsonDocument doc(*obj);
|
||||
QByteArray bytes = doc.toJson();
|
||||
delete obj;
|
||||
return QString(bytes);
|
||||
}
|
||||
|
||||
QJsonObject*
|
||||
SWGAMModSettings::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_mod_factor_isSet){
|
||||
obj->insert("modFactor", QJsonValue(mod_factor));
|
||||
}
|
||||
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
|
||||
SWGAMModSettings::getInputFrequencyOffset() {
|
||||
return input_frequency_offset;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setInputFrequencyOffset(qint64 input_frequency_offset) {
|
||||
this->input_frequency_offset = input_frequency_offset;
|
||||
this->m_input_frequency_offset_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGAMModSettings::getRfBandwidth() {
|
||||
return rf_bandwidth;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setRfBandwidth(float rf_bandwidth) {
|
||||
this->rf_bandwidth = rf_bandwidth;
|
||||
this->m_rf_bandwidth_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGAMModSettings::getModFactor() {
|
||||
return mod_factor;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setModFactor(float mod_factor) {
|
||||
this->mod_factor = mod_factor;
|
||||
this->m_mod_factor_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGAMModSettings::getToneFrequency() {
|
||||
return tone_frequency;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setToneFrequency(float tone_frequency) {
|
||||
this->tone_frequency = tone_frequency;
|
||||
this->m_tone_frequency_isSet = true;
|
||||
}
|
||||
|
||||
float
|
||||
SWGAMModSettings::getVolumeFactor() {
|
||||
return volume_factor;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setVolumeFactor(float volume_factor) {
|
||||
this->volume_factor = volume_factor;
|
||||
this->m_volume_factor_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMModSettings::getChannelMute() {
|
||||
return channel_mute;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setChannelMute(qint32 channel_mute) {
|
||||
this->channel_mute = channel_mute;
|
||||
this->m_channel_mute_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMModSettings::getPlayLoop() {
|
||||
return play_loop;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setPlayLoop(qint32 play_loop) {
|
||||
this->play_loop = play_loop;
|
||||
this->m_play_loop_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMModSettings::getRgbColor() {
|
||||
return rgb_color;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setRgbColor(qint32 rgb_color) {
|
||||
this->rgb_color = rgb_color;
|
||||
this->m_rgb_color_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGAMModSettings::getTitle() {
|
||||
return title;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setTitle(QString* title) {
|
||||
this->title = title;
|
||||
this->m_title_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGAMModSettings::getAudioDeviceName() {
|
||||
return audio_device_name;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setAudioDeviceName(QString* audio_device_name) {
|
||||
this->audio_device_name = audio_device_name;
|
||||
this->m_audio_device_name_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMModSettings::getModAfInput() {
|
||||
return mod_af_input;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setModAfInput(qint32 mod_af_input) {
|
||||
this->mod_af_input = mod_af_input;
|
||||
this->m_mod_af_input_isSet = true;
|
||||
}
|
||||
|
||||
SWGCWKeyerSettings*
|
||||
SWGAMModSettings::getCwKeyer() {
|
||||
return cw_keyer;
|
||||
}
|
||||
void
|
||||
SWGAMModSettings::setCwKeyer(SWGCWKeyerSettings* cw_keyer) {
|
||||
this->cw_keyer = cw_keyer;
|
||||
this->m_cw_keyer_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGAMModSettings::isSet(){
|
||||
bool isObjectUpdated = false;
|
||||
do{
|
||||
if(m_input_frequency_offset_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_rf_bandwidth_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_mod_factor_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;
|
||||
}
|
||||
}
|
||||
|
126
swagger/sdrangel/code/qt5/client/SWGAMModSettings.h
Normal file
126
swagger/sdrangel/code/qt5/client/SWGAMModSettings.h
Normal file
@ -0,0 +1,126 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SWGAMModSettings.h
|
||||
*
|
||||
* AMMod
|
||||
*/
|
||||
|
||||
#ifndef SWGAMModSettings_H_
|
||||
#define SWGAMModSettings_H_
|
||||
|
||||
#include <QJsonObject>
|
||||
|
||||
|
||||
#include "SWGCWKeyerSettings.h"
|
||||
#include <QString>
|
||||
|
||||
#include "SWGObject.h"
|
||||
#include "export.h"
|
||||
|
||||
namespace SWGSDRangel {
|
||||
|
||||
class SWG_API SWGAMModSettings: public SWGObject {
|
||||
public:
|
||||
SWGAMModSettings();
|
||||
SWGAMModSettings(QString* json);
|
||||
virtual ~SWGAMModSettings();
|
||||
void init();
|
||||
void cleanup();
|
||||
|
||||
virtual QString asJson () override;
|
||||
virtual QJsonObject* asJsonObject() override;
|
||||
virtual void fromJsonObject(QJsonObject &json) override;
|
||||
virtual SWGAMModSettings* fromJson(QString &jsonString) override;
|
||||
|
||||
qint64 getInputFrequencyOffset();
|
||||
void setInputFrequencyOffset(qint64 input_frequency_offset);
|
||||
|
||||
float getRfBandwidth();
|
||||
void setRfBandwidth(float rf_bandwidth);
|
||||
|
||||
float getModFactor();
|
||||
void setModFactor(float mod_factor);
|
||||
|
||||
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 mod_factor;
|
||||
bool m_mod_factor_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 /* SWGAMModSettings_H_ */
|
@ -34,6 +34,8 @@ SWGChannelReport::SWGChannelReport() {
|
||||
m_tx_isSet = false;
|
||||
am_demod_report = nullptr;
|
||||
m_am_demod_report_isSet = false;
|
||||
am_mod_report = nullptr;
|
||||
m_am_mod_report_isSet = false;
|
||||
nfm_demod_report = nullptr;
|
||||
m_nfm_demod_report_isSet = false;
|
||||
nfm_mod_report = nullptr;
|
||||
@ -52,6 +54,8 @@ SWGChannelReport::init() {
|
||||
m_tx_isSet = false;
|
||||
am_demod_report = new SWGAMDemodReport();
|
||||
m_am_demod_report_isSet = false;
|
||||
am_mod_report = new SWGAMModReport();
|
||||
m_am_mod_report_isSet = false;
|
||||
nfm_demod_report = new SWGNFMDemodReport();
|
||||
m_nfm_demod_report_isSet = false;
|
||||
nfm_mod_report = new SWGNFMModReport();
|
||||
@ -67,6 +71,9 @@ SWGChannelReport::cleanup() {
|
||||
if(am_demod_report != nullptr) {
|
||||
delete am_demod_report;
|
||||
}
|
||||
if(am_mod_report != nullptr) {
|
||||
delete am_mod_report;
|
||||
}
|
||||
if(nfm_demod_report != nullptr) {
|
||||
delete nfm_demod_report;
|
||||
}
|
||||
@ -92,6 +99,8 @@ SWGChannelReport::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&am_demod_report, pJson["AMDemodReport"], "SWGAMDemodReport", "SWGAMDemodReport");
|
||||
|
||||
::SWGSDRangel::setValue(&am_mod_report, pJson["AMModReport"], "SWGAMModReport", "SWGAMModReport");
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_demod_report, pJson["NFMDemodReport"], "SWGNFMDemodReport", "SWGNFMDemodReport");
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_mod_report, pJson["NFMModReport"], "SWGNFMModReport", "SWGNFMModReport");
|
||||
@ -121,6 +130,9 @@ SWGChannelReport::asJsonObject() {
|
||||
if((am_demod_report != nullptr) && (am_demod_report->isSet())){
|
||||
toJsonValue(QString("AMDemodReport"), am_demod_report, obj, QString("SWGAMDemodReport"));
|
||||
}
|
||||
if((am_mod_report != nullptr) && (am_mod_report->isSet())){
|
||||
toJsonValue(QString("AMModReport"), am_mod_report, obj, QString("SWGAMModReport"));
|
||||
}
|
||||
if((nfm_demod_report != nullptr) && (nfm_demod_report->isSet())){
|
||||
toJsonValue(QString("NFMDemodReport"), nfm_demod_report, obj, QString("SWGNFMDemodReport"));
|
||||
}
|
||||
@ -161,6 +173,16 @@ SWGChannelReport::setAmDemodReport(SWGAMDemodReport* am_demod_report) {
|
||||
this->m_am_demod_report_isSet = true;
|
||||
}
|
||||
|
||||
SWGAMModReport*
|
||||
SWGChannelReport::getAmModReport() {
|
||||
return am_mod_report;
|
||||
}
|
||||
void
|
||||
SWGChannelReport::setAmModReport(SWGAMModReport* am_mod_report) {
|
||||
this->am_mod_report = am_mod_report;
|
||||
this->m_am_mod_report_isSet = true;
|
||||
}
|
||||
|
||||
SWGNFMDemodReport*
|
||||
SWGChannelReport::getNfmDemodReport() {
|
||||
return nfm_demod_report;
|
||||
@ -189,6 +211,7 @@ SWGChannelReport::isSet(){
|
||||
if(channel_type != nullptr && *channel_type != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_tx_isSet){ isObjectUpdated = true; break;}
|
||||
if(am_demod_report != nullptr && am_demod_report->isSet()){ isObjectUpdated = true; break;}
|
||||
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;}
|
||||
}while(false);
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
|
||||
#include "SWGAMDemodReport.h"
|
||||
#include "SWGAMModReport.h"
|
||||
#include "SWGNFMDemodReport.h"
|
||||
#include "SWGNFMModReport.h"
|
||||
#include <QString>
|
||||
@ -54,6 +55,9 @@ public:
|
||||
SWGAMDemodReport* getAmDemodReport();
|
||||
void setAmDemodReport(SWGAMDemodReport* am_demod_report);
|
||||
|
||||
SWGAMModReport* getAmModReport();
|
||||
void setAmModReport(SWGAMModReport* am_mod_report);
|
||||
|
||||
SWGNFMDemodReport* getNfmDemodReport();
|
||||
void setNfmDemodReport(SWGNFMDemodReport* nfm_demod_report);
|
||||
|
||||
@ -73,6 +77,9 @@ private:
|
||||
SWGAMDemodReport* am_demod_report;
|
||||
bool m_am_demod_report_isSet;
|
||||
|
||||
SWGAMModReport* am_mod_report;
|
||||
bool m_am_mod_report_isSet;
|
||||
|
||||
SWGNFMDemodReport* nfm_demod_report;
|
||||
bool m_nfm_demod_report_isSet;
|
||||
|
||||
|
@ -34,6 +34,8 @@ SWGChannelSettings::SWGChannelSettings() {
|
||||
m_tx_isSet = false;
|
||||
am_demod_settings = nullptr;
|
||||
m_am_demod_settings_isSet = false;
|
||||
am_mod_settings = nullptr;
|
||||
m_am_mod_settings_isSet = false;
|
||||
nfm_demod_settings = nullptr;
|
||||
m_nfm_demod_settings_isSet = false;
|
||||
nfm_mod_settings = nullptr;
|
||||
@ -52,6 +54,8 @@ SWGChannelSettings::init() {
|
||||
m_tx_isSet = false;
|
||||
am_demod_settings = new SWGAMDemodSettings();
|
||||
m_am_demod_settings_isSet = false;
|
||||
am_mod_settings = new SWGAMModSettings();
|
||||
m_am_mod_settings_isSet = false;
|
||||
nfm_demod_settings = new SWGNFMDemodSettings();
|
||||
m_nfm_demod_settings_isSet = false;
|
||||
nfm_mod_settings = new SWGNFMModSettings();
|
||||
@ -67,6 +71,9 @@ SWGChannelSettings::cleanup() {
|
||||
if(am_demod_settings != nullptr) {
|
||||
delete am_demod_settings;
|
||||
}
|
||||
if(am_mod_settings != nullptr) {
|
||||
delete am_mod_settings;
|
||||
}
|
||||
if(nfm_demod_settings != nullptr) {
|
||||
delete nfm_demod_settings;
|
||||
}
|
||||
@ -92,6 +99,8 @@ SWGChannelSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&am_demod_settings, pJson["AMDemodSettings"], "SWGAMDemodSettings", "SWGAMDemodSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&am_mod_settings, pJson["AMModSettings"], "SWGAMModSettings", "SWGAMModSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_demod_settings, pJson["NFMDemodSettings"], "SWGNFMDemodSettings", "SWGNFMDemodSettings");
|
||||
|
||||
::SWGSDRangel::setValue(&nfm_mod_settings, pJson["NFMModSettings"], "SWGNFMModSettings", "SWGNFMModSettings");
|
||||
@ -121,6 +130,9 @@ SWGChannelSettings::asJsonObject() {
|
||||
if((am_demod_settings != nullptr) && (am_demod_settings->isSet())){
|
||||
toJsonValue(QString("AMDemodSettings"), am_demod_settings, obj, QString("SWGAMDemodSettings"));
|
||||
}
|
||||
if((am_mod_settings != nullptr) && (am_mod_settings->isSet())){
|
||||
toJsonValue(QString("AMModSettings"), am_mod_settings, obj, QString("SWGAMModSettings"));
|
||||
}
|
||||
if((nfm_demod_settings != nullptr) && (nfm_demod_settings->isSet())){
|
||||
toJsonValue(QString("NFMDemodSettings"), nfm_demod_settings, obj, QString("SWGNFMDemodSettings"));
|
||||
}
|
||||
@ -161,6 +173,16 @@ SWGChannelSettings::setAmDemodSettings(SWGAMDemodSettings* am_demod_settings) {
|
||||
this->m_am_demod_settings_isSet = true;
|
||||
}
|
||||
|
||||
SWGAMModSettings*
|
||||
SWGChannelSettings::getAmModSettings() {
|
||||
return am_mod_settings;
|
||||
}
|
||||
void
|
||||
SWGChannelSettings::setAmModSettings(SWGAMModSettings* am_mod_settings) {
|
||||
this->am_mod_settings = am_mod_settings;
|
||||
this->m_am_mod_settings_isSet = true;
|
||||
}
|
||||
|
||||
SWGNFMDemodSettings*
|
||||
SWGChannelSettings::getNfmDemodSettings() {
|
||||
return nfm_demod_settings;
|
||||
@ -189,6 +211,7 @@ SWGChannelSettings::isSet(){
|
||||
if(channel_type != nullptr && *channel_type != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_tx_isSet){ isObjectUpdated = true; break;}
|
||||
if(am_demod_settings != nullptr && am_demod_settings->isSet()){ isObjectUpdated = true; break;}
|
||||
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;}
|
||||
}while(false);
|
||||
|
@ -23,6 +23,7 @@
|
||||
|
||||
|
||||
#include "SWGAMDemodSettings.h"
|
||||
#include "SWGAMModSettings.h"
|
||||
#include "SWGNFMDemodSettings.h"
|
||||
#include "SWGNFMModSettings.h"
|
||||
#include <QString>
|
||||
@ -54,6 +55,9 @@ public:
|
||||
SWGAMDemodSettings* getAmDemodSettings();
|
||||
void setAmDemodSettings(SWGAMDemodSettings* am_demod_settings);
|
||||
|
||||
SWGAMModSettings* getAmModSettings();
|
||||
void setAmModSettings(SWGAMModSettings* am_mod_settings);
|
||||
|
||||
SWGNFMDemodSettings* getNfmDemodSettings();
|
||||
void setNfmDemodSettings(SWGNFMDemodSettings* nfm_demod_settings);
|
||||
|
||||
@ -73,6 +77,9 @@ private:
|
||||
SWGAMDemodSettings* am_demod_settings;
|
||||
bool m_am_demod_settings_isSet;
|
||||
|
||||
SWGAMModSettings* am_mod_settings;
|
||||
bool m_am_mod_settings_isSet;
|
||||
|
||||
SWGNFMDemodSettings* nfm_demod_settings;
|
||||
bool m_nfm_demod_settings_isSet;
|
||||
|
||||
|
@ -16,6 +16,8 @@
|
||||
|
||||
#include "SWGAMDemodReport.h"
|
||||
#include "SWGAMDemodSettings.h"
|
||||
#include "SWGAMModReport.h"
|
||||
#include "SWGAMModSettings.h"
|
||||
#include "SWGAirspyHFSettings.h"
|
||||
#include "SWGAudioDevices.h"
|
||||
#include "SWGAudioInputDevice.h"
|
||||
@ -70,6 +72,12 @@ namespace SWGSDRangel {
|
||||
if(QString("SWGAMDemodSettings").compare(type) == 0) {
|
||||
return new SWGAMDemodSettings();
|
||||
}
|
||||
if(QString("SWGAMModReport").compare(type) == 0) {
|
||||
return new SWGAMModReport();
|
||||
}
|
||||
if(QString("SWGAMModSettings").compare(type) == 0) {
|
||||
return new SWGAMModSettings();
|
||||
}
|
||||
if(QString("SWGAirspyHFSettings").compare(type) == 0) {
|
||||
return new SWGAirspyHFSettings();
|
||||
}
|
||||
|
@ -52,6 +52,8 @@ SWGNFMModSettings::SWGNFMModSettings() {
|
||||
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;
|
||||
@ -88,6 +90,8 @@ SWGNFMModSettings::init() {
|
||||
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();
|
||||
@ -110,6 +114,9 @@ SWGNFMModSettings::cleanup() {
|
||||
if(title != nullptr) {
|
||||
delete title;
|
||||
}
|
||||
if(audio_device_name != nullptr) {
|
||||
delete audio_device_name;
|
||||
}
|
||||
|
||||
if(cw_keyer != nullptr) {
|
||||
delete cw_keyer;
|
||||
@ -151,6 +158,8 @@ SWGNFMModSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::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");
|
||||
@ -207,6 +216,9 @@ SWGNFMModSettings::asJsonObject() {
|
||||
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));
|
||||
}
|
||||
@ -337,6 +349,16 @@ SWGNFMModSettings::setTitle(QString* title) {
|
||||
this->m_title_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGNFMModSettings::getAudioDeviceName() {
|
||||
return audio_device_name;
|
||||
}
|
||||
void
|
||||
SWGNFMModSettings::setAudioDeviceName(QString* audio_device_name) {
|
||||
this->audio_device_name = audio_device_name;
|
||||
this->m_audio_device_name_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGNFMModSettings::getModAfInput() {
|
||||
return mod_af_input;
|
||||
@ -374,6 +396,7 @@ SWGNFMModSettings::isSet(){
|
||||
if(m_ctcss_index_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);
|
||||
|
@ -79,6 +79,9 @@ public:
|
||||
QString* getTitle();
|
||||
void setTitle(QString* title);
|
||||
|
||||
QString* getAudioDeviceName();
|
||||
void setAudioDeviceName(QString* audio_device_name);
|
||||
|
||||
qint32 getModAfInput();
|
||||
void setModAfInput(qint32 mod_af_input);
|
||||
|
||||
@ -125,6 +128,9 @@ private:
|
||||
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;
|
||||
|
||||
|
@ -4,6 +4,7 @@ import requests, json, traceback, sys
|
||||
from optparse import OptionParser
|
||||
|
||||
base_url = "http://127.0.0.1:8091/sdrangel"
|
||||
deviceset_url = ""
|
||||
|
||||
requests_methods = {
|
||||
"GET": requests.get,
|
||||
@ -20,6 +21,7 @@ def getInputOptions():
|
||||
parser.add_option("-a", "--address", dest="address", help="address and port", metavar="ADDRESS", type="string")
|
||||
parser.add_option("-d", "--device-index", dest="device_index", help="device set index", metavar="INDEX", type="int")
|
||||
parser.add_option("-D", "--device-hwid", dest="device_hwid", help="device hardware id", metavar="HWID", type="string")
|
||||
parser.add_option("-C", "--channel-id", dest="channel_id", help="channel id", metavar="ID", type="string", default="NFMDemod")
|
||||
parser.add_option("-F", "--device-freq", dest="device_freq", help="device center frequency (kHz)", metavar="FREQ", type="int")
|
||||
parser.add_option("-f", "--channel-freq", dest="channel_freq", help="channel center frequency (Hz)", metavar="FREQ", type="int")
|
||||
parser.add_option("-s", "--sample-rate", dest="sample_rate", help="host to device sample rate (kS/s)", metavar="RATE", type="int")
|
||||
@ -74,6 +76,98 @@ def callAPI(url, method, params, json, text):
|
||||
printResponse(r)
|
||||
return None
|
||||
|
||||
# ======================================================================
|
||||
def setupBladeRFXB200(fc):
|
||||
if fc < 50000:
|
||||
return 5 # BLADERF_XB200_AUTO_3DB
|
||||
elif fc < 54000:
|
||||
return 0 # BLADERF_XB200_50M
|
||||
elif fc < 144000:
|
||||
return 5 # BLADERF_XB200_AUTO_3DB
|
||||
elif fc < 148000:
|
||||
return 1 # BLADERF_XB200_144M
|
||||
elif fc < 222000:
|
||||
return 5 # BLADERF_XB200_AUTO_3DB
|
||||
elif fc < 225000:
|
||||
return 2 # BLADERF_XB200_222M
|
||||
else:
|
||||
return 5 # BLADERF_XB200_AUTO_3DB
|
||||
|
||||
# ======================================================================
|
||||
def setupDevice(options):
|
||||
settings = callAPI(deviceset_url + "/device/settings", "GET", None, None, "Get device settings")
|
||||
if settings is None:
|
||||
exit(-1)
|
||||
|
||||
print(options.sample_rate)
|
||||
|
||||
if options.device_hwid == "BladeRF":
|
||||
settings['bladeRFOutputSettings']['centerFrequency'] = options.device_freq*1000
|
||||
settings['bladeRFOutputSettings']['devSampleRate'] = options.sample_rate*1000
|
||||
settings['bladeRFOutputSettings']['vga1'] = -20
|
||||
settings['bladeRFOutputSettings']['vga2'] = 6
|
||||
settings['bladeRFOutputSettings']['bandwidth'] = 1500*1000
|
||||
settings['bladeRFOutputSettings']['log2Interp'] = 4
|
||||
settings['bladeRFOutputSettings']['xb200'] = 1 # assume XB200 is mounted
|
||||
settings['bladeRFOutputSettings']['xb200Path'] = 1 if options.device_freq < 300000 else 0
|
||||
settings['bladeRFOutputSettings']['xb200Filter'] = setupBladeRFXB200(options.device_freq)
|
||||
elif options.device_hwid == "LimeSDR":
|
||||
settings["limeSdrOutputSettings"]["antennaPath"] = options.antenna_path
|
||||
settings["limeSdrOutputSettings"]["devSampleRate"] = options.sample_rate*1000
|
||||
settings["limeSdrOutputSettings"]["log2HardInterp"] = 4
|
||||
settings["limeSdrOutputSettings"]["log2SoftInterp"] = 4
|
||||
settings["limeSdrOutputSettings"]["centerFrequency"] = options.device_freq*1000 + 500000
|
||||
settings["limeSdrOutputSettings"]["ncoEnable"] = 1
|
||||
settings["limeSdrOutputSettings"]["ncoFrequency"] = -500000
|
||||
settings["limeSdrOutputSettings"]["lpfBW"] = 4050000
|
||||
settings["limeSdrOutputSettings"]["lpfFIRBW"] = 100000
|
||||
settings["limeSdrOutputSettings"]["lpfFIREnable"] = 1
|
||||
elif options.device_hwid == "HackRF":
|
||||
settings['hackRFOutputSettings']['LOppmTenths'] = -51
|
||||
settings['hackRFOutputSettings']['centerFrequency'] = options.device_freq*1000
|
||||
settings['hackRFOutputSettings']['devSampleRate'] = options.sample_rate*1000
|
||||
settings['hackRFOutputSettings']['lnaExt'] = 0
|
||||
settings['hackRFOutputSettings']['log2Interp'] = 4
|
||||
settings['hackRFOutputSettings']['vgaGain'] = 24
|
||||
|
||||
r = callAPI(deviceset_url + "/device/settings", "PATCH", None, settings, "Patch device settings")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
|
||||
# ======================================================================
|
||||
def setupChannel(options):
|
||||
r = callAPI(deviceset_url + "/channel", "POST", None, {"channelType": options.channel_id, "tx": 1}, "Create modulator")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
|
||||
settings = callAPI(deviceset_url + "/channel/0/settings", "GET", None, None, "Get modulator settings")
|
||||
if settings is None:
|
||||
exit(-1)
|
||||
|
||||
if options.channel_id == "NFMMod":
|
||||
settings["NFMModSettings"]["title"] = "Test NFM"
|
||||
settings["NFMModSettings"]["inputFrequencyOffset"] = options.channel_freq
|
||||
settings["NFMModSettings"]["cwKeyer"]["text"] = "VVV DE F4EXB "
|
||||
settings["NFMModSettings"]["cwKeyer"]["loop"] = 1
|
||||
settings["NFMModSettings"]["cwKeyer"]["mode"] = 1 # text
|
||||
settings["NFMModSettings"]["modAFInput"] = 4 # CW text
|
||||
settings["NFMModSettings"]["toneFrequency"] = 600
|
||||
elif options.channel_id == "AMMod":
|
||||
settings["AMModSettings"]["title"] = "Test AM"
|
||||
settings["AMModSettings"]["inputFrequencyOffset"] = options.channel_freq
|
||||
settings["AMModSettings"]["cwKeyer"]["text"] = "VVV DE F4EXB "
|
||||
settings["AMModSettings"]["cwKeyer"]["loop"] = 1
|
||||
settings["AMModSettings"]["cwKeyer"]["mode"] = 1 # text
|
||||
settings["AMModSettings"]["modAFInput"] = 4 # CW text
|
||||
settings["AMModSettings"]["toneFrequency"] = 600
|
||||
settings["AMModSettings"]["modFactor"] = 0.9
|
||||
settings["AMModSettings"]["rfBandwidth"] = 7500
|
||||
|
||||
r = callAPI(deviceset_url + "/channel/0/settings", "PATCH", None, settings, "Change modulator")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
|
||||
|
||||
# ======================================================================
|
||||
def main():
|
||||
try:
|
||||
@ -86,61 +180,16 @@ def main():
|
||||
r = callAPI("/deviceset", "POST", {"tx": 1}, None, "Add Tx device set")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
|
||||
|
||||
global deviceset_url
|
||||
deviceset_url = "/deviceset/%d" % options.device_index
|
||||
|
||||
r = callAPI(deviceset_url + "/device", "PUT", None, {"hwType": "%s" % options.device_hwid, "tx": 1}, "setup device on Tx device set")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
|
||||
settings = callAPI(deviceset_url + "/device/settings", "GET", None, None, "Get device settings")
|
||||
if settings is None:
|
||||
exit(-1)
|
||||
|
||||
print(options.sample_rate)
|
||||
|
||||
if options.device_hwid == "LimeSDR":
|
||||
settings["limeSdrOutputSettings"]["antennaPath"] = options.antenna_path
|
||||
settings["limeSdrOutputSettings"]["devSampleRate"] = options.sample_rate*1000
|
||||
settings["limeSdrOutputSettings"]["log2HardInterp"] = 4
|
||||
settings["limeSdrOutputSettings"]["log2SoftInterp"] = 4
|
||||
settings["limeSdrOutputSettings"]["centerFrequency"] = options.device_freq*1000 + 500000
|
||||
settings["limeSdrOutputSettings"]["ncoEnable"] = 1
|
||||
settings["limeSdrOutputSettings"]["ncoFrequency"] = -500000
|
||||
settings["limeSdrOutputSettings"]["lpfBW"] = 4050000
|
||||
settings["limeSdrOutputSettings"]["lpfFIRBW"] = 100000
|
||||
settings["limeSdrOutputSettings"]["lpfFIREnable"] = 1
|
||||
elif options.device_hwid == "HackRF":
|
||||
settings['hackRFOutputSettings']['LOppmTenths'] = -51
|
||||
settings['hackRFOutputSettings']['centerFrequency'] = options.device_freq*1000
|
||||
settings['hackRFOutputSettings']['devSampleRate'] = options.sample_rate*1000
|
||||
settings['hackRFOutputSettings']['lnaExt'] = 0
|
||||
settings['hackRFOutputSettings']['log2Interp'] = 4
|
||||
settings['hackRFOutputSettings']['vgaGain'] = 24
|
||||
|
||||
r = callAPI(deviceset_url + "/device/settings", "PATCH", None, settings, "Patch device settings")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
|
||||
r = callAPI(deviceset_url + "/channel", "POST", None, {"channelType": "NFMMod", "tx": 1}, "Create NFM mod")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
|
||||
settings = callAPI(deviceset_url + "/channel/0/settings", "GET", None, None, "Get NFM mod settings")
|
||||
if settings is None:
|
||||
exit(-1)
|
||||
|
||||
settings["NFMModSettings"]["title"] = "Test NFM"
|
||||
settings["NFMModSettings"]["inputFrequencyOffset"] = options.channel_freq
|
||||
settings["NFMModSettings"]["cwKeyer"]["text"] = "VVV DE F4EXB "
|
||||
settings["NFMModSettings"]["cwKeyer"]["loop"] = 1
|
||||
settings["NFMModSettings"]["cwKeyer"]["mode"] = 1 # text
|
||||
settings["NFMModSettings"]["modAFInput"] = 4 # CW text
|
||||
settings["NFMModSettings"]["toneFrequency"] = 600
|
||||
|
||||
r = callAPI(deviceset_url + "/channel/0/settings", "PATCH", None, settings, "Change NFM mod")
|
||||
if r is None:
|
||||
exit(-1)
|
||||
setupDevice(options)
|
||||
setupChannel(options)
|
||||
|
||||
r = callAPI(deviceset_url + "/device/run", "POST", None, None, "Start running device")
|
||||
if r is None:
|
||||
|
Loading…
Reference in New Issue
Block a user