1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -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
+32
View File
@@ -21,6 +21,7 @@
#include "plugin/plugininterface.h"
#include "settings/preset.h"
#include "dsp/dspengine.h"
#include "channel/channelsinkapi.h"
DeviceSourceAPI::DeviceSourceAPI(int deviceTabIndex,
DSPDeviceSourceEngine *deviceSourceEngine) :
@@ -61,6 +62,37 @@ void DeviceSourceAPI::removeThreadedSink(ThreadedBasebandSampleSink* sink)
m_deviceSourceEngine->removeThreadedSink(sink);
}
void DeviceSourceAPI::addChannelAPI(ChannelSinkAPI* channelAPI)
{
m_channelAPIs.append(channelAPI);
renumerateChannels();
}
void DeviceSourceAPI::removeChannelAPI(ChannelSinkAPI* channelAPI)
{
if (m_channelAPIs.removeOne(channelAPI)) {
renumerateChannels();
}
channelAPI->setIndexInDeviceSet(-1);
}
ChannelSinkAPI *DeviceSourceAPI::getChanelAPIAt(int index)
{
if (index < m_channelAPIs.size()) {
return m_channelAPIs.at(index);
} else {
return 0;
}
}
void DeviceSourceAPI::renumerateChannels()
{
for (int i = 0; i < m_channelAPIs.size(); ++i) {
m_channelAPIs.at(i)->setIndexInDeviceSet(i);
}
}
void DeviceSourceAPI::setSampleSource(DeviceSampleSource* source)
{
m_deviceSourceEngine->setSource(source);