LimeRFE feature: added start/stop Rx/Tx in actions

pull/1391/head
f4exb 2022-08-17 11:40:22 +02:00
rodzic 4c2eb487c3
commit e23b053ab2
7 zmienionych plików z 154 dodań i 10 usunięć

Wyświetl plik

@ -302,13 +302,16 @@ int LimeRFE::setRx(bool rxOn)
}
}
qDebug("LimeRFE::setRx: switch %s mode: %d", rxOn ? "on" : "off", mode);
int rc = RFE_Mode(m_rfeDevice, mode);
if (rc == 0) {
if (rc == 0)
{
m_rxOn = rxOn;
} else {
qInfo("LimeRFE::setRx: %s", getError(rc).c_str());
qDebug("LimeRFE::setRx: switch %s mode: %d", rxOn ? "on" : "off", mode);
}
else
{
qInfo("LimeRFE::setRx %s: %s", rxOn ? "on" : "off", getError(rc).c_str());
}
return rc;
@ -337,13 +340,16 @@ int LimeRFE::setTx(bool txOn)
}
}
qDebug("LimeRFE::setTx: switch %s mode: %d", txOn ? "on" : "off", mode);
int rc = RFE_Mode(m_rfeDevice, mode);
if (rc == 0) {
if (rc == 0)
{
m_txOn = txOn;
} else {
qInfo("LimeRFE::setTx: %s", getError(rc).c_str());
qDebug("LimeRFE::setTx: switch %s mode: %d", txOn ? "on" : "off", mode);
}
else
{
qInfo("LimeRFE::setTx %s: %s", txOn ? "on" : "off", getError(rc).c_str());
}
return rc;
@ -905,6 +911,46 @@ int LimeRFE::webapiActionsPost(
unknownAction = false;
}
if (featureActionsKeys.contains("setRx"))
{
int rc = setRx(swgLimeRFEActions->getSetRx() != 0);
unknownAction = false;
if (rc == 0)
{
if (getMessageQueueToGUI())
{
MsgReportSetRx *msg = MsgReportSetRx::create(swgLimeRFEActions->getSetRx() != 0);
getMessageQueueToGUI()->push(msg);
}
}
else
{
errorMessage = QString("Cannot switch Rx");
return 500;
}
}
if (featureActionsKeys.contains("setTx"))
{
int rc = setTx(swgLimeRFEActions->getSetTx() != 0);
unknownAction = false;
if (rc == 0)
{
if (getMessageQueueToGUI())
{
MsgReportSetTx *msg = MsgReportSetTx::create(swgLimeRFEActions->getSetTx() != 0);
getMessageQueueToGUI()->push(msg);
}
}
else
{
errorMessage = QString("Cannot switch Tx");
return 500;
}
}
if (unknownAction)
{
errorMessage = "Unknown action";

Wyświetl plik

@ -7318,6 +7318,14 @@ margin-bottom: 20px;
"openCloseDevice" : {
"type" : "integer",
"description" : "Open or close device\n * 0 - Close device\n * 1 - Open device\n"
},
"setRx" : {
"type" : "integer",
"description" : "Set Rx om or off\n * 0 - Rx off\n * 1 - Rx on\n"
},
"setTx" : {
"type" : "integer",
"description" : "Set Tx om or off\n * 0 - Tx off\n * 1 - Tx on\n"
}
},
"description" : "LimeRFE"
@ -56597,7 +56605,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2022-08-16T14:53:35.735+02:00
Generated 2022-08-16T18:08:01.866+02:00
</div>
</div>
</div>

Wyświetl plik

@ -172,3 +172,15 @@ LimeRFEActions:
Open or close device
* 0 - Close device
* 1 - Open device
setRx:
type: integer
description: >
Set Rx om or off
* 0 - Rx off
* 1 - Rx on
setTx:
type: integer
description: >
Set Tx om or off
* 0 - Tx off
* 1 - Tx on

Wyświetl plik

@ -172,3 +172,15 @@ LimeRFEActions:
Open or close device
* 0 - Close device
* 1 - Open device
setRx:
type: integer
description: >
Set Rx om or off
* 0 - Rx off
* 1 - Rx on
setTx:
type: integer
description: >
Set Tx om or off
* 0 - Tx off
* 1 - Tx on

Wyświetl plik

@ -7318,6 +7318,14 @@ margin-bottom: 20px;
"openCloseDevice" : {
"type" : "integer",
"description" : "Open or close device\n * 0 - Close device\n * 1 - Open device\n"
},
"setRx" : {
"type" : "integer",
"description" : "Set Rx om or off\n * 0 - Rx off\n * 1 - Rx on\n"
},
"setTx" : {
"type" : "integer",
"description" : "Set Tx om or off\n * 0 - Tx off\n * 1 - Tx on\n"
}
},
"description" : "LimeRFE"
@ -56597,7 +56605,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2022-08-16T14:53:35.735+02:00
Generated 2022-08-16T18:08:01.866+02:00
</div>
</div>
</div>

