1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-15 21:01:45 -05:00

REST API: updates for MIMO

This commit is contained in:
f4exb 2019-12-23 18:49:06 +01:00
parent 2d1e4c5493
commit ddc4667bdb
12 changed files with 443 additions and 33 deletions

View File

@ -126,6 +126,7 @@ public:
virtual void setSinkCenterFrequency(qint64 centerFrequency, int index) { (void) centerFrequency; (void) index; } virtual void setSinkCenterFrequency(qint64 centerFrequency, int index) { (void) centerFrequency; (void) index; }
virtual quint64 getMIMOCenterFrequency() const { return getSourceCenterFrequency(0); } virtual quint64 getMIMOCenterFrequency() const { return getSourceCenterFrequency(0); }
virtual unsigned int getMIMOSampleRate() const { return getSourceSampleRate(0); }
virtual bool handleMessage(const Message& message); virtual bool handleMessage(const Message& message);

View File

@ -382,7 +382,7 @@ void DeviceAPI::setSamplingDevicePluginInstanceGUI(PluginInstanceGUI *gui)
m_samplingDevicePluginInstanceUI = gui; m_samplingDevicePluginInstanceUI = gui;
} }
void DeviceAPI::getDeviceEngineStateStr(QString& state) void DeviceAPI::getDeviceEngineStateStr(QString& state, int subsystemIndex)
{ {
if (m_deviceSourceEngine) if (m_deviceSourceEngine)
{ {
@ -432,17 +432,37 @@ void DeviceAPI::getDeviceEngineStateStr(QString& state)
break; break;
} }
} }
else if (m_deviceMIMOEngine)
{
switch(m_deviceMIMOEngine->state(subsystemIndex))
{
case DSPDeviceSinkEngine::StNotStarted:
state = "notStarted";
break;
case DSPDeviceSinkEngine::StIdle:
state = "idle";
break;
case DSPDeviceSinkEngine::StReady:
state = "ready";
break;
case DSPDeviceSinkEngine::StRunning:
state = "running";
break;
case DSPDeviceSinkEngine::StError:
state = "error";
break;
default:
state = "notStarted";
break;
}
}
else else
{ {
state = "notStarted"; state = "notStarted";
} }
} }
ChannelAPI *DeviceAPI::getChanelSinkAPIAt(int index, int streamIndex) ChannelAPI *DeviceAPI::getChanelSinkAPIAt(int index)
{
(void) streamIndex;
if (m_streamType == StreamSingleRx)
{ {
if (index < m_channelSinkAPIs.size()) { if (index < m_channelSinkAPIs.size()) {
return m_channelSinkAPIs.at(index); return m_channelSinkAPIs.at(index);
@ -450,17 +470,8 @@ ChannelAPI *DeviceAPI::getChanelSinkAPIAt(int index, int streamIndex)
return nullptr; return nullptr;
} }
} }
else // TODO: not implemented
{
return nullptr;
}
}
ChannelAPI *DeviceAPI::getChanelSourceAPIAt(int index, int streamIndex) ChannelAPI *DeviceAPI::getChanelSourceAPIAt(int index)
{
(void) streamIndex;
if (m_streamType == StreamSingleTx)
{ {
if (index < m_channelSourceAPIs.size()) { if (index < m_channelSourceAPIs.size()) {
return m_channelSourceAPIs.at(index); return m_channelSourceAPIs.at(index);
@ -468,8 +479,12 @@ ChannelAPI *DeviceAPI::getChanelSourceAPIAt(int index, int streamIndex)
return nullptr; return nullptr;
} }
} }
else // TODO: not implemented
ChannelAPI *DeviceAPI::getMIMOChannelAPIAt(int index)
{ {
if (index < m_mimoChannelAPIs.size()) {
return m_mimoChannelAPIs.at(index);
} else {
return nullptr; return nullptr;
} }
} }

View File

