- Generated 2020-11-11T12:04:23.918+01:00
+ Generated 2020-11-11T13:32:52.276+01:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml b/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml
index 80baee044..6f96f7679 100644
--- a/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml
+++ b/sdrbase/resources/webapi/doc/swagger/include/GLSpectrum.yaml
@@ -64,4 +64,4 @@ GLSpectrum:
type: string
wsSpectrumPort:
description: port on which the websocket server is listening
- type: integer\ No newline at end of file
+ type: integer
diff --git a/sdrbase/webapi/webapiadapterinterface.cpp b/sdrbase/webapi/webapiadapterinterface.cpp
index 89ffce35d..67a71bf8c 100644
--- a/sdrbase/webapi/webapiadapterinterface.cpp
+++ b/sdrbase/webapi/webapiadapterinterface.cpp
@@ -44,6 +44,8 @@ QString WebAPIAdapterInterface::instanceDeviceSetURL = "/sdrangel/deviceset";
std::regex WebAPIAdapterInterface::devicesetURLRe("^/sdrangel/deviceset/([0-9]{1,2})$");
std::regex WebAPIAdapterInterface::devicesetFocusURLRe("^/sdrangel/deviceset/([0-9]{1,2})/focus$");
+std::regex WebAPIAdapterInterface::devicesetSpectrumSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/spectrum/settings$");
+std::regex WebAPIAdapterInterface::devicesetSpectrumServerURLRe("^/sdrangel/deviceset/([0-9]{1,2})/spectrum/server$");
std::regex WebAPIAdapterInterface::devicesetDeviceURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device$");
std::regex WebAPIAdapterInterface::devicesetDeviceSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/settings$");
std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/run$");
diff --git a/sdrbase/webapi/webapiadapterinterface.h b/sdrbase/webapi/webapiadapterinterface.h
index bdef0205f..41628e875 100644
--- a/sdrbase/webapi/webapiadapterinterface.h
+++ b/sdrbase/webapi/webapiadapterinterface.h
@@ -67,6 +67,8 @@ namespace SWGSDRangel
class SWGFeatureSettings;
class SWGFeatureReport;
class SWGFeatureActions;
+ class SWGGLSpectrum;
+ class SWGSpectrumServer;
}
class SDRBASE_API WebAPIAdapterInterface
@@ -708,6 +710,90 @@ public:
return 501;
}
+ /**
+ * Handler of /sdrangel/deviceset/{devicesetIndex}/spectrum/settings (GET)
+ * returns the Http status code (default 501: not implemented)
+ */
+ virtual int devicesetSpectrumSettingsGet(
+ int deviceSetIndex,
+ SWGSDRangel::SWGGLSpectrum& response,
+ SWGSDRangel::SWGErrorResponse& error)
+ {
+ (void) deviceSetIndex;
+ (void) response;
+ error.init();
+ *error.getMessage() = QString("Function not implemented");
+ return 501;
+ }
+
+ /**
+ * Handler of /sdrangel/deviceset/{devicesetIndex}/spectrum/settings (PUT, PATCH)
+ * returns the Http status code (default 501: not implemented)
+ */
+ virtual int devicesetSpectrumSettingsPutPatch(
+ int deviceSetIndex,
+ bool force, //!< true to force settings = put else patch
+ const QStringList& spectrumSettingsKeys,
+ SWGSDRangel::SWGGLSpectrum& response,
+ SWGSDRangel::SWGErrorResponse& error)
+ {
+ (void) deviceSetIndex;
+ (void) force;
+ (void) spectrumSettingsKeys;
+ (void) response;
+ error.init();
+ *error.getMessage() = QString("Function not implemented");
+ return 501;
+ }
+
+ /**
+ * Handler of /sdrangel/deviceset/{devicesetIndex}/spectrum/server (GET)
+ * returns the Http status code (default 501: not implemented)
+ */
+ virtual int devicesetSpectrumServerGet(
+ int deviceSetIndex,
+ SWGSDRangel::SWGSpectrumServer& response,
+ SWGSDRangel::SWGErrorResponse& error)
+ {
+ (void) deviceSetIndex;
+ (void) response;
+ error.init();
+ *error.getMessage() = QString("Function not implemented");
+ return 501;
+ }
+
+ /**
+ * Handler of /sdrangel/deviceset/{devicesetIndex}/spectrum/server (POST)
+ * returns the Http status code (default 501: not implemented)
+ */
+ virtual int devicesetSpectrumServerPost(
+ int deviceSetIndex,
+ SWGSDRangel::SWGSuccessResponse& response,
+ SWGSDRangel::SWGErrorResponse& error)
+ {
+ (void) deviceSetIndex;
+ (void) response;
+ error.init();
+ *error.getMessage() = QString("Function not implemented");
+ return 501;
+ }
+
+ /**
+ * Handler of /sdrangel/deviceset/{devicesetIndex}/spectrum/server (DELETE)
+ * returns the Http status code (default 501: not implemented)
+ */
+ virtual int devicesetSpectrumServerDelete(
+ int deviceSetIndex,
+ SWGSDRangel::SWGSuccessResponse& response,
+ SWGSDRangel::SWGErrorResponse& error)
+ {
+ (void) deviceSetIndex;
+ (void) response;
+ error.init();
+ *error.getMessage() = QString("Function not implemented");
+ return 501;
+ }
+
/**
* Handler of /sdrangel/deviceset/{devicesetIndex}/device (PUT) swagger/sdrangel/code/html2/index.html#api-Default-instanceChannels
* returns the Http status code (default 501: not implemented)
@@ -1249,6 +1335,8 @@ public:
static QString instanceDeviceSetURL;
static std::regex devicesetURLRe;
static std::regex devicesetFocusURLRe;
+ static std::regex devicesetSpectrumSettingsURLRe;
+ static std::regex devicesetSpectrumServerURLRe;
static std::regex devicesetDeviceURLRe;
static std::regex devicesetDeviceSettingsURLRe;
static std::regex devicesetDeviceRunURLRe;
diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp
index 54c51d8af..38c2c40c6 100644
--- a/sdrbase/webapi/webapirequestmapper.cpp
+++ b/sdrbase/webapi/webapirequestmapper.cpp
@@ -56,6 +56,8 @@
#include "SWGFeatureSettings.h"
#include "SWGFeatureReport.h"
#include "SWGFeatureActions.h"
+#include "SWGGLSpectrum.h"
+#include "SWGSpectrumServer.h"
WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
HttpRequestHandler(parent),
@@ -161,6 +163,10 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
devicesetDeviceService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetFocusURLRe)) {
devicesetFocusService(std::string(desc_match[1]), request, response);
+ } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetSpectrumSettingsURLRe)) {
+ devicesetSpectrumSettingsService(std::string(desc_match[1]), request, response);
+ } else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetSpectrumServerURLRe)) {
+ devicesetSpectrumServerService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceSettingsURLRe)) {
devicesetDeviceSettingsService(std::string(desc_match[1]), request, response);
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceRunURLRe)) {
@@ -1483,6 +1489,155 @@ void WebAPIRequestMapper::devicesetFocusService(const std::string& indexStr, qtw
}
}
+void WebAPIRequestMapper::devicesetSpectrumSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
+{
+ SWGSDRangel::SWGErrorResponse errorResponse;
+ response.setHeader("Content-Type", "application/json");
+ response.setHeader("Access-Control-Allow-Origin", "*");
+
+ try
+ {
+ int deviceSetIndex = boost::lexical_cast