1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Interferometer: implement gain and phase in API

This commit is contained in:
f4exb 2024-05-12 00:30:35 +02:00
parent b6b4eb405f
commit bab47d41c7
8 changed files with 111 additions and 8 deletions

View File

@ -184,6 +184,9 @@ void Interferometer::applySettings(const InterferometerSettings& settings, bool
if ((m_settings.m_phase != settings.m_phase) || force) {
reverseAPIKeys.append("phase");
}
if ((m_settings.m_phase != settings.m_gain) || force) {
reverseAPIKeys.append("gain");
}
if ((m_settings.m_title != settings.m_title) || force) {
reverseAPIKeys.append("title");
}
@ -393,6 +396,12 @@ void Interferometer::webapiUpdateChannelSettings(
if (channelSettingsKeys.contains("log2Decim")) {
settings.m_log2Decim = response.getInterferometerSettings()->getLog2Decim();
}
if (channelSettingsKeys.contains("phase")) {
settings.m_phase = response.getInterferometerSettings()->getPhase();
}
if (channelSettingsKeys.contains("gain")) {
settings.m_gain = response.getInterferometerSettings()->getGain();
}
if (channelSettingsKeys.contains("filterChainHash"))
{
@ -440,6 +449,8 @@ void Interferometer::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings
}
response.getInterferometerSettings()->setLog2Decim(settings.m_log2Decim);
response.getInterferometerSettings()->setPhase(settings.m_phase);
response.getInterferometerSettings()->setGain(settings.m_gain);
response.getInterferometerSettings()->setFilterChainHash(settings.m_filterChainHash);
response.getInterferometerSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
@ -585,6 +596,12 @@ void Interferometer::webapiFormatChannelSettings(
if (channelSettingsKeys.contains("log2Decim") || force) {
swgInterferometerSettings->setLog2Decim(settings.m_log2Decim);
}
if (channelSettingsKeys.contains("phase") || force) {
swgInterferometerSettings->setPhase(settings.m_phase);
}
if (channelSettingsKeys.contains("gain") || force) {
swgInterferometerSettings->setGain(settings.m_gain);
}
if (channelSettingsKeys.contains("filterChainHash") || force) {
swgInterferometerSettings->setFilterChainHash(settings.m_filterChainHash);
}

View File

@ -8501,6 +8501,14 @@ margin-bottom: 20px;
"filterChainHash" : {
"type" : "integer"
},
"phase" : {
"type" : "integer",
"description" : "Channel B phase shift in degrees (-180 to 180)"
},
"gain" : {
"type" : "integer",
"description" : "Channel B gain in centi-Bels"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
@ -58952,7 +58960,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2024-04-07T17:52:28.367+02:00
Generated 2024-05-12T00:06:46.949+02:00
</div>
</div>
</div>

View File

@ -12,6 +12,12 @@ InterferometerSettings:
type: integer
filterChainHash:
type: integer
phase:
description: Channel B phase shift in degrees (-180 to 180)
type: integer
gain:
description: Channel B gain in centi-Bels
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer

View File

@ -12,6 +12,12 @@ InterferometerSettings:
type: integer
filterChainHash:
type: integer
phase:
description: Channel B phase shift in degrees (-180 to 180)
type: integer
gain:
description: Channel B gain in centi-Bels
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer

View File

@ -8501,6 +8501,14 @@ margin-bottom: 20px;
"filterChainHash" : {
"type" : "integer"
},
"phase" : {
"type" : "integer",
"description" : "Channel B phase shift in degrees (-180 to 180)"
},
"gain" : {
"type" : "integer",
"description" : "Channel B gain in centi-Bels"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
@ -58952,7 +58960,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2024-04-07T17:52:28.367+02:00
Generated 2024-05-12T00:06:46.949+02:00
</div>
</div>
</div>

View File

@ -210,11 +210,11 @@ SWGChannelAnalyzerSettings::fromJson(QString &json) {
void
SWGChannelAnalyzerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&frequency, pJson["inputFrequencyOffset"], "qint32", "");
::SWGSDRangel::setValue(&frequency, pJson["frequency"], "qint32", "");
::SWGSDRangel::setValue(&down_sample, pJson["rationalDownSample"], "qint32", "");
::SWGSDRangel::setValue(&down_sample, pJson["downSample"], "qint32", "");
::SWGSDRangel::setValue(&down_sample_rate, pJson["rationalDownSamplerRate"], "qint32", "");
::SWGSDRangel::setValue(&down_sample_rate, pJson["downSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&bandwidth, pJson["bandwidth"], "qint32", "");
@ -285,13 +285,13 @@ QJsonObject*
SWGChannelAnalyzerSettings::asJsonObject() {
QJsonObject* obj = new QJsonObject();
if(m_frequency_isSet){
obj->insert("inputFrequencyOffset", QJsonValue(frequency));
obj->insert("frequency", QJsonValue(frequency));
}
if(m_down_sample_isSet){
obj->insert("rationalDownSample", QJsonValue(down_sample));
obj->insert("downSample", QJsonValue(down_sample));
}
if(m_down_sample_rate_isSet){
obj->insert("rationalDownSamplerRate", QJsonValue(down_sample_rate));
obj->insert("downSampleRate", QJsonValue(down_sample_rate));
}
if(m_bandwidth_isSet){
obj->insert("bandwidth", QJsonValue(bandwidth));

View File

@ -38,6 +38,10 @@ SWGInterferometerSettings::SWGInterferometerSettings() {
m_log2_decim_isSet = false;
filter_chain_hash = 0;
m_filter_chain_hash_isSet = false;
phase = 0;
m_phase_isSet = false;
gain = 0;
m_gain_isSet = false;
use_reverse_api = 0;
m_use_reverse_api_isSet = false;
reverse_api_address = nullptr;
@ -74,6 +78,10 @@ SWGInterferometerSettings::init() {
m_log2_decim_isSet = false;
filter_chain_hash = 0;
m_filter_chain_hash_isSet = false;
phase = 0;
m_phase_isSet = false;
gain = 0;
m_gain_isSet = false;
use_reverse_api = 0;
m_use_reverse_api_isSet = false;
reverse_api_address = new QString("");
@ -104,6 +112,8 @@ SWGInterferometerSettings::cleanup() {
if(reverse_api_address != nullptr) {
delete reverse_api_address;
}
@ -145,6 +155,10 @@ SWGInterferometerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&filter_chain_hash, pJson["filterChainHash"], "qint32", "");
::SWGSDRangel::setValue(&phase, pJson["phase"], "qint32", "");
::SWGSDRangel::setValue(&gain, pJson["gain"], "qint32", "");
::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
@ -194,6 +208,12 @@ SWGInterferometerSettings::asJsonObject() {
if(m_filter_chain_hash_isSet){
obj->insert("filterChainHash", QJsonValue(filter_chain_hash));
}
if(m_phase_isSet){
obj->insert("phase", QJsonValue(phase));
}
if(m_gain_isSet){
obj->insert("gain", QJsonValue(gain));
}
if(m_use_reverse_api_isSet){
obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
}
@ -275,6 +295,26 @@ SWGInterferometerSettings::setFilterChainHash(qint32 filter_chain_hash) {
this->m_filter_chain_hash_isSet = true;
}
qint32
SWGInterferometerSettings::getPhase() {
return phase;
}
void
SWGInterferometerSettings::setPhase(qint32 phase) {
this->phase = phase;
this->m_phase_isSet = true;
}
qint32
SWGInterferometerSettings::getGain() {
return gain;
}
void
SWGInterferometerSettings::setGain(qint32 gain) {
this->gain = gain;
this->m_gain_isSet = true;
}
qint32
SWGInterferometerSettings::getUseReverseApi() {
return use_reverse_api;
@ -385,6 +425,12 @@ SWGInterferometerSettings::isSet(){
if(m_filter_chain_hash_isSet){
isObjectUpdated = true; break;
}
if(m_phase_isSet){
isObjectUpdated = true; break;
}
if(m_gain_isSet){
isObjectUpdated = true; break;
}
if(m_use_reverse_api_isSet){
isObjectUpdated = true; break;
}

View File

@ -61,6 +61,12 @@ public:
qint32 getFilterChainHash();
void setFilterChainHash(qint32 filter_chain_hash);
qint32 getPhase();
void setPhase(qint32 phase);
qint32 getGain();
void setGain(qint32 gain);
qint32 getUseReverseApi();
void setUseReverseApi(qint32 use_reverse_api);
@ -107,6 +113,12 @@ private:
qint32 filter_chain_hash;
bool m_filter_chain_hash_isSet;
qint32 phase;
bool m_phase_isSet;
qint32 gain;
bool m_gain_isSet;
qint32 use_reverse_api;
bool m_use_reverse_api_isSet;