@ -133,13 +133,15 @@ public:
// PluginInstanceGUI *getSampleSourcePluginInstanceGUI() { return m_sampleSourcePluginInstanceUI; } // PluginInstanceGUI *getSampleSourcePluginInstanceGUI() { return m_sampleSourcePluginInstanceUI; }
// PluginInstanceGUI *getSampleSinkPluginInstanceGUI() { return m_sampleSinkPluginInstanceUI; } // PluginInstanceGUI *getSampleSinkPluginInstanceGUI() { return m_sampleSinkPluginInstanceUI; }
void getDeviceEngineStateStr(QString& state); void getDeviceEngineStateStr(QString& state, int subsystemIndex = 0);
ChannelAPI *getChanelSinkAPIAt(int index, int streamIndex = 0); ChannelAPI *getChanelSinkAPIAt(int index);
ChannelAPI *getChanelSourceAPIAt(int index, int streamIndex = 0); ChannelAPI *getChanelSourceAPIAt(int index);
ChannelAPI *getMIMOChannelAPIAt(int index);
int getNbSourceChannels() const { return m_channelSourceAPIs.size(); } int getNbSourceChannels() const { return m_channelSourceAPIs.size(); }
int getNbSinkChannels() const { return m_channelSinkAPIs.size(); } int getNbSinkChannels() const { return m_channelSinkAPIs.size(); }
int getNbMIMOChannels() const { return m_mimoChannelAPIs.size(); }
void loadSamplingDeviceSettings(const Preset* preset); void loadSamplingDeviceSettings(const Preset* preset);
// void loadSourceSettings(const Preset* preset); // void loadSourceSettings(const Preset* preset);

View File

@ -77,6 +77,7 @@ public:
virtual void setSourceCenterFrequency(qint64 centerFrequency, int index) = 0; virtual void setSourceCenterFrequency(qint64 centerFrequency, int index) = 0;
virtual quint64 getMIMOCenterFrequency() const = 0; //!< Unique center frequency for preset identification or any unique reference virtual quint64 getMIMOCenterFrequency() const = 0; //!< Unique center frequency for preset identification or any unique reference
virtual unsigned int getMIMOSampleRate() const = 0; //!< Unique sample rate for any unique reference
virtual bool handleMessage(const Message& message) = 0; virtual bool handleMessage(const Message& message) = 0;

View File

@ -1596,7 +1596,6 @@ definitions:
- serial - serial
- centerFrequency - centerFrequency
- bandwidth - bandwidth
- state
properties: properties:
index: index:
description: "Index in the list of device sets opened in this instance" description: "Index in the list of device sets opened in this instance"
@ -1627,7 +1626,13 @@ definitions:
description: "Bandwidth in Hz or complex S/s of baseband" description: "Bandwidth in Hz or complex S/s of baseband"
type: integer type: integer
state: state:
description: "State: notStarted, idle, ready, running, error" description: "Single subsystem state: notStarted, idle, ready, running, error"
type: string
stateRx:
description: "Rx subsystem state (MIMO): notStarted, idle, ready, running, error"
type: string
stateTx:
description: "Tx subsystem state (MIMO): notStarted, idle, ready, running, error"
type: string type: string
Channel: Channel:
@ -1639,6 +1644,9 @@ definitions:
- title - title
- deltaFrequency - deltaFrequency
properties: properties:
direction:
description: 0 for Rx only, 1 for Tx only or 2 for any direction (MIMO)
type: integer
index: index:
description: "Index in the list of channels" description: "Index in the list of channels"
type: integer type: integer

View File

