1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -04:00

Web API: new entry point to get a channel report. Applied to NFM mod and demod

This commit is contained in:
f4exb
2018-03-18 20:17:11 +01:00
parent 733c213bf2
commit d4e1521c90
31 changed files with 2221 additions and 14 deletions
+61
View File
@@ -54,6 +54,7 @@
#include "SWGDeviceSettings.h"
#include "SWGDeviceState.h"
#include "SWGChannelSettings.h"
#include "SWGChannelReport.h"
#include "SWGSuccessResponse.h"
#include "SWGErrorResponse.h"
#include "SWGDeviceState.h"
@@ -1199,6 +1200,66 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
}
}
int WebAPIAdapterGUI::devicesetChannelReportGet(
int deviceSetIndex,
int channelIndex,
SWGSDRangel::SWGChannelReport& 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
{
ChannelSinkAPI *channelAPI = deviceSet->m_deviceSourceAPI->getChanelAPIAt(channelIndex);
if (channelAPI == 0)
{
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
else
{
response.setChannelType(new QString());
channelAPI->getIdentifier(*response.getChannelType());
response.setTx(0);
return channelAPI->webapiReportGet(response, *error.getMessage());
}
}
else if (deviceSet->m_deviceSinkEngine) // Tx
{
ChannelSourceAPI *channelAPI = deviceSet->m_deviceSinkAPI->getChanelAPIAt(channelIndex);
if (channelAPI == 0)
{
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
return 404;
}
else
{
response.setChannelType(new QString());
channelAPI->getIdentifier(*response.getChannelType());
response.setTx(1);
return channelAPI->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::devicesetChannelSettingsPutPatch(
int deviceSetIndex,
int channelIndex,