1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 13:47:01 -04:00

Web API: added channel enumeration in /sdrangel GET. Partial implementation in channel plugins

This commit is contained in:
f4exb
2017-11-19 03:38:07 +01:00
parent 30cd01cad0
commit b91ad7c4b7
31 changed files with 353 additions and 15 deletions
+26 -2
View File
@@ -25,6 +25,8 @@
#include "device/deviceuiset.h"
#include "dsp/devicesamplesource.h"
#include "dsp/devicesamplesink.h"
#include "channel/channelsinkapi.h"
#include "channel/channelsourceapi.h"
#include "SWGInstanceSummaryResponse.h"
#include "SWGErrorResponse.h"
@@ -86,7 +88,18 @@ int WebAPIAdapterGUI::instanceSummary(
samplingDevice->setBandwidth(sampleSink->getSampleRate());
}
deviceSet->back()->setChannelcount(0);
deviceSet->back()->setChannelcount((*it)->m_deviceSinkAPI->getNbChannels());
QList<Swagger::SWGChannel*> *channels = deviceSet->back()->getChannels();
for (int i = 0; i < deviceSet->back()->getChannelcount(); i++)
{
channels->append(new Swagger::SWGChannel);
ChannelSourceAPI *channel = (*it)->m_deviceSinkAPI->getChanelAPIAt(i);
channels->back()->setDeltaFrequency(channel->getDeltaFrequency());
channels->back()->setIndex(channel->getIndexInDeviceSet());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
}
}
if ((*it)->m_deviceSourceEngine) // Rx data
@@ -104,7 +117,18 @@ int WebAPIAdapterGUI::instanceSummary(
samplingDevice->setBandwidth(sampleSource->getSampleRate());
}
deviceSet->back()->setChannelcount(0);
deviceSet->back()->setChannelcount((*it)->m_deviceSourceAPI->getNbChannels());
QList<Swagger::SWGChannel*> *channels = deviceSet->back()->getChannels();
for (int i = 0; i < deviceSet->back()->getChannelcount(); i++)
{
channels->append(new Swagger::SWGChannel);
ChannelSinkAPI *channel = (*it)->m_deviceSourceAPI->getChanelAPIAt(i);
channels->back()->setDeltaFrequency(channel->getDeltaFrequency());
channels->back()->setIndex(channel->getIndexInDeviceSet());
channel->getIdentifier(*channels->back()->getId());
channel->getTitle(*channels->back()->getTitle());
}
}
}