@ -29,8 +29,10 @@
#include "device/deviceenumerator.h" #include "device/deviceenumerator.h"
#include "dsp/devicesamplesource.h" #include "dsp/devicesamplesource.h"
#include "dsp/devicesamplesink.h" #include "dsp/devicesamplesink.h"
#include "dsp/devicesamplemimo.h"
#include "dsp/dspdevicesourceengine.h" #include "dsp/dspdevicesourceengine.h"
#include "dsp/dspdevicesinkengine.h" #include "dsp/dspdevicesinkengine.h"
#include "dsp/dspdevicemimoengine.h"
#include "dsp/dspengine.h" #include "dsp/dspengine.h"
#include "plugin/pluginapi.h" #include "plugin/pluginapi.h"
#include "plugin/pluginmanager.h" #include "plugin/pluginmanager.h"
@ -1944,6 +1946,7 @@ void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const
channels->back()->init(); channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i); ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(1);
channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID()); channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId()); channel->getIdentifier(*channels->back()->getId());
@ -1976,6 +1979,72 @@ void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const
channels->back()->init(); channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i); ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(0);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
}
}
if (deviceUISet->m_deviceMIMOEngine) // MIMO data
{
samplingDevice->setDirection(2);
*samplingDevice->getHwType() = deviceUISet->m_deviceAPI->getHardwareId();
*samplingDevice->getSerial() = deviceUISet->m_deviceAPI->getSamplingDeviceSerial();
samplingDevice->setSequence(deviceUISet->m_deviceAPI->getSamplingDeviceSequence());
samplingDevice->setDeviceNbStreams(deviceUISet->m_deviceAPI->getDeviceNbItems());
samplingDevice->setDeviceStreamIndex(deviceUISet->m_deviceAPI->getDeviceItemIndex());
samplingDevice->setState(new QString("notStarted"));
deviceUISet->m_deviceAPI->getDeviceEngineStateStr(*samplingDevice->getStateRx(), 0);
deviceUISet->m_deviceAPI->getDeviceEngineStateStr(*samplingDevice->getStateTx(), 1);
DeviceSampleMIMO *sampleMIMO = deviceUISet->m_deviceMIMOEngine->getMIMO();
if (sampleMIMO)
{
samplingDevice->setCenterFrequency(sampleMIMO->getMIMOCenterFrequency());
samplingDevice->setBandwidth(sampleMIMO->getMIMOSampleRate());
}
int nbSinkChannels = deviceUISet->m_deviceAPI->getNbSinkChannels();
int nbSourceChannels = deviceUISet->m_deviceAPI->getNbSourceChannels();
int nbMIMOChannels = deviceUISet->m_deviceAPI->getNbMIMOChannels();
deviceSet->setChannelcount(nbSinkChannels + nbSourceChannels + nbMIMOChannels);
QList<SWGSDRangel::SWGChannel*> *channels = deviceSet->getChannels();
for (int i = 0; i < nbSinkChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(0);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
}
for (int i = 0; i < nbSourceChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(1);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
}
for (int i = 0; i < nbMIMOChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getMIMOChannelAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(2);
channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID()); channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId()); channel->getIdentifier(*channels->back()->getId());
@ -2001,6 +2070,7 @@ void WebAPIAdapterGUI::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channel
channels->back()->init(); channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i); ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(1);
channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID()); channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId()); channel->getIdentifier(*channels->back()->getId());
@ -2027,6 +2097,79 @@ void WebAPIAdapterGUI::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channel
channels->back()->init(); channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i); ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(0);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
channelReport = new SWGSDRangel::SWGChannelReport();
if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
channels->back()->setReport(channelReport);
} else {
delete channelReport;
}
}
}
if (deviceUISet->m_deviceMIMOEngine) // MIMO data
{
int nbSinkChannels = deviceUISet->m_deviceAPI->getNbSinkChannels();
int nbSourceChannels = deviceUISet->m_deviceAPI->getNbSourceChannels();
int nbMIMOChannels = deviceUISet->m_deviceAPI->getNbMIMOChannels();
QList<SWGSDRangel::SWGChannel*> *channels = channelsDetail->getChannels();
channelsDetail->setChannelcount(nbSinkChannels + nbSourceChannels + nbMIMOChannels);
for (int i = 0; i < nbSinkChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSinkAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(0);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
channelReport = new SWGSDRangel::SWGChannelReport();
if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
channels->back()->setReport(channelReport);
} else {
delete channelReport;
}
}
for (int i = 0; i < nbSourceChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getChanelSourceAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(1);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
channelReport = new SWGSDRangel::SWGChannelReport();
if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
channels->back()->setReport(channelReport);
} else {
delete channelReport;
}
}
for (int i = 0; i < nbMIMOChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceUISet->m_deviceAPI->getMIMOChannelAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(2);
channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID()); channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId()); channel->getIdentifier(*channels->back()->getId());

View File