Wyświetl plik

@ -40,6 +40,10 @@ SWGLimeRFEActions::SWGLimeRFEActions() {
m_from_to_settings_isSet = false;
open_close_device = 0;
m_open_close_device_isSet = false;
set_rx = 0;
m_set_rx_isSet = false;
set_tx = 0;
m_set_tx_isSet = false;
}
SWGLimeRFEActions::~SWGLimeRFEActions() {
@ -60,6 +64,10 @@ SWGLimeRFEActions::init() {
m_from_to_settings_isSet = false;
open_close_device = 0;
m_open_close_device_isSet = false;
set_rx = 0;
m_set_rx_isSet = false;
set_tx = 0;
m_set_tx_isSet = false;
}
void
@ -70,6 +78,8 @@ SWGLimeRFEActions::cleanup() {
}
SWGLimeRFEActions*
@ -95,6 +105,10 @@ SWGLimeRFEActions::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&open_close_device, pJson["openCloseDevice"], "qint32", "");
::SWGSDRangel::setValue(&set_rx, pJson["setRx"], "qint32", "");
::SWGSDRangel::setValue(&set_tx, pJson["setTx"], "qint32", "");
}
QString
@ -129,6 +143,12 @@ SWGLimeRFEActions::asJsonObject() {
if(m_open_close_device_isSet){
obj->insert("openCloseDevice", QJsonValue(open_close_device));
}
if(m_set_rx_isSet){
obj->insert("setRx", QJsonValue(set_rx));
}
if(m_set_tx_isSet){
obj->insert("setTx", QJsonValue(set_tx));
}
return obj;
}
@ -193,6 +213,26 @@ SWGLimeRFEActions::setOpenCloseDevice(qint32 open_close_device) {
this->m_open_close_device_isSet = true;
}
qint32
SWGLimeRFEActions::getSetRx() {
return set_rx;
}
void
SWGLimeRFEActions::setSetRx(qint32 set_rx) {
this->set_rx = set_rx;
this->m_set_rx_isSet = true;
}
qint32
SWGLimeRFEActions::getSetTx() {
return set_tx;
}
void
SWGLimeRFEActions::setSetTx(qint32 set_tx) {
this->set_tx = set_tx;
this->m_set_tx_isSet = true;
}
bool
SWGLimeRFEActions::isSet(){
@ -216,6 +256,12 @@ SWGLimeRFEActions::isSet(){
if(m_open_close_device_isSet){
isObjectUpdated = true; break;
}
if(m_set_rx_isSet){
isObjectUpdated = true; break;
}
if(m_set_tx_isSet){
isObjectUpdated = true; break;
}
}while(false);
return isObjectUpdated;
}

Wyświetl plik

@ -59,6 +59,12 @@ public:
qint32 getOpenCloseDevice();
void setOpenCloseDevice(qint32 open_close_device);
qint32 getSetRx();
void setSetRx(qint32 set_rx);
qint32 getSetTx();
void setSetTx(qint32 set_tx);
virtual bool isSet() override;
@ -81,6 +87,12 @@ private:
qint32 open_close_device;
bool m_open_close_device_isSet;
qint32 set_rx;
bool m_set_rx_isSet;
qint32 set_tx;
bool m_set_tx_isSet;
};
}