mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-15 04:41:55 -05:00
Reverse API: Perseus
This commit is contained in:
parent
802c5fe53b
commit
f7028fac3a
@ -24,6 +24,8 @@
|
|||||||
#include "ui_perseusgui.h"
|
#include "ui_perseusgui.h"
|
||||||
#include "gui/colormapper.h"
|
#include "gui/colormapper.h"
|
||||||
#include "gui/glspectrum.h"
|
#include "gui/glspectrum.h"
|
||||||
|
#include "gui/crightclickenabler.h"
|
||||||
|
#include "gui/basicdevicesettingsdialog.h"
|
||||||
#include "dsp/dspengine.h"
|
#include "dsp/dspengine.h"
|
||||||
#include "dsp/dspcommands.h"
|
#include "dsp/dspcommands.h"
|
||||||
#include "perseusgui.h"
|
#include "perseusgui.h"
|
||||||
@ -48,6 +50,9 @@ PerseusGui::PerseusGui(DeviceUISet *deviceUISet, QWidget* parent) :
|
|||||||
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
connect(&m_statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));
|
||||||
m_statusTimer.start(500);
|
m_statusTimer.start(500);
|
||||||
|
|
||||||
|
CRightClickEnabler *startStopRightClickEnabler = new CRightClickEnabler(ui->startStop);
|
||||||
|
connect(startStopRightClickEnabler, SIGNAL(rightClick(const QPoint &)), this, SLOT(openDeviceSettingsDialog(const QPoint &)));
|
||||||
|
|
||||||
displaySettings();
|
displaySettings();
|
||||||
|
|
||||||
m_rates = m_sampleSource->getSampleRates();
|
m_rates = m_sampleSource->getSampleRates();
|
||||||
@ -398,6 +403,21 @@ int PerseusGui::getDevSampleRateIndex(uint32_t sampeRate)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PerseusGui::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();
|
||||||
|
}
|
||||||
|
@ -91,6 +91,7 @@ private slots:
|
|||||||
void updateHardware();
|
void updateHardware();
|
||||||
void updateStatus();
|
void updateStatus();
|
||||||
void handleInputMessages();
|
void handleInputMessages();
|
||||||
|
void openDeviceSettingsDialog(const QPoint& p);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSGUI_H_ */
|
#endif /* PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSGUI_H_ */
|
||||||
|
@ -15,6 +15,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QBuffer>
|
||||||
|
|
||||||
#include "SWGDeviceSettings.h"
|
#include "SWGDeviceSettings.h"
|
||||||
#include "SWGDeviceState.h"
|
#include "SWGDeviceState.h"
|
||||||
@ -45,10 +47,15 @@ PerseusInput::PerseusInput(DeviceSourceAPI *deviceAPI) :
|
|||||||
openDevice();
|
openDevice();
|
||||||
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
|
m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID()));
|
||||||
m_deviceAPI->addSink(m_fileSink);
|
m_deviceAPI->addSink(m_fileSink);
|
||||||
|
|
||||||
|
m_networkManager = new QNetworkAccessManager();
|
||||||
|
connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||||
}
|
}
|
||||||
|
|
||||||
PerseusInput::~PerseusInput()
|
PerseusInput::~PerseusInput()
|
||||||
{
|
{
|
||||||
|
disconnect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*)));
|
||||||
|
delete m_networkManager;
|
||||||
m_deviceAPI->removeSink(m_fileSink);
|
m_deviceAPI->removeSink(m_fileSink);
|
||||||
delete m_fileSink;
|
delete m_fileSink;
|
||||||
closeDevice();
|
closeDevice();
|
||||||
@ -187,6 +194,10 @@ bool PerseusInput::handleMessage(const Message& message)
|
|||||||
m_deviceAPI->stopAcquisition();
|
m_deviceAPI->stopAcquisition();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (m_settings.m_useReverseAPI) {
|
||||||
|
webapiReverseSendStartStop(cmd.getStartStop());
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else if (MsgFileRecord::match(message))
|
else if (MsgFileRecord::match(message))
|
||||||
@ -287,9 +298,11 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
{
|
{
|
||||||
bool forwardChange = false;
|
bool forwardChange = false;
|
||||||
int sampleRateIndex = settings.m_devSampleRateIndex;
|
int sampleRateIndex = settings.m_devSampleRateIndex;
|
||||||
|
QList<QString> reverseAPIKeys;
|
||||||
|
|
||||||
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
if ((m_settings.m_devSampleRateIndex != settings.m_devSampleRateIndex) || force)
|
||||||
{
|
{
|
||||||
|
reverseAPIKeys.append("devSampleRateIndex");
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (settings.m_devSampleRateIndex >= m_sampleRates.size()) {
|
if (settings.m_devSampleRateIndex >= m_sampleRates.size()) {
|
||||||
@ -321,6 +334,7 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
|
|
||||||
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
if ((m_settings.m_log2Decim != settings.m_log2Decim) || force)
|
||||||
{
|
{
|
||||||
|
reverseAPIKeys.append("log2Decim");
|
||||||
forwardChange = true;
|
forwardChange = true;
|
||||||
|
|
||||||
if (m_perseusThread != 0)
|
if (m_perseusThread != 0)
|
||||||
@ -330,6 +344,22 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)) {
|
||||||
|
reverseAPIKeys.append("centerFrequency");
|
||||||
|
}
|
||||||
|
if (force || (m_settings.m_LOppmTenths != settings.m_LOppmTenths)) {
|
||||||
|
reverseAPIKeys.append("LOppmTenths");
|
||||||
|
}
|
||||||
|
if (force || (m_settings.m_wideBand != settings.m_wideBand)) {
|
||||||
|
reverseAPIKeys.append("wideBand");
|
||||||
|
}
|
||||||
|
if (force || (m_settings.m_transverterMode != settings.m_transverterMode)) {
|
||||||
|
reverseAPIKeys.append("transverterMode");
|
||||||
|
}
|
||||||
|
if (force || (m_settings.m_transverterDeltaFrequency != settings.m_transverterDeltaFrequency)) {
|
||||||
|
reverseAPIKeys.append("transverterDeltaFrequency");
|
||||||
|
}
|
||||||
|
|
||||||
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|
if (force || (m_settings.m_centerFrequency != settings.m_centerFrequency)
|
||||||
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|
|| (m_settings.m_LOppmTenths != settings.m_LOppmTenths)
|
||||||
|| (m_settings.m_wideBand != settings.m_wideBand)
|
|| (m_settings.m_wideBand != settings.m_wideBand)
|
||||||
@ -352,6 +382,7 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
|
|
||||||
if ((m_settings.m_attenuator != settings.m_attenuator) || force)
|
if ((m_settings.m_attenuator != settings.m_attenuator) || force)
|
||||||
{
|
{
|
||||||
|
reverseAPIKeys.append("attenuator");
|
||||||
int rc = perseus_set_attenuator_n(m_perseusDescriptor, (int) settings.m_attenuator);
|
int rc = perseus_set_attenuator_n(m_perseusDescriptor, (int) settings.m_attenuator);
|
||||||
|
|
||||||
if (rc < 0) {
|
if (rc < 0) {
|
||||||
@ -361,6 +392,13 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (force || (m_settings.m_adcDither != settings.m_adcDither)) {
|
||||||
|
reverseAPIKeys.append("adcDither");
|
||||||
|
}
|
||||||
|
if (force || (m_settings.m_adcPreamp != settings.m_adcPreamp)) {
|
||||||
|
reverseAPIKeys.append("adcPreamp");
|
||||||
|
}
|
||||||
|
|
||||||
if ((m_settings.m_adcDither != settings.m_adcDither)
|
if ((m_settings.m_adcDither != settings.m_adcDither)
|
||||||
|| (m_settings.m_adcPreamp != settings.m_adcPreamp) || force)
|
|| (m_settings.m_adcPreamp != settings.m_adcPreamp) || force)
|
||||||
{
|
{
|
||||||
@ -383,6 +421,15 @@ bool PerseusInput::applySettings(const PerseusSettings& settings, bool force)
|
|||||||
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
m_deviceAPI->getDeviceEngineInputMessageQueue()->push(notif);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
m_settings = settings;
|
||||||
m_settings.m_devSampleRateIndex = sampleRateIndex;
|
m_settings.m_devSampleRateIndex = sampleRateIndex;
|
||||||
|
|
||||||
@ -539,3 +586,97 @@ void PerseusInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PerseusInput::webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PerseusSettings& settings, bool force)
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings();
|
||||||
|
swgDeviceSettings->setTx(0);
|
||||||
|
swgDeviceSettings->setDeviceHwType(new QString("Perseus"));
|
||||||
|
swgDeviceSettings->setPerseusSettings(new SWGSDRangel::SWGPerseusSettings());
|
||||||
|
SWGSDRangel::SWGPerseusSettings *swgPerseusSettings = swgDeviceSettings->getPerseusSettings();
|
||||||
|
|
||||||
|
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
||||||
|
|
||||||
|
if (deviceSettingsKeys.contains("centerFrequency") || force) {
|
||||||
|
swgPerseusSettings->setCenterFrequency(settings.m_centerFrequency);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("LOppmTenths") || force) {
|
||||||
|
swgPerseusSettings->setLOppmTenths(settings.m_LOppmTenths);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("devSampleRateIndex") || force) {
|
||||||
|
swgPerseusSettings->setDevSampleRateIndex(settings.m_devSampleRateIndex);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("log2Decim") || force) {
|
||||||
|
swgPerseusSettings->setLog2Decim(settings.m_log2Decim);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("adcDither") || force) {
|
||||||
|
swgPerseusSettings->setAdcDither(settings.m_adcDither ? 1 : 0);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("adcPreamp") || force) {
|
||||||
|
swgPerseusSettings->setAdcPreamp(settings.m_adcPreamp ? 1 : 0);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("wideBand") || force) {
|
||||||
|
swgPerseusSettings->setWideBand(settings.m_wideBand ? 1 : 0);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("attenuator") || force) {
|
||||||
|
swgPerseusSettings->setAttenuator((int) settings.m_attenuator);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("transverterDeltaFrequency") || force) {
|
||||||
|
swgPerseusSettings->setTransverterDeltaFrequency(settings.m_transverterDeltaFrequency);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("transverterMode") || force) {
|
||||||
|
swgPerseusSettings->setTransverterMode(settings.m_transverterMode ? 1 : 0);
|
||||||
|
}
|
||||||
|
if (deviceSettingsKeys.contains("fileRecordName") || force) {
|
||||||
|
swgPerseusSettings->setFileRecordName(new QString(settings.m_fileRecordName));
|
||||||
|
}
|
||||||
|
|
||||||
|
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));
|
||||||
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||||
|
|
||||||
|
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 PerseusInput::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 PerseusInput::networkManagerFinished(QNetworkReply *reply)
|
||||||
|
{
|
||||||
|
QNetworkReply::NetworkError replyError = reply->error();
|
||||||
|
|
||||||
|
if (replyError)
|
||||||
|
{
|
||||||
|
qWarning() << "PerseusInput::networkManagerFinished:"
|
||||||
|
<< " error(" << (int) replyError
|
||||||
|
<< "): " << replyError
|
||||||
|
<< ": " << reply->errorString();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString answer = reply->readAll();
|
||||||
|
answer.chop(1); // remove last \n
|
||||||
|
qDebug("PerseusInput::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
||||||
|
}
|
||||||
|
@ -18,17 +18,22 @@
|
|||||||
#define PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSINPUT_H_
|
#define PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSINPUT_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "perseus-sdr.h"
|
|
||||||
|
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
|
||||||
|
#include "perseus-sdr.h"
|
||||||
#include "dsp/devicesamplesource.h"
|
#include "dsp/devicesamplesource.h"
|
||||||
#include "util/message.h"
|
#include "util/message.h"
|
||||||
#include "perseussettings.h"
|
#include "perseussettings.h"
|
||||||
|
|
||||||
|
class QNetworkAccessManager;
|
||||||
|
class QNetworkReply;
|
||||||
class DeviceSourceAPI;
|
class DeviceSourceAPI;
|
||||||
class FileRecord;
|
class FileRecord;
|
||||||
class PerseusThread;
|
class PerseusThread;
|
||||||
|
|
||||||
class PerseusInput : public DeviceSampleSource {
|
class PerseusInput : public DeviceSampleSource {
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
class MsgConfigurePerseus : public Message {
|
class MsgConfigurePerseus : public Message {
|
||||||
MESSAGE_CLASS_DECLARATION
|
MESSAGE_CLASS_DECLARATION
|
||||||
@ -144,6 +149,8 @@ private:
|
|||||||
PerseusThread *m_perseusThread;
|
PerseusThread *m_perseusThread;
|
||||||
perseus_descr *m_perseusDescriptor;
|
perseus_descr *m_perseusDescriptor;
|
||||||
std::vector<uint32_t> m_sampleRates;
|
std::vector<uint32_t> m_sampleRates;
|
||||||
|
QNetworkAccessManager *m_networkManager;
|
||||||
|
QNetworkRequest m_networkRequest;
|
||||||
|
|
||||||
bool openDevice();
|
bool openDevice();
|
||||||
void closeDevice();
|
void closeDevice();
|
||||||
@ -151,6 +158,11 @@ private:
|
|||||||
bool applySettings(const PerseusSettings& settings, bool force = false);
|
bool applySettings(const PerseusSettings& settings, bool force = false);
|
||||||
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PerseusSettings& settings);
|
void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const PerseusSettings& settings);
|
||||||
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
void webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& response);
|
||||||
|
void webapiReverseSendSettings(QList<QString>& deviceSettingsKeys, const PerseusSettings& settings, bool force);
|
||||||
|
void webapiReverseSendStartStop(bool start);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void networkManagerFinished(QNetworkReply *reply);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSINPUT_H_ */
|
#endif /* PLUGINS_SAMPLESOURCE_PERSEUS_PERSEUSINPUT_H_ */
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
const PluginDescriptor PerseusPlugin::m_pluginDescriptor = {
|
const PluginDescriptor PerseusPlugin::m_pluginDescriptor = {
|
||||||
QString("Perseus Input"),
|
QString("Perseus Input"),
|
||||||
QString("4.0.0"),
|
QString("4.3.2"),
|
||||||
QString("(c) Edouard Griffiths, F4EXB"),
|
QString("(c) Edouard Griffiths, F4EXB"),
|
||||||
QString("https://github.com/f4exb/sdrangel"),
|
QString("https://github.com/f4exb/sdrangel"),
|
||||||
true,
|
true,
|
||||||
|
@ -36,6 +36,10 @@ void PerseusSettings::resetToDefaults()
|
|||||||
m_wideBand = false;
|
m_wideBand = false;
|
||||||
m_attenuator = Attenuator_None;
|
m_attenuator = Attenuator_None;
|
||||||
m_fileRecordName = "";
|
m_fileRecordName = "";
|
||||||
|
m_useReverseAPI = false;
|
||||||
|
m_reverseAPIAddress = "127.0.0.1";
|
||||||
|
m_reverseAPIPort = 8888;
|
||||||
|
m_reverseAPIDeviceIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
QByteArray PerseusSettings::serialize() const
|
QByteArray PerseusSettings::serialize() const
|
||||||
@ -51,6 +55,10 @@ QByteArray PerseusSettings::serialize() const
|
|||||||
s.writeBool(7, m_adcPreamp);
|
s.writeBool(7, m_adcPreamp);
|
||||||
s.writeBool(8, m_wideBand);
|
s.writeBool(8, m_wideBand);
|
||||||
s.writeS32(9, (int) m_attenuator);
|
s.writeS32(9, (int) m_attenuator);
|
||||||
|
s.writeBool(10, m_useReverseAPI);
|
||||||
|
s.writeString(11, m_reverseAPIAddress);
|
||||||
|
s.writeU32(12, m_reverseAPIPort);
|
||||||
|
s.writeU32(13, m_reverseAPIDeviceIndex);
|
||||||
|
|
||||||
return s.final();
|
return s.final();
|
||||||
}
|
}
|
||||||
@ -68,6 +76,7 @@ bool PerseusSettings::deserialize(const QByteArray& data)
|
|||||||
if (d.getVersion() == 1)
|
if (d.getVersion() == 1)
|
||||||
{
|
{
|
||||||
int intval;
|
int intval;
|
||||||
|
uint32_t uintval;
|
||||||
|
|
||||||
d.readU32(1, &m_devSampleRateIndex, 0);
|
d.readU32(1, &m_devSampleRateIndex, 0);
|
||||||
d.readS32(2, &m_LOppmTenths, 0);
|
d.readS32(2, &m_LOppmTenths, 0);
|
||||||
@ -85,6 +94,19 @@ bool PerseusSettings::deserialize(const QByteArray& data)
|
|||||||
m_attenuator = Attenuator_None;
|
m_attenuator = Attenuator_None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
d.readBool(10, &m_useReverseAPI, false);
|
||||||
|
d.readString(11, &m_reverseAPIAddress, "127.0.0.1");
|
||||||
|
d.readU32(12, &uintval, 0);
|
||||||
|
|
||||||
|
if ((uintval > 1023) && (uintval < 65535)) {
|
||||||
|
m_reverseAPIPort = uintval;
|
||||||
|
} else {
|
||||||
|
m_reverseAPIPort = 8888;
|
||||||
|
}
|
||||||
|
|
||||||
|
d.readU32(13, &uintval, 0);
|
||||||
|
m_reverseAPIDeviceIndex = uintval > 99 ? 99 : uintval;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -42,6 +42,10 @@ struct PerseusSettings
|
|||||||
bool m_wideBand;
|
bool m_wideBand;
|
||||||
Attenuator m_attenuator;
|
Attenuator m_attenuator;
|
||||||
QString m_fileRecordName;
|
QString m_fileRecordName;
|
||||||
|
bool m_useReverseAPI;
|
||||||
|
QString m_reverseAPIAddress;
|
||||||
|
uint16_t m_reverseAPIPort;
|
||||||
|
uint16_t m_reverseAPIDeviceIndex;
|
||||||
|
|
||||||
PerseusSettings();
|
PerseusSettings();
|
||||||
void resetToDefaults();
|
void resetToDefaults();
|
||||||
|
Loading…
Reference in New Issue
Block a user