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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user