mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-02 14:04:46 -04:00
Web API: /sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings PUT, PATCH for NFM demod and mod
This commit is contained in:
@@ -1077,6 +1077,93 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
|
||||
}
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
|
||||
int deviceSetIndex,
|
||||
int channelIndex,
|
||||
bool force,
|
||||
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
|
||||
{
|
||||
QString channelType;
|
||||
channelAPI->getIdentifier(channelType);
|
||||
|
||||
if (channelType == *response.getChannelType())
|
||||
{
|
||||
return channelAPI->webapiSettingsPutPatch(force, response, *error.getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
|
||||
.arg(*response.getChannelType())
|
||||
.arg(channelIndex)
|
||||
.arg(channelType);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
}
|
||||
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
|
||||
{
|
||||
QString channelType;
|
||||
channelAPI->getIdentifier(channelType);
|
||||
|
||||
if (channelType == *response.getChannelType())
|
||||
{
|
||||
return channelAPI->webapiSettingsPutPatch(force, response, *error.getMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
|
||||
.arg(*response.getChannelType())
|
||||
.arg(channelIndex)
|
||||
.arg(channelType);
|
||||
return 404;
|
||||
}
|
||||
}
|
||||
}
|
||||
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)
|
||||
{
|
||||
deviceSetList->init();
|
||||
|
||||
Reference in New Issue
Block a user