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

Fixed Websocket spectrum: server implementation

This commit is contained in:
f4exb
2020-11-12 01:22:48 +01:00
parent b8136bf18c
commit 65587d43b1
12 changed files with 222 additions and 4913 deletions
+103
View File
@@ -1469,6 +1469,109 @@ int WebAPIAdapter::devicesetFocusPatch(
}
}
int WebAPIAdapter::devicesetSpectrumSettingsGet(
int deviceSetIndex,
SWGSDRangel::SWGGLSpectrum& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size()))
{
const DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex];
return deviceSet->webapiSpectrumSettingsGet(response, *error.getMessage());
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
int WebAPIAdapter::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_mainCore->m_deviceSets.size()))
{
DeviceSet *deviceSet = m_mainCore->m_deviceSets[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 WebAPIAdapter::devicesetSpectrumServerGet(
int deviceSetIndex,
SWGSDRangel::SWGSpectrumServer& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size()))
{
const DeviceSet *deviceSet = m_mainCore->m_deviceSets[deviceSetIndex];
deviceSet->webapiSpectrumServerGet(response, *error.getMessage());
return 200;
}
else
{
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404;
}
}
int WebAPIAdapter::devicesetSpectrumServerPost(
int deviceSetIndex,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size()))
{
DeviceSet *deviceSet = m_mainCore->m_deviceSets[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 WebAPIAdapter::devicesetSpectrumServerDelete(
int deviceSetIndex,
SWGSDRangel::SWGSuccessResponse& response,
SWGSDRangel::SWGErrorResponse& error)
{
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore->m_deviceSets.size()))
{
DeviceSet *deviceSet = m_mainCore->m_deviceSets[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 WebAPIAdapter::devicesetDevicePut(
int deviceSetIndex,
SWGSDRangel::SWGDeviceListItem& query,