Reverse API: AM and NFM mod REST API updates

This commit is contained in:
f4exb 2018-12-20 08:29:48 +01:00
parent c4a818cfae
commit 1803789400
12 changed files with 440 additions and 4 deletions

View File

@ -630,6 +630,21 @@ int AMMod::webapiSettingsPutPatch(
if (channelSettingsKeys.contains("modFactor")) {
settings.m_modFactor = response.getAmModSettings()->getModFactor();
}
if (channelSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getAmModSettings()->getUseReverseApi() != 0;
}
if (channelSettingsKeys.contains("reverseAPIAddress")) {
settings.m_reverseAPIAddress = *response.getAmModSettings()->getReverseApiAddress() != 0;
}
if (channelSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getAmModSettings()->getReverseApiPort();
}
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIDeviceIndex = response.getAmModSettings()->getReverseApiDeviceIndex();
}
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
settings.m_reverseAPIChannelIndex = response.getAmModSettings()->getReverseApiChannelIndex();
}
if (channelSettingsKeys.contains("cwKeyer"))
{
@ -739,6 +754,18 @@ void AMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respons
} else {
response.getAmModSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
}
response.getAmModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getAmModSettings()->getReverseApiAddress()) {
*response.getAmModSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
} else {
response.getAmModSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
}
response.getAmModSettings()->setReverseApiPort(settings.m_reverseAPIPort);
response.getAmModSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
response.getAmModSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
}
void AMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)

View File

@ -686,6 +686,21 @@ int NFMMod::webapiSettingsPutPatch(
if (channelSettingsKeys.contains("volumeFactor")) {
settings.m_volumeFactor = response.getNfmModSettings()->getVolumeFactor();
}
if (channelSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getNfmModSettings()->getUseReverseApi() != 0;
}
if (channelSettingsKeys.contains("reverseAPIAddress")) {
settings.m_reverseAPIAddress = *response.getNfmModSettings()->getReverseApiAddress() != 0;
}
if (channelSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getNfmModSettings()->getReverseApiPort();
}
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIDeviceIndex = response.getNfmModSettings()->getReverseApiDeviceIndex();
}
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
settings.m_reverseAPIChannelIndex = response.getNfmModSettings()->getReverseApiChannelIndex();
}
if (channelSettingsKeys.contains("cwKeyer"))
{
@ -798,6 +813,18 @@ void NFMMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respon
}
apiCwKeyerSettings->setWpm(cwKeyerSettings.m_wpm);
response.getNfmModSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getNfmModSettings()->getReverseApiAddress()) {
*response.getNfmModSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
} else {
response.getNfmModSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
}
response.getNfmModSettings()->setReverseApiPort(settings.m_reverseAPIPort);
response.getNfmModSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
response.getNfmModSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
}
void NFMMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)

View File

@ -837,6 +837,22 @@ margin-bottom: 20px;
"modAFInput" : {
"type" : "integer"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
},
"reverseAPIChannelIndex" : {
"type" : "integer"
},
"cwKeyer" : {
"$ref" : "#/definitions/CWKeyerSettings"
}
@ -3055,6 +3071,22 @@ margin-bottom: 20px;
"modAFInput" : {
"type" : "integer"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
},
"reverseAPIChannelIndex" : {
"type" : "integer"
},
"cwKeyer" : {
"$ref" : "#/definitions/CWKeyerSettings"
}
@ -23717,7 +23749,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-12-18T23:38:18.118+01:00
Generated 2018-12-20T08:23:16.509+01:00
</div>
</div>
</div>

View File

@ -29,9 +29,20 @@ AMModSettings:
type: string
modAFInput:
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer
reverseAPIChannelIndex:
type: integer
cwKeyer:
$ref: "/doc/swagger/include/CWKeyer.yaml#/CWKeyerSettings"
AMModReport:
description: AMMod
properties:

View File

@ -35,6 +35,17 @@ NFMModSettings:
type: string
modAFInput:
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer
reverseAPIChannelIndex:
type: integer
cwKeyer:
$ref: "/doc/swagger/include/CWKeyer.yaml#/CWKeyerSettings"

View File

@ -29,9 +29,20 @@ AMModSettings:
type: string
modAFInput:
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer
reverseAPIChannelIndex:
type: integer
cwKeyer:
$ref: "http://localhost:8081/api/swagger/include/CWKeyer.yaml#/CWKeyerSettings"
AMModReport:
description: AMMod
properties:

