mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-25 17:28:50 -05:00
REST API: implemented GUI code for /sdrangel/deviceset/{deviceSetIndex}/spectrum/settings (GET) and /sdrangel/deviceset/{deviceSetIndex}/spectrum/server (GET)
This commit is contained in:
parent
fc4302f5b8
commit
4d86d7e510
@ -18,6 +18,9 @@
|
|||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "SWGGLSpectrum.h"
|
||||||
|
#include "SWGSpectrumServer.h"
|
||||||
|
|
||||||
#include "glspectruminterface.h"
|
#include "glspectruminterface.h"
|
||||||
#include "dspcommands.h"
|
#include "dspcommands.h"
|
||||||
#include "dspengine.h"
|
#include "dspengine.h"
|
||||||
@ -778,3 +781,66 @@ void SpectrumVis::handleConfigureWSSpectrum(const QString& address, uint16_t por
|
|||||||
m_wsSpectrum.openSocket();
|
m_wsSpectrum.openSocket();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int SpectrumVis::webapiSpectrumSettingsGet(SWGSDRangel::SWGGLSpectrum& response, QString& errorMessage) const
|
||||||
|
{
|
||||||
|
(void) errorMessage;
|
||||||
|
response.init();
|
||||||
|
webapiFormatSpectrumSettings(response, m_settings);
|
||||||
|
return 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
int SpectrumVis::webapiSpectrumServerGet(SWGSDRangel::SWGSpectrumServer& response, QString& errorMessage) const
|
||||||
|
{
|
||||||
|
bool serverRunning = m_wsSpectrum.socketOpened();
|
||||||
|
QList<QHostAddress> peerHosts;
|
||||||
|
QList<quint16> peerPorts;
|
||||||
|
m_wsSpectrum.getPeers(peerHosts, peerPorts);
|
||||||
|
response.init();
|
||||||
|
response.setRun(serverRunning ? 1 : 0);
|
||||||
|
|
||||||
|
if (peerHosts.size() > 0)
|
||||||
|
{
|
||||||
|
response.setClients(new QList<SWGSDRangel::SWGSpectrumServer_clients*>);
|
||||||
|
|
||||||
|
for (int i = 0; i < peerHosts.size(); i++)
|
||||||
|
{
|
||||||
|
response.getClients()->push_back(new SWGSDRangel::SWGSpectrumServer_clients);
|
||||||
|
response.getClients()->back()->setAddress(new QString(peerHosts.at(i).toString()));
|
||||||
|
response.getClients()->back()->setPort(peerPorts.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SpectrumVis::webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& response, const GLSpectrumSettings& settings)
|
||||||
|
{
|
||||||
|
response.setFftSize(settings.m_fftSize);
|
||||||
|
response.setFftOverlap(settings.m_fftOverlap);
|
||||||
|
response.setFftWindow((int) settings.m_fftWindow);
|
||||||
|
response.setRefLevel(settings.m_refLevel);
|
||||||
|
response.setPowerRange(settings.m_powerRange);
|
||||||
|
response.setDecay(settings.m_decay);
|
||||||
|
response.setDecayDivisor(settings.m_decayDivisor);
|
||||||
|
response.setHistogramStroke(settings.m_histogramStroke);
|
||||||
|
response.setDisplayGridIntensity(settings.m_displayGridIntensity);
|
||||||
|
response.setDisplayTraceIntensity(settings.m_displayTraceIntensity);
|
||||||
|
response.setDisplayWaterfall(settings.m_displayWaterfall ? 1 : 0);
|
||||||
|
response.setInvertedWaterfall(settings.m_invertedWaterfall ? 1 : 0);
|
||||||
|
response.setWaterfallShare(settings.m_waterfallShare);
|
||||||
|
response.setDisplayMaxHold(settings.m_displayMaxHold ? 1 : 0);
|
||||||
|
response.setDisplayCurrent(settings.m_displayCurrent ? 1 : 0);
|
||||||
|
response.setDisplayHistogram(settings.m_displayHistogram ? 1 : 0);
|
||||||
|
response.setDisplayGrid(settings.m_displayGrid ? 1 : 0);
|
||||||
|
response.setAveragingMode((int) settings.m_averagingMode);
|
||||||
|
response.setAveragingValue(settings.m_averagingValue);
|
||||||
|
response.setLinear(settings.m_linear ? 1 : 0);
|
||||||
|
response.setSsb(settings.m_ssb ? 1 : 0);
|
||||||
|
response.setUsb(settings.m_usb ? 1 : 0);
|
||||||
|
response.setWsSpectrumPort(settings.m_wsSpectrumPort);
|
||||||
|
|
||||||
|
if (response.getWsSpectrumAddress()) {
|
||||||
|
*response.getWsSpectrumAddress() = settings.m_wsSpectrumAddress;
|
||||||
|
} else {
|
||||||
|
response.setWsSpectrumAddress(new QString(settings.m_wsSpectrumAddress));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -37,7 +37,12 @@
|
|||||||
class GLSpectrumInterface;
|
class GLSpectrumInterface;
|
||||||
class MessageQueue;
|
class MessageQueue;
|
||||||
|
|
||||||
class SDRBASE_API SpectrumVis : public BasebandSampleSink {
|
namespace SWGSDRangel {
|
||||||
|
class SWGGLSpectrum;
|
||||||
|
class SWGSpectrumServer;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SDRGUI_API SpectrumVis : public BasebandSampleSink {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class SDRBASE_API MsgConfigureSpectrumVis : public Message {
|
class SDRBASE_API MsgConfigureSpectrumVis : public Message {
|
||||||
@ -126,6 +131,9 @@ public:
|
|||||||
virtual void stop();
|
virtual void stop();
|
||||||
virtual bool handleMessage(const Message& message);
|
virtual bool handleMessage(const Message& message);
|
||||||
|
|
||||||
|
int webapiSpectrumSettingsGet(SWGSDRangel::SWGGLSpectrum& response, QString& errorMessage) const;
|
||||||
|
int webapiSpectrumServerGet(SWGSDRangel::SWGSpectrumServer& response, QString& errorMessage) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
class MsgConfigureScalingFactor : public Message
|
class MsgConfigureScalingFactor : public Message
|
||||||
{
|
{
|
||||||
@ -199,6 +207,8 @@ private:
|
|||||||
void handleScalef(Real scalef);
|
void handleScalef(Real scalef);
|
||||||
void handleWSOpenClose(bool openClose);
|
void handleWSOpenClose(bool openClose);
|
||||||
void handleConfigureWSSpectrum(const QString& address, uint16_t port);
|
void handleConfigureWSSpectrum(const QString& address, uint16_t port);
|
||||||
|
|
||||||
|
static void webapiFormatSpectrumSettings(SWGSDRangel::SWGGLSpectrum& response, const GLSpectrumSettings& settings);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // INCLUDE_SPECTRUMVIS_H
|
#endif // INCLUDE_SPECTRUMVIS_H
|
||||||
|
@ -4753,6 +4753,10 @@ margin-bottom: 20px;
|
|||||||
"wsSpectrumAddress" : {
|
"wsSpectrumAddress" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"description" : "IPv4 address of interface the websocket server is listening to"
|
"description" : "IPv4 address of interface the websocket server is listening to"
|
||||||
|
},
|
||||||
|
"wsSpectrumPort" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"description" : "port on which the websocket server is listening"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description" : "GLSpectrumGUI settings"
|
"description" : "GLSpectrumGUI settings"
|
||||||
@ -44592,7 +44596,7 @@ except ApiException as e:
|
|||||||
</div>
|
</div>
|
||||||
<div id="generator">
|
<div id="generator">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
Generated 2020-11-11T12:04:23.918+01:00
|
Generated 2020-11-11T13:32:52.276+01:00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -64,4 +64,4 @@ GLSpectrum:
|
|||||||
type: string
|
type: string
|
||||||
wsSpectrumPort:
|
wsSpectrumPort:
|
||||||
description: port on which the websocket server is listening
|
description: port on which the websocket server is listening
|
||||||
type: integer\ No newline at end of file
|
type: integer
|
||||||
|
@ -44,6 +44,8 @@ QString WebAPIAdapterInterface::instanceDeviceSetURL = "/sdrangel/deviceset";
|
|||||||
|
|
||||||
std::regex WebAPIAdapterInterface::devicesetURLRe("^/sdrangel/deviceset/([0-9]{1,2})$");
|
std::regex WebAPIAdapterInterface::devicesetURLRe("^/sdrangel/deviceset/([0-9]{1,2})$");
|
||||||
std::regex WebAPIAdapterInterface::devicesetFocusURLRe("^/sdrangel/deviceset/([0-9]{1,2})/focus$");
|
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::devicesetDeviceURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device$");
|
||||||
std::regex WebAPIAdapterInterface::devicesetDeviceSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/settings$");
|
std::regex WebAPIAdapterInterface::devicesetDeviceSettingsURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/settings$");
|
||||||
std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/run$");
|
std::regex WebAPIAdapterInterface::devicesetDeviceRunURLRe("^/sdrangel/deviceset/([0-9]{1,2})/device/run$");
|
||||||
|
@ -67,6 +67,8 @@ namespace SWGSDRangel
|
|||||||
class SWGFeatureSettings;
|
class SWGFeatureSettings;
|
||||||
class SWGFeatureReport;
|
class SWGFeatureReport;
|
||||||
class SWGFeatureActions;
|
class SWGFeatureActions;
|
||||||
|
class SWGGLSpectrum;
|
||||||
|
class SWGSpectrumServer;
|
||||||
}
|
}
|
||||||
|
|
||||||
class SDRBASE_API WebAPIAdapterInterface
|
class SDRBASE_API WebAPIAdapterInterface
|
||||||
@ -708,6 +710,90 @@ public:
|
|||||||
return 501;
|
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
|
* 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)
|
* returns the Http status code (default 501: not implemented)
|
||||||
@ -1249,6 +1335,8 @@ public:
|
|||||||
static QString instanceDeviceSetURL;
|
static QString instanceDeviceSetURL;
|
||||||
static std::regex devicesetURLRe;
|
static std::regex devicesetURLRe;
|
||||||
static std::regex devicesetFocusURLRe;
|
static std::regex devicesetFocusURLRe;
|
||||||
|
static std::regex devicesetSpectrumSettingsURLRe;
|
||||||
|
static std::regex devicesetSpectrumServerURLRe;
|
||||||
static std::regex devicesetDeviceURLRe;
|
static std::regex devicesetDeviceURLRe;
|
||||||
static std::regex devicesetDeviceSettingsURLRe;
|
static std::regex devicesetDeviceSettingsURLRe;
|
||||||
static std::regex devicesetDeviceRunURLRe;
|
static std::regex devicesetDeviceRunURLRe;
|
||||||
|
@ -56,6 +56,8 @@
|
|||||||
#include "SWGFeatureSettings.h"
|
#include "SWGFeatureSettings.h"
|
||||||
#include "SWGFeatureReport.h"
|
#include "SWGFeatureReport.h"
|
||||||
#include "SWGFeatureActions.h"
|
#include "SWGFeatureActions.h"
|
||||||
|
#include "SWGGLSpectrum.h"
|
||||||
|
#include "SWGSpectrumServer.h"
|
||||||
|
|
||||||
WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
|
WebAPIRequestMapper::WebAPIRequestMapper(QObject* parent) :
|
||||||
HttpRequestHandler(parent),
|
HttpRequestHandler(parent),
|
||||||
@ -161,6 +163,10 @@ void WebAPIRequestMapper::service(qtwebapp::HttpRequest& request, qtwebapp::Http
|
|||||||
devicesetDeviceService(std::string(desc_match[1]), request, response);
|
devicesetDeviceService(std::string(desc_match[1]), request, response);
|
||||||
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetFocusURLRe)) {
|
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetFocusURLRe)) {
|
||||||
devicesetFocusService(std::string(desc_match[1]), request, response);
|
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)) {
|
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceSettingsURLRe)) {
|
||||||
devicesetDeviceSettingsService(std::string(desc_match[1]), request, response);
|
devicesetDeviceSettingsService(std::string(desc_match[1]), request, response);
|
||||||
} else if (std::regex_match(pathStr, desc_match, WebAPIAdapterInterface::devicesetDeviceRunURLRe)) {
|
} 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<int>(indexStr);
|
||||||
|
|
||||||
|
if ((request.getMethod() == "PUT") || (request.getMethod() == "PATCH"))
|
||||||
|
{
|
||||||
|
QString jsonStr = request.getBody();
|
||||||
|
QJsonObject jsonObject;
|
||||||
|
|
||||||
|
if (parseJsonBody(jsonStr, jsonObject, response))
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGGLSpectrum normalResponse;
|
||||||
|
resetSpectrumSettings(normalResponse);
|
||||||
|
QStringList spectrumSettingsKeys;
|
||||||
|
|
||||||
|
if (validateSpectrumSettings(normalResponse, jsonObject, spectrumSettingsKeys))
|
||||||
|
{
|
||||||
|
int status = m_adapter->devicesetSpectrumSettingsPutPatch(
|
||||||
|
deviceSetIndex,
|
||||||
|
(request.getMethod() == "PUT"), // force settings on PUT
|
||||||
|
spectrumSettingsKeys,
|
||||||
|
normalResponse,
|
||||||
|
errorResponse);
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status/100 == 2) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.setStatus(400,"Invalid JSON request");
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Invalid JSON request";
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.setStatus(400,"Invalid JSON format");
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Invalid JSON format";
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (request.getMethod() == "GET")
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGGLSpectrum normalResponse;
|
||||||
|
resetSpectrumSettings(normalResponse);
|
||||||
|
int status = m_adapter->devicesetSpectrumSettingsGet(deviceSetIndex, normalResponse, errorResponse);
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status/100 == 2) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.setStatus(405,"Invalid HTTP method");
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Invalid HTTP method";
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const boost::bad_lexical_cast &e)
|
||||||
|
{
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Wrong integer conversion on device set index";
|
||||||
|
response.setStatus(400,"Invalid data");
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void WebAPIRequestMapper::devicesetSpectrumServerService(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<int>(indexStr);
|
||||||
|
|
||||||
|
if (request.getMethod() == "GET")
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGSpectrumServer normalResponse;
|
||||||
|
int status = m_adapter->devicesetSpectrumServerGet(deviceSetIndex, normalResponse, errorResponse);
|
||||||
|
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status/100 == 2) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (request.getMethod() == "POST")
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGSuccessResponse normalResponse;
|
||||||
|
int status = m_adapter->devicesetSpectrumServerPost(deviceSetIndex, normalResponse, errorResponse);
|
||||||
|
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status/100 == 2) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (request.getMethod() == "DELETE")
|
||||||
|
{
|
||||||
|
SWGSDRangel::SWGSuccessResponse normalResponse;
|
||||||
|
int status = m_adapter->devicesetSpectrumServerDelete(deviceSetIndex, normalResponse, errorResponse);
|
||||||
|
|
||||||
|
response.setStatus(status);
|
||||||
|
|
||||||
|
if (status/100 == 2) {
|
||||||
|
response.write(normalResponse.asJson().toUtf8());
|
||||||
|
} else {
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
response.setStatus(405,"Invalid HTTP method");
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Invalid HTTP method";
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const boost::bad_lexical_cast &e)
|
||||||
|
{
|
||||||
|
errorResponse.init();
|
||||||
|
*errorResponse.getMessage() = "Wrong integer conversion on device set index";
|
||||||
|
response.setStatus(400,"Invalid data");
|
||||||
|
response.write(errorResponse.asJson().toUtf8());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void WebAPIRequestMapper::devicesetDeviceService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
void WebAPIRequestMapper::devicesetDeviceService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
|
||||||
{
|
{
|
||||||
SWGSDRangel::SWGErrorResponse errorResponse;
|
SWGSDRangel::SWGErrorResponse errorResponse;
|
||||||
@ -3209,6 +3364,125 @@ bool WebAPIRequestMapper::validateLimeRFEConfig(SWGSDRangel::SWGLimeRFESettings&
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WebAPIRequestMapper::validateSpectrumSettings(SWGSDRangel::SWGGLSpectrum& spectrumSettings, QJsonObject& jsonObject, QStringList& spectrumSettingsKeys)
|
||||||
|
{
|
||||||
|
if (jsonObject.contains("fftSize"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setFftSize(jsonObject["fftSize"].toInt(1024));
|
||||||
|
spectrumSettingsKeys.append("fftSize");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("fftOverlap"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setFftOverlap(jsonObject["fftOverlap"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("fftOverlap");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("fftWindow"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setFftWindow(jsonObject["fftWindow"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("fftWindow");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("refLevel"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setRefLevel(jsonObject["refLevel"].toDouble(0.0));
|
||||||
|
spectrumSettingsKeys.append("refLevel");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("powerRange"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setPowerRange(jsonObject["powerRange"].toDouble(100.0));
|
||||||
|
spectrumSettingsKeys.append("powerRange");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("displayWaterfall"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setDisplayWaterfall(jsonObject["displayWaterfall"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("displayWaterfall");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("invertedWaterfall"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setInvertedWaterfall(jsonObject["invertedWaterfall"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("invertedWaterfall");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("displayHistogram"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setDisplayHistogram(jsonObject["displayHistogram"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("displayHistogram");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("decay"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setDecay(jsonObject["decay"].toInt(1));
|
||||||
|
spectrumSettingsKeys.append("decay");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("displayGrid"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setDisplayGrid(jsonObject["displayGrid"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("displayGrid");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("displayGridIntensity"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setDisplayGridIntensity(jsonObject["displayGridIntensity"].toInt(30));
|
||||||
|
spectrumSettingsKeys.append("displayGridIntensity");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("decayDivisor"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setDecayDivisor(jsonObject["decayDivisor"].toInt(1));
|
||||||
|
spectrumSettingsKeys.append("decayDivisor");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("histogramStroke"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setHistogramStroke(jsonObject["histogramStroke"].toInt(10));
|
||||||
|
spectrumSettingsKeys.append("histogramStroke");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("displayCurrent"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setDisplayCurrent(jsonObject["displayCurrent"].toInt(1));
|
||||||
|
spectrumSettingsKeys.append("displayCurrent");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("displayTraceIntensity"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setDisplayTraceIntensity(jsonObject["displayTraceIntensity"].toInt(50));
|
||||||
|
spectrumSettingsKeys.append("displayTraceIntensity");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("waterfallShare"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setWaterfallShare(jsonObject["waterfallShare"].toDouble(0.5));
|
||||||
|
spectrumSettingsKeys.append("waterfallShare");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("averagingMode"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setAveragingMode(jsonObject["averagingMode"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("averagingMode");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("averagingValue"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setAveragingValue(jsonObject["averagingValue"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("averagingValue");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("linear"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setLinear(jsonObject["linear"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("linear");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("ssb"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setSsb(jsonObject["ssb"].toInt(0));
|
||||||
|
spectrumSettingsKeys.append("ssb");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("usb"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setUsb(jsonObject["usb"].toInt(1));
|
||||||
|
spectrumSettingsKeys.append("usb");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("wsSpectrumAddress") && jsonObject["wsSpectrumAddress"].isString())
|
||||||
|
{
|
||||||
|
spectrumSettings.setWsSpectrumAddress(new QString(jsonObject["wsSpectrumAddress"].toString()));
|
||||||
|
spectrumSettingsKeys.append("wsSpectrumAddress");
|
||||||
|
}
|
||||||
|
if (jsonObject.contains("wsSpectrumPort"))
|
||||||
|
{
|
||||||
|
spectrumSettings.setUsb(jsonObject["wsSpectrumPort"].toInt(8887));
|
||||||
|
spectrumSettingsKeys.append("wsSpectrumPort");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool WebAPIRequestMapper::validateConfig(
|
bool WebAPIRequestMapper::validateConfig(
|
||||||
SWGSDRangel::SWGInstanceConfigResponse& config,
|
SWGSDRangel::SWGInstanceConfigResponse& config,
|
||||||
QJsonObject& jsonObject,
|
QJsonObject& jsonObject,
|
||||||
@ -4182,6 +4456,11 @@ void WebAPIRequestMapper::appendSettingsArrayKeys(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WebAPIRequestMapper::resetSpectrumSettings(SWGSDRangel::SWGGLSpectrum& spectrumSettings)
|
||||||
|
{
|
||||||
|
spectrumSettings.cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings)
|
void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings)
|
||||||
{
|
{
|
||||||
deviceSettings.cleanup();
|
deviceSettings.cleanup();
|
||||||
|
@ -80,6 +80,8 @@ private:
|
|||||||
|
|
||||||
void devicesetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void devicesetService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
void devicesetFocusService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void devicesetFocusService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
|
void devicesetSpectrumSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
|
void devicesetSpectrumServerService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
void devicesetDeviceService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void devicesetDeviceService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
void devicesetDeviceSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void devicesetDeviceSettingsService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
void devicesetDeviceRunService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
void devicesetDeviceRunService(const std::string& indexStr, qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response);
|
||||||
@ -104,6 +106,7 @@ private:
|
|||||||
bool validatePresetTransfer(SWGSDRangel::SWGPresetTransfer& presetTransfer);
|
bool validatePresetTransfer(SWGSDRangel::SWGPresetTransfer& presetTransfer);
|
||||||
bool validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifier& presetIdentifier);
|
bool validatePresetIdentifer(SWGSDRangel::SWGPresetIdentifier& presetIdentifier);
|
||||||
bool validatePresetExport(SWGSDRangel::SWGPresetExport& presetExport);
|
bool validatePresetExport(SWGSDRangel::SWGPresetExport& presetExport);
|
||||||
|
bool validateSpectrumSettings(SWGSDRangel::SWGGLSpectrum& spectrumSettings, QJsonObject& jsonObject, QStringList& spectrumSettingsKeys);
|
||||||
bool validateDeviceListItem(SWGSDRangel::SWGDeviceListItem& deviceListItem, QJsonObject& jsonObject);
|
bool validateDeviceListItem(SWGSDRangel::SWGDeviceListItem& deviceListItem, QJsonObject& jsonObject);
|
||||||
bool validateDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings, QJsonObject& jsonObject, QStringList& deviceSettingsKeys);
|
bool validateDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings, QJsonObject& jsonObject, QStringList& deviceSettingsKeys);
|
||||||
bool validateDeviceActions(SWGSDRangel::SWGDeviceActions& deviceActions, QJsonObject& jsonObject, QStringList& deviceActionsKeys);
|
bool validateDeviceActions(SWGSDRangel::SWGDeviceActions& deviceActions, QJsonObject& jsonObject, QStringList& deviceActionsKeys);
|
||||||
@ -201,6 +204,7 @@ private:
|
|||||||
|
|
||||||
bool parseJsonBody(QString& jsonStr, QJsonObject& jsonObject, qtwebapp::HttpResponse& response);
|
bool parseJsonBody(QString& jsonStr, QJsonObject& jsonObject, qtwebapp::HttpResponse& response);
|
||||||
|
|
||||||
|
void resetSpectrumSettings(SWGSDRangel::SWGGLSpectrum& spectrumSettings);
|
||||||
void resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings);
|
void resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings);
|
||||||
void resetDeviceReport(SWGSDRangel::SWGDeviceReport& deviceReport);
|
void resetDeviceReport(SWGSDRangel::SWGDeviceReport& deviceReport);
|
||||||
void resetDeviceActions(SWGSDRangel::SWGDeviceActions& deviceActions);
|
void resetDeviceActions(SWGSDRangel::SWGDeviceActions& deviceActions);
|
||||||
|
@ -73,11 +73,23 @@ void WSSpectrum::closeSocket()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool WSSpectrum::socketOpened()
|
bool WSSpectrum::socketOpened() const
|
||||||
{
|
{
|
||||||
return m_webSocketServer && m_webSocketServer->isListening();
|
return m_webSocketServer && m_webSocketServer->isListening();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void WSSpectrum::getPeers(QList<QHostAddress>& hosts, QList<quint16>& ports) const
|
||||||
|
{
|
||||||
|
hosts.clear();
|
||||||
|
ports.clear();
|
||||||
|
|
||||||
|
for (auto pSocket : m_clients)
|
||||||
|
{
|
||||||
|
hosts.push_back(pSocket->peerAddress());
|
||||||
|
ports.push_back(pSocket->peerPort());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
QString WSSpectrum::getWebSocketIdentifier(QWebSocket *peer)
|
QString WSSpectrum::getWebSocketIdentifier(QWebSocket *peer)
|
||||||
{
|
{
|
||||||
return QStringLiteral("%1:%2").arg(peer->peerAddress().toString(), QString::number(peer->peerPort()));
|
return QStringLiteral("%1:%2").arg(peer->peerAddress().toString(), QString::number(peer->peerPort()));
|
||||||
|
@ -41,7 +41,8 @@ public:
|
|||||||
|
|
||||||
void openSocket();
|
void openSocket();
|
||||||
void closeSocket();
|
void closeSocket();
|
||||||
bool socketOpened();
|
bool socketOpened() const;
|
||||||
|
void getPeers(QList<QHostAddress>& hosts, QList<quint16>& ports) const;
|
||||||
void setListeningAddress(const QString& address) { m_listeningAddress.setAddress(address); }
|
void setListeningAddress(const QString& address) { m_listeningAddress.setAddress(address); }
|
||||||
void setPort(quint16 port) { m_port = port; }
|
void setPort(quint16 port) { m_port = port; }
|
||||||
void newSpectrum(
|
void newSpectrum(
|
||||||
|
@ -450,3 +450,13 @@ void DeviceUISet::handleChannelGUIClosing(ChannelGUI* channelGUI)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DeviceUISet::webapiSpectrumSettingsGet(SWGSDRangel::SWGGLSpectrum& response, QString& errorMessage) const
|
||||||
|
{
|
||||||
|
return m_spectrumVis->webapiSpectrumSettingsGet(response, errorMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
int DeviceUISet::webapiSpectrumServerGet(SWGSDRangel::SWGSpectrumServer& response, QString& errorMessage) const
|
||||||
|
{
|
||||||
|
return m_spectrumVis->webapiSpectrumServerGet(response, errorMessage);
|
||||||
|
}
|
||||||
|
@ -40,6 +40,11 @@ class ChannelAPI;
|
|||||||
class ChannelGUI;
|
class ChannelGUI;
|
||||||
class Preset;
|
class Preset;
|
||||||
|
|
||||||
|
namespace SWGSDRangel {
|
||||||
|
class SWGGLSpectrum;
|
||||||
|
class SWGSpectrumServer;
|
||||||
|
};
|
||||||
|
|
||||||
class SDRGUI_API DeviceUISet : public QObject
|
class SDRGUI_API DeviceUISet : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -84,6 +89,10 @@ public:
|
|||||||
int getNumberOfAvailableTxChannels() const { return m_nbAvailableTxChannels; }
|
int getNumberOfAvailableTxChannels() const { return m_nbAvailableTxChannels; }
|
||||||
int getNumberOfAvailableMIMOChannels() const { return m_nbAvailableMIMOChannels; }
|
int getNumberOfAvailableMIMOChannels() const { return m_nbAvailableMIMOChannels; }
|
||||||
|
|
||||||
|
// REST API
|
||||||
|
int webapiSpectrumSettingsGet(SWGSDRangel::SWGGLSpectrum& response, QString& errorMessage) const;
|
||||||
|
int webapiSpectrumServerGet(SWGSDRangel::SWGSpectrumServer& response, QString& errorMessage) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct ChannelInstanceRegistration
|
struct ChannelInstanceRegistration
|
||||||
{
|
{
|
||||||
|
@ -64,4 +64,4 @@ GLSpectrum:
|
|||||||
type: string
|
type: string
|
||||||
wsSpectrumPort:
|
wsSpectrumPort:
|
||||||
description: port on which the websocket server is listening
|
description: port on which the websocket server is listening
|
||||||
type: integer\ No newline at end of file
|
type: integer
|
||||||
|
@ -4753,6 +4753,10 @@ margin-bottom: 20px;
|
|||||||
"wsSpectrumAddress" : {
|
"wsSpectrumAddress" : {
|
||||||
"type" : "string",
|
"type" : "string",
|
||||||
"description" : "IPv4 address of interface the websocket server is listening to"
|
"description" : "IPv4 address of interface the websocket server is listening to"
|
||||||
|
},
|
||||||
|
"wsSpectrumPort" : {
|
||||||
|
"type" : "integer",
|
||||||
|
"description" : "port on which the websocket server is listening"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"description" : "GLSpectrumGUI settings"
|
"description" : "GLSpectrumGUI settings"
|
||||||
@ -44592,7 +44596,7 @@ except ApiException as e:
|
|||||||
</div>
|
</div>
|
||||||
<div id="generator">
|
<div id="generator">
|
||||||
<div class="content">
|
<div class="content">
|
||||||
Generated 2020-11-11T12:04:23.918+01:00
|
Generated 2020-11-11T13:32:52.276+01:00
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -74,6 +74,8 @@ SWGGLSpectrum::SWGGLSpectrum() {
|
|||||||
m_usb_isSet = false;
|
m_usb_isSet = false;
|
||||||
ws_spectrum_address = nullptr;
|
ws_spectrum_address = nullptr;
|
||||||
m_ws_spectrum_address_isSet = false;
|
m_ws_spectrum_address_isSet = false;
|
||||||
|
ws_spectrum_port = 0;
|
||||||
|
m_ws_spectrum_port_isSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SWGGLSpectrum::~SWGGLSpectrum() {
|
SWGGLSpectrum::~SWGGLSpectrum() {
|
||||||
@ -128,6 +130,8 @@ SWGGLSpectrum::init() {
|
|||||||
m_usb_isSet = false;
|
m_usb_isSet = false;
|
||||||
ws_spectrum_address = new QString("");
|
ws_spectrum_address = new QString("");
|
||||||
m_ws_spectrum_address_isSet = false;
|
m_ws_spectrum_address_isSet = false;
|
||||||
|
ws_spectrum_port = 0;
|
||||||
|
m_ws_spectrum_port_isSet = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -157,6 +161,7 @@ SWGGLSpectrum::cleanup() {
|
|||||||
if(ws_spectrum_address != nullptr) {
|
if(ws_spectrum_address != nullptr) {
|
||||||
delete ws_spectrum_address;
|
delete ws_spectrum_address;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SWGGLSpectrum*
|
SWGGLSpectrum*
|
||||||
@ -216,6 +221,8 @@ SWGGLSpectrum::fromJsonObject(QJsonObject &pJson) {
|
|||||||
|
|
||||||
::SWGSDRangel::setValue(&ws_spectrum_address, pJson["wsSpectrumAddress"], "QString", "QString");
|
::SWGSDRangel::setValue(&ws_spectrum_address, pJson["wsSpectrumAddress"], "QString", "QString");
|
||||||
|
|
||||||
|
::SWGSDRangel::setValue(&ws_spectrum_port, pJson["wsSpectrumPort"], "qint32", "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
@ -301,6 +308,9 @@ SWGGLSpectrum::asJsonObject() {
|
|||||||
if(ws_spectrum_address != nullptr && *ws_spectrum_address != QString("")){
|
if(ws_spectrum_address != nullptr && *ws_spectrum_address != QString("")){
|
||||||
toJsonValue(QString("wsSpectrumAddress"), ws_spectrum_address, obj, QString("QString"));
|
toJsonValue(QString("wsSpectrumAddress"), ws_spectrum_address, obj, QString("QString"));
|
||||||
}
|
}
|
||||||
|
if(m_ws_spectrum_port_isSet){
|
||||||
|
obj->insert("wsSpectrumPort", QJsonValue(ws_spectrum_port));
|
||||||
|
}
|
||||||
|
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
@ -535,6 +545,16 @@ SWGGLSpectrum::setWsSpectrumAddress(QString* ws_spectrum_address) {
|
|||||||
this->m_ws_spectrum_address_isSet = true;
|
this->m_ws_spectrum_address_isSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
qint32
|
||||||
|
SWGGLSpectrum::getWsSpectrumPort() {
|
||||||
|
return ws_spectrum_port;
|
||||||
|
}
|
||||||
|
void
|
||||||
|
SWGGLSpectrum::setWsSpectrumPort(qint32 ws_spectrum_port) {
|
||||||
|
this->ws_spectrum_port = ws_spectrum_port;
|
||||||
|
this->m_ws_spectrum_port_isSet = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
SWGGLSpectrum::isSet(){
|
SWGGLSpectrum::isSet(){
|
||||||
@ -609,6 +629,9 @@ SWGGLSpectrum::isSet(){
|
|||||||
if(ws_spectrum_address && *ws_spectrum_address != QString("")){
|
if(ws_spectrum_address && *ws_spectrum_address != QString("")){
|
||||||
isObjectUpdated = true; break;
|
isObjectUpdated = true; break;
|
||||||
}
|
}
|
||||||
|
if(m_ws_spectrum_port_isSet){
|
||||||
|
isObjectUpdated = true; break;
|
||||||
|
}
|
||||||
}while(false);
|
}while(false);
|
||||||
return isObjectUpdated;
|
return isObjectUpdated;
|
||||||
}
|
}
|
||||||
|
@ -111,6 +111,9 @@ public:
|
|||||||
QString* getWsSpectrumAddress();
|
QString* getWsSpectrumAddress();
|
||||||
void setWsSpectrumAddress(QString* ws_spectrum_address);
|
void setWsSpectrumAddress(QString* ws_spectrum_address);
|
||||||
|
|
||||||
|
qint32 getWsSpectrumPort();
|
||||||
|
void setWsSpectrumPort(qint32 ws_spectrum_port);
|
||||||
|
|
||||||
|
|
||||||
virtual bool isSet() override;
|
virtual bool isSet() override;
|
||||||
|
|
||||||
@ -184,6 +187,9 @@ private:
|
|||||||
QString* ws_spectrum_address;
|
QString* ws_spectrum_address;
|
||||||
bool m_ws_spectrum_address_isSet;
|
bool m_ws_spectrum_address_isSet;
|
||||||
|
|
||||||
|
qint32 ws_spectrum_port;
|
||||||
|
bool m_ws_spectrum_port_isSet;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user