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

REST API: implemented GUI code for /sdrangel/deviceset/{deviceSetIndex}/spectrum/settings (PUT,PATCH) and /sdrangel/deviceset/{deviceSetIndex}/spectrum/server (POST,DELETE)

This commit is contained in:
f4exb
2020-05-06 01:38:23 +02:00
parent 946e45a6a3
commit 37de6d4bb7
9 changed files with 315 additions and 30 deletions
+63
View File
@@ -1434,6 +1434,27 @@ int WebAPIAdapterGUI::devicesetSpectrumSettingsGet(
}
}
int WebAPIAdapterGUI::devicesetSpectrumSettingsPutPatch(
int deviceSetIndex,
bool force, //!< true to force settings = put else patch
const QStringList& spectrumSettingsKeys,
SWGSDRangel::SWGGLSpectrum& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
return deviceSet->webapiSpectrumSettingsPutPatch(force, spectrumSettingsKeys, response, *error.getMessage());
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
int WebAPIAdapterGUI::devicesetSpectrumServerGet(
int deviceSetIndex,
SWGSDRangel::SWGSpectrumServer& response,
@@ -1455,6 +1476,48 @@ int WebAPIAdapterGUI::devicesetSpectrumServerGet(
}
}
int WebAPIAdapterGUI::devicesetSpectrumServerPost(
int deviceSetIndex,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
deviceSet->webapiSpectrumServerPost(response, *error.getMessage());
return 200;
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
int WebAPIAdapterGUI::devicesetSpectrumServerDelete(
int deviceSetIndex,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
deviceSet->webapiSpectrumServerDelete(response, *error.getMessage());
return 200;
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
int WebAPIAdapterGUI::devicesetDevicePut(
int deviceSetIndex,
SWGSDRangel::SWGDeviceListItem& query,