Update Freq Scanner API

pull/1905/head
srcejon 2023-11-30 13:14:21 +00:00
rodzic dad8562a0c
commit f3a47a2747
7 zmienionych plików z 203 dodań i 18 usunięć

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

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

Wyświetl plik

@ -34,6 +34,14 @@ SWGFreqScannerFrequency::SWGFreqScannerFrequency() {
m_enabled_isSet = false;
notes = nullptr;
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() {
@ -48,6 +56,14 @@ SWGFreqScannerFrequency::init() {
m_enabled_isSet = false;
notes = new QString("");
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
@ -57,6 +73,18 @@ SWGFreqScannerFrequency::cleanup() {
if(notes != nullptr) {
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*
@ -76,6 +104,14 @@ SWGFreqScannerFrequency::fromJsonObject(QJsonObject &pJson) {
::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
@ -101,6 +137,18 @@ SWGFreqScannerFrequency::asJsonObject() {
if(notes != nullptr && *notes != 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;
}
@ -135,6 +183,46 @@ SWGFreqScannerFrequency::setNotes(QString* notes) {
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
SWGFreqScannerFrequency::isSet(){
@ -149,6 +237,18 @@ SWGFreqScannerFrequency::isSet(){
if(notes && *notes != QString("")){
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);
return isObjectUpdated;
}

Wyświetl plik

@ -51,6 +51,18 @@ public:
QString* getNotes();
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;
@ -64,6 +76,18 @@ private:
QString* notes;
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;
};
}