From 9619b4df521cc6f3446237be9c278d94f8fd4ef1 Mon Sep 17 00:00:00 2001 From: f4exb Date: Fri, 25 Oct 2019 08:30:01 +0200 Subject: [PATCH] MIMO: plugins update --- .../beamsteeringcwmod/CMakeLists.txt | 2 + .../beamsteeringcwmod/beamsteeringcwmod.cpp | 9 +- .../beamsteeringcwmod/beamsteeringcwmod.h | 3 +- .../beamsteeringcwmodgui.cpp | 21 ++++- .../beamsteeringcwmod/beamsteeringcwmodgui.h | 4 - .../beamsteeringcwmodsettings.cpp | 2 +- .../beamsteeringcwmodsource.cpp | 86 ++++++++++++------- .../beamsteeringcwmodsource.h | 40 ++++++--- .../beamsteeringcwmodstreamsource.cpp | 49 +++++++++++ .../beamsteeringcwmodstreamsource.h | 46 ++++++++++ .../interferometer/interferometer.cpp | 3 +- .../interferometer/interferometer.h | 3 +- .../interferometer/interferometergui.cpp | 1 + .../interferometer/interferometerplugin.cpp | 2 +- .../interferometer/interferometerstreamsink.h | 2 - .../bladerf2mimo/bladerf2mimoplugin.cpp | 14 ++- 16 files changed, 218 insertions(+), 69 deletions(-) create mode 100644 plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.cpp create mode 100644 plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.h diff --git a/plugins/channelmimo/beamsteeringcwmod/CMakeLists.txt b/plugins/channelmimo/beamsteeringcwmod/CMakeLists.txt index 3a2f1730b..88b357292 100644 --- a/plugins/channelmimo/beamsteeringcwmod/CMakeLists.txt +++ b/plugins/channelmimo/beamsteeringcwmod/CMakeLists.txt @@ -5,6 +5,7 @@ set(beamsteeringcwmod_SOURCES beamsteeringcwmod.cpp beamsteeringcwmodsettings.cpp beamsteeringcwmodsource.cpp + beamsteeringcwmodstreamsource.cpp beamsteeringcwmodwebapiadapter.cpp ) @@ -13,6 +14,7 @@ set(beamsteeringcwmod_HEADERS beamsteeringcwmod.h beamsteeringcwmodsettings.h beamsteeringcwmodsource.h + beamsteeringcwmodstreamsource.h beamsteeringcwmodwebapiadapter.h ) diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmod.cpp b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmod.cpp index c081c7806..f9755c5e1 100644 --- a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmod.cpp +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmod.cpp @@ -81,7 +81,7 @@ void BeamSteeringCWMod::stopSources() m_thread->wait(); } -void BeamSteeringCWMod::pull(const SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) +void BeamSteeringCWMod::pull(const SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) { m_source->pull(begin, nbSamples, sourceIndex); } @@ -158,11 +158,11 @@ bool BeamSteeringCWMod::handleMessage(const Message& cmd) m_deviceSampleRate = notif.getSampleRate(); calculateFrequencyOffset(); // This is when device sample rate changes - // Notify sink of input sample rate change + // Notify source of input sample rate change BeamSteeringCWModSource::MsgSignalNotification *sig = BeamSteeringCWModSource::MsgSignalNotification::create( - m_deviceSampleRate, notif.getCenterFrequency(), notif.getIndex() + m_deviceSampleRate, notif.getCenterFrequency() ); - qDebug() << "BeamSteeringCWMod::handleMessage: DSPMIMOSignalNotification: push to worker"; + qDebug() << "BeamSteeringCWMod::handleMessage: DSPMIMOSignalNotification: push to source"; m_source->getInputMessageQueue()->push(sig); // Redo the channelizer stuff with the new sample rate to re-synchronize everything @@ -173,6 +173,7 @@ bool BeamSteeringCWMod::handleMessage(const Message& cmd) if (m_guiMessageQueue) { + qDebug() << "BeamSteeringCWMod::handleMessage: DSPMIMOSignalNotification: push to GUI"; MsgBasebandNotification *msg = MsgBasebandNotification::create( notif.getSampleRate(), notif.getCenterFrequency()); m_guiMessageQueue->push(msg); diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmod.h b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmod.h index f263dd73e..bd2d79080 100644 --- a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmod.h +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmod.h @@ -94,12 +94,13 @@ public: virtual void startSources(); //!< thread start() virtual void stopSources(); //!< thread exit() and wait() virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex); - virtual void pull(const SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int sourceIndex); + virtual void pull(const SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex); virtual bool handleMessage(const Message& cmd); //!< Processing of a message. Returns true if message has actually been processed virtual void getIdentifier(QString& id) { id = objectName(); } virtual void getTitle(QString& title) { title = "BeamSteeringCWMod"; } virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } + uint32_t getDeviceSampleRate() const { return m_deviceSampleRate; } virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodgui.cpp b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodgui.cpp index ca3d0aa76..548fb6b12 100644 --- a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodgui.cpp +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodgui.cpp @@ -110,22 +110,29 @@ BeamSteeringCWModGUI::BeamSteeringCWModGUI(PluginAPI* pluginAPI, DeviceUISet *de ui(new Ui::BeamSteeringCWModGUI), m_pluginAPI(pluginAPI), m_deviceUISet(deviceUISet), - m_sampleRate(0), + m_sampleRate(48000), + m_centerFrequency(435000000), m_tickCount(0) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose, true); + setStreamIndicator("M"); + connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool))); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &))); m_bsCWSource = (BeamSteeringCWMod*) mimoChannel; m_bsCWSource->setMessageQueueToGUI(getInputMessageQueue()); + m_sampleRate = m_bsCWSource->getDeviceSampleRate(); + + connect(&MainWindow::getInstance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); m_channelMarker.blockSignals(true); m_channelMarker.addStreamIndex(1); m_channelMarker.setColor(m_settings.m_rgbColor); m_channelMarker.setCenterFrequency(0); m_channelMarker.setTitle("Beam Steering CW Source"); + m_channelMarker.setSourceOrSinkStream(false); m_channelMarker.blockSignals(false); m_channelMarker.setVisible(true); // activate signal on the last setting only @@ -138,9 +145,8 @@ BeamSteeringCWModGUI::BeamSteeringCWModGUI(PluginAPI* pluginAPI, DeviceUISet *de connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleSourceMessages())); //connect(&(m_deviceUISet->m_deviceSourceAPI->getMasterTimer()), SIGNAL(timeout()), this, SLOT(tick())); - m_time.start(); - displaySettings(); + displayRateAndShift(); applySettings(true); } @@ -172,7 +178,7 @@ void BeamSteeringCWModGUI::displaySettings() m_channelMarker.blockSignals(true); m_channelMarker.setCenterFrequency(0); m_channelMarker.setTitle(m_settings.m_title); - m_channelMarker.setBandwidth(m_sampleRate); // TODO + m_channelMarker.setBandwidth(m_sampleRate); m_channelMarker.setMovable(false); // do not let user move the center arbitrarily m_channelMarker.blockSignals(false); m_channelMarker.setColor(m_settings.m_rgbColor); // activate signal on the last setting only @@ -183,6 +189,7 @@ void BeamSteeringCWModGUI::displaySettings() blockApplySettings(true); ui->interpolationFactor->setCurrentIndex(m_settings.m_log2Interp); applyInterpolation(); + ui->steeringDegreesText->setText(tr("%1").arg(m_settings.m_steerDegrees)); blockApplySettings(false); } @@ -269,6 +276,12 @@ void BeamSteeringCWModGUI::on_position_valueChanged(int value) applyPosition(); } +void BeamSteeringCWModGUI::on_steeringDegrees_valueChanged(int value) +{ + m_settings.m_steerDegrees = value; + applySettings(); +} + void BeamSteeringCWModGUI::applyInterpolation() { uint32_t maxHash = 1; diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodgui.h b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodgui.h index c76e86725..9a3d08e71 100644 --- a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodgui.h +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodgui.h @@ -21,7 +21,6 @@ #include #include -#include #include "plugin/plugininstancegui.h" #include "dsp/channelmarker.h" @@ -69,7 +68,6 @@ private: BeamSteeringCWMod* m_bsCWSource; MessageQueue m_inputMessageQueue; - QTime m_time; uint32_t m_tickCount; explicit BeamSteeringCWModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, MIMOChannel *mimoChannel, QWidget* parent = nullptr); @@ -90,8 +88,6 @@ private slots: void handleSourceMessages(); void on_interpolationFactor_currentIndexChanged(int index); void on_position_valueChanged(int value); - void on_localDevice_currentIndexChanged(int index); - void on_localDevicesRefresh_clicked(bool checked); void on_steeringDegrees_valueChanged(int value); void onWidgetRolled(QWidget* widget, bool rollDown); void onMenuDialogCalled(const QPoint& p); diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsettings.cpp b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsettings.cpp index 5c837e16d..85419ca27 100644 --- a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsettings.cpp +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsettings.cpp @@ -32,7 +32,7 @@ void BeamSteeringCWModSettings::resetToDefaults() { m_steerDegrees = 90; m_rgbColor = QColor(140, 4, 4).rgb(); - m_title = "Local Source"; + m_title = "Beam Steering CW Modulator"; m_log2Interp = 0; m_filterChainHash = 0; m_channelMarker = nullptr; diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsource.cpp b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsource.cpp index ff432df9d..13c894b5e 100644 --- a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsource.cpp +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsource.cpp @@ -26,8 +26,10 @@ MESSAGE_CLASS_DEFINITION(BeamSteeringCWModSource::MsgConfigureChannelizer, Message) MESSAGE_CLASS_DEFINITION(BeamSteeringCWModSource::MsgSignalNotification, Message) +MESSAGE_CLASS_DEFINITION(BeamSteeringCWModSource::MsgConfigureSteeringAngle, Message) BeamSteeringCWModSource::BeamSteeringCWModSource() : + m_steeringDegrees(90), m_mutex(QMutex::Recursive) { m_sampleMOFifo.init(2, 96000 * 8); @@ -35,7 +37,8 @@ BeamSteeringCWModSource::BeamSteeringCWModSource() : for (int i = 0; i < 2; i++) { - //TODO: m_channelizers[i] = new UpChannelizer(&m_sinks[i]); + m_streamSources[i].setStreamIndex(i); + m_channelizers[i] = new UpSampleChannelizer(&m_streamSources[i]); m_sizes[i] = 0; } @@ -53,8 +56,7 @@ BeamSteeringCWModSource::BeamSteeringCWModSource() : BeamSteeringCWModSource::~BeamSteeringCWModSource() { - for (int i = 0; i < 2; i++) - { + for (int i = 0; i < 2; i++) { delete m_channelizers[i]; } } @@ -65,11 +67,18 @@ void BeamSteeringCWModSource::reset() m_sampleMOFifo.reset(); for (int i = 0; i < 2; i++) { - //TODO: m_sinks[i].reset(); + m_streamSources[i].reset(); } } -void BeamSteeringCWModSource::pull(const SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int streamIndex) +void BeamSteeringCWModSource::setSteeringDegrees(int steeringDegrees) +{ + m_steeringDegrees = steeringDegrees < -180 ? -180 : steeringDegrees > 180 ? 180 : steeringDegrees; + MsgConfigureSteeringAngle *msg = MsgConfigureSteeringAngle::create((m_steeringDegrees/180.0f)*M_PI); + m_inputMessageQueue.push(msg); +} + +void BeamSteeringCWModSource::pull(const SampleVector::iterator& begin, unsigned int nbSamples, unsigned int streamIndex) { if (streamIndex > 1) { return; @@ -85,14 +94,31 @@ void BeamSteeringCWModSource::pull(const SampleVector::const_iterator& begin, un if (streamIndex == 1) { + unsigned int part1Begin, part1End, part2Begin, part2End, size; + if (m_sizes[0] != m_sizes[1]) { qWarning("BeamSteeringCWModSource::pull: unequal sizes: [0]: %d [1]: %d", m_sizes[0], m_sizes[1]); - m_sampleMOFifo.writeSync(m_vbegin, std::min(m_sizes[0], m_sizes[1])); + size = std::min(m_sizes[0], m_sizes[1]); } else { - m_sampleMOFifo.writeSync(m_vbegin, m_sizes[0]); + size = m_sizes[0]; + } + + std::vector& data = m_sampleMOFifo.getData(); + m_sampleMOFifo.readSync(size, part1Begin, part1End, part2Begin, part2End); + + if (part1Begin != part1End) + { + std::copy(data[0].begin() + part1Begin, data[0].begin() + part1End, m_vbegin[0]); + std::copy(data[1].begin() + part1Begin, data[1].begin() + part1End, m_vbegin[1]); + } + + if (part2Begin != part2End) + { + std::copy(data[0].begin() + part2Begin, data[0].begin() + part2End, m_vbegin[0]); + std::copy(data[1].begin() + part2Begin, data[1].begin() + part2End, m_vbegin[1]); } } } @@ -101,7 +127,7 @@ void BeamSteeringCWModSource::handleData() { QMutexLocker mutexLocker(&m_mutex); - const std::vector& data = m_sampleMOFifo.getData(); + std::vector& data = m_sampleMOFifo.getData(); unsigned int ipart1begin; unsigned int ipart1end; @@ -126,18 +152,11 @@ void BeamSteeringCWModSource::handleData() } } -void BeamSteeringCWModSource::processFifo(const std::vector& data, unsigned int ibegin, unsigned int iend) +void BeamSteeringCWModSource::processFifo(std::vector& data, unsigned int ibegin, unsigned int iend) { for (unsigned int stream = 0; stream < 2; stream++) { - //TODO: m_channelizers[stream]->pull(data[stream].begin() + ibegin, iend - ibegin); + m_channelizers[stream]->pull(data[stream].begin() + ibegin, iend - ibegin); } - - run(); -} - -void BeamSteeringCWModSource::run() -{ - // TODO } void BeamSteeringCWModSource::handleInputMessages() @@ -168,35 +187,44 @@ bool BeamSteeringCWModSource::handleMessage(const Message& cmd) for (int i = 0; i < 2; i++) { - // TODO - // m_channelizers[i]->set(m_channelizers[i]->getInputMessageQueue(), - // log2Interp, - // filterChainHash); - // m_sinks[i].reset(); + m_channelizers[i]->setInterpolation(log2Interp, filterChainHash); + m_streamSources[i].reset(); } return true; } else if (MsgSignalNotification::match(cmd)) { + QMutexLocker mutexLocker(&m_mutex); MsgSignalNotification& cfg = (MsgSignalNotification&) cmd; int outputSampleRate = cfg.getOutputSampleRate(); - qint64 centerFrequency = cfg.getCenterFrequency(); - int streamIndex = cfg.getStreamIndex(); qDebug() << "BeamSteeringCWModSource::handleMessage: MsgSignalNotification:" << " outputSampleRate: " << outputSampleRate - << " centerFrequency: " << centerFrequency - << " streamIndex: " << streamIndex; + << " centerFrequency: " << cfg.getCenterFrequency(); - if (streamIndex < 2) + for (int i = 0; i < 2; i++) { - DSPSignalNotification *notif = new DSPSignalNotification(outputSampleRate, centerFrequency); - // TODO: m_channelizers[streamIndex]->getInputMessageQueue()->push(notif); + m_channelizers[i]->setOutputSampleRate(outputSampleRate); + m_streamSources[i].reset(); } return true; } + else if (MsgConfigureSteeringAngle::match(cmd)) + { + QMutexLocker mutexLocker(&m_mutex); + MsgConfigureSteeringAngle& cfg = (MsgConfigureSteeringAngle&) cmd; + float steeringAngle = cfg.getSteeringAngle(); + steeringAngle = steeringAngle < -M_PI ? -M_PI : steeringAngle > M_PI ? M_PI : steeringAngle; + + qDebug() << "BeamSteeringCWModSource::handleMessage: MsgConfigureSteeringAngle:" + << " steeringAngle: " << steeringAngle; + + m_streamSources[1].setPhase(M_PI*cos(steeringAngle)); + + return true; + } else { qDebug("BeamSteeringCWModSource::handleMessage: unhandled: %s", cmd.getIdentifier()); diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsource.h b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsource.h index d22968915..50c94cdb0 100644 --- a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsource.h +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodsource.h @@ -24,6 +24,7 @@ #include "dsp/samplemofifo.h" #include "util/message.h" #include "util/messagequeue.h" +#include "beamsteeringcwmodstreamsource.h" class UpSampleChannelizer; @@ -59,43 +60,58 @@ public: public: int getOutputSampleRate() const { return m_outputSampleRate; } qint64 getCenterFrequency() const { return m_centerFrequency; } - int getStreamIndex() const { return m_streamIndex; } - static MsgSignalNotification* create(int outputSampleRate, qint64 centerFrequency, int streamIndex) { - return new MsgSignalNotification(outputSampleRate, centerFrequency, streamIndex); + static MsgSignalNotification* create(int outputSampleRate, qint64 centerFrequency) { + return new MsgSignalNotification(outputSampleRate, centerFrequency); } private: int m_outputSampleRate; qint64 m_centerFrequency; - int m_streamIndex; - MsgSignalNotification(int outputSampleRate, qint64 centerFrequency, int streamIndex) : + MsgSignalNotification(int outputSampleRate, qint64 centerFrequency) : Message(), m_outputSampleRate(outputSampleRate), - m_centerFrequency(centerFrequency), - m_streamIndex(streamIndex) + m_centerFrequency(centerFrequency) { } }; + class MsgConfigureSteeringAngle : public Message { + MESSAGE_CLASS_DECLARATION + + public: + float getSteeringAngle() const { return m_steeringAngle; } + + static MsgConfigureSteeringAngle* create(float steeringAngle) { + return new MsgConfigureSteeringAngle(steeringAngle); + } + private: + float m_steeringAngle; + + MsgConfigureSteeringAngle(float steeringAngle) : + Message(), + m_steeringAngle(steeringAngle) + {} + }; + BeamSteeringCWModSource(); ~BeamSteeringCWModSource(); void reset(); MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication - void setSteeringDegrees(int steeringDegrees) { m_steeringDegrees = steeringDegrees; } - void pull(const SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int streamIndex); + void setSteeringDegrees(int steeringDegrees); + void pull(const SampleVector::iterator& begin, unsigned int nbSamples, unsigned int streamIndex); private: - void processFifo(const std::vector& data, unsigned int ibegin, unsigned int iend); - void run(); + void processFifo(std::vector& data, unsigned int ibegin, unsigned int iend); bool handleMessage(const Message& cmd); int m_steeringDegrees; SampleMOFifo m_sampleMOFifo; - std::vector m_vbegin; + std::vector m_vbegin; int m_sizes[2]; UpSampleChannelizer *m_channelizers[2]; + BeamSteeringCWModStreamSource m_streamSources[2]; MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication QMutex m_mutex; unsigned int m_lastStream; diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.cpp b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.cpp new file mode 100644 index 000000000..9944e749a --- /dev/null +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.cpp @@ -0,0 +1,49 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2019 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#include "beamsteeringcwmodstreamsource.h" + +BeamSteeringCWModStreamSource::BeamSteeringCWModStreamSource() : + m_amp(0.5f) +{ + m_real = m_amp; + m_imag = 0.0f; +} + +BeamSteeringCWModStreamSource::~BeamSteeringCWModStreamSource() +{} + +void BeamSteeringCWModStreamSource::setPhase(float phase) +{ + float normPhase = phase < -M_PI ? -M_PI : phase > M_PI ? M_PI : phase; + m_real = m_amp * cos(normPhase); + m_imag = m_amp * sin(normPhase); +} + +void BeamSteeringCWModStreamSource::pull(SampleVector::iterator begin, unsigned int nbSamples) +{ + std::fill(begin, begin + nbSamples, Sample{m_real, m_imag}); +} + +void BeamSteeringCWModStreamSource::pullOne(Sample& sample) +{ + sample.setReal(m_real); + sample.setImag(m_imag); +} + +void BeamSteeringCWModStreamSource::reset() +{} \ No newline at end of file diff --git a/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.h b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.h new file mode 100644 index 000000000..d87ee4933 --- /dev/null +++ b/plugins/channelmimo/beamsteeringcwmod/beamsteeringcwmodstreamsource.h @@ -0,0 +1,46 @@ +/////////////////////////////////////////////////////////////////////////////////// +// Copyright (C) 2019 Edouard Griffiths, F4EXB // +// // +// 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 . // +/////////////////////////////////////////////////////////////////////////////////// + +#ifndef INCLUDE_BEAMSTEERINGCWMODSTREAMSOURCE_H +#define INCLUDE_BEAMSTEERINGCWMODSTREAMSOURCE_H + +#include "dsp/channelsamplesource.h" + +class BeamSteeringCWModStreamSource : public ChannelSampleSource +{ +public: + BeamSteeringCWModStreamSource(); + virtual ~BeamSteeringCWModStreamSource(); + + virtual void pull(SampleVector::iterator begin, unsigned int nbSamples); + virtual void pullOne(Sample& sample); + + void reset(); + void setPhase(float phase); + unsigned int getStreamIndex() const { return m_streamIndex; } + void setStreamIndex(unsigned int streamIndex) { m_streamIndex = streamIndex; } + +private: + unsigned int m_streamIndex; + float m_amp; + FixReal m_real; + FixReal m_imag; +}; + + + +#endif // INCLUDE_BEAMSTEERINGCWMODSTREAMSOURCE_H diff --git a/plugins/channelmimo/interferometer/interferometer.cpp b/plugins/channelmimo/interferometer/interferometer.cpp index 87362bcb3..eb86f3a0a 100644 --- a/plugins/channelmimo/interferometer/interferometer.cpp +++ b/plugins/channelmimo/interferometer/interferometer.cpp @@ -101,7 +101,7 @@ void Interferometer::feed(const SampleVector::const_iterator& begin, const Sampl m_sink->feed(begin, end, sinkIndex); } -void Interferometer::pull(const SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) +void Interferometer::pull(const SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex) { (void) begin; (void) nbSamples; @@ -197,6 +197,7 @@ bool Interferometer::handleMessage(const Message& cmd) if (m_guiMessageQueue) { + qDebug() << "Interferometer::handleMessage: DSPMIMOSignalNotification: push to GUI"; MsgBasebandNotification *msg = MsgBasebandNotification::create( notif.getSampleRate(), notif.getCenterFrequency()); m_guiMessageQueue->push(msg); diff --git a/plugins/channelmimo/interferometer/interferometer.h b/plugins/channelmimo/interferometer/interferometer.h index a92582a30..1bc95db8d 100644 --- a/plugins/channelmimo/interferometer/interferometer.h +++ b/plugins/channelmimo/interferometer/interferometer.h @@ -94,12 +94,13 @@ public: virtual void startSources() {} virtual void stopSources() {} virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, unsigned int sinkIndex); - virtual void pull(const SampleVector::const_iterator& begin, unsigned int nbSamples, unsigned int sourceIndex); + virtual void pull(const SampleVector::iterator& begin, unsigned int nbSamples, unsigned int sourceIndex); virtual bool handleMessage(const Message& cmd); //!< Processing of a message. Returns true if message has actually been processed virtual void getIdentifier(QString& id) { id = objectName(); } virtual void getTitle(QString& title) { title = "Interferometer"; } virtual qint64 getCenterFrequency() const { return m_frequencyOffset; } + uint32_t getDeviceSampleRate() const { return m_deviceSampleRate; } virtual QByteArray serialize() const; virtual bool deserialize(const QByteArray& data); diff --git a/plugins/channelmimo/interferometer/interferometergui.cpp b/plugins/channelmimo/interferometer/interferometergui.cpp index dbc43147e..5b2a33586 100644 --- a/plugins/channelmimo/interferometer/interferometergui.cpp +++ b/plugins/channelmimo/interferometer/interferometergui.cpp @@ -126,6 +126,7 @@ InterferometerGUI::InterferometerGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI m_interferometer->setScopeSink(m_scopeVis); m_interferometer->setSpectrumSink(m_spectrumVis); m_interferometer->setMessageQueueToGUI(getInputMessageQueue()); + m_sampleRate = m_interferometer->getDeviceSampleRate(); ui->glSpectrum->setDisplayWaterfall(true); ui->glSpectrum->setDisplayMaxHold(true); diff --git a/plugins/channelmimo/interferometer/interferometerplugin.cpp b/plugins/channelmimo/interferometer/interferometerplugin.cpp index 6d74df8a1..50f140e8e 100644 --- a/plugins/channelmimo/interferometer/interferometerplugin.cpp +++ b/plugins/channelmimo/interferometer/interferometerplugin.cpp @@ -29,7 +29,7 @@ const PluginDescriptor InterferometerPlugin::m_pluginDescriptor = { QString("Interferometer"), - QString("4.12.0"), + QString("5.0.0"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, diff --git a/plugins/channelmimo/interferometer/interferometerstreamsink.h b/plugins/channelmimo/interferometer/interferometerstreamsink.h index 918c86029..9572e524b 100644 --- a/plugins/channelmimo/interferometer/interferometerstreamsink.h +++ b/plugins/channelmimo/interferometer/interferometerstreamsink.h @@ -21,8 +21,6 @@ #include #include "dsp/basebandsamplesink.h" -#include "dsp/nco.h" -#include "dsp/interpolator.h" class InterferometerStreamSink : public BasebandSampleSink diff --git a/plugins/samplemimo/bladerf2mimo/bladerf2mimoplugin.cpp b/plugins/samplemimo/bladerf2mimo/bladerf2mimoplugin.cpp index d162e5ef5..76c2a2341 100644 --- a/plugins/samplemimo/bladerf2mimo/bladerf2mimoplugin.cpp +++ b/plugins/samplemimo/bladerf2mimo/bladerf2mimoplugin.cpp @@ -20,18 +20,16 @@ #include "plugin/pluginapi.h" #include "util/simpleserializer.h" -#ifdef SERVER_MODE -#include "bladerf2mimo.h" -#else +#ifndef SERVER_MODE #include "bladerf2mimogui.h" -#include "bladerf2mimo.h" // TODO #endif +#include "bladerf2mimo.h" #include "bladerf2mimoplugin.h" -//#include "testmiwebapiadapter.h" +#include "bladerf2mimowebapiadapter.h" const PluginDescriptor BladeRF2MIMOPlugin::m_pluginDescriptor = { QString("BladeRF2 MIMO"), - QString("4.12.0"), + QString("5.0.0"), QString("(c) Edouard Griffiths, F4EXB"), QString("https://github.com/f4exb/sdrangel"), true, @@ -138,7 +136,5 @@ DeviceSampleMIMO *BladeRF2MIMOPlugin::createSampleMIMOPluginInstance(const QStri DeviceWebAPIAdapter *BladeRF2MIMOPlugin::createDeviceWebAPIAdapter() const { - // TODO - //return new BladeRF2MIMOWebAPIAdapter(); - return nullptr; + return new BladeRF2MIMOWebAPIAdapter(); }