API: fixed adding channels when device is MIMO

pull/1108/head
f4exb 2022-01-13 02:45:25 +01:00
rodzic 61226c06bd
commit a1c85aac17
3 zmienionych plików z 39 dodań i 11 usunięć

Wyświetl plik

@ -340,23 +340,23 @@ public:
public:
int getDeviceSetIndex() const { return m_deviceSetIndex; }
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:
int m_deviceSetIndex;
int m_channelRegistrationIndex;
bool m_tx;
int m_direction;
MsgAddChannel(int deviceSetIndex, int channelRegistrationIndex, bool tx) :
MsgAddChannel(int deviceSetIndex, int channelRegistrationIndex, int direction) :
Message(),
m_deviceSetIndex(deviceSetIndex),
m_channelRegistrationIndex(channelRegistrationIndex),
m_tx(tx)
m_direction(direction)
{ }
};

Wyświetl plik

@ -2359,7 +2359,7 @@ int WebAPIAdapter::devicesetChannelPost(
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);
response.init();
@ -2395,7 +2395,7 @@ int WebAPIAdapter::devicesetChannelPost(
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);
response.init();
@ -2431,7 +2431,7 @@ int WebAPIAdapter::devicesetChannelPost(
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);
response.init();

Wyświetl plik

@ -1170,7 +1170,35 @@ bool MainWindow::handleMessage(const Message& cmd)
{
MainCore::MsgAddChannel& notif = (MainCore::MsgAddChannel&) cmd;
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;
}
@ -2247,7 +2275,7 @@ void MainWindow::channelAddClicked(int channelIndex)
int nbMIMOChannels = deviceUI->getNumberOfAvailableMIMOChannels();
int nbRxChannels = deviceUI->getNumberOfAvailableRxChannels();
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);
if (channelIndex < nbMIMOChannels)