From dbc9e780775c473950288151c2dc90727ab2b6f9 Mon Sep 17 00:00:00 2001 From: f4exb Date: Thu, 29 Mar 2018 10:03:52 +0200 Subject: [PATCH] DATV demod: fixed message handling --- plugins/channelrx/demoddatv/datvdemod.cpp | 57 ++++++++++--------- plugins/channelrx/demoddatv/datvdemod.h | 3 - .../channelrx/demoddatv/datvdemodplugin.cpp | 2 +- sdrbase/dsp/downchannelizer.cpp | 12 +--- 4 files changed, 34 insertions(+), 40 deletions(-) diff --git a/plugins/channelrx/demoddatv/datvdemod.cpp b/plugins/channelrx/demoddatv/datvdemod.cpp index 48a93886b..1c653bd0f 100644 --- a/plugins/channelrx/demoddatv/datvdemod.cpp +++ b/plugins/channelrx/demoddatv/datvdemod.cpp @@ -58,15 +58,10 @@ DATVDemod::DATVDemod(DeviceSourceAPI *deviceAPI) : m_objRFFilter = new fftfilt(-256000.0 / 1024000.0, 256000.0 / 1024000.0, rfFilterFftLength); - //To setup correct Sample Rate m_channelizer = new DownChannelizer(this); - channelSampleRateChanged(); - m_threadedChannelizer = new ThreadedBasebandSampleSink(m_channelizer, this); m_deviceAPI->addThreadedSink(m_threadedChannelizer); m_deviceAPI->addChannelAPI(this); - - connect(m_channelizer, SIGNAL(inputSampleRateChanged()), this, SLOT(channelSampleRateChanged())); } DATVDemod::~DATVDemod() @@ -98,20 +93,6 @@ DATVDemod::~DATVDemod() delete m_channelizer; } -void DATVDemod::channelSampleRateChanged() -{ - qDebug() << "DATVDemod::channelSampleRateChanged:" - << " sample rate: " << m_channelizer->getInputSampleRate(); - - if(m_objRunning.intMsps!=m_channelizer->getInputSampleRate()) - { - m_objRunning.intMsps = m_channelizer->getInputSampleRate(); - m_objRunning.intSampleRate = m_objRunning.intMsps; - - ApplySettings(); - } -} - bool DATVDemod::SetTVScreen(TVScreen *objScreen) { m_objRegisteredTVScreen = objScreen; @@ -904,10 +885,38 @@ void DATVDemod::stop() bool DATVDemod::handleMessage(const Message& cmd) { - qDebug() << "DATVDemod::handleMessage"; + if (DownChannelizer::MsgChannelizerNotification::match(cmd)) + { + DownChannelizer::MsgChannelizerNotification& objNotif = (DownChannelizer::MsgChannelizerNotification&) cmd; + qDebug() << "DATVDemod::handleMessage: MsgChannelizerNotification:" + << " m_intSampleRate: " << objNotif.getSampleRate() + << " m_intFrequencyOffset: " << objNotif.getFrequencyOffset(); - if (MsgConfigureDATVDemod::match(cmd)) + if (m_objRunning.intMsps != objNotif.getSampleRate()) + { + m_objRunning.intMsps = objNotif.getSampleRate(); + m_objRunning.intSampleRate = m_objRunning.intMsps; + + ApplySettings(); + } + + return true; + } + else if (MsgConfigureChannelizer::match(cmd)) + { + MsgConfigureChannelizer& cfg = (MsgConfigureChannelizer&) cmd; + + m_channelizer->configure(m_channelizer->getInputMessageQueue(), + m_channelizer->getInputSampleRate(), + cfg.getCenterFrequency()); + + qDebug() << "DATVDemod::handleMessage: MsgConfigureChannelizer: sampleRate: " << m_channelizer->getInputSampleRate() + << " centerFrequency: " << cfg.getCenterFrequency(); + + return true; + } + else if (MsgConfigureDATVDemod::match(cmd)) { MsgConfigureDATVDemod& objCfg = (MsgConfigureDATVDemod&) cmd; @@ -960,8 +969,7 @@ bool DATVDemod::handleMessage(const Message& cmd) << " intExcursion: " << objCfg.m_objMsgConfig.intExcursion; ApplySettings(); - } - + } return true; } @@ -973,13 +981,11 @@ bool DATVDemod::handleMessage(const Message& cmd) void DATVDemod::ApplySettings() { - if(m_objRunning.intMsps==0) { return; } - InitDATVParameters(m_objRunning.intMsps, m_objRunning.intRFBandwidth, m_objRunning.intCenterFrequency, @@ -996,7 +1002,6 @@ void DATVDemod::ApplySettings() m_objRunning.fltRollOff, m_objRunning.blnViterbi, m_objRunning.intExcursion); - } int DATVDemod::GetSampleRate() diff --git a/plugins/channelrx/demoddatv/datvdemod.h b/plugins/channelrx/demoddatv/datvdemod.h index dc2d36276..a5af83546 100644 --- a/plugins/channelrx/demoddatv/datvdemod.h +++ b/plugins/channelrx/demoddatv/datvdemod.h @@ -262,9 +262,6 @@ public: { } }; -private slots: - void channelSampleRateChanged(); - private: class MsgConfigureDATVDemod : public Message { diff --git a/plugins/channelrx/demoddatv/datvdemodplugin.cpp b/plugins/channelrx/demoddatv/datvdemodplugin.cpp index 2e3dbe018..94d3a849c 100644 --- a/plugins/channelrx/demoddatv/datvdemodplugin.cpp +++ b/plugins/channelrx/demoddatv/datvdemodplugin.cpp @@ -27,7 +27,7 @@ const PluginDescriptor DATVDemodPlugin::m_ptrPluginDescriptor = { QString("DATV Demodulator"), - QString("3.2.0"), + QString("3.14.0"), QString("(c) F4HKW for SDRAngel using LeanSDR framework (c) F4DAV"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/sdrbase/dsp/downchannelizer.cpp b/sdrbase/dsp/downchannelizer.cpp index 3b2772db0..56dc25807 100644 --- a/sdrbase/dsp/downchannelizer.cpp +++ b/sdrbase/dsp/downchannelizer.cpp @@ -110,8 +110,6 @@ void DownChannelizer::stop() bool DownChannelizer::handleMessage(const Message& cmd) { - qDebug() << "DownChannelizer::handleMessage: " << cmd.getIdentifier(); - // TODO: apply changes only if input sample rate or requested output sample rate change. Change of center frequency has no impact. if (DSPSignalNotification::match(cmd)) @@ -146,19 +144,13 @@ bool DownChannelizer::handleMessage(const Message& cmd) } else if (BasebandSampleSink::MsgThreadedSink::match(cmd)) { + qDebug() << "DownChannelizer::handleMessage: MsgThreadedSink: forwarded to demod"; return m_sampleSink->handleMessage(cmd); // this message is passed to the demod } else { + qDebug() << "DownChannelizer::handleMessage: " << cmd.getIdentifier() << " unhandled"; return false; -// if (m_sampleSink != 0) -// { -// return m_sampleSink->handleMessage(cmd); -// } -// else -// { -// return false; -// } } }