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

Update Freq Scanner API

This commit is contained in:
srcejon 2023-11-30 13:14:21 +00:00
parent dad8562a0c
commit f3a47a2747
7 changed files with 203 additions and 18 deletions

View File

@ -841,26 +841,35 @@ void FreqScanner::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("threshold")) { if (channelSettingsKeys.contains("threshold")) {
settings.m_threshold = response.getFreqScannerSettings()->getThreshold(); settings.m_threshold = response.getFreqScannerSettings()->getThreshold();
} }
/*if (channelSettingsKeys.contains("frequencies")) if (channelSettingsKeys.contains("frequencies"))
{ {
settings.m_frequencies.clear(); settings.m_frequencySettings.clear();
settings.m_enabled.clear();
settings.m_notes.clear();
QList<SWGSDRangel::SWGFreqScannerFrequency *> *frequencies = response.getFreqScannerSettings()->getFrequencies(); QList<SWGSDRangel::SWGFreqScannerFrequency *> *frequencies = response.getFreqScannerSettings()->getFrequencies();
if (frequencies) if (frequencies)
{ {
for (const auto frequency : *frequencies) for (const auto frequency : *frequencies)
{ {
settings.m_frequencies.append(frequency->getFrequency()); FreqScannerSettings::FrequencySettings freqSetting;
settings.m_enabled.append((bool)frequency->getEnabled()); freqSetting.m_frequency = frequency->getFrequency();
if (frequency->getNotes()) { if (frequency->getNotes()) {
settings.m_notes.append(*frequency->getNotes()); freqSetting.m_notes = *frequency->getNotes();
} else { }
settings.m_notes.append(""); if (frequency->getChannel()) {
freqSetting.m_channel = *frequency->getChannel();
}
if (frequency->getChannelBandwidth()) {
freqSetting.m_channelBandwidth = *frequency->getChannelBandwidth();
}
if (frequency->getThreshold()) {
freqSetting.m_threshold = *frequency->getThreshold();
}
if (frequency->getSquelch()) {
freqSetting.m_squelch = *frequency->getSquelch();
}
settings.m_frequencySettings.append(freqSetting);
} }
} }
} }
}*/
if (channelSettingsKeys.contains("rgbColor")) { if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getFreqScannerSettings()->getRgbColor(); settings.m_rgbColor = response.getFreqScannerSettings()->getRgbColor();
} }
@ -896,17 +905,29 @@ void FreqScanner::webapiUpdateChannelSettings(
QList<SWGSDRangel::SWGFreqScannerFrequency *> *FreqScanner::createFrequencyList(const FreqScannerSettings& settings) QList<SWGSDRangel::SWGFreqScannerFrequency *> *FreqScanner::createFrequencyList(const FreqScannerSettings& settings)
{ {
QList<SWGSDRangel::SWGFreqScannerFrequency *> *frequencies = new QList<SWGSDRangel::SWGFreqScannerFrequency *>(); QList<SWGSDRangel::SWGFreqScannerFrequency *> *frequencies = new QList<SWGSDRangel::SWGFreqScannerFrequency *>();
/*for (int i = 0; i < settings.m_frequencies.size(); i++) for (int i = 0; i < settings.m_frequencySettings.size(); i++)
{ {
SWGSDRangel::SWGFreqScannerFrequency *frequency = new SWGSDRangel::SWGFreqScannerFrequency(); SWGSDRangel::SWGFreqScannerFrequency *frequency = new SWGSDRangel::SWGFreqScannerFrequency();
frequency->init(); frequency->init();
frequency->setFrequency(settings.m_frequencies[i]); frequency->setFrequency(settings.m_frequencySettings[i].m_frequency);
frequency->setEnabled(settings.m_enabled[i]); frequency->setEnabled(settings.m_frequencySettings[i].m_enabled);
if (!settings.m_notes[i].isEmpty()) { if (!settings.m_frequencySettings[i].m_notes.isEmpty()) {
frequency->setNotes(new QString(settings.m_notes[i])); frequency->setNotes(new QString(settings.m_frequencySettings[i].m_notes));
}
if (!settings.m_frequencySettings[i].m_channel.isEmpty()) {
frequency->setChannel(new QString(settings.m_frequencySettings[i].m_channel));
}
if (!settings.m_frequencySettings[i].m_channelBandwidth.isEmpty()) {
frequency->setChannelBandwidth(new QString(settings.m_frequencySettings[i].m_channelBandwidth));
}
if (!settings.m_frequencySettings[i].m_threshold.isEmpty()) {
frequency->setThreshold(new QString(settings.m_frequencySettings[i].m_threshold));
}
if (!settings.m_frequencySettings[i].m_squelch.isEmpty()) {
frequency->setSquelch(new QString(settings.m_frequencySettings[i].m_squelch));
} }
frequencies->append(frequency); frequencies->append(frequency);
}*/ }
return frequencies; return frequencies;
} }

