mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 14:04:46 -04:00
Web API: /sdrangel/dvserial implementation
This commit is contained in:
@@ -40,6 +40,8 @@
|
||||
#include "SWGAudioDevices.h"
|
||||
#include "SWGAudioDevicesSelect.h"
|
||||
#include "SWGLocationInformation.h"
|
||||
#include "SWGDVSeralDevices.h"
|
||||
#include "SWGDVSerialDevice.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "webapiadaptergui.h"
|
||||
@@ -348,6 +350,39 @@ int WebAPIAdapterGUI::instanceLocationPut(
|
||||
return 200;
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::instanceDVSerialPatch(
|
||||
bool dvserial,
|
||||
Swagger::SWGDVSeralDevices& response,
|
||||
Swagger::SWGErrorResponse& error __attribute__((unused)))
|
||||
{
|
||||
m_mainWindow.m_dspEngine->setDVSerialSupport(dvserial);
|
||||
response.init();
|
||||
|
||||
if (dvserial)
|
||||
{
|
||||
std::vector<std::string> deviceNames;
|
||||
m_mainWindow.m_dspEngine->getDVSerialNames(deviceNames);
|
||||
response.setNbDevices((int) deviceNames.size());
|
||||
QList<Swagger::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 Swagger::SWGDVSerialDevice);
|
||||
*deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it);
|
||||
++it;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response.setNbDevices(0);
|
||||
}
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
QtMsgType WebAPIAdapterGUI::getMsgTypeFromString(const QString& msgTypeString)
|
||||
{
|
||||
if (msgTypeString == "debug") {
|
||||
|
||||
Reference in New Issue
Block a user