mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-17 13:51:47 -05:00
Added MIMO channel support to device API and engine
This commit is contained in:
parent
99a5ffbcfb
commit
77b5002907
@ -141,6 +141,8 @@ void DeviceAPI::addChannelSource(ThreadedBasebandSampleSource* source, int strea
|
||||
|
||||
if (m_deviceSinkEngine) {
|
||||
m_deviceSinkEngine->addThreadedSource(source);
|
||||
} else if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->addChannelSource(source);
|
||||
}
|
||||
}
|
||||
|
||||
@ -150,6 +152,22 @@ void DeviceAPI::removeChannelSource(ThreadedBasebandSampleSource* source, int st
|
||||
|
||||
if (m_deviceSinkEngine) {
|
||||
m_deviceSinkEngine->removeThreadedSource(source);
|
||||
} else if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->removeChannelSource(source);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::addMIMOChannel(MIMOChannel* channel)
|
||||
{
|
||||
if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->addMIMOChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::removeMIMOChannel(MIMOChannel* channel)
|
||||
{
|
||||
if (m_deviceMIMOEngine) {
|
||||
m_deviceMIMOEngine->removeMIMOChannel(channel);
|
||||
}
|
||||
}
|
||||
|
||||
@ -189,6 +207,18 @@ void DeviceAPI::removeChannelSourceAPI(ChannelAPI* channelAPI, int streamIndex)
|
||||
channelAPI->setIndexInDeviceSet(-1);
|
||||
}
|
||||
|
||||
void DeviceAPI::addMIMOChannelAPI(ChannelAPI* channelAPI)
|
||||
{
|
||||
m_mimoChannelAPIs.append(channelAPI);
|
||||
}
|
||||
|
||||
void DeviceAPI::removeMIMOChannelAPI(ChannelAPI *channelAPI)
|
||||
{
|
||||
if (m_mimoChannelAPIs.removeOne(channelAPI)) {
|
||||
renumerateChannels();
|
||||
}
|
||||
}
|
||||
|
||||
void DeviceAPI::setSampleSource(DeviceSampleSource* source)
|
||||
{
|
||||
if (m_deviceSourceEngine) {
|
||||
@ -790,4 +820,13 @@ void DeviceAPI::renumerateChannels()
|
||||
m_channelSourceAPIs.at(i)->setDeviceAPI(this);
|
||||
}
|
||||
}
|
||||
else if (m_streamType == StreamMIMO)
|
||||
{
|
||||
for (int i = 0; i < m_mimoChannelAPIs.size(); ++i)
|
||||
{
|
||||
m_mimoChannelAPIs.at(i)->setIndexInDeviceSet(i);
|
||||
m_mimoChannelAPIs.at(i)->setDeviceSetIndex(m_deviceTabIndex);
|
||||
m_mimoChannelAPIs.at(i)->setDeviceAPI(this);
|
||||
}
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@
|
||||
class BasebandSampleSink;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class ThreadedBasebandSampleSource;
|
||||
class MIMOChannel;
|
||||
class ChannelAPI;
|
||||
class DeviceSampleSink;
|
||||
class DeviceSampleSource;
|
||||
@ -80,11 +81,15 @@ public:
|
||||
void removeChannelSink(ThreadedBasebandSampleSink* sink, int streamIndex = 0); //!< Remove a channel sink (Rx)
|
||||
void addChannelSource(ThreadedBasebandSampleSource* sink, int streamIndex = 0); //!< Add a channel source (Tx)
|
||||
void removeChannelSource(ThreadedBasebandSampleSource* sink, int streamIndex = 0); //!< Remove a channel source (Tx)
|
||||
void addMIMOChannel(MIMOChannel* channel); //!< Add a MIMO channel (n Rx and m Tx combination)
|
||||
void removeMIMOChannel(MIMOChannel* channe); //!< Remove a MIMO channel (n Rx and m Tx combination)
|
||||
|
||||
void addChannelSinkAPI(ChannelAPI* channelAPI, int streamIndex = 0);
|
||||
void removeChannelSinkAPI(ChannelAPI* channelAPI, int streamIndex = 0);
|
||||
void addChannelSourceAPI(ChannelAPI* channelAPI, int streamIndex = 0);
|
||||
void removeChannelSourceAPI(ChannelAPI* channelAPI, int streamIndex = 0);
|
||||
void addMIMOChannelAPI(ChannelAPI* channelAPI);
|
||||
void removeMIMOChannelAPI(ChannelAPI* channelAPI);
|
||||
|
||||
void setSampleSource(DeviceSampleSource* source); //!< Set the device sample source (single Rx)
|
||||
void setSampleSink(DeviceSampleSink* sink); //!< Set the device sample sink (single Tx)
|
||||
@ -211,6 +216,7 @@ protected:
|
||||
// MIMO
|
||||
|
||||
DSPDeviceMIMOEngine *m_deviceMIMOEngine;
|
||||
QList<ChannelAPI*> m_mimoChannelAPIs;
|
||||
|
||||
private:
|
||||
void renumerateChannels();
|
||||
|
@ -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()))
|
||||
|
@ -32,6 +32,7 @@ class DeviceSampleMIMO;
|
||||
class ThreadedBasebandSampleSource;
|
||||
class ThreadedBasebandSampleSink;
|
||||
class BasebandSampleSink;
|
||||
class MIMOChannel;
|
||||
|
||||
class SDRBASE_API DSPDeviceMIMOEngine : public QThread {
|
||||
Q_OBJECT
|
||||
@ -123,6 +124,30 @@ public:
|
||||
unsigned int m_index;
|
||||
};
|
||||
|
||||
class AddMIMOChannel : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
public:
|
||||
AddMIMOChannel(MIMOChannel* channel) :
|
||||
Message(),
|
||||
m_channel(channel)
|
||||
{ }
|
||||
MIMOChannel* getChannel() const { return m_channel; }
|
||||
private:
|
||||
MIMOChannel* m_channel;
|
||||
};
|
||||
|
||||
class RemoveMIMOChannel : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
public:
|
||||
RemoveMIMOChannel(MIMOChannel* channel) :
|
||||
Message(),
|
||||
m_channel(channel)
|
||||
{ }
|
||||
MIMOChannel* getChannel() const { return m_channel; }
|
||||
private:
|
||||
MIMOChannel* m_channel;
|
||||
};
|
||||
|
||||
class AddBasebandSampleSink : public Message {
|
||||
MESSAGE_CLASS_DECLARATION
|
||||
public:
|
||||
@ -255,6 +280,8 @@ public:
|
||||
void removeChannelSource(ThreadedBasebandSampleSource* source, int index = 0); //!< Remove a channel source that runs on its own thread
|
||||
void addChannelSink(ThreadedBasebandSampleSink* sink, int index = 0); //!< Add a channel sink that will run on its own thread
|
||||
void removeChannelSink(ThreadedBasebandSampleSink* sink, int index = 0); //!< Remove a channel sink that runs on its own thread
|
||||
void addMIMOChannel(MIMOChannel *channel); //!< Add a MIMO channel
|
||||
void removeMIMOChannel(MIMOChannel *channel); //!< Remove a MIMO channel
|
||||
|
||||
void addAncillarySink(BasebandSampleSink* sink, int index = 0); //!< Add an ancillary sink like a I/Q recorder
|
||||
void removeAncillarySink(BasebandSampleSink* sink, int index = 0); //!< Remove an ancillary sample sink
|
||||
@ -342,6 +369,9 @@ private:
|
||||
typedef std::list<ThreadedBasebandSampleSource*> ThreadedBasebandSampleSources;
|
||||
std::vector<ThreadedBasebandSampleSources> m_threadedBasebandSampleSources; //!< channel sample sources on their own threads (per output stream)
|
||||
|
||||
typedef std::list<MIMOChannel*> MIMOChannels;
|
||||
MIMOChannels m_mimoChannels; //!< MIMO channels
|
||||
|
||||
std::vector<SourceCorrection> m_sourcesCorrections;
|
||||
|
||||
BasebandSampleSink *m_spectrumSink; //!< The spectrum sink
|
||||
|
Loading…
Reference in New Issue
Block a user