View File

@ -7007,6 +7007,18 @@ margin-bottom: 20px;
}, },
"notes" : { "notes" : {
"type" : "string" "type" : "string"
},
"channel" : {
"type" : "string"
},
"channelBandwidth" : {
"type" : "string"
},
"threshold" : {
"type" : "string"
},
"squelch" : {
"type" : "string"
} }
} }
}; };
@ -58401,7 +58413,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2023-11-05T10:45:45.965+01:00 Generated 2023-11-30T13:04:24.913+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -69,3 +69,11 @@ FreqScannerFrequency:
type: integer type: integer
notes: notes:
type: string type: string
channel:
type: string
channelBandwidth:
type: string
threshold:
type: string
squelch:
type: string

View File

@ -69,3 +69,11 @@ FreqScannerFrequency:
type: integer type: integer
notes: notes:
type: string type: string
channel:
type: string
channelBandwidth:
type: string
threshold:
type: string
squelch:
type: string

View File

@ -7007,6 +7007,18 @@ margin-bottom: 20px;
}, },
"notes" : { "notes" : {
"type" : "string" "type" : "string"
},
"channel" : {
"type" : "string"
},
"channelBandwidth" : {
"type" : "string"
},
"threshold" : {
"type" : "string"
},
"squelch" : {
"type" : "string"
} }
} }
}; };
@ -58401,7 +58413,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2023-11-05T10:45:45.965+01:00 Generated 2023-11-30T13:04:24.913+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -34,6 +34,14 @@ SWGFreqScannerFrequency::SWGFreqScannerFrequency() {
m_enabled_isSet = false; m_enabled_isSet = false;
notes = nullptr; notes = nullptr;
m_notes_isSet = false; m_notes_isSet = false;
channel = nullptr;
m_channel_isSet = false;
channel_bandwidth = nullptr;
m_channel_bandwidth_isSet = false;
threshold = nullptr;
m_threshold_isSet = false;
squelch = nullptr;
m_squelch_isSet = false;
} }
SWGFreqScannerFrequency::~SWGFreqScannerFrequency() { SWGFreqScannerFrequency::~SWGFreqScannerFrequency() {
@ -48,6 +56,14 @@ SWGFreqScannerFrequency::init() {
m_enabled_isSet = false; m_enabled_isSet = false;
notes = new QString(""); notes = new QString("");
m_notes_isSet = false; m_notes_isSet = false;
channel = new QString("");
m_channel_isSet = false;
channel_bandwidth = new QString("");
m_channel_bandwidth_isSet = false;
threshold = new QString("");
m_threshold_isSet = false;
squelch = new QString("");
m_squelch_isSet = false;
} }
void void
@ -57,6 +73,18 @@ SWGFreqScannerFrequency::cleanup() {
if(notes != nullptr) { if(notes != nullptr) {
delete notes; delete notes;
} }
if(channel != nullptr) {
delete channel;
}
if(channel_bandwidth != nullptr) {
delete channel_bandwidth;
}
if(threshold != nullptr) {
delete threshold;
}
if(squelch != nullptr) {
delete squelch;
}
} }
SWGFreqScannerFrequency* SWGFreqScannerFrequency*
@ -76,6 +104,14 @@ SWGFreqScannerFrequency::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&notes, pJson["notes"], "QString", "QString"); ::SWGSDRangel::setValue(&notes, pJson["notes"], "QString", "QString");
::SWGSDRangel::setValue(&channel, pJson["channel"], "QString", "QString");
::SWGSDRangel::setValue(&channel_bandwidth, pJson["channelBandwidth"], "QString", "QString");
::SWGSDRangel::setValue(&threshold, pJson["threshold"], "QString", "QString");
::SWGSDRangel::setValue(&squelch, pJson["squelch"], "QString", "QString");
} }
QString QString
@ -101,6 +137,18 @@ SWGFreqScannerFrequency::asJsonObject() {
if(notes != nullptr && *notes != QString("")){ if(notes != nullptr && *notes != QString("")){
toJsonValue(QString("notes"), notes, obj, QString("QString")); toJsonValue(QString("notes"), notes, obj, QString("QString"));
} }
if(channel != nullptr && *channel != QString("")){
toJsonValue(QString("channel"), channel, obj, QString("QString"));
}
if(channel_bandwidth != nullptr && *channel_bandwidth != QString("")){
toJsonValue(QString("channelBandwidth"), channel_bandwidth, obj, QString("QString"));
}
if(threshold != nullptr && *threshold != QString("")){
toJsonValue(QString("threshold"), threshold, obj, QString("QString"));
}
if(squelch != nullptr && *squelch != QString("")){
toJsonValue(QString("squelch"), squelch, obj, QString("QString"));
}
return obj; return obj;
} }
@ -135,6 +183,46 @@ SWGFreqScannerFrequency::setNotes(QString* notes) {
this->m_notes_isSet = true; this->m_notes_isSet = true;
} }
QString*
SWGFreqScannerFrequency::getChannel() {
return channel;
}
void
SWGFreqScannerFrequency::setChannel(QString* channel) {
this->channel = channel;
this->m_channel_isSet = true;
}
QString*
SWGFreqScannerFrequency::getChannelBandwidth() {
return channel_bandwidth;
}
void
SWGFreqScannerFrequency::setChannelBandwidth(QString* channel_bandwidth) {
this->channel_bandwidth = channel_bandwidth;
this->m_channel_bandwidth_isSet = true;
}
QString*
SWGFreqScannerFrequency::getThreshold() {
return threshold;
}
void
SWGFreqScannerFrequency::setThreshold(QString* threshold) {
this->threshold = threshold;
this->m_threshold_isSet = true;
}
QString*
SWGFreqScannerFrequency::getSquelch() {
return squelch;
}
void
SWGFreqScannerFrequency::setSquelch(QString* squelch) {
this->squelch = squelch;
this->m_squelch_isSet = true;
}
bool bool
SWGFreqScannerFrequency::isSet(){ SWGFreqScannerFrequency::isSet(){
@ -149,6 +237,18 @@ SWGFreqScannerFrequency::isSet(){
if(notes && *notes != QString("")){ if(notes && *notes != QString("")){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(channel && *channel != QString("")){
isObjectUpdated = true; break;
}
if(channel_bandwidth && *channel_bandwidth != QString("")){
isObjectUpdated = true; break;
}
if(threshold && *threshold != QString("")){
isObjectUpdated = true; break;
}
if(squelch && *squelch != QString("")){
isObjectUpdated = true; break;
}
}while(false); }while(false);
return isObjectUpdated; return isObjectUpdated;
} }

View File

@ -51,6 +51,18 @@ public:
QString* getNotes(); QString* getNotes();
void setNotes(QString* notes); void setNotes(QString* notes);
QString* getChannel();
void setChannel(QString* channel);
QString* getChannelBandwidth();
void setChannelBandwidth(QString* channel_bandwidth);
QString* getThreshold();
void setThreshold(QString* threshold);
QString* getSquelch();
void setSquelch(QString* squelch);
virtual bool isSet() override; virtual bool isSet() override;
@ -64,6 +76,18 @@ private:
QString* notes; QString* notes;
bool m_notes_isSet; bool m_notes_isSet;
QString* channel;
bool m_channel_isSet;
QString* channel_bandwidth;
bool m_channel_bandwidth_isSet;
QString* threshold;
bool m_threshold_isSet;
QString* squelch;
bool m_squelch_isSet;
}; };
} }