1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Added MIMO channel support to device API and engine

This commit is contained in:
f4exb
2019-09-04 05:00:22 +02:00
parent 99a5ffbcfb
commit 77b5002907
4 changed files with 140 additions and 1 deletions
+65 -1
View File
@@ -18,10 +18,11 @@
#include <QDebug>
#include "dsp/dspcommands.h"
#include "dspcommands.h"
#include "threadedbasebandsamplesource.h"
#include "threadedbasebandsamplesink.h"
#include "devicesamplemimo.h"
#include "mimochannel.h"
#include "dspdevicemimoengine.h"
@@ -34,6 +35,8 @@ MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddThreadedBasebandSampleSource, M
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveThreadedBasebandSampleSource, Message)
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddThreadedBasebandSampleSink, Message)
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveThreadedBasebandSampleSink, Message)
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddMIMOChannel, Message)
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveMIMOChannel, Message)
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddBasebandSampleSink, Message)
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::RemoveBasebandSampleSink, Message)
MESSAGE_CLASS_DEFINITION(DSPDeviceMIMOEngine::AddSpectrumSink, Message)
@@ -189,6 +192,22 @@ void DSPDeviceMIMOEngine::removeChannelSink(ThreadedBasebandSampleSink* sink, in
m_syncMessenger.sendWait(cmd);
}
void DSPDeviceMIMOEngine::addMIMOChannel(MIMOChannel *channel)
{
qDebug() << "DSPDeviceMIMOEngine::addMIMOChannel: "
<< channel->objectName().toStdString().c_str();
AddMIMOChannel cmd(channel);
m_syncMessenger.sendWait(cmd);
}
void DSPDeviceMIMOEngine::removeMIMOChannel(MIMOChannel *channel)
{
qDebug() << "DSPDeviceMIMOEngine::removeMIMOChannel: "
<< channel->objectName().toStdString().c_str();
RemoveMIMOChannel cmd(channel);
m_syncMessenger.sendWait(cmd);
}
void DSPDeviceMIMOEngine::addAncillarySink(BasebandSampleSink* sink, int index)
{
qDebug() << "DSPDeviceMIMOEngine::addSink: "
@@ -718,6 +737,45 @@ void DSPDeviceMIMOEngine::handleSynchronousMessages()
m_threadedBasebandSampleSources[isink].remove(threadedSource);
}
}
else if (AddMIMOChannel::match(*message))
{
const AddMIMOChannel *msg = (AddMIMOChannel *) message;
MIMOChannel *channel = msg->getChannel();
m_mimoChannels.push_back(channel);
for (int isource = 0; isource < m_deviceSampleMIMO->getNbSourceStreams(); isource++)
{
DSPMIMOSignalNotification notif(
m_deviceSampleMIMO->getSourceSampleRate(isource),
m_deviceSampleMIMO->getSourceCenterFrequency(isource),
true,
isource
);
channel->handleMessage(notif);
}
for (int isink = 0; isink < m_deviceSampleMIMO->getNbSinkStreams(); isink++)
{
DSPMIMOSignalNotification notif(
m_deviceSampleMIMO->getSourceSampleRate(isink),
m_deviceSampleMIMO->getSourceCenterFrequency(isink),
false,
isink
);
channel->handleMessage(notif);
}
if (m_state == StRunning) {
channel->start();
}
}
else if (RemoveMIMOChannel::match(*message))
{
const RemoveMIMOChannel *msg = (RemoveMIMOChannel *) message;
MIMOChannel *channel = msg->getChannel();
channel->stop();
m_mimoChannels.remove(channel);
}
else if (AddSpectrumSink::match(*message))
{
m_spectrumSink = ((AddSpectrumSink*) message)->getSampleSink();
@@ -841,6 +899,12 @@ void DSPDeviceMIMOEngine::handleInputMessages()
<< " sampleRate: " << sampleRate
<< " centerFrequency: " << centerFrequency;
for (MIMOChannels::const_iterator it = m_mimoChannels.begin(); it != m_mimoChannels.end(); ++it)
{
DSPMIMOSignalNotification *message = new DSPMIMOSignalNotification(*notif);
(*it)->handleMessage(*message);
}
if (sourceElseSink)
{
if ((istream < m_deviceSampleMIMO->getNbSourceStreams()))