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