mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-09-05 14:47:50 -04:00
API: fixed adding channels when device is MIMO
This commit is contained in:
parent
61226c06bd
commit
a1c85aac17
@ -340,23 +340,23 @@ public:
|
|||||||
public:
|
public:
|
||||||
int getDeviceSetIndex() const { return m_deviceSetIndex; }
|
int getDeviceSetIndex() const { return m_deviceSetIndex; }
|
||||||
int getChannelRegistrationIndex() const { return m_channelRegistrationIndex; }
|
int getChannelRegistrationIndex() const { return m_channelRegistrationIndex; }
|
||||||
bool isTx() const { return m_tx; }
|
int getDirection() const { return m_direction; }
|
||||||
|
|
||||||
static MsgAddChannel* create(int deviceSetIndex, int channelRegistrationIndex, bool tx)
|
static MsgAddChannel* create(int deviceSetIndex, int channelRegistrationIndex, int direction)
|
||||||
{
|
{
|
||||||
return new MsgAddChannel(deviceSetIndex, channelRegistrationIndex, tx);
|
return new MsgAddChannel(deviceSetIndex, channelRegistrationIndex, direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_deviceSetIndex;
|
int m_deviceSetIndex;
|
||||||
int m_channelRegistrationIndex;
|
int m_channelRegistrationIndex;
|
||||||
bool m_tx;
|
int m_direction;
|
||||||
|
|
||||||
MsgAddChannel(int deviceSetIndex, int channelRegistrationIndex, bool tx) :
|
MsgAddChannel(int deviceSetIndex, int channelRegistrationIndex, int direction) :
|
||||||
Message(),
|
Message(),
|
||||||
m_deviceSetIndex(deviceSetIndex),
|
m_deviceSetIndex(deviceSetIndex),
|
||||||
m_channelRegistrationIndex(channelRegistrationIndex),
|
m_channelRegistrationIndex(channelRegistrationIndex),
|
||||||
m_tx(tx)
|
m_direction(direction)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2359,7 +2359,7 @@ int WebAPIAdapter::devicesetChannelPost(
|
|||||||
|
|
||||||
if (index < nbRegistrations)
|
if (index < nbRegistrations)
|
||||||
{
|
{
|
||||||
MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, false);
|
MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, 0);
|
||||||
m_mainCore->m_mainMessageQueue->push(msg);
|
m_mainCore->m_mainMessageQueue->push(msg);
|
||||||
|
|
||||||
response.init();
|
response.init();
|
||||||
@ -2395,7 +2395,7 @@ int WebAPIAdapter::devicesetChannelPost(
|
|||||||
|
|
||||||
if (index < nbRegistrations)
|
if (index < nbRegistrations)
|
||||||
{
|
{
|
||||||
MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, true);
|
MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, 1);
|
||||||
m_mainCore->m_mainMessageQueue->push(msg);
|
m_mainCore->m_mainMessageQueue->push(msg);
|
||||||
|
|
||||||
response.init();
|
response.init();
|
||||||
@ -2431,7 +2431,7 @@ int WebAPIAdapter::devicesetChannelPost(
|
|||||||
|
|
||||||
if (index < nbRegistrations)
|
if (index < nbRegistrations)
|
||||||
{
|
{
|
||||||
MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, true);
|
MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, 2);
|
||||||
m_mainCore->m_mainMessageQueue->push(msg);
|
m_mainCore->m_mainMessageQueue->push(msg);
|
||||||
|
|
||||||
response.init();
|
response.init();
|
||||||
|
@ -1170,7 +1170,35 @@ bool MainWindow::handleMessage(const Message& cmd)
|
|||||||
{
|
{
|
||||||
MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd;
|
MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd;
|
||||||
ui->tabInputsView->setCurrentIndex(notif.getDeviceSetIndex());
|
ui->tabInputsView->setCurrentIndex(notif.getDeviceSetIndex());
|
||||||
channelAddClicked(notif.getChannelRegistrationIndex());
|
int currentChannelTabIndex = ui->tabChannels->currentIndex();
|
||||||
|
|
||||||
|
if (currentChannelTabIndex >= 0)
|
||||||
|
{
|
||||||
|
DeviceUISet *deviceUI = m_deviceUIs[currentChannelTabIndex];
|
||||||
|
int channelRegistrationIndex;
|
||||||
|
|
||||||
|
if (deviceUI->m_deviceMIMOEngine)
|
||||||
|
{
|
||||||
|
int nbMIMOChannels = deviceUI->getNumberOfAvailableMIMOChannels();
|
||||||
|
int nbRxChannels = deviceUI->getNumberOfAvailableRxChannels();
|
||||||
|
int nbTxChannels = deviceUI->getNumberOfAvailableTxChannels();
|
||||||
|
int direction = notif.getDirection();
|
||||||
|
|
||||||
|
if (direction == 2) {
|
||||||
|
channelRegistrationIndex = notif.getChannelRegistrationIndex();
|
||||||
|
} else if (direction == 0) {
|
||||||
|
channelRegistrationIndex = nbMIMOChannels + notif.getChannelRegistrationIndex();
|
||||||
|
} else {
|
||||||
|
channelRegistrationIndex = nbMIMOChannels + nbRxChannels + notif.getChannelRegistrationIndex();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
channelRegistrationIndex = notif.getChannelRegistrationIndex();
|
||||||
|
}
|
||||||
|
|
||||||
|
channelAddClicked(channelRegistrationIndex);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -2247,7 +2275,7 @@ void MainWindow::channelAddClicked(int channelIndex)
|
|||||||
int nbMIMOChannels = deviceUI->getNumberOfAvailableMIMOChannels();
|
int nbMIMOChannels = deviceUI->getNumberOfAvailableMIMOChannels();
|
||||||
int nbRxChannels = deviceUI->getNumberOfAvailableRxChannels();
|
int nbRxChannels = deviceUI->getNumberOfAvailableRxChannels();
|
||||||
int nbTxChannels = deviceUI->getNumberOfAvailableTxChannels();
|
int nbTxChannels = deviceUI->getNumberOfAvailableTxChannels();
|
||||||
qDebug("MainWindow::channelAddClicked: MIMO: tab: nbMIMO: %d %d nbRx: %d nbTx: %d selected: %d",
|
qDebug("MainWindow::channelAddClicked: MIMO: tab %d : nbMIMO: %d nbRx: %d nbTx: %d selected: %d",
|
||||||
currentChannelTabIndex, nbMIMOChannels, nbRxChannels, nbTxChannels, channelIndex);
|
currentChannelTabIndex, nbMIMOChannels, nbRxChannels, nbTxChannels, channelIndex);
|
||||||
|
|
||||||
if (channelIndex < nbMIMOChannels)
|
if (channelIndex < nbMIMOChannels)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user