mirror of
https://github.com/f4exb/sdrangel.git
synced 2026-06-01 21:54:55 -04:00
REST API: config: GET (1) preferences and partial presets
This commit is contained in:
@@ -35,8 +35,10 @@
|
||||
#include "plugin/pluginapi.h"
|
||||
#include "plugin/pluginmanager.h"
|
||||
#include "channel/channelapi.h"
|
||||
#include "webapi/webapiadapterbase.h"
|
||||
|
||||
#include "SWGInstanceSummaryResponse.h"
|
||||
#include "SWGInstanceConfigResponse.h"
|
||||
#include "SWGInstanceDevicesResponse.h"
|
||||
#include "SWGInstanceChannelsResponse.h"
|
||||
#include "SWGDeviceListItem.h"
|
||||
@@ -114,6 +116,29 @@ int WebAPIAdapterGUI::instanceDelete(
|
||||
return 400;
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::instanceConfigGet(
|
||||
SWGSDRangel::SWGInstanceConfigResponse& response,
|
||||
SWGSDRangel::SWGErrorResponse& error)
|
||||
{
|
||||
response.init();
|
||||
SWGSDRangel::SWGPreferences *preferences = response.getPreferences();
|
||||
WebAPIAdapterBase::webapiFormatPreferences(preferences, m_mainWindow.getMainSettings().getPreferences());
|
||||
SWGSDRangel::SWGPreset *workingPreset = response.getWorkingPreset();
|
||||
WebAPIAdapterBase::webapiFormatPreset(workingPreset, m_mainWindow.getMainSettings().getWorkingPresetConst());
|
||||
|
||||
int nbPresets = m_mainWindow.m_settings.getPresetCount();
|
||||
QList<SWGSDRangel::SWGPreset*> *swgPresets = response.getPresets();
|
||||
|
||||
for (int i = 0; i < nbPresets; i++)
|
||||
{
|
||||
const Preset *preset = m_mainWindow.m_settings.getPreset(i);
|
||||
swgPresets->append(new SWGSDRangel::SWGPreset);
|
||||
WebAPIAdapterBase::webapiFormatPreset(swgPresets->back(), *preset);
|
||||
}
|
||||
|
||||
return 200;
|
||||
}
|
||||
|
||||
int WebAPIAdapterGUI::instanceDevices(
|
||||
int direction,
|
||||
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
||||
|
||||
Reference in New Issue
Block a user