@ -2028,6 +2028,7 @@ void WebAPIAdapterSrv::getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, con
channels->back()->init(); channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i); ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(1);
channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID()); channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId()); channel->getIdentifier(*channels->back()->getId());
@ -2060,6 +2061,72 @@ void WebAPIAdapterSrv::getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, con
channels->back()->init(); channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i); ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(0);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
}
}
if (deviceSet->m_deviceMIMOEngine) // MIMO data
{
samplingDevice->setDirection(2);
*samplingDevice->getHwType() = deviceSet->m_deviceAPI->getHardwareId();
*samplingDevice->getSerial() = deviceSet->m_deviceAPI->getSamplingDeviceSerial();
samplingDevice->setSequence(deviceSet->m_deviceAPI->getSamplingDeviceSequence());
samplingDevice->setDeviceNbStreams(deviceSet->m_deviceAPI->getDeviceNbItems());
samplingDevice->setDeviceStreamIndex(deviceSet->m_deviceAPI->getDeviceItemIndex());
samplingDevice->setState(new QString("notStarted"));
deviceSet->m_deviceAPI->getDeviceEngineStateStr(*samplingDevice->getStateRx(), 0);
deviceSet->m_deviceAPI->getDeviceEngineStateStr(*samplingDevice->getStateTx(), 1);
DeviceSampleMIMO *sampleMIMO = deviceSet->m_deviceMIMOEngine->getMIMO();
if (sampleMIMO)
{
samplingDevice->setCenterFrequency(sampleMIMO->getMIMOCenterFrequency());
samplingDevice->setBandwidth(sampleMIMO->getMIMOSampleRate());
}
int nbSinkChannels = deviceSet->m_deviceAPI->getNbSinkChannels();
int nbSourceChannels = deviceSet->m_deviceAPI->getNbSourceChannels();
int nbMIMOChannels = deviceSet->m_deviceAPI->getNbMIMOChannels();
swgDeviceSet->setChannelcount(nbSinkChannels + nbSourceChannels + nbMIMOChannels);
QList<SWGSDRangel::SWGChannel*> *channels = swgDeviceSet->getChannels();
for (int i = 0; i < nbSinkChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(0);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
}
for (int i = 0; i < nbSourceChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(1);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
}
for (int i = 0; i < nbMIMOChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getMIMOChannelAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(2);
channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID()); channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId()); channel->getIdentifier(*channels->back()->getId());
@ -2085,6 +2152,7 @@ void WebAPIAdapterSrv::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channel
channels->back()->init(); channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i); ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(1);
channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID()); channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId()); channel->getIdentifier(*channels->back()->getId());
@ -2111,6 +2179,79 @@ void WebAPIAdapterSrv::getChannelsDetail(SWGSDRangel::SWGChannelsDetail *channel
channels->back()->init(); channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i); ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency()); channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(0);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
channelReport = new SWGSDRangel::SWGChannelReport();
if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
channels->back()->setReport(channelReport);
} else {
delete channelReport;
}
}
}
if (deviceSet->m_deviceMIMOEngine) // MIMO data
{
int nbSinkChannels = deviceSet->m_deviceAPI->getNbSinkChannels();
int nbSourceChannels = deviceSet->m_deviceAPI->getNbSourceChannels();
int nbMIMOChannels = deviceSet->m_deviceAPI->getNbMIMOChannels();
QList<SWGSDRangel::SWGChannel*> *channels = channelsDetail->getChannels();
channelsDetail->setChannelcount(nbSinkChannels + nbSourceChannels + nbMIMOChannels);
for (int i = 0; i < nbSinkChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSinkAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(0);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
channelReport = new SWGSDRangel::SWGChannelReport();
if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
channels->back()->setReport(channelReport);
} else {
delete channelReport;
}
}
for (int i = 0; i < nbSourceChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getChanelSourceAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(1);
channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
channelReport = new SWGSDRangel::SWGChannelReport();
if (channel->webapiReportGet(*channelReport, channelReportError) != 501) {
channels->back()->setReport(channelReport);
} else {
delete channelReport;
}
}
for (int i = 0; i < nbMIMOChannels; i++)
{
channels->append(new SWGSDRangel::SWGChannel);
channels->back()->init();
ChannelAPI *channel = deviceSet->m_deviceAPI->getMIMOChannelAPIAt(i);
channels->back()->setDeltaFrequency(channel->getCenterFrequency());
channels->back()->setDirection(2);
channels->back()->setIndex(channel->getIndexInDeviceSet()); channels->back()->setIndex(channel->getIndexInDeviceSet());
channels->back()->setUid(channel->getUID()); channels->back()->setUid(channel->getUID());
channel->getIdentifier(*channels->back()->getId()); channel->getIdentifier(*channels->back()->getId());

View File

@ -1596,7 +1596,6 @@ definitions:
- serial - serial
- centerFrequency - centerFrequency
- bandwidth - bandwidth
- state
properties: properties:
index: index:
description: "Index in the list of device sets opened in this instance" description: "Index in the list of device sets opened in this instance"
@ -1627,7 +1626,13 @@ definitions:
description: "Bandwidth in Hz or complex S/s of baseband" description: "Bandwidth in Hz or complex S/s of baseband"
type: integer type: integer
state: state:
description: "State: notStarted, idle, ready, running, error" description: "Single subsystem state: notStarted, idle, ready, running, error"
type: string
stateRx:
description: "Rx subsystem state (MIMO): notStarted, idle, ready, running, error"
type: string
stateTx:
description: "Tx subsystem state (MIMO): notStarted, idle, ready, running, error"
type: string type: string
Channel: Channel:
@ -1639,6 +1644,9 @@ definitions:
- title - title
- deltaFrequency - deltaFrequency
properties: properties:
direction:
description: 0 for Rx only, 1 for Tx only or 2 for any direction (MIMO)
type: integer
index: index:
description: "Index in the list of channels" description: "Index in the list of channels"
type: integer type: integer

View File

@ -28,6 +28,8 @@ SWGChannel::SWGChannel(QString* json) {
} }
SWGChannel::SWGChannel() { SWGChannel::SWGChannel() {
direction = 0;
m_direction_isSet = false;
index = 0; index = 0;
m_index_isSet = false; m_index_isSet = false;
id = nullptr; id = nullptr;
@ -48,6 +50,8 @@ SWGChannel::~SWGChannel() {
void void
SWGChannel::init() { SWGChannel::init() {
direction = 0;
m_direction_isSet = false;
index = 0; index = 0;
m_index_isSet = false; m_index_isSet = false;
id = new QString(""); id = new QString("");
@ -65,6 +69,7 @@ SWGChannel::init() {
void void
SWGChannel::cleanup() { SWGChannel::cleanup() {
if(id != nullptr) { if(id != nullptr) {
delete id; delete id;
} }
@ -89,6 +94,8 @@ SWGChannel::fromJson(QString &json) {
void void
SWGChannel::fromJsonObject(QJsonObject &pJson) { SWGChannel::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&direction, pJson["direction"], "qint32", "");
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", ""); ::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString"); ::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString");
@ -117,6 +124,9 @@ SWGChannel::asJson ()
QJsonObject* QJsonObject*
SWGChannel::asJsonObject() { SWGChannel::asJsonObject() {
QJsonObject* obj = new QJsonObject(); QJsonObject* obj = new QJsonObject();
if(m_direction_isSet){
obj->insert("direction", QJsonValue(direction));
}
if(m_index_isSet){ if(m_index_isSet){
obj->insert("index", QJsonValue(index)); obj->insert("index", QJsonValue(index));
} }
@ -139,6 +149,16 @@ SWGChannel::asJsonObject() {
return obj; return obj;
} }
qint32
SWGChannel::getDirection() {
return direction;
}
void
SWGChannel::setDirection(qint32 direction) {
this->direction = direction;
this->m_direction_isSet = true;
}
qint32 qint32
SWGChannel::getIndex() { SWGChannel::getIndex() {
return index; return index;
@ -204,6 +224,9 @@ bool
SWGChannel::isSet(){ SWGChannel::isSet(){
bool isObjectUpdated = false; bool isObjectUpdated = false;
do{ do{
if(m_direction_isSet){
isObjectUpdated = true; break;
}
if(m_index_isSet){ if(m_index_isSet){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }

View File

@ -43,6 +43,9 @@ public:
virtual void fromJsonObject(QJsonObject &json) override; virtual void fromJsonObject(QJsonObject &json) override;
virtual SWGChannel* fromJson(QString &jsonString) override; virtual SWGChannel* fromJson(QString &jsonString) override;
qint32 getDirection();
void setDirection(qint32 direction);
qint32 getIndex(); qint32 getIndex();
void setIndex(qint32 index); void setIndex(qint32 index);
@ -65,6 +68,9 @@ public:
virtual bool isSet() override; virtual bool isSet() override;
private: private:
qint32 direction;
bool m_direction_isSet;
qint32 index; qint32 index;
bool m_index_isSet; bool m_index_isSet;

View File

@ -48,6 +48,10 @@ SWGSamplingDevice::SWGSamplingDevice() {
m_bandwidth_isSet = false; m_bandwidth_isSet = false;
state = nullptr; state = nullptr;
m_state_isSet = false; m_state_isSet = false;
state_rx = nullptr;
m_state_rx_isSet = false;
state_tx = nullptr;
m_state_tx_isSet = false;
} }
SWGSamplingDevice::~SWGSamplingDevice() { SWGSamplingDevice::~SWGSamplingDevice() {
@ -76,6 +80,10 @@ SWGSamplingDevice::init() {
m_bandwidth_isSet = false; m_bandwidth_isSet = false;
state = new QString(""); state = new QString("");
m_state_isSet = false; m_state_isSet = false;
state_rx = new QString("");
m_state_rx_isSet = false;
state_tx = new QString("");
m_state_tx_isSet = false;
} }
void void
@ -96,6 +104,12 @@ SWGSamplingDevice::cleanup() {
if(state != nullptr) { if(state != nullptr) {
delete state; delete state;
} }
if(state_rx != nullptr) {
delete state_rx;
}
if(state_tx != nullptr) {
delete state_tx;
}
} }
SWGSamplingDevice* SWGSamplingDevice*
@ -129,6 +143,10 @@ SWGSamplingDevice::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString"); ::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString");
::SWGSDRangel::setValue(&state_rx, pJson["stateRx"], "QString", "QString");
::SWGSDRangel::setValue(&state_tx, pJson["stateTx"], "QString", "QString");
} }
QString QString
@ -175,6 +193,12 @@ SWGSamplingDevice::asJsonObject() {
if(state != nullptr && *state != QString("")){ if(state != nullptr && *state != QString("")){
toJsonValue(QString("state"), state, obj, QString("QString")); toJsonValue(QString("state"), state, obj, QString("QString"));
} }
if(state_rx != nullptr && *state_rx != QString("")){
toJsonValue(QString("stateRx"), state_rx, obj, QString("QString"));
}
if(state_tx != nullptr && *state_tx != QString("")){
toJsonValue(QString("stateTx"), state_tx, obj, QString("QString"));
}
return obj; return obj;
} }
@ -279,6 +303,26 @@ SWGSamplingDevice::setState(QString* state) {
this->m_state_isSet = true; this->m_state_isSet = true;
} }
QString*
SWGSamplingDevice::getStateRx() {
return state_rx;
}
void
SWGSamplingDevice::setStateRx(QString* state_rx) {
this->state_rx = state_rx;
this->m_state_rx_isSet = true;
}
QString*
SWGSamplingDevice::getStateTx() {
return state_tx;
}
void
SWGSamplingDevice::setStateTx(QString* state_tx) {
this->state_tx = state_tx;
this->m_state_tx_isSet = true;
}
bool bool
SWGSamplingDevice::isSet(){ SWGSamplingDevice::isSet(){
@ -314,6 +358,12 @@ SWGSamplingDevice::isSet(){
if(state && *state != QString("")){ if(state && *state != QString("")){
isObjectUpdated = true; break; isObjectUpdated = true; break;
} }
if(state_rx && *state_rx != QString("")){
isObjectUpdated = true; break;
}
if(state_tx && *state_tx != QString("")){
isObjectUpdated = true; break;
}
}while(false); }while(false);
return isObjectUpdated; return isObjectUpdated;
} }

View File

@ -72,6 +72,12 @@ public:
QString* getState(); QString* getState();
void setState(QString* state); void setState(QString* state);
QString* getStateRx();
void setStateRx(QString* state_rx);
QString* getStateTx();
void setStateTx(QString* state_tx);
virtual bool isSet() override; virtual bool isSet() override;
@ -106,6 +112,12 @@ private:
QString* state; QString* state;
bool m_state_isSet; bool m_state_isSet;
QString* state_rx;
bool m_state_rx_isSet;
QString* state_tx;
bool m_state_tx_isSet;
}; };
} }