2020-11-27 22:10:27 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Copyright (C) 2015-2018 Edouard Griffiths, F4EXB. //
|
|
|
|
// Copyright (C) 2020 Jon Beniston, M7RCE //
|
|
|
|
// //
|
|
|
|
// This program is free software; you can redistribute it and/or modify //
|
|
|
|
// it under the terms of the GNU General Public License as published by //
|
|
|
|
// the Free Software Foundation as version 3 of the License, or //
|
|
|
|
// (at your option) any later version. //
|
|
|
|
// //
|
|
|
|
// This program is distributed in the hope that it will be useful, //
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
|
|
|
// GNU General Public License V3 for more details. //
|
|
|
|
// //
|
|
|
|
// You should have received a copy of the GNU General Public License //
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#include <QTime>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QBuffer>
|
|
|
|
#include <QThread>
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <complex.h>
|
|
|
|
|
|
|
|
#include "SWGChannelSettings.h"
|
2022-05-13 16:24:48 -04:00
|
|
|
#include "SWGWorkspaceInfo.h"
|
2020-11-27 22:10:27 -05:00
|
|
|
#include "SWGVORDemodSettings.h"
|
|
|
|
#include "SWGChannelReport.h"
|
|
|
|
#include "SWGVORDemodReport.h"
|
|
|
|
|
|
|
|
#include "dsp/dspengine.h"
|
|
|
|
#include "dsp/dspcommands.h"
|
2023-03-21 07:33:49 -04:00
|
|
|
#include "dsp/morsedemod.h"
|
2020-11-27 22:10:27 -05:00
|
|
|
#include "device/deviceapi.h"
|
|
|
|
#include "feature/feature.h"
|
2022-01-08 23:27:12 -05:00
|
|
|
#include "settings/serializable.h"
|
2020-11-27 22:10:27 -05:00
|
|
|
#include "util/db.h"
|
|
|
|
#include "maincore.h"
|
|
|
|
|
2022-05-01 07:05:36 -04:00
|
|
|
#include "vordemodreport.h"
|
|
|
|
#include "vordemod.h"
|
2020-11-29 03:26:32 -05:00
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
MESSAGE_CLASS_DEFINITION(VORDemod::MsgConfigureVORDemod, Message)
|
2020-11-27 22:10:27 -05:00
|
|
|
|
2022-05-01 06:15:03 -04:00
|
|
|
const char * const VORDemod::m_channelIdURI = "sdrangel.channel.vordemod";
|
2022-05-01 05:43:23 -04:00
|
|
|
const char * const VORDemod::m_channelId = "VORDemod";
|
2020-11-27 22:10:27 -05:00
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
VORDemod::VORDemod(DeviceAPI *deviceAPI) :
|
2020-11-27 22:10:27 -05:00
|
|
|
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
|
|
|
|
m_deviceAPI(deviceAPI),
|
2022-10-12 18:14:00 -04:00
|
|
|
m_thread(nullptr),
|
|
|
|
m_basebandSink(nullptr),
|
|
|
|
m_running(false),
|
2020-11-27 22:10:27 -05:00
|
|
|
m_basebandSampleRate(0)
|
|
|
|
{
|
|
|
|
setObjectName(m_channelId);
|
|
|
|
applySettings(m_settings, true);
|
|
|
|
|
|
|
|
m_deviceAPI->addChannelSink(this);
|
|
|
|
m_deviceAPI->addChannelSinkAPI(this);
|
|
|
|
|
|
|
|
m_networkManager = new QNetworkAccessManager();
|
2022-03-23 17:32:23 -04:00
|
|
|
QObject::connect(
|
|
|
|
m_networkManager,
|
|
|
|
&QNetworkAccessManager::finished,
|
|
|
|
this,
|
2022-05-01 05:43:23 -04:00
|
|
|
&VORDemod::networkManagerFinished
|
2022-03-23 17:32:23 -04:00
|
|
|
);
|
2022-03-18 12:08:04 -04:00
|
|
|
QObject::connect(
|
|
|
|
this,
|
|
|
|
&ChannelAPI::indexInDeviceSetChanged,
|
|
|
|
this,
|
2022-05-01 05:43:23 -04:00
|
|
|
&VORDemod::handleIndexInDeviceSetChanged
|
2022-03-18 12:08:04 -04:00
|
|
|
);
|
2022-10-12 18:14:00 -04:00
|
|
|
|
|
|
|
start();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
VORDemod::~VORDemod()
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
2022-05-01 05:43:23 -04:00
|
|
|
qDebug("VORDemod::~VORDemod");
|
2022-03-23 17:32:23 -04:00
|
|
|
QObject::disconnect(
|
|
|
|
m_networkManager,
|
|
|
|
&QNetworkAccessManager::finished,
|
|
|
|
this,
|
2022-05-01 05:43:23 -04:00
|
|
|
&VORDemod::networkManagerFinished
|
2022-03-23 17:32:23 -04:00
|
|
|
);
|
2020-11-27 22:10:27 -05:00
|
|
|
delete m_networkManager;
|
|
|
|
m_deviceAPI->removeChannelSinkAPI(this);
|
|
|
|
m_deviceAPI->removeChannelSink(this);
|
2022-10-12 18:14:00 -04:00
|
|
|
stop();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::setDeviceAPI(DeviceAPI *deviceAPI)
|
2022-04-16 10:45:53 -04:00
|
|
|
{
|
|
|
|
if (deviceAPI != m_deviceAPI)
|
|
|
|
{
|
|
|
|
m_deviceAPI->removeChannelSinkAPI(this);
|
|
|
|
m_deviceAPI->removeChannelSink(this);
|
|
|
|
m_deviceAPI = deviceAPI;
|
|
|
|
m_deviceAPI->addChannelSink(this);
|
|
|
|
m_deviceAPI->addChannelSinkAPI(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
uint32_t VORDemod::getNumberOfDeviceStreams() const
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
|
|
|
return m_deviceAPI->getNbSourceStreams();
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
|
|
|
(void) firstOfBurst;
|
2022-10-12 18:14:00 -04:00
|
|
|
|
|
|
|
if (m_running) {
|
|
|
|
m_basebandSink->feed(begin, end);
|
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::start()
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
2022-10-12 18:14:00 -04:00
|
|
|
if (m_running) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
qDebug("VORDemod::start");
|
2022-10-12 18:14:00 -04:00
|
|
|
m_thread = new QThread();
|
|
|
|
m_basebandSink = new VORDemodBaseband();
|
|
|
|
m_basebandSink->setMessageQueueToChannel(getInputMessageQueue());
|
|
|
|
m_basebandSink->moveToThread(m_thread);
|
|
|
|
|
|
|
|
QObject::connect(m_thread, &QThread::finished, m_basebandSink, &QObject::deleteLater);
|
|
|
|
QObject::connect(m_thread, &QThread::finished, m_thread, &QThread::deleteLater);
|
2020-11-27 22:10:27 -05:00
|
|
|
|
|
|
|
m_basebandSink->reset();
|
|
|
|
m_basebandSink->startWork();
|
2022-10-12 18:14:00 -04:00
|
|
|
m_thread->start();
|
2020-11-27 22:10:27 -05:00
|
|
|
|
|
|
|
DSPSignalNotification *dspMsg = new DSPSignalNotification(m_basebandSampleRate, m_centerFrequency);
|
|
|
|
m_basebandSink->getInputMessageQueue()->push(dspMsg);
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
VORDemodBaseband::MsgConfigureVORDemodBaseband *msg = VORDemodBaseband::MsgConfigureVORDemodBaseband::create(m_settings, true);
|
2020-11-27 22:10:27 -05:00
|
|
|
m_basebandSink->getInputMessageQueue()->push(msg);
|
2022-10-12 18:14:00 -04:00
|
|
|
|
|
|
|
m_running = true;
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::stop()
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
2022-10-12 18:14:00 -04:00
|
|
|
if (!m_running) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
qDebug("VORDemod::stop");
|
2022-10-12 18:14:00 -04:00
|
|
|
m_running = false;
|
2020-11-27 22:10:27 -05:00
|
|
|
m_basebandSink->stopWork();
|
2022-10-12 18:14:00 -04:00
|
|
|
m_thread->quit();
|
|
|
|
m_thread->wait();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
bool VORDemod::handleMessage(const Message& cmd)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
|
|
|
if (MsgConfigureVORDemod::match(cmd))
|
|
|
|
{
|
|
|
|
MsgConfigureVORDemod& cfg = (MsgConfigureVORDemod&) cmd;
|
2022-05-01 05:43:23 -04:00
|
|
|
qDebug() << "VORDemod::handleMessage: MsgConfigureVORDemod";
|
2020-11-27 22:10:27 -05:00
|
|
|
applySettings(cfg.getSettings(), cfg.getForce());
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else if (DSPSignalNotification::match(cmd))
|
|
|
|
{
|
|
|
|
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
|
|
|
|
m_basebandSampleRate = notif.getSampleRate();
|
|
|
|
m_centerFrequency = notif.getCenterFrequency();
|
2022-05-01 05:43:23 -04:00
|
|
|
qDebug() << "VORDemod::handleMessage: DSPSignalNotification";
|
2022-10-12 18:14:00 -04:00
|
|
|
|
|
|
|
// Forward to the sink
|
|
|
|
if (m_running)
|
|
|
|
{
|
|
|
|
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy
|
|
|
|
m_basebandSink->getInputMessageQueue()->push(rep);
|
|
|
|
}
|
|
|
|
|
2020-11-27 22:10:27 -05:00
|
|
|
// Forward to GUI if any
|
2022-04-13 05:08:21 -04:00
|
|
|
if (m_guiMessageQueue) {
|
|
|
|
m_guiMessageQueue->push(new DSPSignalNotification(notif));
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2022-05-01 05:43:23 -04:00
|
|
|
else if (VORDemodReport::MsgReportRadial::match(cmd))
|
2020-11-29 03:26:32 -05:00
|
|
|
{
|
2022-05-01 05:43:23 -04:00
|
|
|
VORDemodReport::MsgReportRadial& report = (VORDemodReport::MsgReportRadial&) cmd;
|
2020-11-29 03:26:32 -05:00
|
|
|
m_radial = report.getRadial();
|
|
|
|
m_refMag = report.getRefMag();
|
|
|
|
m_varMag = report.getVarMag();
|
|
|
|
|
|
|
|
if (m_guiMessageQueue)
|
|
|
|
{
|
2022-05-01 05:43:23 -04:00
|
|
|
VORDemodReport::MsgReportRadial *msg = new VORDemodReport::MsgReportRadial(report);
|
2020-11-29 03:26:32 -05:00
|
|
|
m_guiMessageQueue->push(msg);
|
|
|
|
}
|
|
|
|
|
2022-03-02 17:57:35 -05:00
|
|
|
MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
|
2022-02-26 07:44:46 -05:00
|
|
|
QList<ObjectPipe*> pipes;
|
|
|
|
messagePipes.getMessagePipes(this, "report", pipes);
|
2020-11-29 03:26:32 -05:00
|
|
|
|
2022-02-26 07:44:46 -05:00
|
|
|
if (pipes.size() > 0) {
|
|
|
|
sendChannelReport(pipes);
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2023-03-21 07:33:49 -04:00
|
|
|
else if (MorseDemod::MsgReportIdent::match(cmd))
|
2020-11-29 03:26:32 -05:00
|
|
|
{
|
2023-03-21 07:33:49 -04:00
|
|
|
MorseDemod::MsgReportIdent& report = (MorseDemod::MsgReportIdent&) cmd;
|
2020-11-29 03:26:32 -05:00
|
|
|
m_morseIdent = report.getIdent();
|
|
|
|
|
|
|
|
if (m_guiMessageQueue)
|
|
|
|
{
|
2023-03-21 07:33:49 -04:00
|
|
|
MorseDemod::MsgReportIdent *msg = new MorseDemod::MsgReportIdent(report);
|
2020-11-29 03:26:32 -05:00
|
|
|
m_guiMessageQueue->push(msg);
|
|
|
|
}
|
|
|
|
|
2022-03-02 17:57:35 -05:00
|
|
|
MessagePipes& messagePipes = MainCore::instance()->getMessagePipes();
|
2022-02-26 07:44:46 -05:00
|
|
|
QList<ObjectPipe*> pipes;
|
|
|
|
messagePipes.getMessagePipes(this, "report", pipes);
|
2020-11-29 03:26:32 -05:00
|
|
|
|
2022-02-26 07:44:46 -05:00
|
|
|
if (pipes.size() > 0) {
|
|
|
|
sendChannelReport(pipes);
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
else
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::setCenterFrequency(qint64 frequency)
|
2022-01-06 16:47:41 -05:00
|
|
|
{
|
2022-05-01 05:43:23 -04:00
|
|
|
VORDemodSettings settings = m_settings;
|
2022-01-06 16:47:41 -05:00
|
|
|
settings.m_inputFrequencyOffset = frequency;
|
|
|
|
applySettings(settings, false);
|
|
|
|
|
|
|
|
if (m_guiMessageQueue) // forward to GUI if any
|
|
|
|
{
|
|
|
|
MsgConfigureVORDemod *msgToGUI = MsgConfigureVORDemod::create(settings, false);
|
|
|
|
m_guiMessageQueue->push(msgToGUI);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::applySettings(const VORDemodSettings& settings, bool force)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
2022-05-01 05:43:23 -04:00
|
|
|
qDebug() << "VORDemod::applySettings:"
|
2020-11-29 03:26:32 -05:00
|
|
|
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
|
|
|
<< " m_navId: " << settings.m_navId
|
2020-11-27 22:10:27 -05:00
|
|
|
<< " m_volume: " << settings.m_volume
|
|
|
|
<< " m_squelch: " << settings.m_squelch
|
2023-03-06 10:06:05 -05:00
|
|
|
<< " m_identBandpassEnable: " << settings.m_identBandpassEnable
|
2020-11-27 22:10:27 -05:00
|
|
|
<< " m_audioMute: " << settings.m_audioMute
|
|
|
|
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
|
|
|
<< " m_streamIndex: " << settings.m_streamIndex
|
|
|
|
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
|
|
|
<< " m_reverseAPIAddress: " << settings.m_reverseAPIAddress
|
|
|
|
<< " m_reverseAPIPort: " << settings.m_reverseAPIPort
|
|
|
|
<< " m_reverseAPIDeviceIndex: " << settings.m_reverseAPIDeviceIndex
|
|
|
|
<< " m_reverseAPIChannelIndex: " << settings.m_reverseAPIChannelIndex
|
|
|
|
<< " force: " << force;
|
|
|
|
|
|
|
|
QList<QString> reverseAPIKeys;
|
|
|
|
|
2020-11-29 03:26:32 -05:00
|
|
|
if ((m_settings.m_inputFrequencyOffset != settings.m_inputFrequencyOffset) || force) {
|
|
|
|
reverseAPIKeys.append("inputFrequencyOffset");
|
|
|
|
}
|
|
|
|
if ((m_settings.m_navId != settings.m_navId) || force) {
|
|
|
|
reverseAPIKeys.append("navId");
|
2022-05-04 04:51:28 -04:00
|
|
|
|
|
|
|
// Reset state so we don't report old data for new NavId
|
|
|
|
m_radial = 0.0f;
|
2022-05-04 05:05:03 -04:00
|
|
|
m_refMag = -200.0f;
|
|
|
|
m_varMag = -200.0f;
|
2022-05-04 04:51:28 -04:00
|
|
|
m_morseIdent = "";
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
if ((m_settings.m_squelch != settings.m_squelch) || force) {
|
|
|
|
reverseAPIKeys.append("squelch");
|
|
|
|
}
|
|
|
|
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force) {
|
|
|
|
reverseAPIKeys.append("audioDeviceName");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((m_settings.m_audioMute != settings.m_audioMute) || force) {
|
|
|
|
reverseAPIKeys.append("audioMute");
|
|
|
|
}
|
2023-03-06 10:06:05 -05:00
|
|
|
if ((m_settings.m_identBandpassEnable != settings.m_identBandpassEnable) || force) {
|
|
|
|
reverseAPIKeys.append("identBandpassEnable");
|
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
if ((m_settings.m_volume != settings.m_volume) || force) {
|
|
|
|
reverseAPIKeys.append("volume");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_settings.m_streamIndex != settings.m_streamIndex)
|
|
|
|
{
|
|
|
|
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
|
|
|
|
{
|
|
|
|
m_deviceAPI->removeChannelSinkAPI(this);
|
|
|
|
m_deviceAPI->removeChannelSink(this, m_settings.m_streamIndex);
|
|
|
|
m_deviceAPI->addChannelSink(this, settings.m_streamIndex);
|
|
|
|
m_deviceAPI->addChannelSinkAPI(this);
|
|
|
|
}
|
|
|
|
|
|
|
|
reverseAPIKeys.append("streamIndex");
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((m_settings.m_identThreshold != settings.m_identThreshold) || force) {
|
|
|
|
reverseAPIKeys.append("identThreshold");
|
|
|
|
}
|
|
|
|
|
2022-10-12 18:14:00 -04:00
|
|
|
if (m_running)
|
|
|
|
{
|
|
|
|
VORDemodBaseband::MsgConfigureVORDemodBaseband *msg = VORDemodBaseband::MsgConfigureVORDemodBaseband::create(settings, force);
|
|
|
|
m_basebandSink->getInputMessageQueue()->push(msg);
|
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
|
2022-03-02 17:07:15 -05:00
|
|
|
QList<ObjectPipe*> pipes;
|
2022-03-02 17:57:35 -05:00
|
|
|
MainCore::instance()->getMessagePipes().getMessagePipes(this, "settings", pipes);
|
2020-12-13 07:04:36 -05:00
|
|
|
|
2022-03-02 17:07:15 -05:00
|
|
|
if (pipes.size() > 0) {
|
|
|
|
sendChannelSettings(pipes, reverseAPIKeys, settings, force);
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
m_settings = settings;
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
QByteArray VORDemod::serialize() const
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
|
|
|
return m_settings.serialize();
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
bool VORDemod::deserialize(const QByteArray& data)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
|
|
|
if (m_settings.deserialize(data))
|
|
|
|
{
|
|
|
|
MsgConfigureVORDemod *msg = MsgConfigureVORDemod::create(m_settings, true);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_settings.resetToDefaults();
|
|
|
|
MsgConfigureVORDemod *msg = MsgConfigureVORDemod::create(m_settings, true);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
int VORDemod::webapiSettingsGet(
|
2020-11-27 22:10:27 -05:00
|
|
|
SWGSDRangel::SWGChannelSettings& response,
|
|
|
|
QString& errorMessage)
|
|
|
|
{
|
|
|
|
(void) errorMessage;
|
2022-05-01 06:15:03 -04:00
|
|
|
response.setVorDemodSettings(new SWGSDRangel::SWGVORDemodSettings());
|
|
|
|
response.getVorDemodSettings()->init();
|
2020-11-27 22:10:27 -05:00
|
|
|
webapiFormatChannelSettings(response, m_settings);
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
2022-05-13 16:24:48 -04:00
|
|
|
int VORDemod::webapiWorkspaceGet(
|
|
|
|
SWGSDRangel::SWGWorkspaceInfo& response,
|
|
|
|
QString& errorMessage)
|
|
|
|
{
|
|
|
|
(void) errorMessage;
|
|
|
|
response.setIndex(m_settings.m_workspaceIndex);
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
int VORDemod::webapiSettingsPutPatch(
|
2020-11-27 22:10:27 -05:00
|
|
|
bool force,
|
|
|
|
const QStringList& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings& response,
|
|
|
|
QString& errorMessage)
|
|
|
|
{
|
|
|
|
(void) errorMessage;
|
2022-05-01 05:43:23 -04:00
|
|
|
VORDemodSettings settings = m_settings;
|
2020-11-27 22:10:27 -05:00
|
|
|
webapiUpdateChannelSettings(settings, channelSettingsKeys, response);
|
|
|
|
|
|
|
|
MsgConfigureVORDemod *msg = MsgConfigureVORDemod::create(settings, force);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
qDebug("VORDemod::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue);
|
2020-11-27 22:10:27 -05:00
|
|
|
if (m_guiMessageQueue) // forward to GUI if any
|
|
|
|
{
|
|
|
|
MsgConfigureVORDemod *msgToGUI = MsgConfigureVORDemod::create(settings, force);
|
|
|
|
m_guiMessageQueue->push(msgToGUI);
|
|
|
|
}
|
|
|
|
|
|
|
|
webapiFormatChannelSettings(response, settings);
|
|
|
|
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::webapiUpdateChannelSettings(
|
|
|
|
VORDemodSettings& settings,
|
2020-11-27 22:10:27 -05:00
|
|
|
const QStringList& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings& response)
|
|
|
|
{
|
2020-11-29 03:26:32 -05:00
|
|
|
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_inputFrequencyOffset = response.getVorDemodSettings()->getInputFrequencyOffset();
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("navId")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_navId = response.getVorDemodSettings()->getNavId();
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
if (channelSettingsKeys.contains("audioMute")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_audioMute = response.getVorDemodSettings()->getAudioMute() != 0;
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rgbColor")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_rgbColor = response.getVorDemodSettings()->getRgbColor();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("squelch")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_squelch = response.getVorDemodSettings()->getSquelch();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
2023-03-06 10:06:05 -05:00
|
|
|
if (channelSettingsKeys.contains("identBandpassEnable")) {
|
|
|
|
settings.m_identBandpassEnable = response.getVorDemodSettings()->getIdentBandpassEnable();
|
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
if (channelSettingsKeys.contains("title")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_title = *response.getVorDemodSettings()->getTitle();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("volume")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_volume = response.getVorDemodSettings()->getVolume();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("audioDeviceName")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_audioDeviceName = *response.getVorDemodSettings()->getAudioDeviceName();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("streamIndex")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_streamIndex = response.getVorDemodSettings()->getStreamIndex();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("useReverseAPI")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_useReverseAPI = response.getVorDemodSettings()->getUseReverseApi() != 0;
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIAddress")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_reverseAPIAddress = *response.getVorDemodSettings()->getReverseApiAddress();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_reverseAPIPort = response.getVorDemodSettings()->getReverseApiPort();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_reverseAPIDeviceIndex = response.getVorDemodSettings()->getReverseApiDeviceIndex();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_reverseAPIChannelIndex = response.getVorDemodSettings()->getReverseApiChannelIndex();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("identThreshold")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_identThreshold = response.getVorDemodSettings()->getIdentThreshold();
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
2022-01-08 23:27:12 -05:00
|
|
|
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getVorDemodSettings()->getChannelMarker());
|
2022-01-08 23:27:12 -05:00
|
|
|
}
|
|
|
|
if (settings.m_rollupState && channelSettingsKeys.contains("rollupState")) {
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_rollupState->updateFrom(channelSettingsKeys, response.getVorDemodSettings()->getRollupState());
|
2022-01-08 23:27:12 -05:00
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
int VORDemod::webapiReportGet(
|
2020-11-27 22:10:27 -05:00
|
|
|
SWGSDRangel::SWGChannelReport& response,
|
|
|
|
QString& errorMessage)
|
|
|
|
{
|
|
|
|
(void) errorMessage;
|
2022-05-01 06:15:03 -04:00
|
|
|
response.setVorDemodReport(new SWGSDRangel::SWGVORDemodReport());
|
|
|
|
response.getVorDemodReport()->init();
|
2020-11-27 22:10:27 -05:00
|
|
|
webapiFormatChannelReport(response);
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const VORDemodSettings& settings)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
|
|
|
response.getVorDemodSettings()->setNavId(settings.m_navId);
|
|
|
|
response.getVorDemodSettings()->setAudioMute(settings.m_audioMute ? 1 : 0);
|
|
|
|
response.getVorDemodSettings()->setRgbColor(settings.m_rgbColor);
|
|
|
|
response.getVorDemodSettings()->setSquelch(settings.m_squelch);
|
2023-03-06 10:06:05 -05:00
|
|
|
response.getVorDemodSettings()->setIdentBandpassEnable(settings.m_identBandpassEnable);
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setVolume(settings.m_volume);
|
|
|
|
|
|
|
|
if (response.getVorDemodSettings()->getTitle()) {
|
|
|
|
*response.getVorDemodSettings()->getTitle() = settings.m_title;
|
2020-11-27 22:10:27 -05:00
|
|
|
} else {
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setTitle(new QString(settings.m_title));
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 06:15:03 -04:00
|
|
|
if (response.getVorDemodSettings()->getAudioDeviceName()) {
|
|
|
|
*response.getVorDemodSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
|
2020-11-27 22:10:27 -05:00
|
|
|
} else {
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setStreamIndex(settings.m_streamIndex);
|
|
|
|
response.getVorDemodSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
2020-11-27 22:10:27 -05:00
|
|
|
|
2022-05-01 06:15:03 -04:00
|
|
|
if (response.getVorDemodSettings()->getReverseApiAddress()) {
|
|
|
|
*response.getVorDemodSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
|
2020-11-27 22:10:27 -05:00
|
|
|
} else {
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort);
|
|
|
|
response.getVorDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
|
|
|
response.getVorDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
|
|
|
|
response.getVorDemodSettings()->setIdentThreshold(settings.m_identThreshold);
|
2022-01-08 23:27:12 -05:00
|
|
|
|
|
|
|
if (settings.m_channelMarker)
|
|
|
|
{
|
2022-05-01 06:15:03 -04:00
|
|
|
if (response.getVorDemodSettings()->getChannelMarker())
|
2022-01-08 23:27:12 -05:00
|
|
|
{
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_channelMarker->formatTo(response.getVorDemodSettings()->getChannelMarker());
|
2022-01-08 23:27:12 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
|
|
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setChannelMarker(swgChannelMarker);
|
2022-01-08 23:27:12 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (settings.m_rollupState)
|
|
|
|
{
|
2022-05-01 06:15:03 -04:00
|
|
|
if (response.getVorDemodSettings()->getRollupState())
|
2022-01-08 23:27:12 -05:00
|
|
|
{
|
2022-05-01 06:15:03 -04:00
|
|
|
settings.m_rollupState->formatTo(response.getVorDemodSettings()->getRollupState());
|
2022-01-08 23:27:12 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
|
|
|
settings.m_rollupState->formatTo(swgRollupState);
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodSettings()->setRollupState(swgRollupState);
|
2022-01-08 23:27:12 -05:00
|
|
|
}
|
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
2022-10-12 18:14:00 -04:00
|
|
|
if (m_running)
|
|
|
|
{
|
|
|
|
double magsqAvg, magsqPeak;
|
|
|
|
int nbMagsqSamples;
|
|
|
|
getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
|
|
|
|
response.getVorDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg));
|
|
|
|
response.getVorDemodReport()->setSquelch(m_basebandSink->getSquelchOpen() ? 1 : 0);
|
|
|
|
response.getVorDemodReport()->setAudioSampleRate(m_basebandSink->getAudioSampleRate());
|
|
|
|
}
|
|
|
|
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodReport()->setNavId(m_settings.m_navId);
|
|
|
|
response.getVorDemodReport()->setRadial(m_radial);
|
|
|
|
response.getVorDemodReport()->setRefMag(m_refMag);
|
|
|
|
response.getVorDemodReport()->setVarMag(m_varMag);
|
2020-12-07 13:32:43 -05:00
|
|
|
float refMagDB = std::round(20.0*std::log10(m_refMag));
|
|
|
|
float varMagDB = std::round(20.0*std::log10(m_varMag));
|
|
|
|
bool validRefMag = refMagDB > m_settings.m_refThresholdDB;
|
|
|
|
bool validVarMag = varMagDB > m_settings.m_varThresholdDB;
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodReport()->setValidRadial(validRefMag && validVarMag ? 1 : 0);
|
|
|
|
response.getVorDemodReport()->setValidRefMag(validRefMag ? 1 : 0);
|
|
|
|
response.getVorDemodReport()->setValidVarMag(validVarMag ? 1 : 0);
|
2020-11-29 03:26:32 -05:00
|
|
|
|
2022-05-01 06:15:03 -04:00
|
|
|
if (response.getVorDemodReport()->getMorseIdent()) {
|
|
|
|
*response.getVorDemodReport()->getMorseIdent() = m_morseIdent;
|
2020-11-29 03:26:32 -05:00
|
|
|
} else {
|
2022-05-01 06:15:03 -04:00
|
|
|
response.getVorDemodReport()->setMorseIdent(new QString(m_morseIdent));
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const VORDemodSettings& settings, bool force)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
|
|
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
|
|
|
|
|
|
|
QString channelSettingsURL = QString("http://%1:%2/sdrangel/deviceset/%3/channel/%4/settings")
|
|
|
|
.arg(settings.m_reverseAPIAddress)
|
|
|
|
.arg(settings.m_reverseAPIPort)
|
|
|
|
.arg(settings.m_reverseAPIDeviceIndex)
|
|
|
|
.arg(settings.m_reverseAPIChannelIndex);
|
|
|
|
m_networkRequest.setUrl(QUrl(channelSettingsURL));
|
|
|
|
m_networkRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
|
|
|
|
|
|
|
QBuffer *buffer = new QBuffer();
|
|
|
|
buffer->open((QBuffer::ReadWrite));
|
|
|
|
buffer->write(swgChannelSettings->asJson().toUtf8());
|
|
|
|
buffer->seek(0);
|
|
|
|
|
|
|
|
// Always use PATCH to avoid passing reverse API settings
|
|
|
|
QNetworkReply *reply = m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer);
|
|
|
|
buffer->setParent(reply);
|
|
|
|
|
|
|
|
delete swgChannelSettings;
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::sendChannelSettings(
|
2022-03-02 17:07:15 -05:00
|
|
|
const QList<ObjectPipe*>& pipes,
|
2020-12-13 07:04:36 -05:00
|
|
|
QList<QString>& channelSettingsKeys,
|
2022-05-01 05:43:23 -04:00
|
|
|
const VORDemodSettings& settings,
|
2020-12-13 07:04:36 -05:00
|
|
|
bool force)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
2022-03-02 17:07:15 -05:00
|
|
|
for (const auto& pipe : pipes)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
2022-03-02 17:07:15 -05:00
|
|
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
|
|
|
|
|
|
|
if (messageQueue)
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
|
|
|
webapiFormatChannelSettings(channelSettingsKeys, swgChannelSettings, settings, force);
|
|
|
|
MainCore::MsgChannelSettings *msg = MainCore::MsgChannelSettings::create(
|
|
|
|
this,
|
|
|
|
channelSettingsKeys,
|
|
|
|
swgChannelSettings,
|
|
|
|
force
|
|
|
|
);
|
|
|
|
messageQueue->push(msg);
|
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::sendChannelReport(QList<ObjectPipe*>& messagePipes)
|
2020-11-29 03:26:32 -05:00
|
|
|
{
|
2022-02-26 07:44:46 -05:00
|
|
|
for (const auto& pipe : messagePipes)
|
2020-11-29 03:26:32 -05:00
|
|
|
{
|
2022-02-26 07:44:46 -05:00
|
|
|
MessageQueue *messageQueue = qobject_cast<MessageQueue*>(pipe->m_element);
|
|
|
|
|
|
|
|
if (messageQueue)
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelReport *swgChannelReport = new SWGSDRangel::SWGChannelReport();
|
|
|
|
swgChannelReport->setDirection(0);
|
|
|
|
swgChannelReport->setChannelType(new QString(m_channelId));
|
2022-05-01 06:15:03 -04:00
|
|
|
swgChannelReport->setVorDemodReport(new SWGSDRangel::SWGVORDemodReport());
|
2022-02-26 07:44:46 -05:00
|
|
|
webapiFormatChannelReport(*swgChannelReport);
|
|
|
|
MainCore::MsgChannelReport *msg = MainCore::MsgChannelReport::create(this, swgChannelReport);
|
|
|
|
messageQueue->push(msg);
|
|
|
|
}
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::webapiFormatChannelSettings(
|
2020-11-27 22:10:27 -05:00
|
|
|
QList<QString>& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
2022-05-01 05:43:23 -04:00
|
|
|
const VORDemodSettings& settings,
|
2020-11-27 22:10:27 -05:00
|
|
|
bool force
|
|
|
|
)
|
|
|
|
{
|
|
|
|
swgChannelSettings->setDirection(0); // Single sink (Rx)
|
|
|
|
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
|
|
|
|
swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
|
2022-05-01 05:43:23 -04:00
|
|
|
swgChannelSettings->setChannelType(new QString("VORDemod"));
|
2022-05-01 06:15:03 -04:00
|
|
|
swgChannelSettings->setVorDemodSettings(new SWGSDRangel::SWGVORDemodSettings());
|
|
|
|
SWGSDRangel::SWGVORDemodSettings *swgVORDemodSettings = swgChannelSettings->getVorDemodSettings();
|
2020-11-27 22:10:27 -05:00
|
|
|
|
|
|
|
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
|
|
|
|
2020-11-29 03:26:32 -05:00
|
|
|
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("navId") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setNavId(settings.m_navId);
|
2020-11-29 03:26:32 -05:00
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
if (channelSettingsKeys.contains("audioMute") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setAudioMute(settings.m_audioMute ? 1 : 0);
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rgbColor") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setRgbColor(settings.m_rgbColor);
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("squelch") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setSquelch(settings.m_squelch);
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
2023-03-06 10:06:05 -05:00
|
|
|
if (channelSettingsKeys.contains("identBandpassEnable") || force) {
|
|
|
|
swgVORDemodSettings->setIdentBandpassEnable(settings.m_identBandpassEnable);
|
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
if (channelSettingsKeys.contains("title") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setTitle(new QString(settings.m_title));
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("volume") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setVolume(settings.m_volume);
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("audioDeviceName") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("streamIndex") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setStreamIndex(settings.m_streamIndex);
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("identThreshold") || force) {
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setAudioMute(settings.m_identThreshold);
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
2022-01-08 23:27:12 -05:00
|
|
|
|
|
|
|
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
|
|
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setChannelMarker(swgChannelMarker);
|
2022-01-08 23:27:12 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
if (settings.m_rollupState && (channelSettingsKeys.contains("rollupState") || force))
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
|
|
|
settings.m_rollupState->formatTo(swgRollupState);
|
2022-05-01 06:15:03 -04:00
|
|
|
swgVORDemodSettings->setRollupState(swgRollupState);
|
2022-01-08 23:27:12 -05:00
|
|
|
}
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::networkManagerFinished(QNetworkReply *reply)
|
2020-11-27 22:10:27 -05:00
|
|
|
{
|
|
|
|
QNetworkReply::NetworkError replyError = reply->error();
|
|
|
|
|
|
|
|
if (replyError)
|
|
|
|
{
|
2022-05-01 05:43:23 -04:00
|
|
|
qWarning() << "VORDemod::networkManagerFinished:"
|
2020-11-27 22:10:27 -05:00
|
|
|
<< " error(" << (int) replyError
|
|
|
|
<< "): " << replyError
|
|
|
|
<< ": " << reply->errorString();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QString answer = reply->readAll();
|
|
|
|
answer.chop(1); // remove last \n
|
2022-05-01 05:43:23 -04:00
|
|
|
qDebug("VORDemod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
2020-11-27 22:10:27 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
reply->deleteLater();
|
|
|
|
}
|
2022-03-18 12:08:04 -04:00
|
|
|
|
2022-05-01 05:43:23 -04:00
|
|
|
void VORDemod::handleIndexInDeviceSetChanged(int index)
|
2022-03-18 12:08:04 -04:00
|
|
|
{
|
2022-10-12 18:14:00 -04:00
|
|
|
if (!m_running || (index < 0)) {
|
2022-03-18 12:08:04 -04:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString fifoLabel = QString("%1 [%2:%3]")
|
|
|
|
.arg(m_channelId)
|
|
|
|
.arg(m_deviceAPI->getDeviceSetIndex())
|
|
|
|
.arg(index);
|
|
|
|
m_basebandSink->setFifoLabel(fifoLabel);
|
|
|
|
m_basebandSink->setAudioFifoLabel(fifoLabel);
|
|
|
|
}
|