Reverse API: LimeSDR input changes

This commit is contained in:
f4exb 2018-12-18 23:37:26 +01:00
parent 442f23ca91
commit 2945f7302f
12 changed files with 436 additions and 9 deletions

View File

@ -14,10 +14,14 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include <QMutexLocker>
#include <QDebug>
#include <cstddef>
#include <string.h>
#include <QMutexLocker>
#include <QDebug>
#include <QNetworkReply>
#include <QBuffer>
#include "lime/LimeSuite.h"
#include "SWGDeviceSettings.h"
@ -61,11 +65,20 @@ LimeSDRInput::LimeSDRInput(DeviceSourceAPI *deviceAPI) :
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
m_deviceAPI->addSink(m_fileSink);
m_networkManager = new QNetworkAccessManager();
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
}
LimeSDRInput::~LimeSDRInput()
{
if (m_running) stop();
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
delete m_networkManager;
if (m_running) {
stop();
}
m_deviceAPI->removeSink(m_fileSink);
delete m_fileSink;
suspendRxBuddies();
@ -759,6 +772,10 @@ bool LimeSDRInput::handleMessage(const Message& message)
m_deviceAPI->stopAcquisition();
}
if (m_settings.m_useReverseAPI) {
webapiReverseSendStartStop(cmd.getStartStop());
}
return true;
}
else
@ -779,6 +796,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
bool doLPCalibration = false;
bool setAntennaAuto = false;
double clockGenFreq = 0.0;
QList<QString> reverseAPIKeys;
// QMutexLocker mutexLocker(&m_mutex);
qint64 deviceCenterFrequency = settings.m_centerFrequency;
@ -798,16 +817,20 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_dcBlock != settings.m_dcBlock) || force)
{
reverseAPIKeys.append("dcBlock");
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
}
if ((m_settings.m_iqCorrection != settings.m_iqCorrection) || force)
{
reverseAPIKeys.append("iqCorrection");
m_deviceAPI->configureCorrections(settings.m_dcBlock, settings.m_iqCorrection);
}
if ((m_settings.m_gainMode != settings.m_gainMode) || force)
{
reverseAPIKeys.append("gainMode");
if (settings.m_gainMode == LimeSDRInputSettings::GAIN_AUTO)
{
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
@ -871,6 +894,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_AUTO) && (m_settings.m_gain != settings.m_gain))
{
reverseAPIKeys.append("gain");
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
if (LMS_SetGaindB(m_deviceShared.m_deviceParams->getDevice(),
@ -890,6 +915,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && (m_settings.m_lnaGain != settings.m_lnaGain))
{
reverseAPIKeys.append("lnaGain");
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
if (DeviceLimeSDR::SetRFELNA_dB(m_deviceShared.m_deviceParams->getDevice(),
@ -908,6 +935,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && (m_settings.m_tiaGain != settings.m_tiaGain))
{
reverseAPIKeys.append("tiaGain");
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
if (DeviceLimeSDR::SetRFETIA_dB(m_deviceShared.m_deviceParams->getDevice(),
@ -926,6 +955,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_gainMode == LimeSDRInputSettings::GAIN_MANUAL) && (m_settings.m_pgaGain != settings.m_pgaGain))
{
reverseAPIKeys.append("pgaGain");
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
if (DeviceLimeSDR::SetRBBPGA_dB(m_deviceShared.m_deviceParams->getDevice(),
@ -945,6 +976,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_devSampleRate != settings.m_devSampleRate)
|| (m_settings.m_log2HardDecim != settings.m_log2HardDecim) || force)
{
reverseAPIKeys.append("devSampleRate");
reverseAPIKeys.append("log2HardDecim");
forwardChangeAllDSP = true; //m_settings.m_devSampleRate != settings.m_devSampleRate;
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
@ -973,6 +1006,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_lpfBW != settings.m_lpfBW) || force)
{
reverseAPIKeys.append("lpfBW");
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
doLPCalibration = true;
@ -982,6 +1017,9 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_lpfFIRBW != settings.m_lpfFIRBW) ||
(m_settings.m_lpfFIREnable != settings.m_lpfFIREnable) || force)
{
reverseAPIKeys.append("lpfFIRBW");
reverseAPIKeys.append("lpfFIREnable");
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
if (LMS_SetGFIRLPF(m_deviceShared.m_deviceParams->getDevice(),
@ -1007,6 +1045,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_ncoFrequency != settings.m_ncoFrequency) ||
(m_settings.m_ncoEnable != settings.m_ncoEnable) || force || forceNCOFrequency)
{
reverseAPIKeys.append("ncoFrequency");
reverseAPIKeys.append("ncoEnable");
forwardChangeOwnDSP = true;
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
@ -1034,6 +1074,7 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_log2SoftDecim != settings.m_log2SoftDecim) || force)
{
reverseAPIKeys.append("log2SoftDecim");
forwardChangeOwnDSP = true;
m_deviceShared.m_log2Soft = settings.m_log2SoftDecim; // for buddies
@ -1046,6 +1087,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_antennaPath != settings.m_antennaPath) || force)
{
reverseAPIKeys.append("antennaPath");
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
{
if (DeviceLimeSDR::setRxAntennaPath(m_deviceShared.m_deviceParams->getDevice(),
@ -1071,6 +1114,9 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
|| (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)
|| setAntennaAuto || force)
{
reverseAPIKeys.append("centerFrequency");
reverseAPIKeys.append("transverterMode");
reverseAPIKeys.append("transverterDeltaFrequency");
forwardChangeRxDSP = true;
if (m_deviceShared.m_deviceParams->getDevice() != 0 && m_channelAcquired)
@ -1091,6 +1137,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_extClock != settings.m_extClock) ||
(settings.m_extClock && (m_settings.m_extClockFreq != settings.m_extClockFreq)) || force)
{
reverseAPIKeys.append("extClock");
reverseAPIKeys.append("extClockFreq");
if (DeviceLimeSDR::setClockSource(m_deviceShared.m_deviceParams->getDevice(),
settings.m_extClock,
@ -1115,6 +1163,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
{
if ((m_settings.m_gpioDir != settings.m_gpioDir) || force)
{
reverseAPIKeys.append("gpioDir");
if (LMS_GPIODirWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioDir, 1) != 0)
{
qCritical("LimeSDROutput::applySettings: could not set GPIO directions to %u", settings.m_gpioDir);
@ -1128,6 +1178,8 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
if ((m_settings.m_gpioPins != settings.m_gpioPins) || force)
{
reverseAPIKeys.append("gpioPins");
if (LMS_GPIOWrite(m_deviceShared.m_deviceParams->getDevice(), &settings.m_gpioPins, 1) != 0)
{
qCritical("LimeSDROutput::applySettings: could not set GPIO pins to %u", settings.m_gpioPins);
@ -1140,6 +1192,15 @@ bool LimeSDRInput::applySettings(const LimeSDRInputSettings& settings, bool forc
}
}
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);
webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force);
}
m_settings = settings;
double clockGenFreqAfter;
@ -1444,6 +1505,18 @@ int LimeSDRInput::webapiSettingsPutPatch(
if (deviceSettingsKeys.contains("gpioPins")) {
settings.m_gpioPins = response.getLimeSdrInputSettings()->getGpioPins() & 0xFF;
}
if (deviceSettingsKeys.contains("useReverseAPI")) {
settings.m_useReverseAPI = response.getLimeSdrInputSettings()->getUseReverseApi() != 0;
}
if (deviceSettingsKeys.contains("reverseAPIAddress")) {
settings.m_reverseAPIAddress = *response.getLimeSdrInputSettings()->getReverseApiAddress() != 0;
}
if (deviceSettingsKeys.contains("reverseAPIPort")) {
settings.m_reverseAPIPort = response.getLimeSdrInputSettings()->getReverseApiPort();
}
if (deviceSettingsKeys.contains("reverseAPIDeviceIndex")) {
settings.m_reverseAPIDeviceIndex = response.getLimeSdrInputSettings()->getReverseApiDeviceIndex();
}
MsgConfigureLimeSDR *msg = MsgConfigureLimeSDR::create(settings, force);
m_inputMessageQueue.push(msg);
@ -1490,6 +1563,16 @@ void LimeSDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& re
response.getLimeSdrInputSettings()->setGpioDir(settings.m_gpioDir);
response.getLimeSdrInputSettings()->setGpioPins(settings.m_gpioPins);
response.getLimeSdrInputSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
if (response.getLimeSdrInputSettings()->getReverseApiAddress()) {
*response.getLimeSdrInputSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
} else {
response.getLimeSdrInputSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
}
response.getLimeSdrInputSettings()->setReverseApiPort(settings.m_reverseAPIPort);
response.getLimeSdrInputSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
}
int LimeSDRInput::webapiReportGet(
@ -1570,3 +1653,135 @@ void LimeSDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respon
response.getLimeSdrInputReport()->setGpioDir(gpioDir);
response.getLimeSdrInputReport()->setGpioPins(gpioPins);
}
void LimeSDRInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LimeSDRInputSettings& settings, bool force)
{
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
swgDeviceSettings->setTx(0);
swgDeviceSettings->setDeviceHwType(new QString("LimeSDR"));
swgDeviceSettings->setLimeSdrInputSettings(new SWGSDRangel::SWGLimeSdrInputSettings());
SWGSDRangel::SWGLimeSdrInputSettings *swgLimeSdrInputSettings = swgDeviceSettings->getLimeSdrInputSettings();
// transfer data that has been modified. When force is on transfer all data except reverse API data
if (deviceSettingsKeys.contains("antennaPath") || force) {
swgLimeSdrInputSettings->setAntennaPath((int) settings.m_antennaPath);
}
if (deviceSettingsKeys.contains("centerFrequency")) {
swgLimeSdrInputSettings->setCenterFrequency(settings.m_centerFrequency);
}
if (deviceSettingsKeys.contains("dcBlock")) {
swgLimeSdrInputSettings->setDcBlock(settings.m_dcBlock ? 1 : 0);
}
if (deviceSettingsKeys.contains("devSampleRate")) {
swgLimeSdrInputSettings->setDevSampleRate(settings.m_devSampleRate);
}
if (deviceSettingsKeys.contains("extClock")) {
swgLimeSdrInputSettings->setExtClock(settings.m_extClock ? 1 : 0);
}
if (deviceSettingsKeys.contains("extClockFreq")) {
swgLimeSdrInputSettings->setExtClockFreq(settings.m_extClockFreq);
}
if (deviceSettingsKeys.contains("gain")) {
swgLimeSdrInputSettings->setGain(settings.m_gain);
}
if (deviceSettingsKeys.contains("gainMode")) {
swgLimeSdrInputSettings->setGainMode((int) settings.m_gainMode);
}
if (deviceSettingsKeys.contains("iqCorrection")) {
swgLimeSdrInputSettings->setIqCorrection(settings.m_iqCorrection ? 1 : 0);
}
if (deviceSettingsKeys.contains("lnaGain")) {
swgLimeSdrInputSettings->setLnaGain(settings.m_lnaGain);
}
if (deviceSettingsKeys.contains("log2HardDecim")) {
swgLimeSdrInputSettings->setLog2HardDecim(settings.m_log2HardDecim);
}
if (deviceSettingsKeys.contains("log2SoftDecim")) {
swgLimeSdrInputSettings->setLog2SoftDecim(settings.m_log2SoftDecim);
}
if (deviceSettingsKeys.contains("lpfBW")) {
swgLimeSdrInputSettings->setLpfBw(settings.m_lpfBW);
}
if (deviceSettingsKeys.contains("lpfFIREnable")) {
swgLimeSdrInputSettings->setLpfFirEnable(settings.m_lpfFIREnable ? 1 : 0);
}
if (deviceSettingsKeys.contains("lpfFIRBW")) {
swgLimeSdrInputSettings->setLpfFirbw(settings.m_lpfFIRBW);
}
if (deviceSettingsKeys.contains("ncoEnable")) {
swgLimeSdrInputSettings->setNcoEnable(settings.m_ncoEnable ? 1 : 0);
}
if (deviceSettingsKeys.contains("ncoFrequency")) {
swgLimeSdrInputSettings->setNcoFrequency(settings.m_ncoFrequency);
}
if (deviceSettingsKeys.contains("pgaGain")) {
swgLimeSdrInputSettings->setPgaGain(settings.m_pgaGain);
}
if (deviceSettingsKeys.contains("tiaGain")) {
swgLimeSdrInputSettings->setTiaGain(settings.m_tiaGain);
}
if (deviceSettingsKeys.contains("transverterDeltaFrequency")) {
swgLimeSdrInputSettings->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
}
if (deviceSettingsKeys.contains("transverterMode")) {
swgLimeSdrInputSettings->setTransverterMode(settings.m_transverterMode ? 1 : 0);
}
if (deviceSettingsKeys.contains("fileRecordName")) {
swgLimeSdrInputSettings->setFileRecordName(new QString(settings.m_fileRecordName));
}
if (deviceSettingsKeys.contains("gpioDir")) {
swgLimeSdrInputSettings->setGpioDir(settings.m_gpioDir & 0xFF);
}
if (deviceSettingsKeys.contains("gpioPins")) {
swgLimeSdrInputSettings->setGpioPins(settings.m_gpioPins & 0xFF);
}
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/settings")
.arg(settings.m_reverseAPIAddress)
.arg(settings.m_reverseAPIPort)
.arg(settings.m_reverseAPIDeviceIndex);
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
QBuffer *buffer=new QBuffer();
buffer->open((QBuffer::ReadWrite));
buffer->write(swgDeviceSettings->asJson().toUtf8());
buffer->seek(0);
// Always use PATCH to avoid passing reverse API settings
m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
delete swgDeviceSettings;
}
void LimeSDRInput::webapiReverseSendStartStop(bool start)
{
QString deviceSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/device/run")
.arg(m_settings.m_reverseAPIAddress)
.arg(m_settings.m_reverseAPIPort)
.arg(m_settings.m_reverseAPIDeviceIndex);
m_networkRequest.setUrl(QUrl(deviceSettingsURL));
if (start) {
m_networkManager->sendCustomRequest(m_networkRequest, "POST");
} else {
m_networkManager->sendCustomRequest(m_networkRequest, "DELETE");
}
}
void LimeSDRInput::networkManagerFinished(QNetworkReply *reply)
{
QNetworkReply::NetworkError replyError = reply->error();
if (replyError)
{
qWarning() << "LimeSDRInput::networkManagerFinished:"
<< " error(" << (int) replyError
<< "): " << replyError
<< ": " << reply->errorString();
return;
}
QString answer = reply->readAll();
qDebug("LimeSDRInput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
}

View File

@ -17,9 +17,11 @@
#ifndef PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUT_H_
#define PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUT_H_
#include <stdint.h>
#include <QString>
#include <QByteArray>
#include <stdint.h>
#include <QNetworkRequest>
#include "dsp/devicesamplesource.h"
#include "limesdr/devicelimesdrshared.h"
@ -28,9 +30,12 @@
class DeviceSourceAPI;
class LimeSDRInputThread;
class FileRecord;
class QNetworkAccessManager;
class QNetworkReply;
class LimeSDRInput : public DeviceSampleSource
{
Q_OBJECT
public:
class MsgConfigureLimeSDR : public Message {
MESSAGE_CLASS_DECLARATION
@ -257,6 +262,8 @@ private:
bool m_channelAcquired;
lms_stream_t m_streamId;
FileRecord *m_fileSink; //!< File sink to record device I/Q output
QNetworkAccessManager *m_networkManager;
QNetworkRequest m_networkRequest;
bool openDevice();
void closeDevice();
@ -269,6 +276,11 @@ private:
bool applySettings(const LimeSDRInputSettings& settings, bool force = false, bool forceNCOFrequency = false);
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const LimeSDRInputSettings& settings);
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const LimeSDRInputSettings& settings, bool force);
void webapiReverseSendStartStop(bool start);
private slots:
void networkManagerFinished(QNetworkReply *reply);
};
#endif /* PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUT_H_ */

View File

@ -24,6 +24,8 @@
#include "ui_limesdrinputgui.h"
#include "gui/colormapper.h"
#include "gui/glspectrum.h"
#include "gui/crightclickenabler.h"
#include "gui/basicdevicesettingsdialog.h"
#include "dsp/dspengine.h"
#include "dsp/dspcommands.h"
#include "device/devicesourceapi.h"
@ -77,6 +79,9 @@ LimeSDRInputGUI::LimeSDRInputGUI(DeviceUISet *deviceUISet, QWidget* parent) :
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()), Qt::QueuedConnection);
m_limeSDRInput->setMessageQueueToGUI(&m_inputMessageQueue);
CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
}
LimeSDRInputGUI::~LimeSDRInputGUI()
@ -651,4 +656,21 @@ void LimeSDRInputGUI::on_transverter_clicked()
sendSettings();
}
void LimeSDRInputGUI::openDeviceSettingsDialog(const QPoint& p)
{
BasicDeviceSettingsDialog dialog(this);
dialog.setUseReverseAPI(m_settings.m_useReverseAPI);
dialog.setReverseAPIAddress(m_settings.m_reverseAPIAddress);
dialog.setReverseAPIPort(m_settings.m_reverseAPIPort);
dialog.setReverseAPIDeviceIndex(m_settings.m_reverseAPIDeviceIndex);
dialog.move(p);
dialog.exec();
m_settings.m_useReverseAPI = dialog.useReverseAPI();
m_settings.m_reverseAPIAddress = dialog.getReverseAPIAddress();
m_settings.m_reverseAPIPort = dialog.getReverseAPIPort();
m_settings.m_reverseAPIDeviceIndex = dialog.getReverseAPIDeviceIndex();
sendSettings();
}

View File

@ -100,6 +100,7 @@ private slots:
void on_antenna_currentIndexChanged(int index);
void on_extClock_clicked();
void on_transverter_clicked();
void openDeviceSettingsDialog(const QPoint& p);
void updateHardware();
void updateStatus();

View File

@ -48,6 +48,10 @@ void LimeSDRInputSettings::resetToDefaults()
m_fileRecordName = "";
m_gpioDir = 0;
m_gpioPins = 0;
m_useReverseAPI = false;
m_reverseAPIAddress = "127.0.0.1";
m_reverseAPIPort = 8888;
m_reverseAPIDeviceIndex = 0;
}
QByteArray LimeSDRInputSettings::serialize() const
@ -76,7 +80,10 @@ QByteArray LimeSDRInputSettings::serialize() const
s.writeS64(21, m_transverterDeltaFrequency);
s.writeU32(22, m_gpioDir);
s.writeU32(23, m_gpioPins);
s.writeBool(24, m_useReverseAPI);
s.writeString(25, m_reverseAPIAddress);
s.writeU32(26, m_reverseAPIPort);
s.writeU32(27, m_reverseAPIDeviceIndex);
return s.final();
}
@ -121,6 +128,18 @@ bool LimeSDRInputSettings::deserialize(const QByteArray& data)
m_gpioDir = uintval & 0xFF;
d.readU32(23, &uintval, 0);
m_gpioPins = uintval & 0xFF;
d.readBool(24, &m_useReverseAPI, false);
d.readString(25, &m_reverseAPIAddress, "127.0.0.1");
d.readU32(26, &uintval, 0);
if ((uintval > 1023) && (uintval < 65535)) {
m_reverseAPIPort = uintval;
} else {
m_reverseAPIPort = 8888;
}
d.readU32(27, &uintval, 0);
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
return true;
}