View File

@ -35,6 +35,17 @@ NFMModSettings:
type: string
modAFInput:
type: integer
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer
reverseAPIChannelIndex:
type: integer
cwKeyer:
$ref: "http://localhost:8081/api/swagger/include/CWKeyer.yaml#/CWKeyerSettings"

View File

@ -837,6 +837,22 @@ margin-bottom: 20px;
"modAFInput" : {
"type" : "integer"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
},
"reverseAPIChannelIndex" : {
"type" : "integer"
},
"cwKeyer" : {
"$ref" : "#/definitions/CWKeyerSettings"
}
@ -3055,6 +3071,22 @@ margin-bottom: 20px;
"modAFInput" : {
"type" : "integer"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
},
"reverseAPIChannelIndex" : {
"type" : "integer"
},
"cwKeyer" : {
"$ref" : "#/definitions/CWKeyerSettings"
}
@ -23717,7 +23749,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-12-18T23:38:18.118+01:00
Generated 2018-12-20T08:23:16.509+01:00
</div>
</div>
</div>

View File

@ -50,6 +50,16 @@ SWGAMModSettings::SWGAMModSettings() {
m_audio_device_name_isSet = false;
mod_af_input = 0;
m_mod_af_input_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;
cw_keyer = nullptr;
m_cw_keyer_isSet = false;
}
@ -82,6 +92,16 @@ SWGAMModSettings::init() {
m_audio_device_name_isSet = false;
mod_af_input = 0;
m_mod_af_input_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;
cw_keyer = new SWGCWKeyerSettings();
m_cw_keyer_isSet = false;
}
@ -103,6 +123,13 @@ SWGAMModSettings::cleanup() {
delete audio_device_name;
}
if(reverse_api_address != nullptr) {
delete reverse_api_address;
}
if(cw_keyer != nullptr) {
delete cw_keyer;
}
@ -141,6 +168,16 @@ SWGAMModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "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", "");
::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings");
}
@ -192,6 +229,21 @@ SWGAMModSettings::asJsonObject() {
if(m_mod_af_input_isSet){
obj->insert("modAFInput", QJsonValue(mod_af_input));
}
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));
}
if((cw_keyer != nullptr) && (cw_keyer->isSet())){
toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));
}
@ -309,6 +361,56 @@ SWGAMModSettings::setModAfInput(qint32 mod_af_input) {
this->m_mod_af_input_isSet = true;
}
qint32
SWGAMModSettings::getUseReverseApi() {
return use_reverse_api;
}
void
SWGAMModSettings::setUseReverseApi(qint32 use_reverse_api) {
this->use_reverse_api = use_reverse_api;
this->m_use_reverse_api_isSet = true;
}
QString*
SWGAMModSettings::getReverseApiAddress() {
return reverse_api_address;
}
void
SWGAMModSettings::setReverseApiAddress(QString* reverse_api_address) {
this->reverse_api_address = reverse_api_address;
this->m_reverse_api_address_isSet = true;
}
qint32
SWGAMModSettings::getReverseApiPort() {
return reverse_api_port;
}
void
SWGAMModSettings::setReverseApiPort(qint32 reverse_api_port) {
this->reverse_api_port = reverse_api_port;
this->m_reverse_api_port_isSet = true;
}
qint32
SWGAMModSettings::getReverseApiDeviceIndex() {
return reverse_api_device_index;
}
void
SWGAMModSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) {
this->reverse_api_device_index = reverse_api_device_index;
this->m_reverse_api_device_index_isSet = true;
}
qint32
SWGAMModSettings::getReverseApiChannelIndex() {
return reverse_api_channel_index;
}
void
SWGAMModSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) {
this->reverse_api_channel_index = reverse_api_channel_index;
this->m_reverse_api_channel_index_isSet = true;
}
SWGCWKeyerSettings*
SWGAMModSettings::getCwKeyer() {
return cw_keyer;
@ -335,6 +437,11 @@ SWGAMModSettings::isSet(){
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
if(m_mod_af_input_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;}
if(cw_keyer != nullptr && cw_keyer->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;

View File

@ -76,6 +76,21 @@ public:
qint32 getModAfInput();
void setModAfInput(qint32 mod_af_input);
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);
SWGCWKeyerSettings* getCwKeyer();
void setCwKeyer(SWGCWKeyerSettings* cw_keyer);
@ -116,6 +131,21 @@ private:
qint32 mod_af_input;
bool m_mod_af_input_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;
SWGCWKeyerSettings* cw_keyer;
bool m_cw_keyer_isSet;

View File

@ -56,6 +56,16 @@ SWGNFMModSettings::SWGNFMModSettings() {
m_audio_device_name_isSet = false;
mod_af_input = 0;
m_mod_af_input_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;
cw_keyer = nullptr;
m_cw_keyer_isSet = false;
}
@ -94,6 +104,16 @@ SWGNFMModSettings::init() {
m_audio_device_name_isSet = false;
mod_af_input = 0;
m_mod_af_input_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;
cw_keyer = new SWGCWKeyerSettings();
m_cw_keyer_isSet = false;
}
@ -118,6 +138,13 @@ SWGNFMModSettings::cleanup() {
delete audio_device_name;
}
if(reverse_api_address != nullptr) {
delete reverse_api_address;
}
if(cw_keyer != nullptr) {
delete cw_keyer;
}
@ -162,6 +189,16 @@ SWGNFMModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&mod_af_input, pJson["modAFInput"], "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", "");
::SWGSDRangel::setValue(&cw_keyer, pJson["cwKeyer"], "SWGCWKeyerSettings", "SWGCWKeyerSettings");
}
@ -222,6 +259,21 @@ SWGNFMModSettings::asJsonObject() {
if(m_mod_af_input_isSet){
obj->insert("modAFInput", QJsonValue(mod_af_input));
}
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));
}
if((cw_keyer != nullptr) && (cw_keyer->isSet())){
toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));
}
@ -369,6 +421,56 @@ SWGNFMModSettings::setModAfInput(qint32 mod_af_input) {
this->m_mod_af_input_isSet = true;
}
qint32
SWGNFMModSettings::getUseReverseApi() {
return use_reverse_api;
}
void
SWGNFMModSettings::setUseReverseApi(qint32 use_reverse_api) {
this->use_reverse_api = use_reverse_api;
this->m_use_reverse_api_isSet = true;
}
QString*
SWGNFMModSettings::getReverseApiAddress() {
return reverse_api_address;
}
void
SWGNFMModSettings::setReverseApiAddress(QString* reverse_api_address) {
this->reverse_api_address = reverse_api_address;
this->m_reverse_api_address_isSet = true;
}
qint32
SWGNFMModSettings::getReverseApiPort() {
return reverse_api_port;
}
void
SWGNFMModSettings::setReverseApiPort(qint32 reverse_api_port) {
this->reverse_api_port = reverse_api_port;
this->m_reverse_api_port_isSet = true;
}
qint32
SWGNFMModSettings::getReverseApiDeviceIndex() {
return reverse_api_device_index;
}
void
SWGNFMModSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) {
this->reverse_api_device_index = reverse_api_device_index;
this->m_reverse_api_device_index_isSet = true;
}
qint32
SWGNFMModSettings::getReverseApiChannelIndex() {
return reverse_api_channel_index;
}
void
SWGNFMModSettings::setReverseApiChannelIndex(qint32 reverse_api_channel_index) {
this->reverse_api_channel_index = reverse_api_channel_index;
this->m_reverse_api_channel_index_isSet = true;
}
SWGCWKeyerSettings*
SWGNFMModSettings::getCwKeyer() {
return cw_keyer;
@ -398,6 +500,11 @@ SWGNFMModSettings::isSet(){
if(title != nullptr && *title != QString("")){ isObjectUpdated = true; break;}
if(audio_device_name != nullptr && *audio_device_name != QString("")){ isObjectUpdated = true; break;}
if(m_mod_af_input_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;}
if(cw_keyer != nullptr && cw_keyer->isSet()){ isObjectUpdated = true; break;}
}while(false);
return isObjectUpdated;

View File

@ -85,6 +85,21 @@ public:
qint32 getModAfInput();
void setModAfInput(qint32 mod_af_input);
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);
SWGCWKeyerSettings* getCwKeyer();
void setCwKeyer(SWGCWKeyerSettings* cw_keyer);
@ -134,6 +149,21 @@ private:
qint32 mod_af_input;
bool m_mod_af_input_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;
SWGCWKeyerSettings* cw_keyer;
bool m_cw_keyer_isSet;