1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 05:41:56 -05:00

MIMO support: added basics in device UI set and device set

This commit is contained in:
f4exb 2019-05-16 18:39:13 +02:00
parent 60db6f76a6
commit f351fe6e71
10 changed files with 39 additions and 30 deletions

View File

@ -31,19 +31,19 @@
#include "deviceuiset.h"
DeviceUISet::DeviceUISet(int tabIndex, bool rxElseTx, QTimer& timer)
DeviceUISet::DeviceUISet(int tabIndex, int deviceType, QTimer& timer)
{
m_spectrum = new GLSpectrum;
if (rxElseTx) {
if ((deviceType == 0) || (deviceType == 2)) { // Single Rx or MIMO
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, m_spectrum);
} else {
} else if (deviceType == 1) { // Single Tx
m_spectrumVis = new SpectrumVis(SDR_TX_SCALEF, m_spectrum);
}
m_spectrum->connectTimer(timer);
m_spectrumGUI = new GLSpectrumGUI;
m_spectrumGUI->setBuddies(m_spectrumVis->getInputMessageQueue(), m_spectrumVis, m_spectrum);
m_channelWindow = new ChannelWindow;
m_samplingDeviceControl = new SamplingDeviceControl(tabIndex, rxElseTx);
m_samplingDeviceControl = new SamplingDeviceControl(tabIndex, deviceType);
m_deviceSourceEngine = 0;
m_deviceAPI = 0;
m_deviceSinkEngine = 0;

View File

@ -28,9 +28,10 @@ class GLSpectrum;
class GLSpectrumGUI;
class ChannelWindow;
class SamplingDeviceControl;
class DSPDeviceSourceEngine;
class DeviceAPI;
class DSPDeviceSourceEngine;
class DSPDeviceSinkEngine;
class DSPDeviceMIMOEngine;
class ChannelMarker;
class PluginAPI;
class PluginInstanceGUI;
@ -44,12 +45,13 @@ public:
GLSpectrumGUI *m_spectrumGUI;
ChannelWindow *m_channelWindow;
SamplingDeviceControl *m_samplingDeviceControl;
DSPDeviceSourceEngine *m_deviceSourceEngine;
DeviceAPI *m_deviceAPI;
DSPDeviceSourceEngine *m_deviceSourceEngine;
DSPDeviceSinkEngine *m_deviceSinkEngine;
DSPDeviceMIMOEngine *m_deviceMIMOEngine;
QByteArray m_mainWindowState;
DeviceUISet(int tabIndex, bool rxElseTx, QTimer& timer);
DeviceUISet(int tabIndex, int deviceType, QTimer& timer);
~DeviceUISet();
GLSpectrum *getSpectrum() { return m_spectrum; } //!< Direct spectrum getter

View File

@ -22,12 +22,12 @@
#include "ui_samplingdevicecontrol.h"
SamplingDeviceControl::SamplingDeviceControl(int tabIndex, bool rxElseTx, QWidget* parent) :
SamplingDeviceControl::SamplingDeviceControl(int tabIndex, int deviceType, QWidget* parent) :
QWidget(parent),
ui(new Ui::SamplingDeviceControl),
m_pluginManager(0),
m_deviceTabIndex(tabIndex),
m_rxElseTx(rxElseTx),
m_deviceType(deviceType),
m_selectedDeviceIndex(-1)
{
ui->setupUi(this);
@ -41,7 +41,7 @@ SamplingDeviceControl::~SamplingDeviceControl()
void SamplingDeviceControl::on_deviceChange_clicked()
{
SamplingDeviceDialog dialog(m_rxElseTx, m_deviceTabIndex, this);
SamplingDeviceDialog dialog(m_deviceType, m_deviceTabIndex, this);
dialog.exec();
if (dialog.getSelectedDeviceIndex() >= 0)
@ -61,13 +61,13 @@ void SamplingDeviceControl::on_deviceReload_clicked()
void SamplingDeviceControl::setSelectedDeviceIndex(int index)
{
if (m_rxElseTx)
if (m_deviceType == 0) // Single Rx
{
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(index);
DeviceEnumerator::instance()->changeRxSelection(m_deviceTabIndex, index);
ui->deviceSelectedText->setText(samplingDevice->displayedName);
}
else
else if (m_deviceType == 1) // Single Tx
{
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(index);
DeviceEnumerator::instance()->changeTxSelection(m_deviceTabIndex, index);
@ -79,12 +79,12 @@ void SamplingDeviceControl::setSelectedDeviceIndex(int index)
void SamplingDeviceControl::removeSelectedDeviceIndex()
{
if (m_rxElseTx)
if (m_deviceType == 0) // Single Rx
{
DeviceEnumerator::instance()->removeRxSelection(m_deviceTabIndex);
ui->deviceSelectedText->setText("None");
}
else
else if (m_deviceType == 1) // Single Tx
{
DeviceEnumerator::instance()->removeTxSelection(m_deviceTabIndex);
ui->deviceSelectedText->setText("None");

View File

@ -36,7 +36,7 @@ class SDRGUI_API SamplingDeviceControl : public QWidget {
Q_OBJECT
public:
explicit SamplingDeviceControl(int tabIndex, bool rxElseTx, QWidget* parent = 0);
explicit SamplingDeviceControl(int tabIndex, int deviceType, QWidget* parent = 0);
~SamplingDeviceControl();
int getSelectedDeviceIndex() const { return m_selectedDeviceIndex; }
@ -55,7 +55,7 @@ private:
Ui::SamplingDeviceControl* ui;
PluginManager *m_pluginManager;
int m_deviceTabIndex;
bool m_rxElseTx;
int m_deviceType;
int m_selectedDeviceIndex;
signals:

View File

@ -24,10 +24,10 @@
#include "device/deviceenumerator.h"
SamplingDeviceDialog::SamplingDeviceDialog(bool rxElseTx, int deviceTabIndex, QWidget* parent) :
SamplingDeviceDialog::SamplingDeviceDialog(int deviceType, int deviceTabIndex, QWidget* parent) :
QDialog(parent),
ui(new Ui::SamplingDeviceDialog),
m_rxElseTx(rxElseTx),
m_deviceType(deviceType),
m_deviceTabIndex(deviceTabIndex),
m_selectedDeviceIndex(-1)
{
@ -35,9 +35,9 @@ SamplingDeviceDialog::SamplingDeviceDialog(bool rxElseTx, int deviceTabIndex, QW
QList<QString> deviceDisplayNames;
if (m_rxElseTx) {
if (m_deviceType == 0) { // Single Rx
DeviceEnumerator::instance()->listRxDeviceNames(deviceDisplayNames, m_deviceIndexes);
} else {
} else if (m_deviceType == 1) { // Single Tx
DeviceEnumerator::instance()->listTxDeviceNames(deviceDisplayNames, m_deviceIndexes);
}
@ -54,9 +54,9 @@ void SamplingDeviceDialog::accept()
{
m_selectedDeviceIndex = m_deviceIndexes[ui->deviceSelect->currentIndex()];
if (m_rxElseTx) {
if (m_deviceType == 0) { // Single Rx
DeviceEnumerator::instance()->changeRxSelection(m_deviceTabIndex, m_selectedDeviceIndex);
} else {
} else if (m_deviceType == 1) { // Single Tx
DeviceEnumerator::instance()->changeTxSelection(m_deviceTabIndex, m_selectedDeviceIndex);
}

View File

@ -35,13 +35,13 @@ class SDRGUI_API SamplingDeviceDialog : public QDialog {
Q_OBJECT
public:
explicit SamplingDeviceDialog(bool rxElseTx, int deviceTabIndex, QWidget* parent = 0);
explicit SamplingDeviceDialog(int deviceType, int deviceTabIndex, QWidget* parent = 0);
~SamplingDeviceDialog();
int getSelectedDeviceIndex() const { return m_selectedDeviceIndex; }
private:
Ui::SamplingDeviceDialog* ui;
bool m_rxElseTx;
int m_deviceType;
int m_deviceTabIndex;
int m_selectedDeviceIndex;
std::vector<int> m_deviceIndexes;

View File

@ -266,7 +266,7 @@ void MainWindow::addSourceDevice(int deviceIndex)
sprintf(uidCStr, "UID:%d", dspDeviceSourceEngineUID);
int deviceTabIndex = m_deviceUIs.size();
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, true, m_masterTimer));
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, 0, m_masterTimer));
m_deviceUIs.back()->m_deviceSourceEngine = dspDeviceSourceEngine;
char tabNameCStr[16];
@ -339,7 +339,7 @@ void MainWindow::addSinkDevice()
sprintf(uidCStr, "UID:%d", dspDeviceSinkEngineUID);
int deviceTabIndex = m_deviceUIs.size();
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, false, m_masterTimer));
m_deviceUIs.push_back(new DeviceUISet(deviceTabIndex, 1, m_masterTimer));
m_deviceUIs.back()->m_deviceSourceEngine = 0;
m_deviceUIs.back()->m_deviceSinkEngine = dspDeviceSinkEngine;

View File

@ -50,9 +50,10 @@ DeviceSet::ChannelInstanceRegistration::ChannelInstanceRegistration(const QStrin
DeviceSet::DeviceSet(int tabIndex)
{
m_deviceSourceEngine = 0;
m_deviceAPI = 0;
m_deviceSourceEngine = 0;
m_deviceSinkEngine = 0;
m_deviceMIMOEngine = 0;
m_deviceTabIndex = tabIndex;
}

View File

@ -20,9 +20,10 @@
#include <QTimer>
class DSPDeviceSourceEngine;
class DeviceAPI;
class DSPDeviceSourceEngine;
class DSPDeviceSinkEngine;
class DSPDeviceMIMOEngine;
class PluginAPI;
class ChannelAPI;
class Preset;
@ -30,9 +31,10 @@ class Preset;
class DeviceSet
{
public:
DSPDeviceSourceEngine *m_deviceSourceEngine;
DeviceAPI *m_deviceAPI;
DSPDeviceSourceEngine *m_deviceSourceEngine;
DSPDeviceSinkEngine *m_deviceSinkEngine;
DSPDeviceMIMOEngine *m_deviceMIMOEngine;
DeviceSet(int tabIndex);
~DeviceSet();

View File

@ -274,7 +274,9 @@ void MainCore::addSinkDevice()
int deviceTabIndex = m_deviceSets.size();
m_deviceSets.push_back(new DeviceSet(deviceTabIndex));
m_deviceSets.back()->m_deviceSourceEngine = 0;
m_deviceSets.back()->m_deviceSinkEngine = dspDeviceSinkEngine;
m_deviceSets.back()->m_deviceMIMOEngine = 0;
dspDeviceSinkEngine;
m_deviceSets.back()->m_deviceMIMOEngine = 0;
char tabNameCStr[16];
sprintf(tabNameCStr, "T%d", deviceTabIndex);
@ -316,6 +318,8 @@ void MainCore::addSourceDevice()
int deviceTabIndex = m_deviceSets.size();
m_deviceSets.push_back(new DeviceSet(deviceTabIndex));
m_deviceSets.back()->m_deviceSourceEngine = dspDeviceSourceEngine;
m_deviceSets.back()->m_deviceSinkEngine = 0;
m_deviceSets.back()->m_deviceMIMOEngine = 0;
char tabNameCStr[16];
sprintf(tabNameCStr, "R%d", deviceTabIndex);