mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-03-23 12:48:49 -04:00
Server: web API: implemented /sdrangel/dvserial
This commit is contained in:
parent
8aeb28f637
commit
0896c2520e
@ -28,6 +28,7 @@
|
||||
#include "SWGAudioDevices.h"
|
||||
#include "SWGAudioDevicesSelect.h"
|
||||
#include "SWGLocationInformation.h"
|
||||
#include "SWGDVSeralDevices.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "maincore.h"
|
||||
@ -291,6 +292,39 @@ int WebAPIAdapterSrv::instanceLocationPut(
|
||||
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)
|
||||
{
|
||||
deviceSetList->init();
|
||||
|
@ -74,6 +74,11 @@ public:
|
||||
SWGSDRangel::SWGLocationInformation& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
virtual int instanceDVSerialPatch(
|
||||
bool dvserial,
|
||||
SWGSDRangel::SWGDVSeralDevices& response,
|
||||
SWGSDRangel::SWGErrorResponse& error);
|
||||
|
||||
private:
|
||||
MainCore& m_mainCore;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user