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

Server: web API: implemented /sdrangel/dvserial

This commit is contained in:
f4exb 2017-12-18 22:39:32 +01:00
parent 8aeb28f637
commit 0896c2520e
2 changed files with 39 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#include "SWGAudioDevices.h" #include "SWGAudioDevices.h"
#include "SWGAudioDevicesSelect.h" #include "SWGAudioDevicesSelect.h"
#include "SWGLocationInformation.h" #include "SWGLocationInformation.h"
#include "SWGDVSeralDevices.h"
#include "SWGErrorResponse.h" #include "SWGErrorResponse.h"
#include "maincore.h" #include "maincore.h"
@ -291,6 +292,39 @@ int WebAPIAdapterSrv::instanceLocationPut(
return 200; return 200;
} }
int WebAPIAdapterSrv::instanceDVSerialPatch(
bool dvserial,
SWGSDRangel::SWGDVSeralDevices& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{
m_mainCore.m_dspEngine->setDVSerialSupport(dvserial);
response.init();
if (dvserial)
{
std::vector<std::string> deviceNames;
m_mainCore.m_dspEngine->getDVSerialNames(deviceNames);
response.setNbDevices((int) deviceNames.size());
QList<SWGSDRangel::SWGDVSerialDevice*> *deviceNamesList = response.getDvSerialDevices();
std::vector<std::string>::iterator it = deviceNames.begin();
std::string deviceNamesStr = "DV Serial devices found: ";
while (it != deviceNames.end())
{
deviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice);
*deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it);
++it;
}
}
else
{
response.setNbDevices(0);
}
return 200;
}
void WebAPIAdapterSrv::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList) void WebAPIAdapterSrv::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList)
{ {
deviceSetList->init(); deviceSetList->init();

View File

@ -74,6 +74,11 @@ public:
SWGSDRangel::SWGLocationInformation& response, SWGSDRangel::SWGLocationInformation& response,
SWGSDRangel::SWGErrorResponse& error); SWGSDRangel::SWGErrorResponse& error);
virtual int instanceDVSerialPatch(
bool dvserial,
SWGSDRangel::SWGDVSeralDevices& response,
SWGSDRangel::SWGErrorResponse& error);
private: private:
MainCore& m_mainCore; MainCore& m_mainCore;