mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 06:04:39 -04:00
Web API: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings GET for NFM demod and mod
This commit is contained in:
@@ -52,6 +52,7 @@
|
||||
#include "SWGPresetIdentifier.h"
|
||||
#include "SWGDeviceSettings.h"
|
||||
#include "SWGDeviceState.h"
|
||||
#include "SWGChannelSettings.h"
|
||||
#include "SWGErrorResponse.h"
|
||||
|
||||
#include "webapiadaptergui.h"
|
||||
@@ -886,6 +887,65 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete(
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::devicesetChannelSettingsGet(
|
||||
int deviceSetIndex,
|
||||
int channelIndex,
|
||||
SWGSDRangel::SWGChannelSettings& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
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.init();
|
||||
*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->webapiSettingsGet(response, *error.getMessage());
|
||||
}
|
||||
}
|
||||
else if (deviceSet->m_deviceSinkEngine) // Tx
|
||||
{
|
||||
ChannelSourceAPI *channelAPI = deviceSet->m_deviceSinkAPI->getChanelAPIAt(channelIndex);
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*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->webapiSettingsGet(response, *error.getMessage());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
|
||||
void WebAPIAdapterGUI::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user