View File

@ -68,6 +68,10 @@ struct LimeSDRInputSettings
QString m_fileRecordName;
uint8_t m_gpioDir; //!< GPIO pin direction LSB first; 0 input, 1 output
uint8_t m_gpioPins; //!< GPIO pins to write; LSB first
bool m_useReverseAPI;
QString m_reverseAPIAddress;
uint16_t m_reverseAPIPort;
uint16_t m_reverseAPIDeviceIndex;
LimeSDRInputSettings();
void resetToDefaults();

View File

@ -2731,6 +2731,19 @@ margin-bottom: 20px;
"gpioPins" : {
"type" : "integer",
"format" : "int8"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
}
},
"description" : "LimeSDR"
@ -23691,7 +23704,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-12-18T21:38:21.986+01:00
Generated 2018-12-18T22:18:01.691+01:00
</div>
</div>
</div>

View File

@ -53,7 +53,16 @@ LimeSdrInputSettings:
gpioPins:
type: integer
format: int8
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer
LimeSdrOutputSettings:
description: LimeSDR
properties:

View File

@ -53,7 +53,16 @@ LimeSdrInputSettings:
gpioPins:
type: integer
format: int8
useReverseAPI:
description: Synchronize with reverse API (1 for yes, 0 for no)
type: integer
reverseAPIAddress:
type: string
reverseAPIPort:
type: integer
reverseAPIDeviceIndex:
type: integer
LimeSdrOutputSettings:
description: LimeSDR
properties:

