mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-12-23 01:55:48 -05:00
REST API: config: GET (1) preferences and partial presets
This commit is contained in:
parent
9588d53327
commit
62ef01c21c
@ -132,6 +132,7 @@ set(sdrbase_SOURCES
|
|||||||
plugin/pluginapi.cpp
|
plugin/pluginapi.cpp
|
||||||
plugin/pluginmanager.cpp
|
plugin/pluginmanager.cpp
|
||||||
|
|
||||||
|
webapi/webapiadapterbase.cpp
|
||||||
webapi/webapiadapterinterface.cpp
|
webapi/webapiadapterinterface.cpp
|
||||||
webapi/webapirequestmapper.cpp
|
webapi/webapirequestmapper.cpp
|
||||||
webapi/webapiserver.cpp
|
webapi/webapiserver.cpp
|
||||||
@ -266,6 +267,7 @@ set(sdrbase_HEADERS
|
|||||||
util/uid.h
|
util/uid.h
|
||||||
util/timeutil.h
|
util/timeutil.h
|
||||||
|
|
||||||
|
webapi/webapiadapterbase.h
|
||||||
webapi/webapiadapterinterface.h
|
webapi/webapiadapterinterface.h
|
||||||
webapi/webapirequestmapper.h
|
webapi/webapirequestmapper.h
|
||||||
webapi/webapiserver
|
webapi/webapiserver
|
||||||
|
@ -23,6 +23,8 @@ public:
|
|||||||
QString getFileLocation() const;
|
QString getFileLocation() const;
|
||||||
int getFileFormat() const; //!< see QSettings::Format for the values
|
int getFileFormat() const; //!< see QSettings::Format for the values
|
||||||
|
|
||||||
|
const Preferences& getPreferences() const { return m_preferences; }
|
||||||
|
|
||||||
Preset* newPreset(const QString& group, const QString& description);
|
Preset* newPreset(const QString& group, const QString& description);
|
||||||
void deletePreset(const Preset* preset);
|
void deletePreset(const Preset* preset);
|
||||||
int getPresetCount() const { return m_presets.count(); }
|
int getPresetCount() const { return m_presets.count(); }
|
||||||
@ -41,6 +43,7 @@ public:
|
|||||||
void renameCommandGroup(const QString& oldGroupName, const QString& newGroupName);
|
void renameCommandGroup(const QString& oldGroupName, const QString& newGroupName);
|
||||||
void deleteCommandGroup(const QString& groupName);
|
void deleteCommandGroup(const QString& groupName);
|
||||||
|
|
||||||
|
const Preset& getWorkingPresetConst() const { return m_workingPreset; }
|
||||||
Preset* getWorkingPreset() { return &m_workingPreset; }
|
Preset* getWorkingPreset() { return &m_workingPreset; }
|
||||||
int getSourceIndex() const { return m_preferences.getSourceIndex(); }
|
int getSourceIndex() const { return m_preferences.getSourceIndex(); }
|
||||||
void setSourceIndex(int value) { m_preferences.setSourceIndex(value); }
|
void setSourceIndex(int value) { m_preferences.setSourceIndex(value); }
|
||||||
|
@ -37,6 +37,8 @@ public:
|
|||||||
bool getUseLogFile() const { return m_useLogFile; }
|
bool getUseLogFile() const { return m_useLogFile; }
|
||||||
const QString& getLogFileName() const { return m_logFileName; }
|
const QString& getLogFileName() const { return m_logFileName; }
|
||||||
|
|
||||||
|
friend class WebAPIAdapterBase;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QString m_sourceDevice; //!< Identification of the source used in R0 tab (GUI flavor) at startup
|
QString m_sourceDevice; //!< Identification of the source used in R0 tab (GUI flavor) at startup
|
||||||
int m_sourceIndex; //!< Index of the source used in R0 tab (GUI flavor) at startup
|
int m_sourceIndex; //!< Index of the source used in R0 tab (GUI flavor) at startup
|
||||||
|
@ -1,3 +1,22 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2015-2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// Swagger server adapter interface //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "settings/preset.h"
|
#include "settings/preset.h"
|
||||||
|
|
||||||
|
@ -1,3 +1,21 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2015-2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// Swagger server adapter interface //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
#ifndef INCLUDE_PRESET_H
|
#ifndef INCLUDE_PRESET_H
|
||||||
#define INCLUDE_PRESET_H
|
#define INCLUDE_PRESET_H
|
||||||
|
|
||||||
@ -98,6 +116,8 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
friend class WebAPIAdapterBase;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool m_sourcePreset;
|
bool m_sourcePreset;
|
||||||
|
|
||||||
|
54
sdrbase/webapi/webapiadapterbase.cpp
Normal file
54
sdrbase/webapi/webapiadapterbase.cpp
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// Swagger server adapter interface //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
#include "webapiadapterbase.h"
|
||||||
|
|
||||||
|
void WebAPIAdapterBase::webapiFormatPreferences(
|
||||||
|
SWGSDRangel::SWGPreferences *apiPreferences,
|
||||||
|
const Preferences& preferences
|
||||||
|
)
|
||||||
|
{
|
||||||
|
apiPreferences->init();
|
||||||
|
apiPreferences->setSourceDevice(new QString(preferences.m_sourceDevice));
|
||||||
|
apiPreferences->setSourceIndex(preferences.m_sourceIndex);
|
||||||
|
apiPreferences->setAudioType(new QString(preferences.m_audioType));
|
||||||
|
apiPreferences->setAudioDevice(new QString(preferences.m_audioDevice));
|
||||||
|
apiPreferences->setLatitude(preferences.m_latitude);
|
||||||
|
apiPreferences->setLongitude(preferences.m_longitude);
|
||||||
|
apiPreferences->setConsoleMinLogLevel((int) preferences.m_consoleMinLogLevel);
|
||||||
|
apiPreferences->setUseLogFile(preferences.m_useLogFile ? 1 : 0);
|
||||||
|
apiPreferences->setLogFileName(new QString(preferences.m_logFileName));
|
||||||
|
apiPreferences->setFileMinLogLevel((int) preferences.m_fileMinLogLevel);
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebAPIAdapterBase::webapiFormatPreset(
|
||||||
|
SWGSDRangel::SWGPreset *apiPreset,
|
||||||
|
const Preset& preset
|
||||||
|
)
|
||||||
|
{
|
||||||
|
apiPreset->init();
|
||||||
|
apiPreset->setSourcePreset(preset.m_sourcePreset ? 1 : 0);
|
||||||
|
apiPreset->setGroup(new QString(preset.m_group));
|
||||||
|
apiPreset->setDescription(new QString(preset.m_description));
|
||||||
|
apiPreset->setCenterFrequency(preset.m_centerFrequency);
|
||||||
|
apiPreset->getMSpectrumConfig()->init(); // TODO when spectrum config is extracted to sdrbase
|
||||||
|
apiPreset->setDcOffsetCorrection(preset.m_dcOffsetCorrection ? 1 : 0);
|
||||||
|
apiPreset->setIqImbalanceCorrection(preset.m_iqImbalanceCorrection ? 1 : 0);
|
||||||
|
// TODO: channel configs
|
||||||
|
// TODO: device configs
|
||||||
|
}
|
44
sdrbase/webapi/webapiadapterbase.h
Normal file
44
sdrbase/webapi/webapiadapterbase.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2019 Edouard Griffiths, F4EXB. //
|
||||||
|
// //
|
||||||
|
// Swagger server adapter interface //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// (at your option) any later version. //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
#ifndef SDRBASE_WEBAPI_WEBAPIADAPTERBASE_H_
|
||||||
|
#define SDRBASE_WEBAPI_WEBAPIADAPTERBASE_H_
|
||||||
|
|
||||||
|
#include "export.h"
|
||||||
|
#include "SWGPreferences.h"
|
||||||
|
#include "SWGPreset.h"
|
||||||
|
#include "settings/preferences.h"
|
||||||
|
#include "settings/preset.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adapter between API and objects in sdrbase library
|
||||||
|
*/
|
||||||
|
class SDRBASE_API WebAPIAdapterBase
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void webapiFormatPreferences(
|
||||||
|
SWGSDRangel::SWGPreferences *apiPreferences,
|
||||||
|
const Preferences& preferences
|
||||||
|
);
|
||||||
|
static void webapiFormatPreset(
|
||||||
|
SWGSDRangel::SWGPreset *apiPreset,
|
||||||
|
const Preset& preset
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // SDRBASE_WEBAPI_WEBAPIADAPTERBASE_H_
|
@ -20,6 +20,7 @@
|
|||||||
#include "webapiadapterinterface.h"
|
#include "webapiadapterinterface.h"
|
||||||
|
|
||||||
QString WebAPIAdapterInterface::instanceSummaryURL = "/sdrangel";
|
QString WebAPIAdapterInterface::instanceSummaryURL = "/sdrangel";
|
||||||
|
QString WebAPIAdapterInterface::instanceConfigURL = "/sdrangel/config";
|
||||||
QString WebAPIAdapterInterface::instanceDevicesURL = "/sdrangel/devices";
|
QString WebAPIAdapterInterface::instanceDevicesURL = "/sdrangel/devices";
|
||||||
QString WebAPIAdapterInterface::instanceChannelsURL = "/sdrangel/channels";
|
QString WebAPIAdapterInterface::instanceChannelsURL = "/sdrangel/channels";
|
||||||
QString WebAPIAdapterInterface::instanceLoggingURL = "/sdrangel/logging";
|
QString WebAPIAdapterInterface::instanceLoggingURL = "/sdrangel/logging";
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
namespace SWGSDRangel
|
namespace SWGSDRangel
|
||||||
{
|
{
|
||||||
class SWGInstanceSummaryResponse;
|
class SWGInstanceSummaryResponse;
|
||||||
|
class SWGInstanceConfigResponse;
|
||||||
class SWGInstanceDevicesResponse;
|
class SWGInstanceDevicesResponse;
|
||||||
class SWGInstanceChannelsResponse;
|
class SWGInstanceChannelsResponse;
|
||||||
class SWGLoggingInfo;
|
class SWGLoggingInfo;
|
||||||
@ -89,6 +90,20 @@ public:
|
|||||||
return 501;
|
return 501;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handler of /sdrangel/config (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceSummary
|
||||||
|
* returns the Http status code (default 501: not implemented)
|
||||||
|
*/
|
||||||
|
virtual int instanceConfigGet(
|
||||||
|
SWGSDRangel::SWGInstanceConfigResponse& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error)
|
||||||
|
{
|
||||||
|
(void) response;
|
||||||
|
error.init();
|
||||||
|
*error.getMessage() = QString("Function not implemented");
|
||||||
|
return 501;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handler of /sdrangel/devices (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceDevices
|
* Handler of /sdrangel/devices (GET) swagger/sdrangel/code/html2/index.html#api-Default-instanceDevices
|
||||||
* returns the Http status code (default 501: not implemented)
|
* returns the Http status code (default 501: not implemented)
|
||||||
@ -770,6 +785,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
static QString instanceSummaryURL;
|
static QString instanceSummaryURL;
|
||||||
|
static QString instanceConfigURL;
|
||||||
static QString instanceDevicesURL;
|
static QString instanceDevicesURL;
|
||||||
static QString instanceChannelsURL;
|
static QString instanceChannelsURL;
|
||||||
static QString instanceLoggingURL;
|
static QString instanceLoggingURL;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "httpdocrootsettings.h"
|
#include "httpdocrootsettings.h"
|
||||||
#include "webapirequestmapper.h"
|
#include "webapirequestmapper.h"
|
||||||
#include "SWGInstanceSummaryResponse.h"
|
#include "SWGInstanceSummaryResponse.h"
|
||||||
|
#include "SWGInstanceConfigResponse.h"
|
||||||
#include "SWGInstanceDevicesResponse.h"
|
#include "SWGInstanceDevicesResponse.h"
|
||||||
#include "SWGInstanceChannelsResponse.h"
|
#include "SWGInstanceChannelsResponse.h"
|
||||||
#include "SWGAudioDevices.h"
|
#include "SWGAudioDevices.h"
|
||||||
@ -96,6 +97,8 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
|||||||
|
|
||||||
if (path == WebAPIAdapterInterface::instanceSummaryURL) {
|
if (path == WebAPIAdapterInterface::instanceSummaryURL) {
|
||||||
instanceSummaryService(request, response);
|
instanceSummaryService(request, response);
|
||||||
|
} else if (path == WebAPIAdapterInterface::instanceConfigURL) {
|
||||||
|
instanceConfigService(request, response);
|
||||||
} else if (path == WebAPIAdapterInterface::instanceDevicesURL) {
|
} else if (path == WebAPIAdapterInterface::instanceDevicesURL) {
|
||||||
instanceDevicesService(request, response);
|
instanceDevicesService(request, response);
|
||||||
} else if (path == WebAPIAdapterInterface::instanceChannelsURL) {
|
} else if (path == WebAPIAdapterInterface::instanceChannelsURL) {
|
||||||
@ -212,6 +215,26 @@ void WebAPIRequestMapper::instanceSummaryService(qtwebapp::HttpRequest& request,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebAPIRequestMapper::instanceConfigService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||||
|
response.setHeader("Content-Type", "application/json");
|
||||||
|
response.setHeader("Access-Control-Allow-Origin", "*");
|
||||||
|
|
||||||
|
if (request.getMethod() == "GET")
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGInstanceConfigResponse normalResponse;
|
||||||
|
int status = m_adapter->instanceConfigGet(normalResponse, errorResponse);
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status/100 == 2) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WebAPIRequestMapper::instanceDevicesService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
void WebAPIRequestMapper::instanceDevicesService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGInstanceDevicesResponse normalResponse;
|
SWGSDRangel::SWGInstanceDevicesResponse normalResponse;
|
||||||
|
@ -49,6 +49,7 @@ private:
|
|||||||
qtwebapp::StaticFileController *m_staticFileController;
|
qtwebapp::StaticFileController *m_staticFileController;
|
||||||
|
|
||||||
void instanceSummaryService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void instanceSummaryService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
|
void instanceConfigService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
void instanceDevicesService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void instanceDevicesService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
void instanceChannelsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void instanceChannelsService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
void instanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void instanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
|
@ -35,8 +35,10 @@
|
|||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "plugin/pluginmanager.h"
|
#include "plugin/pluginmanager.h"
|
||||||
#include "channel/channelapi.h"
|
#include "channel/channelapi.h"
|
||||||
|
#include "webapi/webapiadapterbase.h"
|
||||||
|
|
||||||
#include "SWGInstanceSummaryResponse.h"
|
#include "SWGInstanceSummaryResponse.h"
|
||||||
|
#include "SWGInstanceConfigResponse.h"
|
||||||
#include "SWGInstanceDevicesResponse.h"
|
#include "SWGInstanceDevicesResponse.h"
|
||||||
#include "SWGInstanceChannelsResponse.h"
|
#include "SWGInstanceChannelsResponse.h"
|
||||||
#include "SWGDeviceListItem.h"
|
#include "SWGDeviceListItem.h"
|
||||||
@ -114,6 +116,29 @@ int WebAPIAdapterGUI::instanceDelete(
|
|||||||
return 400;
|
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 WebAPIAdapterGUI::instanceDevices(
|
||||||
int direction,
|
int direction,
|
||||||
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
||||||
|
@ -41,6 +41,10 @@ public:
|
|||||||
SWGSDRangel::SWGSuccessResponse& response,
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error);
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
|
virtual int instanceConfigGet(
|
||||||
|
SWGSDRangel::SWGInstanceConfigResponse& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
virtual int instanceDevices(
|
virtual int instanceDevices(
|
||||||
int direction,
|
int direction,
|
||||||
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
#include <QSysInfo>
|
#include <QSysInfo>
|
||||||
|
|
||||||
#include "SWGInstanceSummaryResponse.h"
|
#include "SWGInstanceSummaryResponse.h"
|
||||||
|
#include "SWGInstanceConfigResponse.h"
|
||||||
#include "SWGInstanceDevicesResponse.h"
|
#include "SWGInstanceDevicesResponse.h"
|
||||||
#include "SWGInstanceChannelsResponse.h"
|
#include "SWGInstanceChannelsResponse.h"
|
||||||
#include "SWGLoggingInfo.h"
|
#include "SWGLoggingInfo.h"
|
||||||
@ -56,6 +57,7 @@
|
|||||||
#include "channel/channelapi.h"
|
#include "channel/channelapi.h"
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "plugin/pluginmanager.h"
|
#include "plugin/pluginmanager.h"
|
||||||
|
#include "webapi/webapiadapterbase.h"
|
||||||
#include "webapiadaptersrv.h"
|
#include "webapiadaptersrv.h"
|
||||||
|
|
||||||
WebAPIAdapterSrv::WebAPIAdapterSrv(MainCore& mainCore) :
|
WebAPIAdapterSrv::WebAPIAdapterSrv(MainCore& mainCore) :
|
||||||
@ -113,6 +115,29 @@ int WebAPIAdapterSrv::instanceDelete(
|
|||||||
return 202;
|
return 202;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int WebAPIAdapterSrv::instanceConfigGet(
|
||||||
|
SWGSDRangel::SWGInstanceConfigResponse& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error)
|
||||||
|
{
|
||||||
|
response.init();
|
||||||
|
SWGSDRangel::SWGPreferences *preferences = response.getPreferences();
|
||||||
|
WebAPIAdapterBase::webapiFormatPreferences(preferences, m_mainCore.getMainSettings().getPreferences());
|
||||||
|
SWGSDRangel::SWGPreset *workingPreset = response.getWorkingPreset();
|
||||||
|
WebAPIAdapterBase::webapiFormatPreset(workingPreset, m_mainCore.getMainSettings().getWorkingPresetConst());
|
||||||
|
|
||||||
|
int nbPresets = m_mainCore.m_settings.getPresetCount();
|
||||||
|
QList<SWGSDRangel::SWGPreset*> *swgPresets = response.getPresets();
|
||||||
|
|
||||||
|
for (int i = 0; i < nbPresets; i++)
|
||||||
|
{
|
||||||
|
const Preset *preset = m_mainCore.m_settings.getPreset(i);
|
||||||
|
swgPresets->append(new SWGSDRangel::SWGPreset);
|
||||||
|
WebAPIAdapterBase::webapiFormatPreset(swgPresets->back(), *preset);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
int WebAPIAdapterSrv::instanceDevices(
|
int WebAPIAdapterSrv::instanceDevices(
|
||||||
int direction,
|
int direction,
|
||||||
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
||||||
|
@ -41,6 +41,10 @@ public:
|
|||||||
SWGSDRangel::SWGSuccessResponse& response,
|
SWGSDRangel::SWGSuccessResponse& response,
|
||||||
SWGSDRangel::SWGErrorResponse& error);
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
|
virtual int instanceConfigGet(
|
||||||
|
SWGSDRangel::SWGInstanceConfigResponse& response,
|
||||||
|
SWGSDRangel::SWGErrorResponse& error);
|
||||||
|
|
||||||
virtual int instanceDevices(
|
virtual int instanceDevices(
|
||||||
int direction,
|
int direction,
|
||||||
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
SWGSDRangel::SWGInstanceDevicesResponse& response,
|
||||||
|
@ -35,7 +35,7 @@ Preset:
|
|||||||
centerFrequency:
|
centerFrequency:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
m_spectrumConfig:
|
spectrumConfig:
|
||||||
$ref: "http://localhost:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum"
|
$ref: "http://localhost:8081/api/swagger/include/GLSpectrum.yaml#/GLSpectrum"
|
||||||
dcOffsetCorrection:
|
dcOffsetCorrection:
|
||||||
description: boolean
|
description: boolean
|
||||||
|
Loading…
Reference in New Issue
Block a user