1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 01:39:05 -05:00

Daemon channel source new plugin (5)

This commit is contained in:
f4exb 2018-09-01 09:53:16 +02:00
parent 2a6752c4cf
commit 3469b91163
9 changed files with 111 additions and 11 deletions

View File

@ -349,7 +349,6 @@ int DaemonSrc::webapiSettingsPutPatch(
if (channelSettingsKeys.contains("dataAddress")) {
settings.m_dataAddress = *response.getSdrDaemonChannelSourceSettings()->getDataAddress();
}
if (channelSettingsKeys.contains("dataPort"))
{
int dataPort = response.getSdrDaemonChannelSourceSettings()->getDataPort();
@ -360,6 +359,12 @@ int DaemonSrc::webapiSettingsPutPatch(
settings.m_dataPort = dataPort;
}
}
if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getSdrDaemonChannelSourceSettings()->getRgbColor();
}
if (channelSettingsKeys.contains("title")) {
settings.m_title = *response.getSdrDaemonChannelSourceSettings()->getTitle();
}
MsgConfigureDaemonSrc *msg = MsgConfigureDaemonSrc::create(settings, force);
m_inputMessageQueue.push(msg);
@ -395,6 +400,13 @@ void DaemonSrc::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& res
}
response.getSdrDaemonChannelSourceSettings()->setDataPort(settings.m_dataPort);
response.getSdrDaemonChannelSourceSettings()->setRgbColor(settings.m_rgbColor);
if (response.getSdrDaemonChannelSourceSettings()->getTitle()) {
*response.getSdrDaemonChannelSourceSettings()->getTitle() = settings.m_title;
} else {
response.getSdrDaemonChannelSourceSettings()->setTitle(new QString(settings.m_title));
}
}
void DaemonSrc::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)

View File

@ -82,9 +82,21 @@ bool DaemonSrcGUI::handleMessage(const Message& message)
{
DaemonSrc::MsgSampleRateNotification& notif = (DaemonSrc::MsgSampleRateNotification&) message;
m_channelMarker.setBandwidth(notif.getSampleRate());
return true;
}
else if (DaemonSrc::MsgConfigureDaemonSrc::match(message))
{
const DaemonSrc::MsgConfigureDaemonSrc& cfg = (DaemonSrc::MsgConfigureDaemonSrc&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else
{
return false;
}
}
DaemonSrcGUI::DaemonSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx __attribute__((unused)), QWidget* parent) :

View File

@ -3215,6 +3215,12 @@ margin-bottom: 20px;
"dataPort" : {
"type" : "integer",
"description" : "Remote USB data port"
},
"rgbColor" : {
"type" : "integer"
},
"title" : {
"type" : "string"
}
},
"description" : "Data handling details for SDRDaemon"
@ -28688,7 +28694,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-08-31T08:45:52.974+02:00
Generated 2018-09-01T05:45:40.779+02:00
</div>
</div>
</div>

View File

@ -7,6 +7,10 @@ SDRDaemonChannelSourceSettings:
dataPort:
description: "Remote USB data port"
type: integer
rgbColor:
type: integer
title:
type: string
SDRDaemonChannelSourceReport:
description: "SDRDaemon channel source report"

View File

