mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Server: web API: implemented /sdrangel/channels GET
This commit is contained in:
parent
07be97c658
commit
8d447dc827
@ -23,6 +23,7 @@
|
||||
|
||||
#include "SWGInstanceSummaryResponse.h"
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
#include "SWGInstanceChannelsResponse.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "maincore.h"
|
||||
@ -35,6 +36,8 @@
|
||||
#include "dsp/devicesamplesource.h"
|
||||
#include "channel/channelsourceapi.h"
|
||||
#include "channel/channelsinkapi.h"
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "plugin/pluginmanager.h"
|
||||
#include "webapiadaptersrv.h"
|
||||
|
||||
WebAPIAdapterSrv::WebAPIAdapterSrv(MainCore& mainCore) :
|
||||
@ -109,6 +112,32 @@ int WebAPIAdapterSrv::instanceDevices(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int WebAPIAdapterSrv::instanceChannels(
|
||||
bool tx,
|
||||
SWGSDRangel::SWGInstanceChannelsResponse& response,
|
||||
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
|
||||
{
|
||||
PluginAPI::ChannelRegistrations *channelRegistrations = tx ? m_mainCore.m_pluginManager->getTxChannelRegistrations() : m_mainCore.m_pluginManager->getRxChannelRegistrations();
|
||||
int nbChannelDevices = channelRegistrations->size();
|
||||
response.setChannelcount(nbChannelDevices);
|
||||
QList<SWGSDRangel::SWGChannelListItem*> *channels = response.getChannels();
|
||||
|
||||
for (int i = 0; i < nbChannelDevices; i++)
|
||||
{
|
||||
channels->append(new SWGSDRangel::SWGChannelListItem);
|
||||
PluginInterface *channelInterface = channelRegistrations->at(i).m_plugin;
|
||||
const PluginDescriptor& pluginDescriptor = channelInterface->getPluginDescriptor();
|
||||
*channels->back()->getVersion() = pluginDescriptor.version;
|
||||
*channels->back()->getName() = pluginDescriptor.displayedName;
|
||||
channels->back()->setTx(tx);
|
||||
*channels->back()->getIdUri() = channelRegistrations->at(i).m_channelIdURI;
|
||||
*channels->back()->getId() = channelRegistrations->at(i).m_channelId;
|
||||
channels->back()->setIndex(i);
|
||||
}
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
void WebAPIAdapterSrv::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList)
|
||||
{
|
||||
deviceSetList->init();
|
||||
|
@ -45,6 +45,11 @@ public:
|
||||
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceChannels(
|
||||
bool tx,
|
||||
SWGSDRangel::SWGInstanceChannelsResponse& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
private:
|
||||
MainCore& m_mainCore;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user