2015-12-06 04:30:51 -05:00
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
2015-12-06 13:47:55 -05:00
|
|
|
// Copyright (C) 2015 F4EXB //
|
|
|
|
// written by Edouard Griffiths //
|
2015-12-06 04:30:51 -05:00
|
|
|
// //
|
|
|
|
// 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 //
|
2019-04-11 00:39:30 -04:00
|
|
|
// (at your option) any later version. //
|
2015-12-06 04:30:51 -05:00
|
|
|
// //
|
|
|
|
// 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/>. //
|
|
|
|
///////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2018-05-23 08:56:29 -04:00
|
|
|
#include "boost/format.hpp"
|
2017-10-01 06:48:31 -04:00
|
|
|
|
2018-12-22 01:16:15 -05:00
|
|
|
#include <QTime>
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QNetworkReply>
|
|
|
|
#include <QBuffer>
|
2019-12-03 12:49:52 -05:00
|
|
|
#include <QThread>
|
2018-12-22 01:16:15 -05:00
|
|
|
|
2018-05-23 08:56:29 -04:00
|
|
|
#include "SWGChannelSettings.h"
|
2022-05-13 16:24:48 -04:00
|
|
|
#include "SWGWorkspaceInfo.h"
|
2018-05-23 08:56:29 -04:00
|
|
|
#include "SWGBFMDemodSettings.h"
|
|
|
|
#include "SWGChannelReport.h"
|
|
|
|
#include "SWGBFMDemodReport.h"
|
|
|
|
#include "SWGRDSReport.h"
|
|
|
|
|
2015-12-06 04:30:51 -05:00
|
|
|
#include "dsp/dspengine.h"
|
2018-02-14 14:11:36 -05:00
|
|
|
#include "dsp/dspcommands.h"
|
2019-09-22 19:25:17 -04:00
|
|
|
#include "dsp/devicesamplemimo.h"
|
2019-05-08 16:11:53 -04:00
|
|
|
#include "device/deviceapi.h"
|
2020-10-22 18:11:18 -04:00
|
|
|
#include "feature/feature.h"
|
2018-05-23 08:56:29 -04:00
|
|
|
#include "util/db.h"
|
2020-10-22 18:11:18 -04:00
|
|
|
#include "maincore.h"
|
2016-10-02 15:52:39 -04:00
|
|
|
|
2017-10-01 06:48:31 -04:00
|
|
|
#include "bfmdemod.h"
|
2016-10-02 07:18:07 -04:00
|
|
|
|
2015-12-06 04:30:51 -05:00
|
|
|
MESSAGE_CLASS_DEFINITION(BFMDemod::MsgConfigureBFMDemod, Message)
|
|
|
|
|
2020-11-21 14:24:18 -05:00
|
|
|
const char* const BFMDemod::m_channelIdURI = "sdrangel.channel.bfm";
|
|
|
|
const char* const BFMDemod::m_channelId = "BFMDemod";
|
2017-08-25 12:56:43 -04:00
|
|
|
const int BFMDemod::m_udpBlockSize = 512;
|
2016-03-21 03:40:42 -04:00
|
|
|
|
2019-05-08 16:11:53 -04:00
|
|
|
BFMDemod::BFMDemod(DeviceAPI *deviceAPI) :
|
2019-12-03 12:49:52 -05:00
|
|
|
ChannelAPI(m_channelIdURI, ChannelAPI::StreamSingleSink),
|
|
|
|
m_deviceAPI(deviceAPI),
|
2020-04-30 03:57:05 -04:00
|
|
|
m_spectrumVis(SDR_RX_SCALEF),
|
2019-12-03 12:49:52 -05:00
|
|
|
m_basebandSampleRate(0)
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
2017-11-22 19:19:32 -05:00
|
|
|
setObjectName(m_channelId);
|
2015-12-06 04:30:51 -05:00
|
|
|
|
2019-12-03 12:49:52 -05:00
|
|
|
m_thread = new QThread(this);
|
|
|
|
m_basebandSink = new BFMDemodBaseband();
|
2020-04-30 03:57:05 -04:00
|
|
|
m_basebandSink->setSpectrumSink(&m_spectrumVis);
|
2022-06-20 07:55:30 -04:00
|
|
|
m_basebandSink->setChannel(this);
|
2019-12-03 12:49:52 -05:00
|
|
|
m_basebandSink->moveToThread(m_thread);
|
2018-03-27 17:57:29 -04:00
|
|
|
|
2019-12-03 12:49:52 -05:00
|
|
|
applySettings(m_settings, true);
|
2017-10-01 10:02:34 -04:00
|
|
|
|
2019-12-03 12:49:52 -05:00
|
|
|
m_deviceAPI->addChannelSink(this);
|
2019-05-08 16:11:53 -04:00
|
|
|
m_deviceAPI->addChannelSinkAPI(this);
|
2018-12-22 01:16:15 -05:00
|
|
|
|
|
|
|
m_networkManager = new QNetworkAccessManager();
|
2022-03-23 17:32:23 -04:00
|
|
|
QObject::connect(
|
|
|
|
m_networkManager,
|
|
|
|
&QNetworkAccessManager::finished,
|
|
|
|
this,
|
|
|
|
&BFMDemod::networkManagerFinished
|
|
|
|
);
|
2022-03-18 12:08:04 -04:00
|
|
|
QObject::connect(
|
|
|
|
this,
|
|
|
|
&ChannelAPI::indexInDeviceSetChanged,
|
|
|
|
this,
|
|
|
|
&BFMDemod::handleIndexInDeviceSetChanged
|
|
|
|
);
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
BFMDemod::~BFMDemod()
|
|
|
|
{
|
2022-03-23 17:32:23 -04:00
|
|
|
QObject::disconnect(
|
|
|
|
m_networkManager,
|
|
|
|
&QNetworkAccessManager::finished,
|
|
|
|
this,
|
|
|
|
&BFMDemod::networkManagerFinished
|
|
|
|
);
|
2018-12-22 01:16:15 -05:00
|
|
|
delete m_networkManager;
|
|
|
|
|
2019-12-03 12:49:52 -05:00
|
|
|
m_deviceAPI->removeChannelSinkAPI(this);
|
|
|
|
m_deviceAPI->removeChannelSink(this);
|
|
|
|
delete m_basebandSink;
|
|
|
|
delete m_thread;
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
2022-04-16 10:45:53 -04:00
|
|
|
void BFMDemod::setDeviceAPI(DeviceAPI *deviceAPI)
|
|
|
|
{
|
|
|
|
if (deviceAPI != m_deviceAPI)
|
|
|
|
{
|
|
|
|
m_deviceAPI->removeChannelSinkAPI(this);
|
|
|
|
m_deviceAPI->removeChannelSink(this);
|
|
|
|
m_deviceAPI = deviceAPI;
|
|
|
|
m_deviceAPI->addChannelSink(this);
|
|
|
|
m_deviceAPI->addChannelSinkAPI(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-09-22 19:25:17 -04:00
|
|
|
uint32_t BFMDemod::getNumberOfDeviceStreams() const
|
|
|
|
{
|
|
|
|
return m_deviceAPI->getNbSourceStreams();
|
|
|
|
}
|
|
|
|
|
2018-11-12 18:45:03 -05:00
|
|
|
void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool firstOfBurst)
|
2015-12-06 04:30:51 -05:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) firstOfBurst;
|
2019-12-03 12:49:52 -05:00
|
|
|
m_basebandSink->feed(begin, end);
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemod::start()
|
|
|
|
{
|
2019-12-03 12:49:52 -05:00
|
|
|
qDebug() << "BFMDemod::start";
|
|
|
|
|
|
|
|
if (m_basebandSampleRate != 0) {
|
|
|
|
m_basebandSink->setBasebandSampleRate(m_basebandSampleRate);
|
|
|
|
}
|
|
|
|
|
|
|
|
m_basebandSink->reset();
|
|
|
|
m_thread->start();
|
2020-05-04 21:24:10 -04:00
|
|
|
|
2021-04-20 04:32:21 -04:00
|
|
|
SpectrumSettings spectrumSettings = m_spectrumVis.getSettings();
|
2020-05-04 21:24:10 -04:00
|
|
|
spectrumSettings.m_ssb = true;
|
|
|
|
SpectrumVis::MsgConfigureSpectrumVis *msg = SpectrumVis::MsgConfigureSpectrumVis::create(spectrumSettings, false);
|
|
|
|
m_spectrumVis.getInputMessageQueue()->push(msg);
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemod::stop()
|
|
|
|
{
|
2019-12-03 12:49:52 -05:00
|
|
|
qDebug() << "BFMDemod::stop";
|
|
|
|
m_thread->exit();
|
|
|
|
m_thread->wait();
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
bool BFMDemod::handleMessage(const Message& cmd)
|
|
|
|
{
|
2019-12-03 12:49:52 -05:00
|
|
|
if (MsgConfigureBFMDemod::match(cmd))
|
2017-10-01 14:17:20 -04:00
|
|
|
{
|
|
|
|
MsgConfigureBFMDemod& cfg = (MsgConfigureBFMDemod&) cmd;
|
2017-12-29 05:04:47 -05:00
|
|
|
qDebug() << "BFMDemod::handleMessage: MsgConfigureBFMDemod";
|
2017-10-01 14:17:20 -04:00
|
|
|
|
2017-12-29 05:04:47 -05:00
|
|
|
applySettings(cfg.getSettings(), cfg.getForce());
|
2017-10-01 14:17:20 -04:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2018-02-14 14:11:36 -05:00
|
|
|
else if (DSPSignalNotification::match(cmd))
|
|
|
|
{
|
2019-12-03 12:49:52 -05:00
|
|
|
DSPSignalNotification& notif = (DSPSignalNotification&) cmd;
|
|
|
|
m_basebandSampleRate = notif.getSampleRate();
|
|
|
|
// Forward to the sink
|
|
|
|
DSPSignalNotification* rep = new DSPSignalNotification(notif); // make a copy
|
|
|
|
qDebug() << "BFMDemod::handleMessage: DSPSignalNotification";
|
|
|
|
m_basebandSink->getInputMessageQueue()->push(rep);
|
|
|
|
|
2022-04-13 05:08:21 -04:00
|
|
|
if (getMessageQueueToGUI()) {
|
|
|
|
getMessageQueueToGUI()->push(new DSPSignalNotification(notif));
|
|
|
|
}
|
|
|
|
|
2018-02-14 14:11:36 -05:00
|
|
|
return true;
|
|
|
|
}
|
2015-12-06 04:30:51 -05:00
|
|
|
else
|
|
|
|
{
|
2019-12-03 12:49:52 -05:00
|
|
|
return false;
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-06 16:47:41 -05:00
|
|
|
void BFMDemod::setCenterFrequency(qint64 frequency)
|
|
|
|
{
|
|
|
|
BFMDemodSettings settings = m_settings;
|
|
|
|
settings.m_inputFrequencyOffset = frequency;
|
|
|
|
applySettings(settings, false);
|
|
|
|
|
|
|
|
if (m_guiMessageQueue) // forward to GUI if any
|
|
|
|
{
|
|
|
|
MsgConfigureBFMDemod *msgToGUI = MsgConfigureBFMDemod::create(settings, false);
|
|
|
|
m_guiMessageQueue->push(msgToGUI);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-12-29 05:04:47 -05:00
|
|
|
void BFMDemod::applySettings(const BFMDemodSettings& settings, bool force)
|
|
|
|
{
|
|
|
|
qDebug() << "BFMDemod::applySettings: MsgConfigureBFMDemod:"
|
|
|
|
<< " m_inputFrequencyOffset: " << settings.m_inputFrequencyOffset
|
|
|
|
<< " m_rfBandwidth: " << settings.m_rfBandwidth
|
2018-05-24 20:02:21 -04:00
|
|
|
<< " m_afBandwidth: " << settings.m_afBandwidth
|
2017-12-29 05:04:47 -05:00
|
|
|
<< " m_volume: " << settings.m_volume
|
|
|
|
<< " m_squelch: " << settings.m_squelch
|
|
|
|
<< " m_audioStereo: " << settings.m_audioStereo
|
|
|
|
<< " m_lsbStereo: " << settings.m_lsbStereo
|
|
|
|
<< " m_showPilot: " << settings.m_showPilot
|
|
|
|
<< " m_rdsActive: " << settings.m_rdsActive
|
2018-03-28 01:44:54 -04:00
|
|
|
<< " m_audioDeviceName: " << settings.m_audioDeviceName
|
2019-09-22 19:25:17 -04:00
|
|
|
<< " m_streamIndex: " << settings.m_streamIndex
|
2018-12-22 01:16:15 -05:00
|
|
|
<< " m_useReverseAPI: " << settings.m_useReverseAPI
|
2017-12-29 05:04:47 -05:00
|
|
|
<< " force: " << force;
|
|
|
|
|
2018-12-22 01:16:15 -05:00
|
|
|
QList<QString> reverseAPIKeys;
|
|
|
|
|
|
|
|
if ((settings.m_inputFrequencyOffset != m_settings.m_inputFrequencyOffset) || force) {
|
|
|
|
reverseAPIKeys.append("inputFrequencyOffset");
|
|
|
|
}
|
|
|
|
if ((settings.m_volume != m_settings.m_volume) || force) {
|
|
|
|
reverseAPIKeys.append("volume");
|
|
|
|
}
|
|
|
|
if ((settings.m_audioStereo != m_settings.m_audioStereo) || force) {
|
|
|
|
reverseAPIKeys.append("audioStereo");
|
|
|
|
}
|
|
|
|
if ((settings.m_lsbStereo != m_settings.m_lsbStereo) || force) {
|
|
|
|
reverseAPIKeys.append("lsbStereo");
|
|
|
|
}
|
|
|
|
if ((settings.m_showPilot != m_settings.m_showPilot) || force) {
|
|
|
|
reverseAPIKeys.append("showPilot");
|
|
|
|
}
|
|
|
|
if ((settings.m_rdsActive != m_settings.m_rdsActive) || force) {
|
|
|
|
reverseAPIKeys.append("rdsActive");
|
|
|
|
}
|
2019-12-03 12:49:52 -05:00
|
|
|
if ((settings.m_afBandwidth != m_settings.m_afBandwidth) || force) {
|
2018-12-22 01:16:15 -05:00
|
|
|
reverseAPIKeys.append("afBandwidth");
|
2017-10-01 14:17:20 -04:00
|
|
|
}
|
2019-12-03 12:49:52 -05:00
|
|
|
if ((settings.m_rfBandwidth != m_settings.m_rfBandwidth) || force) {
|
2018-12-22 01:16:15 -05:00
|
|
|
reverseAPIKeys.append("rfBandwidth");
|
2017-10-01 14:17:20 -04:00
|
|
|
}
|
2019-12-03 12:49:52 -05:00
|
|
|
if ((settings.m_squelch != m_settings.m_squelch) || force) {
|
2018-12-22 01:16:15 -05:00
|
|
|
reverseAPIKeys.append("squelch");
|
2017-10-01 14:17:20 -04:00
|
|
|
}
|
2019-12-03 12:49:52 -05:00
|
|
|
if ((settings.m_audioDeviceName != m_settings.m_audioDeviceName) || force) {
|
2018-12-22 01:16:15 -05:00
|
|
|
reverseAPIKeys.append("audioDeviceName");
|
2017-10-01 14:17:20 -04:00
|
|
|
}
|
2015-12-07 20:00:30 -05:00
|
|
|
|
2019-09-22 19:25:17 -04:00
|
|
|
if (m_settings.m_streamIndex != settings.m_streamIndex)
|
|
|
|
{
|
|
|
|
if (m_deviceAPI->getSampleMIMO()) // change of stream is possible for MIMO devices only
|
|
|
|
{
|
2019-12-23 17:41:35 -05:00
|
|
|
m_deviceAPI->removeChannelSinkAPI(this);
|
2019-12-03 12:49:52 -05:00
|
|
|
m_deviceAPI->removeChannelSink(this, m_settings.m_streamIndex);
|
|
|
|
m_deviceAPI->addChannelSink(this, settings.m_streamIndex);
|
2019-12-23 17:41:35 -05:00
|
|
|
m_deviceAPI->addChannelSinkAPI(this);
|
2019-09-22 19:25:17 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
reverseAPIKeys.append("streamIndex");
|
|
|
|
}
|
|
|
|
|
2019-12-03 12:49:52 -05:00
|
|
|
BFMDemodBaseband::MsgConfigureBFMDemodBaseband *msg = BFMDemodBaseband::MsgConfigureBFMDemodBaseband::create(settings, force);
|
|
|
|
m_basebandSink->getInputMessageQueue()->push(msg);
|
|
|
|
|
2018-12-22 01:16:15 -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-10-22 18:11:18 -04:00
|
|
|
}
|
|
|
|
|
2017-10-01 14:17:20 -04:00
|
|
|
m_settings = settings;
|
2015-12-06 04:30:51 -05:00
|
|
|
}
|
2017-12-17 17:15:42 -05:00
|
|
|
|
|
|
|
QByteArray BFMDemod::serialize() const
|
|
|
|
{
|
|
|
|
return m_settings.serialize();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool BFMDemod::deserialize(const QByteArray& data)
|
|
|
|
{
|
|
|
|
if (m_settings.deserialize(data))
|
|
|
|
{
|
|
|
|
MsgConfigureBFMDemod *msg = MsgConfigureBFMDemod::create(m_settings, true);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_settings.resetToDefaults();
|
|
|
|
MsgConfigureBFMDemod *msg = MsgConfigureBFMDemod::create(m_settings, true);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-23 08:56:29 -04:00
|
|
|
int BFMDemod::webapiSettingsGet(
|
|
|
|
SWGSDRangel::SWGChannelSettings& response,
|
2018-11-12 18:45:03 -05:00
|
|
|
QString& errorMessage)
|
2018-05-23 08:56:29 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) errorMessage;
|
2018-05-23 08:56:29 -04:00
|
|
|
response.setBfmDemodSettings(new SWGSDRangel::SWGBFMDemodSettings());
|
|
|
|
response.getBfmDemodSettings()->init();
|
|
|
|
webapiFormatChannelSettings(response, m_settings);
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
2022-05-13 16:24:48 -04:00
|
|
|
int BFMDemod::webapiWorkspaceGet(
|
|
|
|
SWGSDRangel::SWGWorkspaceInfo& response,
|
|
|
|
QString& errorMessage)
|
|
|
|
{
|
|
|
|
(void) errorMessage;
|
|
|
|
response.setIndex(m_settings.m_workspaceIndex);
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
2018-05-23 08:56:29 -04:00
|
|
|
int BFMDemod::webapiSettingsPutPatch(
|
|
|
|
bool force,
|
|
|
|
const QStringList& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings& response,
|
2018-11-12 18:45:03 -05:00
|
|
|
QString& errorMessage)
|
2018-05-23 08:56:29 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) errorMessage;
|
2018-05-23 08:56:29 -04:00
|
|
|
BFMDemodSettings settings = m_settings;
|
2019-08-01 17:21:57 -04:00
|
|
|
webapiUpdateChannelSettings(settings, channelSettingsKeys, response);
|
2018-05-23 08:56:29 -04:00
|
|
|
|
2019-08-01 17:21:57 -04:00
|
|
|
MsgConfigureBFMDemod *msg = MsgConfigureBFMDemod::create(settings, force);
|
|
|
|
m_inputMessageQueue.push(msg);
|
|
|
|
|
|
|
|
qDebug("BFMDemod::webapiSettingsPutPatch: forward to GUI: %p", m_guiMessageQueue);
|
|
|
|
if (m_guiMessageQueue) // forward to GUI if any
|
|
|
|
{
|
|
|
|
MsgConfigureBFMDemod *msgToGUI = MsgConfigureBFMDemod::create(settings, force);
|
|
|
|
m_guiMessageQueue->push(msgToGUI);
|
|
|
|
}
|
|
|
|
|
|
|
|
webapiFormatChannelSettings(response, settings);
|
|
|
|
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemod::webapiUpdateChannelSettings(
|
|
|
|
BFMDemodSettings& settings,
|
|
|
|
const QStringList& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings& response)
|
|
|
|
{
|
|
|
|
if (channelSettingsKeys.contains("inputFrequencyOffset")) {
|
2018-05-23 08:56:29 -04:00
|
|
|
settings.m_inputFrequencyOffset = response.getBfmDemodSettings()->getInputFrequencyOffset();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rfBandwidth")) {
|
|
|
|
settings.m_rfBandwidth = response.getBfmDemodSettings()->getRfBandwidth();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("afBandwidth")) {
|
|
|
|
settings.m_afBandwidth = response.getBfmDemodSettings()->getAfBandwidth();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("volume")) {
|
|
|
|
settings.m_volume = response.getBfmDemodSettings()->getVolume();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("squelch")) {
|
|
|
|
settings.m_squelch = response.getBfmDemodSettings()->getSquelch();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("audioStereo")) {
|
|
|
|
settings.m_audioStereo = response.getBfmDemodSettings()->getAudioStereo() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("lsbStereo")) {
|
|
|
|
settings.m_lsbStereo = response.getBfmDemodSettings()->getLsbStereo() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("showPilot")) {
|
|
|
|
settings.m_showPilot = response.getBfmDemodSettings()->getShowPilot() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rdsActive")) {
|
|
|
|
settings.m_rdsActive = response.getBfmDemodSettings()->getRdsActive() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rgbColor")) {
|
2018-05-24 12:23:08 -04:00
|
|
|
settings.m_rgbColor = response.getBfmDemodSettings()->getRgbColor();
|
2018-05-23 08:56:29 -04:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("title")) {
|
2018-05-24 12:23:08 -04:00
|
|
|
settings.m_title = *response.getBfmDemodSettings()->getTitle();
|
2018-05-23 08:56:29 -04:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("audioDeviceName")) {
|
2018-05-24 12:23:08 -04:00
|
|
|
settings.m_audioDeviceName = *response.getBfmDemodSettings()->getAudioDeviceName();
|
2018-05-23 08:56:29 -04:00
|
|
|
}
|
2019-09-22 19:25:17 -04:00
|
|
|
if (channelSettingsKeys.contains("streamIndex")) {
|
|
|
|
settings.m_streamIndex = response.getBfmDemodSettings()->getStreamIndex();
|
|
|
|
}
|
2018-12-22 01:16:15 -05:00
|
|
|
if (channelSettingsKeys.contains("useReverseAPI")) {
|
|
|
|
settings.m_useReverseAPI = response.getBfmDemodSettings()->getUseReverseApi() != 0;
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIAddress")) {
|
2019-04-20 13:53:16 -04:00
|
|
|
settings.m_reverseAPIAddress = *response.getBfmDemodSettings()->getReverseApiAddress();
|
2018-12-22 01:16:15 -05:00
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIPort")) {
|
|
|
|
settings.m_reverseAPIPort = response.getBfmDemodSettings()->getReverseApiPort();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIDeviceIndex")) {
|
|
|
|
settings.m_reverseAPIDeviceIndex = response.getBfmDemodSettings()->getReverseApiDeviceIndex();
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("reverseAPIChannelIndex")) {
|
|
|
|
settings.m_reverseAPIChannelIndex = response.getBfmDemodSettings()->getReverseApiChannelIndex();
|
|
|
|
}
|
2021-11-30 18:20:14 -05:00
|
|
|
if (settings.m_spectrumGUI && channelSettingsKeys.contains("spectrumConfig")) {
|
|
|
|
settings.m_spectrumGUI->updateFrom(channelSettingsKeys, response.getBfmDemodSettings()->getSpectrumConfig());
|
|
|
|
}
|
2021-12-02 17:54:39 -05:00
|
|
|
if (settings.m_channelMarker && channelSettingsKeys.contains("channelMarker")) {
|
|
|
|
settings.m_channelMarker->updateFrom(channelSettingsKeys, response.getBfmDemodSettings()->getChannelMarker());
|
|
|
|
}
|
2022-01-08 23:27:12 -05:00
|
|
|
if (settings.m_rollupState && channelSettingsKeys.contains("rollupState")) {
|
|
|
|
settings.m_rollupState->updateFrom(channelSettingsKeys, response.getBfmDemodSettings()->getRollupState());
|
|
|
|
}
|
2018-05-23 08:56:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
int BFMDemod::webapiReportGet(
|
|
|
|
SWGSDRangel::SWGChannelReport& response,
|
2018-11-12 18:45:03 -05:00
|
|
|
QString& errorMessage)
|
2018-05-23 08:56:29 -04:00
|
|
|
{
|
2018-11-12 18:45:03 -05:00
|
|
|
(void) errorMessage;
|
2018-05-23 08:56:29 -04:00
|
|
|
response.setBfmDemodReport(new SWGSDRangel::SWGBFMDemodReport());
|
|
|
|
response.getBfmDemodReport()->init();
|
|
|
|
webapiFormatChannelReport(response);
|
|
|
|
return 200;
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& response, const BFMDemodSettings& settings)
|
|
|
|
{
|
|
|
|
response.getBfmDemodSettings()->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
|
|
|
response.getBfmDemodSettings()->setRfBandwidth(settings.m_rfBandwidth);
|
|
|
|
response.getBfmDemodSettings()->setAfBandwidth(settings.m_afBandwidth);
|
|
|
|
response.getBfmDemodSettings()->setVolume(settings.m_volume);
|
|
|
|
response.getBfmDemodSettings()->setSquelch(settings.m_squelch);
|
|
|
|
response.getBfmDemodSettings()->setAudioStereo(settings.m_audioStereo ? 1 : 0);
|
|
|
|
response.getBfmDemodSettings()->setLsbStereo(settings.m_lsbStereo ? 1 : 0);
|
|
|
|
response.getBfmDemodSettings()->setShowPilot(settings.m_showPilot ? 1 : 0);
|
|
|
|
response.getBfmDemodSettings()->setRdsActive(settings.m_rdsActive ? 1 : 0);
|
|
|
|
response.getBfmDemodSettings()->setRgbColor(settings.m_rgbColor);
|
|
|
|
|
|
|
|
if (response.getBfmDemodSettings()->getTitle()) {
|
|
|
|
*response.getBfmDemodSettings()->getTitle() = settings.m_title;
|
|
|
|
} else {
|
|
|
|
response.getBfmDemodSettings()->setTitle(new QString(settings.m_title));
|
|
|
|
}
|
|
|
|
|
|
|
|
if (response.getBfmDemodSettings()->getAudioDeviceName()) {
|
|
|
|
*response.getBfmDemodSettings()->getAudioDeviceName() = settings.m_audioDeviceName;
|
|
|
|
} else {
|
|
|
|
response.getBfmDemodSettings()->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
|
|
|
}
|
2018-12-22 01:16:15 -05:00
|
|
|
|
2019-09-22 19:25:17 -04:00
|
|
|
response.getBfmDemodSettings()->setStreamIndex(settings.m_streamIndex);
|
2018-12-22 01:16:15 -05:00
|
|
|
response.getBfmDemodSettings()->setUseReverseApi(settings.m_useReverseAPI ? 1 : 0);
|
|
|
|
|
|
|
|
if (response.getBfmDemodSettings()->getReverseApiAddress()) {
|
|
|
|
*response.getBfmDemodSettings()->getReverseApiAddress() = settings.m_reverseAPIAddress;
|
|
|
|
} else {
|
|
|
|
response.getBfmDemodSettings()->setReverseApiAddress(new QString(settings.m_reverseAPIAddress));
|
|
|
|
}
|
|
|
|
|
|
|
|
response.getBfmDemodSettings()->setReverseApiPort(settings.m_reverseAPIPort);
|
|
|
|
response.getBfmDemodSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex);
|
|
|
|
response.getBfmDemodSettings()->setReverseApiChannelIndex(settings.m_reverseAPIChannelIndex);
|
2021-11-30 18:20:14 -05:00
|
|
|
|
|
|
|
if (settings.m_spectrumGUI)
|
|
|
|
{
|
|
|
|
if (response.getBfmDemodSettings()->getSpectrumConfig())
|
|
|
|
{
|
|
|
|
settings.m_spectrumGUI->formatTo(response.getBfmDemodSettings()->getSpectrumConfig());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
|
|
|
|
settings.m_spectrumGUI->formatTo(swgGLSpectrum);
|
|
|
|
response.getBfmDemodSettings()->setSpectrumConfig(swgGLSpectrum);
|
|
|
|
}
|
|
|
|
}
|
2021-12-02 17:54:39 -05:00
|
|
|
|
|
|
|
if (settings.m_channelMarker)
|
|
|
|
{
|
|
|
|
if (response.getBfmDemodSettings()->getChannelMarker())
|
|
|
|
{
|
|
|
|
settings.m_channelMarker->formatTo(response.getBfmDemodSettings()->getChannelMarker());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
|
|
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
|
|
|
response.getBfmDemodSettings()->setChannelMarker(swgChannelMarker);
|
|
|
|
}
|
|
|
|
}
|
2022-01-08 23:27:12 -05:00
|
|
|
|
|
|
|
if (settings.m_rollupState)
|
|
|
|
{
|
|
|
|
if (response.getBfmDemodSettings()->getRollupState())
|
|
|
|
{
|
|
|
|
settings.m_rollupState->formatTo(response.getBfmDemodSettings()->getRollupState());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGRollupState *swgRollupState = new SWGSDRangel::SWGRollupState();
|
|
|
|
settings.m_rollupState->formatTo(swgRollupState);
|
|
|
|
response.getBfmDemodSettings()->setRollupState(swgRollupState);
|
|
|
|
}
|
|
|
|
}
|
2018-05-23 08:56:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
|
|
|
|
{
|
|
|
|
double magsqAvg, magsqPeak;
|
|
|
|
int nbMagsqSamples;
|
|
|
|
getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples);
|
|
|
|
|
|
|
|
response.getBfmDemodReport()->setChannelPowerDb(CalcDb::dbPower(magsqAvg));
|
2019-12-03 12:49:52 -05:00
|
|
|
response.getBfmDemodReport()->setSquelch(m_basebandSink->getSquelchState() > 0 ? 1 : 0);
|
|
|
|
response.getBfmDemodReport()->setAudioSampleRate(m_basebandSink->getAudioSampleRate());
|
|
|
|
response.getBfmDemodReport()->setChannelSampleRate(m_basebandSink->getChannelSampleRate());
|
2018-05-23 08:56:29 -04:00
|
|
|
response.getBfmDemodReport()->setPilotLocked(getPilotLock() ? 1 : 0);
|
|
|
|
response.getBfmDemodReport()->setPilotPowerDb(CalcDb::dbPower(getPilotLevel()));
|
|
|
|
|
|
|
|
if (m_settings.m_rdsActive)
|
|
|
|
{
|
|
|
|
response.getBfmDemodReport()->setRdsReport(new SWGSDRangel::SWGRDSReport());
|
|
|
|
webapiFormatRDSReport(response.getBfmDemodReport()->getRdsReport());
|
|
|
|
}
|
2018-05-28 05:43:24 -04:00
|
|
|
else
|
|
|
|
{
|
|
|
|
response.getBfmDemodReport()->setRdsReport(0);
|
|
|
|
}
|
2018-05-23 08:56:29 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemod::webapiFormatRDSReport(SWGSDRangel::SWGRDSReport *report)
|
|
|
|
{
|
|
|
|
report->setDemodStatus(round(getDemodQua()));
|
|
|
|
report->setDecodStatus(round(getDecoderQua()));
|
|
|
|
report->setRdsDemodAccumDb(CalcDb::dbPower(std::fabs(getDemodAcc())));
|
|
|
|
report->setRdsDemodFrequency(getDemodFclk());
|
|
|
|
report->setPid(new QString(str(boost::format("%04X") % getRDSParser().m_pi_program_identification).c_str()));
|
|
|
|
report->setPiType(new QString(getRDSParser().pty_table[getRDSParser().m_pi_program_type].c_str()));
|
|
|
|
report->setPiCoverage(new QString(getRDSParser().coverage_area_codes[getRDSParser().m_pi_area_coverage_index].c_str()));
|
|
|
|
report->setProgServiceName(new QString(getRDSParser().m_g0_program_service_name));
|
|
|
|
report->setMusicSpeech(new QString((getRDSParser().m_g0_music_speech ? "Music" : "Speech")));
|
|
|
|
report->setMonoStereo(new QString((getRDSParser().m_g0_mono_stereo ? "Mono" : "Stereo")));
|
|
|
|
report->setRadioText(new QString(getRDSParser().m_g2_radiotext));
|
|
|
|
std::string time = str(boost::format("%4i-%02i-%02i %02i:%02i (%+.1fh)")\
|
|
|
|
% (1900 + getRDSParser().m_g4_year) % getRDSParser().m_g4_month % getRDSParser().m_g4_day % getRDSParser().m_g4_hours % getRDSParser().m_g4_minutes % getRDSParser().m_g4_local_time_offset);
|
|
|
|
report->setTime(new QString(time.c_str()));
|
|
|
|
report->setAltFrequencies(new QList<SWGSDRangel::SWGRDSReport_altFrequencies*>);
|
|
|
|
|
|
|
|
for (std::set<double>::iterator it = getRDSParser().m_g0_alt_freq.begin(); it != getRDSParser().m_g0_alt_freq.end(); ++it)
|
|
|
|
{
|
|
|
|
if (*it > 76.0)
|
|
|
|
{
|
|
|
|
report->getAltFrequencies()->append(new SWGSDRangel::SWGRDSReport_altFrequencies);
|
|
|
|
report->getAltFrequencies()->back()->setFrequency(*it);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-12-22 01:16:15 -05:00
|
|
|
|
|
|
|
void BFMDemod::webapiReverseSendSettings(QList<QString>& channelSettingsKeys, const BFMDemodSettings& settings, bool force)
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings = new SWGSDRangel::SWGChannelSettings();
|
2020-10-22 18:11:18 -04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-12-13 07:04:36 -05:00
|
|
|
void BFMDemod::sendChannelSettings(
|
2022-03-02 17:07:15 -05:00
|
|
|
const QList<ObjectPipe*>& pipes,
|
2020-12-13 07:04:36 -05:00
|
|
|
QList<QString>& channelSettingsKeys,
|
|
|
|
const BFMDemodSettings& settings,
|
|
|
|
bool force)
|
2020-10-22 18:11:18 -04:00
|
|
|
{
|
2022-03-02 17:07:15 -05:00
|
|
|
for (const auto& pipe : pipes)
|
2020-10-22 18:11:18 -04: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-10-22 18:11:18 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemod::webapiFormatChannelSettings(
|
|
|
|
QList<QString>& channelSettingsKeys,
|
|
|
|
SWGSDRangel::SWGChannelSettings *swgChannelSettings,
|
|
|
|
const BFMDemodSettings& settings,
|
|
|
|
bool force
|
|
|
|
)
|
|
|
|
{
|
|
|
|
swgChannelSettings->setDirection(0); // Single sink (Rx)
|
2019-03-25 08:53:48 -04:00
|
|
|
swgChannelSettings->setOriginatorChannelIndex(getIndexInDeviceSet());
|
|
|
|
swgChannelSettings->setOriginatorDeviceSetIndex(getDeviceSetIndex());
|
2020-10-22 18:11:18 -04:00
|
|
|
swgChannelSettings->setChannelType(new QString(m_channelId));
|
2018-12-22 01:16:15 -05:00
|
|
|
swgChannelSettings->setBfmDemodSettings(new SWGSDRangel::SWGBFMDemodSettings());
|
|
|
|
SWGSDRangel::SWGBFMDemodSettings *swgBFMDemodSettings = swgChannelSettings->getBfmDemodSettings();
|
|
|
|
|
|
|
|
// transfer data that has been modified. When force is on transfer all data except reverse API data
|
|
|
|
|
|
|
|
if (channelSettingsKeys.contains("inputFrequencyOffset") || force) {
|
|
|
|
swgBFMDemodSettings->setInputFrequencyOffset(settings.m_inputFrequencyOffset);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rfBandwidth") || force) {
|
|
|
|
swgBFMDemodSettings->setRfBandwidth(settings.m_rfBandwidth);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("afBandwidth") || force) {
|
|
|
|
swgBFMDemodSettings->setAfBandwidth(settings.m_afBandwidth);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("volume") || force) {
|
|
|
|
swgBFMDemodSettings->setVolume(settings.m_volume);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("squelch") || force) {
|
|
|
|
swgBFMDemodSettings->setSquelch(settings.m_squelch);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("audioStereo") || force) {
|
|
|
|
swgBFMDemodSettings->setAudioStereo(settings.m_audioStereo ? 1 : 0);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("lsbStereo") || force) {
|
|
|
|
swgBFMDemodSettings->setLsbStereo(settings.m_lsbStereo ? 1 : 0);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("showPilot") || force) {
|
|
|
|
swgBFMDemodSettings->setShowPilot(settings.m_showPilot ? 1 : 0);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rdsActive") || force) {
|
|
|
|
swgBFMDemodSettings->setRdsActive(settings.m_rdsActive ? 1 : 0);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("rgbColor") || force) {
|
|
|
|
swgBFMDemodSettings->setRgbColor(settings.m_rgbColor);
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("title") || force) {
|
|
|
|
swgBFMDemodSettings->setTitle(new QString(settings.m_title));
|
|
|
|
}
|
|
|
|
if (channelSettingsKeys.contains("audioDeviceName") || force) {
|
|
|
|
swgBFMDemodSettings->setAudioDeviceName(new QString(settings.m_audioDeviceName));
|
|
|
|
}
|
2019-09-22 19:25:17 -04:00
|
|
|
if (channelSettingsKeys.contains("streamIndex") || force) {
|
|
|
|
swgBFMDemodSettings->setStreamIndex(settings.m_streamIndex);
|
|
|
|
}
|
2021-12-02 17:54:39 -05:00
|
|
|
|
2021-11-30 18:20:14 -05:00
|
|
|
if (settings.m_spectrumGUI && (channelSettingsKeys.contains("spectrunConfig") || force))
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGGLSpectrum *swgGLSpectrum = new SWGSDRangel::SWGGLSpectrum();
|
|
|
|
settings.m_spectrumGUI->formatTo(swgGLSpectrum);
|
|
|
|
swgBFMDemodSettings->setSpectrumConfig(swgGLSpectrum);
|
|
|
|
}
|
2021-12-02 17:54:39 -05:00
|
|
|
|
|
|
|
if (settings.m_channelMarker && (channelSettingsKeys.contains("channelMarker") || force))
|
|
|
|
{
|
|
|
|
SWGSDRangel::SWGChannelMarker *swgChannelMarker = new SWGSDRangel::SWGChannelMarker();
|
|
|
|
settings.m_channelMarker->formatTo(swgChannelMarker);
|
|
|
|
swgBFMDemodSettings->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);
|
|
|
|
swgBFMDemodSettings->setRollupState(swgRollupState);
|
|
|
|
}
|
2018-12-22 01:16:15 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void BFMDemod::networkManagerFinished(QNetworkReply *reply)
|
|
|
|
{
|
|
|
|
QNetworkReply::NetworkError replyError = reply->error();
|
|
|
|
|
|
|
|
if (replyError)
|
|
|
|
{
|
|
|
|
qWarning() << "BFMDemod::networkManagerFinished:"
|
|
|
|
<< " error(" << (int) replyError
|
|
|
|
<< "): " << replyError
|
|
|
|
<< ": " << reply->errorString();
|
2019-11-12 12:46:21 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
QString answer = reply->readAll();
|
|
|
|
answer.chop(1); // remove last \n
|
|
|
|
qDebug("BFMDemod::networkManagerFinished: reply:\n%s", answer.toStdString().c_str());
|
2018-12-22 01:16:15 -05:00
|
|
|
}
|
|
|
|
|
2019-11-12 12:46:21 -05:00
|
|
|
reply->deleteLater();
|
2018-12-22 01:16:15 -05:00
|
|
|
}
|
2022-03-18 12:08:04 -04:00
|
|
|
|
|
|
|
void BFMDemod::handleIndexInDeviceSetChanged(int index)
|
|
|
|
{
|
|
|
|
if (index < 0) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QString fifoLabel = QString("%1 [%2:%3]")
|
|
|
|
.arg(m_channelId)
|
|
|
|
.arg(m_deviceAPI->getDeviceSetIndex())
|
|
|
|
.arg(index);
|
|
|
|
m_basebandSink->setFifoLabel(fifoLabel);
|
|
|
|
m_basebandSink->setAudioFifoLabel(fifoLabel);
|
|
|
|
}
|