View File

@ -2731,6 +2731,19 @@ margin-bottom: 20px;
"gpioPins" : {
"type" : "integer",
"format" : "int8"
},
"useReverseAPI" : {
"type" : "integer",
"description" : "Synchronize with reverse API (1 for yes, 0 for no)"
},
"reverseAPIAddress" : {
"type" : "string"
},
"reverseAPIPort" : {
"type" : "integer"
},
"reverseAPIDeviceIndex" : {
"type" : "integer"
}
},
"description" : "LimeSDR"
@ -23691,7 +23704,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2018-12-18T21:38:21.986+01:00
Generated 2018-12-18T22:18:01.691+01:00
</div>
</div>
</div>

View File

@ -76,6 +76,14 @@ SWGLimeSdrInputSettings::SWGLimeSdrInputSettings() {
m_gpio_dir_isSet = false;
gpio_pins = 0;
m_gpio_pins_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;
}
SWGLimeSdrInputSettings::~SWGLimeSdrInputSettings() {
@ -132,6 +140,14 @@ SWGLimeSdrInputSettings::init() {
m_gpio_dir_isSet = false;
gpio_pins = 0;
m_gpio_pins_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;
}
void
@ -162,6 +178,12 @@ SWGLimeSdrInputSettings::cleanup() {
}
if(reverse_api_address != nullptr) {
delete reverse_api_address;
}
}
SWGLimeSdrInputSettings*
@ -223,6 +245,14 @@ SWGLimeSdrInputSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&gpio_pins, pJson["gpioPins"], "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", "");
}
QString
@ -311,6 +341,18 @@ SWGLimeSdrInputSettings::asJsonObject() {
if(m_gpio_pins_isSet){
obj->insert("gpioPins", QJsonValue(gpio_pins));
}
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));
}
return obj;
}
@ -555,6 +597,46 @@ SWGLimeSdrInputSettings::setGpioPins(qint32 gpio_pins) {
this->m_gpio_pins_isSet = true;
}
qint32
SWGLimeSdrInputSettings::getUseReverseApi() {
return use_reverse_api;
}
void
SWGLimeSdrInputSettings::setUseReverseApi(qint32 use_reverse_api) {
this->use_reverse_api = use_reverse_api;
this->m_use_reverse_api_isSet = true;
}
QString*
SWGLimeSdrInputSettings::getReverseApiAddress() {
return reverse_api_address;
}
void
SWGLimeSdrInputSettings::setReverseApiAddress(QString* reverse_api_address) {
this->reverse_api_address = reverse_api_address;
this->m_reverse_api_address_isSet = true;
}
qint32
SWGLimeSdrInputSettings::getReverseApiPort() {
return reverse_api_port;
}
void
SWGLimeSdrInputSettings::setReverseApiPort(qint32 reverse_api_port) {
this->reverse_api_port = reverse_api_port;
this->m_reverse_api_port_isSet = true;
}
qint32
SWGLimeSdrInputSettings::getReverseApiDeviceIndex() {
return reverse_api_device_index;
}
void
SWGLimeSdrInputSettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) {
this->reverse_api_device_index = reverse_api_device_index;
this->m_reverse_api_device_index_isSet = true;
}
bool
SWGLimeSdrInputSettings::isSet(){
@ -584,6 +666,10 @@ SWGLimeSdrInputSettings::isSet(){
if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;}
if(m_gpio_dir_isSet){ isObjectUpdated = true; break;}
if(m_gpio_pins_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;}
}while(false);
return isObjectUpdated;
}

View File

@ -114,6 +114,18 @@ public:
qint32 getGpioPins();
void setGpioPins(qint32 gpio_pins);
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);
virtual bool isSet() override;
@ -190,6 +202,18 @@ private:
qint32 gpio_pins;
bool m_gpio_pins_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;
};
}