1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-26 09:48:45 -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")) { if (channelSettingsKeys.contains("dataAddress")) {
settings.m_dataAddress = *response.getSdrDaemonChannelSourceSettings()->getDataAddress(); settings.m_dataAddress = *response.getSdrDaemonChannelSourceSettings()->getDataAddress();
} }
if (channelSettingsKeys.contains("dataPort")) if (channelSettingsKeys.contains("dataPort"))
{ {
int dataPort = response.getSdrDaemonChannelSourceSettings()->getDataPort(); int dataPort = response.getSdrDaemonChannelSourceSettings()->getDataPort();
@ -360,6 +359,12 @@ int DaemonSrc::webapiSettingsPutPatch(
settings.m_dataPort = dataPort; 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); MsgConfigureDaemonSrc *msg = MsgConfigureDaemonSrc::create(settings, force);
m_inputMessageQueue.push(msg); m_inputMessageQueue.push(msg);
@ -395,6 +400,13 @@ void DaemonSrc::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& res
} }
response.getSdrDaemonChannelSourceSettings()->setDataPort(settings.m_dataPort); 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) void DaemonSrc::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)

View File

@ -82,9 +82,21 @@ bool DaemonSrcGUI::handleMessage(const Message& message)
{ {
DaemonSrc::MsgSampleRateNotification& notif = (DaemonSrc::MsgSampleRateNotification&) message; DaemonSrc::MsgSampleRateNotification& notif = (DaemonSrc::MsgSampleRateNotification&) message;
m_channelMarker.setBandwidth(notif.getSampleRate()); 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;
} }
return false;
} }
DaemonSrcGUI::DaemonSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx __attribute__((unused)), QWidget* parent) : DaemonSrcGUI::DaemonSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSampleSource *channelTx __attribute__((unused)), QWidget* parent) :

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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