@ -2146,14 +2146,14 @@ bool WebAPIRequestMapper::validateChannelSettings(
return false;
}
}
else if (*channelType == "SDRDaemonChannelSink")
else if (*channelType == "DaemonSrc")
{
if (channelSettings.getTx() == 0)
if (channelSettings.getTx() != 0)
{
QJsonObject sdrDaemonChannelSinkSettingsJsonObject = jsonObject["SDRDaemonChannelSinkSettings"].toObject();
channelSettingsKeys = sdrDaemonChannelSinkSettingsJsonObject.keys();
channelSettings.setSdrDaemonChannelSinkSettings(new SWGSDRangel::SWGSDRDaemonChannelSinkSettings());
channelSettings.getSdrDaemonChannelSinkSettings()->fromJsonObject(sdrDaemonChannelSinkSettingsJsonObject);
QJsonObject daemonChannelSourceSettingsJsonObject = jsonObject["SDRDaemonChannelSourceSettings"].toObject();
channelSettingsKeys = daemonChannelSourceSettingsJsonObject.keys();
channelSettings.setSdrDaemonChannelSourceSettings(new SWGSDRangel::SWGSDRDaemonChannelSourceSettings());
channelSettings.getSdrDaemonChannelSourceSettings()->fromJsonObject(daemonChannelSourceSettingsJsonObject);
return true;
}
else {

View File

@ -7,6 +7,10 @@ SDRDaemonChannelSourceSettings:
dataPort:
description: "Remote USB data port"
type: integer
rgbColor:
type: integer
title:
type: string
SDRDaemonChannelSourceReport:
description: "SDRDaemon channel source report"

View File

@ -3215,6 +3215,12 @@ margin-bottom: 20px;
"dataPort" : {
"type" : "integer",
"description" : "Remote USB data port"
},
"rgbColor" : {
"type" : "integer"
},
"title" : {
"type" : "string"
}
},
"description" : "Data handling details for SDRDaemon"
@ -28688,7 +28694,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-08-31T08:45:52.974+02:00
Generated 2018-09-01T05:45:40.779+02:00
</div>
</div>
</div>

View File

@ -32,6 +32,10 @@ SWGSDRDaemonChannelSourceSettings::SWGSDRDaemonChannelSourceSettings() {
m_data_address_isSet = false;
data_port = 0;
m_data_port_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = nullptr;
m_title_isSet = false;
}
SWGSDRDaemonChannelSourceSettings::~SWGSDRDaemonChannelSourceSettings() {
@ -44,6 +48,10 @@ SWGSDRDaemonChannelSourceSettings::init() {
m_data_address_isSet = false;
data_port = 0;
m_data_port_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = new QString("");
m_title_isSet = false;
}
void
@ -52,6 +60,10 @@ SWGSDRDaemonChannelSourceSettings::cleanup() {
delete data_address;
}
if(title != nullptr) {
delete title;
}
}
SWGSDRDaemonChannelSourceSettings*
@ -69,6 +81,10 @@ SWGSDRDaemonChannelSourceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&data_port, pJson["dataPort"], "qint32", "");
::SWGSDRangel::setValue(&rgb_color, pJson["rgbColor"], "qint32", "");
::SWGSDRangel::setValue(&title, pJson["title"], "QString", "QString");
}
QString
@ -91,6 +107,12 @@ SWGSDRDaemonChannelSourceSettings::asJsonObject() {
if(m_data_port_isSet){
obj->insert("dataPort", QJsonValue(data_port));
}
if(m_rgb_color_isSet){
obj->insert("rgbColor", QJsonValue(rgb_color));
}
if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString"));
}
return obj;
}
@ -115,6 +137,26 @@ SWGSDRDaemonChannelSourceSettings::setDataPort(qint32 data_port) {
this->m_data_port_isSet = true;
}
qint32
SWGSDRDaemonChannelSourceSettings::getRgbColor() {
return rgb_color;
}
void
SWGSDRDaemonChannelSourceSettings::setRgbColor(qint32 rgb_color) {
this->rgb_color = rgb_color;
this->m_rgb_color_isSet = true;
}
QString*
SWGSDRDaemonChannelSourceSettings::getTitle() {
return title;
}
void
SWGSDRDaemonChannelSourceSettings::setTitle(QString* title) {
this->title = title;
this->m_title_isSet = true;
}
bool
SWGSDRDaemonChannelSourceSettings::isSet(){
@ -122,6 +164,8 @@ SWGSDRDaemonChannelSourceSettings::isSet(){
do{
if(data_address != nullptr && *data_address != QString("")){ isObjectUpdated = true; break;}
if(m_data_port_isSet){ isObjectUpdated = true; break;}
if(m_rgb_color_isSet){ isObjectUpdated = true; break;}
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;
}

View File

@ -48,6 +48,12 @@ public:
qint32 getDataPort();
void setDataPort(qint32 data_port);
qint32 getRgbColor();
void setRgbColor(qint32 rgb_color);
QString* getTitle();
void setTitle(QString* title);
virtual bool isSet() override;
@ -58,6 +64,12 @@ private:
qint32 data_port;
bool m_data_port_isSet;
qint32 rgb_color;
bool m_rgb_color_isSet;
QString* title;
bool m_title_isSet;
};
}