mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-04-04 18:48:34 -04:00
Reverse API: AM demod changes (4)
This commit is contained in:
parent
0c2dadfd69
commit
448eaf0b0b
@ -436,7 +436,11 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
|
||||
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
||||
<< " m_pll: " << settings.m_pll
|
||||
<< " m_syncAMOperation: " << (int) settings.m_syncAMOperation
|
||||
<< " m_useReverseAPI" << settings.m_useReverseAPI
|
||||
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
||||
<< " m_reverseAPIAddress: " << settings.m_reverseAPIPort
|
||||
<< " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex
|
||||
<< " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex
|
||||
<< " force: " << force;
|
||||
|
||||
QList<QString> reverseAPIKeys;
|
||||
@ -494,11 +498,13 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
|
||||
}
|
||||
|
||||
reverseAPIKeys.append("pll");
|
||||
reverseAPIKeys.append("syncAMOperation");
|
||||
}
|
||||
|
||||
if ((m_settings.m_syncAMOperation != settings.m_syncAMOperation) || force)
|
||||
{
|
||||
m_syncAMBuffIndex = 0;
|
||||
reverseAPIKeys.append("pll");
|
||||
reverseAPIKeys.append("syncAMOperation");
|
||||
}
|
||||
|
||||
@ -514,19 +520,17 @@ void AMDemod::applySettings(const AMDemodSettings& settings, bool force)
|
||||
reverseAPIKeys.append("volume");
|
||||
}
|
||||
|
||||
if ((m_settings.m_useReverseAPI != settings.m_useReverseAPI))
|
||||
{ // Full synchronization (PUT) when switching on the reverse API
|
||||
if (settings.m_useReverseAPI) {
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, true);
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_useReverseAPI)
|
||||
{ // For subsequent updates rely on the force variable to select PUT or PATCH
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, force);
|
||||
if (settings.m_useReverseAPI)
|
||||
{
|
||||
bool fullUpdate = ((m_settings.m_useReverseAPI != settings.m_useReverseAPI) && settings.m_useReverseAPI) ||
|
||||
(m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) ||
|
||||
(m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) ||
|
||||
(m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex) ||
|
||||
(m_settings.m_reverseAPIChannelIndex != settings.m_reverseAPIChannelIndex);
|
||||
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
|
||||
}
|
||||
|
||||
m_settings = settings;
|
||||
|
||||
}
|
||||
|
||||
QByteArray AMDemod::serialize() const
|
||||
@ -610,7 +614,23 @@ int AMDemod::webapiSettingsPutPatch(
|
||||
qint32 syncAMOperationCode = response.getAmDemodSettings()->getSyncAmOperation();
|
||||
settings.m_syncAMOperation = syncAMOperationCode < 0 ?
|
||||
AMDemodSettings::SyncAMDSB : syncAMOperationCode > 2 ?
|
||||
AMDemodSettings::SyncAMDSB : (AMDemodSettings::SyncAMOperation) syncAMOperationCode;
|
||||
AMDemodSettings::SyncAMLSB : (AMDemodSettings::SyncAMOperation) syncAMOperationCode;
|
||||
}
|
||||
|
||||
if (channelSettingsKeys.contains("useReverseAPI")) {
|
||||
settings.m_useReverseAPI = response.getAmDemodSettings()->getUseReverseApi() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIAddress")) {
|
||||
settings.m_reverseAPIAddress = *response.getAmDemodSettings()->getReverseApiAddress() != 0;
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
||||
settings.m_reverseAPIPort = response.getAmDemodSettings()->getReverseApiPort();
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
||||
settings.m_reverseAPIDeviceIndex = response.getAmDemodSettings()->getReverseApiDeviceIndex();
|
||||
}
|
||||
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
||||
settings.m_reverseAPIChannelIndex = response.getAmDemodSettings()->getReverseApiChannelIndex();
|
||||
}
|
||||
|
||||
if (frequencyOffsetChanged)
|
||||
@ -670,6 +690,17 @@ void AMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo
|
||||
|
||||
response.getAmDemodSettings()->setPll(settings.m_pll ? 1 : 0);
|
||||
response.getAmDemodSettings()->setSyncAmOperation((int) m_settings.m_syncAMOperation);
|
||||
response.getAmDemodSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
||||
|
||||
if (response.getAmDemodSettings()->getReverseApiAddress()) {
|
||||
*response.getAmDemodSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
|
||||
} else {
|
||||
response.getAmDemodSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
|
||||
}
|
||||
|
||||
response.getAmDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort);
|
||||
response.getAmDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
||||
response.getAmDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
|
||||
}
|
||||
|
||||
void AMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
||||
@ -692,7 +723,7 @@ void AMDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, con
|
||||
swgChannelSettings->setAmDemodSettings(new SWGSDRangel::SWGAMDemodSettings());
|
||||
SWGSDRangel::SWGAMDemodSettings *swgAMDemodSettings = swgChannelSettings->getAmDemodSettings();
|
||||
|
||||
// transfer data that has been modified. When force is on transfer all data
|
||||
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
||||
|
||||
if (channelSettingsKeys.contains("audioMute") || force) {
|
||||
swgAMDemodSettings->setAudioMute(settings.m_audioMute ? 1 : 0);
|
||||
@ -740,11 +771,8 @@ void AMDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, con
|
||||
buffer->write(swgChannelSettings->asJson().toUtf8());
|
||||
buffer->seek(0);
|
||||
|
||||
if (force) {
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "PUT", buffer);
|
||||
} else {
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
|
||||
}
|
||||
// Always use PATCH to avoid passing reverse API settings
|
||||
m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
|
||||
|
||||
delete swgChannelSettings;
|
||||
}
|
||||
|
@ -345,11 +345,15 @@ void AMDemodGUI::displaySettings()
|
||||
ui->bandpassEnable->setChecked(m_settings.m_bandpassEnable);
|
||||
ui->pll->setChecked(m_settings.m_pll);
|
||||
|
||||
if (m_settings.m_pll) {
|
||||
if (m_settings.m_syncAMOperation == AMDemodSettings::SyncAMLSB) {
|
||||
if (m_settings.m_pll)
|
||||
{
|
||||
if (m_settings.m_syncAMOperation == AMDemodSettings::SyncAMLSB)
|
||||
{
|
||||
m_samUSB = false;
|
||||
ui->ssb->setIcon(m_iconDSBLSB);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
m_samUSB = true;
|
||||
ui->ssb->setIcon(m_iconDSBUSB);
|
||||
}
|
||||
|
@ -760,6 +760,22 @@ margin-bottom: 20px;
|
||||
"syncAMOperation" : {
|
||||
"type" : "integer",
|
||||
"description" : "Synchronous AM sidebands mode (DSB, USB, LSB)"
|
||||
},
|
||||
"useReverseAPI" : {
|
||||
"type" : "integer",
|
||||
"description" : "Synchronizw with reverse API (1 for yes, 0 for no)"
|
||||
},
|
||||
"reverseAPIAddress" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"reverseAPIPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIDeviceIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIChannelIndex" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "AMDemod"
|
||||
@ -23649,7 +23665,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-11-29T00:50:52.609+01:00
|
||||
Generated 2018-12-16T10:04:01.738+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -33,6 +33,17 @@ AMDemodSettings:
|
||||
syncAMOperation:
|
||||
description: Synchronous AM sidebands mode (DSB, USB, LSB)
|
||||
type: integer
|
||||
useReverseAPI:
|
||||
description: Synchronizw with reverse API (1 for yes, 0 for no)
|
||||
type: integer
|
||||
reverseAPIAddress:
|
||||
type: string
|
||||
reverseAPIPort:
|
||||
type: integer
|
||||
reverseAPIDeviceIndex:
|
||||
type: integer
|
||||
reverseAPIChannelIndex:
|
||||
type: integer
|
||||
|
||||
AMDemodReport:
|
||||
description: AMDemod
|
||||
|
@ -33,6 +33,17 @@ AMDemodSettings:
|
||||
syncAMOperation:
|
||||
description: Synchronous AM sidebands mode (DSB, USB, LSB)
|
||||
type: integer
|
||||
useReverseAPI:
|
||||
description: Synchronizw with reverse API (1 for yes, 0 for no)
|
||||
type: integer
|
||||
reverseAPIAddress:
|
||||
type: string
|
||||
reverseAPIPort:
|
||||
type: integer
|
||||
reverseAPIDeviceIndex:
|
||||
type: integer
|
||||
reverseAPIChannelIndex:
|
||||
type: integer
|
||||
|
||||
AMDemodReport:
|
||||
description: AMDemod
|
||||
|
@ -760,6 +760,22 @@ margin-bottom: 20px;
|
||||
"syncAMOperation" : {
|
||||
"type" : "integer",
|
||||
"description" : "Synchronous AM sidebands mode (DSB, USB, LSB)"
|
||||
},
|
||||
"useReverseAPI" : {
|
||||
"type" : "integer",
|
||||
"description" : "Synchronizw with reverse API (1 for yes, 0 for no)"
|
||||
},
|
||||
"reverseAPIAddress" : {
|
||||
"type" : "string"
|
||||
},
|
||||
"reverseAPIPort" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIDeviceIndex" : {
|
||||
"type" : "integer"
|
||||
},
|
||||
"reverseAPIChannelIndex" : {
|
||||
"type" : "integer"
|
||||
}
|
||||
},
|
||||
"description" : "AMDemod"
|
||||
@ -23649,7 +23665,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-11-29T00:50:52.609+01:00
|
||||
Generated 2018-12-16T10:04:01.738+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -50,6 +50,16 @@ SWGAMDemodSettings::SWGAMDemodSettings() {
|
||||
m_pll_isSet = false;
|
||||
sync_am_operation = 0;
|
||||
m_sync_am_operation_isSet = false;
|
||||
use_reverse_api = 0;
|
||||
m_use_reverse_api_isSet = false;
|
||||
reverse_api_address = nullptr;
|
||||
m_reverse_api_address_isSet = false;
|
||||
reverse_api_port = 0;
|
||||
m_reverse_api_port_isSet = false;
|
||||
reverse_api_device_index = 0;
|
||||
m_reverse_api_device_index_isSet = false;
|
||||
reverse_api_channel_index = 0;
|
||||
m_reverse_api_channel_index_isSet = false;
|
||||
}
|
||||
|
||||
SWGAMDemodSettings::~SWGAMDemodSettings() {
|
||||
@ -80,6 +90,16 @@ SWGAMDemodSettings::init() {
|
||||
m_pll_isSet = false;
|
||||
sync_am_operation = 0;
|
||||
m_sync_am_operation_isSet = false;
|
||||
use_reverse_api = 0;
|
||||
m_use_reverse_api_isSet = false;
|
||||
reverse_api_address = new QString("");
|
||||
m_reverse_api_address_isSet = false;
|
||||
reverse_api_port = 0;
|
||||
m_reverse_api_port_isSet = false;
|
||||
reverse_api_device_index = 0;
|
||||
m_reverse_api_device_index_isSet = false;
|
||||
reverse_api_channel_index = 0;
|
||||
m_reverse_api_channel_index_isSet = false;
|
||||
}
|
||||
|
||||
void
|
||||
@ -99,6 +119,13 @@ SWGAMDemodSettings::cleanup() {
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(reverse_api_address != nullptr) {
|
||||
delete reverse_api_address;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
SWGAMDemodSettings*
|
||||
@ -134,6 +161,16 @@ SWGAMDemodSettings::fromJsonObject(QJsonObject &pJson) {
|
||||
|
||||
::SWGSDRangel::setValue(&sync_am_operation, pJson["syncAMOperation"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse_api_address, pJson["reverseAPIAddress"], "QString", "QString");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse_api_port, pJson["reverseAPIPort"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", "");
|
||||
|
||||
::SWGSDRangel::setValue(&reverse_api_channel_index, pJson["reverseAPIChannelIndex"], "qint32", "");
|
||||
|
||||
}
|
||||
|
||||
QString
|
||||
@ -183,6 +220,21 @@ SWGAMDemodSettings::asJsonObject() {
|
||||
if(m_sync_am_operation_isSet){
|
||||
obj->insert("syncAMOperation", QJsonValue(sync_am_operation));
|
||||
}
|
||||
if(m_use_reverse_api_isSet){
|
||||
obj->insert("useReverseAPI", QJsonValue(use_reverse_api));
|
||||
}
|
||||
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){
|
||||
toJsonValue(QString("reverseAPIAddress"), reverse_api_address, obj, QString("QString"));
|
||||
}
|
||||
if(m_reverse_api_port_isSet){
|
||||
obj->insert("reverseAPIPort", QJsonValue(reverse_api_port));
|
||||
}
|
||||
if(m_reverse_api_device_index_isSet){
|
||||
obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index));
|
||||
}
|
||||
if(m_reverse_api_channel_index_isSet){
|
||||
obj->insert("reverseAPIChannelIndex", QJsonValue(reverse_api_channel_index));
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
@ -297,6 +349,56 @@ SWGAMDemodSettings::setSyncAmOperation(qint32 sync_am_operation) {
|
||||
this->m_sync_am_operation_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMDemodSettings::getUseReverseApi() {
|
||||
return use_reverse_api;
|
||||
}
|
||||
void
|
||||
SWGAMDemodSettings::setUseReverseApi(qint32 use_reverse_api) {
|
||||
this->use_reverse_api = use_reverse_api;
|
||||
this->m_use_reverse_api_isSet = true;
|
||||
}
|
||||
|
||||
QString*
|
||||
SWGAMDemodSettings::getReverseApiAddress() {
|
||||
return reverse_api_address;
|
||||
}
|
||||
void
|
||||
SWGAMDemodSettings::setReverseApiAddress(QString* reverse_api_address) {
|
||||
this->reverse_api_address = reverse_api_address;
|
||||
this->m_reverse_api_address_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMDemodSettings::getReverseApiPort() {
|
||||
return reverse_api_port;
|
||||
}
|
||||
void
|
||||
SWGAMDemodSettings::setReverseApiPort(qint32 reverse_api_port) {
|
||||
this->reverse_api_port = reverse_api_port;
|
||||
this->m_reverse_api_port_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMDemodSettings::getReverseApiDeviceIndex() {
|
||||
return reverse_api_device_index;
|
||||
}
|
||||
void
|
||||
SWGAMDemodSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) {
|
||||
this->reverse_api_device_index = reverse_api_device_index;
|
||||
this->m_reverse_api_device_index_isSet = true;
|
||||
}
|
||||
|
||||
qint32
|
||||
SWGAMDemodSettings::getReverseApiChannelIndex() {
|
||||
return reverse_api_channel_index;
|
||||
}
|
||||
void
|
||||
SWGAMDemodSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) {
|
||||
this->reverse_api_channel_index = reverse_api_channel_index;
|
||||
this->m_reverse_api_channel_index_isSet = true;
|
||||
}
|
||||
|
||||
|
||||
bool
|
||||
SWGAMDemodSettings::isSet(){
|
||||
@ -313,6 +415,11 @@ SWGAMDemodSettings::isSet(){
|
||||
if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_pll_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_sync_am_operation_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;}
|
||||
if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;}
|
||||
if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;}
|
||||
if(m_reverse_api_channel_index_isSet){ isObjectUpdated = true; break;}
|
||||
}while(false);
|
||||
return isObjectUpdated;
|
||||
}
|
||||
|
@ -75,6 +75,21 @@ public:
|
||||
qint32 getSyncAmOperation();
|
||||
void setSyncAmOperation(qint32 sync_am_operation);
|
||||
|
||||
qint32 getUseReverseApi();
|
||||
void setUseReverseApi(qint32 use_reverse_api);
|
||||
|
||||
QString* getReverseApiAddress();
|
||||
void setReverseApiAddress(QString* reverse_api_address);
|
||||
|
||||
qint32 getReverseApiPort();
|
||||
void setReverseApiPort(qint32 reverse_api_port);
|
||||
|
||||
qint32 getReverseApiDeviceIndex();
|
||||
void setReverseApiDeviceIndex(qint32 reverse_api_device_index);
|
||||
|
||||
qint32 getReverseApiChannelIndex();
|
||||
void setReverseApiChannelIndex(qint32 reverse_api_channel_index);
|
||||
|
||||
|
||||
virtual bool isSet() override;
|
||||
|
||||
@ -112,6 +127,21 @@ private:
|
||||
qint32 sync_am_operation;
|
||||
bool m_sync_am_operation_isSet;
|
||||
|
||||
qint32 use_reverse_api;
|
||||
bool m_use_reverse_api_isSet;
|
||||
|
||||
QString* reverse_api_address;
|
||||
bool m_reverse_api_address_isSet;
|
||||
|
||||
qint32 reverse_api_port;
|
||||
bool m_reverse_api_port_isSet;
|
||||
|
||||
qint32 reverse_api_device_index;
|
||||
bool m_reverse_api_device_index_isSet;
|
||||
|
||||
qint32 reverse_api_channel_index;
|
||||
bool m_reverse_api_channel_index_isSet;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user