1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-01 21:54:55 -04:00

Web API: implemented device report interface. Applied to Airspy

This commit is contained in:
f4exb
2018-05-26 01:43:28 +02:00
parent ae07298387
commit f8f976fd50
26 changed files with 1905 additions and 2 deletions
+40
View File
@@ -53,6 +53,7 @@
#include "SWGPresetIdentifier.h"
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGDeviceReport.h"
#include "SWGChannelsDetail.h"
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
@@ -1169,6 +1170,45 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete(
}
}
int WebAPIAdapterGUI::devicesetDeviceReportGet(
int deviceSetIndex,
SWGSDRangel::SWGDeviceReport& response,
SWGSDRangel::SWGErrorResponse& error)
{
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
if (deviceSet->m_deviceSourceEngine) // Rx
{
response.setDeviceHwType(new QString(deviceSet->m_deviceSourceAPI->getHardwareId()));
response.setTx(0);
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
return source->webapiReportGet(response, *error.getMessage());
}
else if (deviceSet->m_deviceSinkEngine) // Tx
{
response.setDeviceHwType(new QString(deviceSet->m_deviceSinkAPI->getHardwareId()));
response.setTx(1);
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
return sink->webapiReportGet(response, *error.getMessage());
}
else
{
*error.getMessage() = QString("DeviceSet error");
return 500;
}
}
else
{
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
int WebAPIAdapterGUI::devicesetChannelsReportGet(
int deviceSetIndex,
SWGSDRangel::SWGChannelsDetail& response,