1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-23 18:52:28 -04:00

Web API: new generator with lazy instantiation and some memory leak fixes. Implemented in webapi classes (part 1)

This commit is contained in:
f4exb 2018-02-14 01:42:35 +01:00
parent 5f062a24bf
commit a1f69ebc2b
87 changed files with 1243 additions and 745 deletions

View File

@ -16922,7 +16922,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2018-02-12T16:42:25.289+01:00 Generated 2018-02-14T00:45:07.183+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -125,6 +125,7 @@ public:
* returns the Http status code (default 501: not implemented) * returns the Http status code (default 501: not implemented)
*/ */
virtual int instanceLoggingPut( virtual int instanceLoggingPut(
SWGSDRangel::SWGLoggingInfo& query __attribute__((unused)),
SWGSDRangel::SWGLoggingInfo& response __attribute__((unused)), SWGSDRangel::SWGLoggingInfo& response __attribute__((unused)),
SWGSDRangel::SWGErrorResponse& error) SWGSDRangel::SWGErrorResponse& error)
{ {

View File

@ -241,6 +241,7 @@ void WebAPIRequestMapper::instanceChannelsService(qtwebapp::HttpRequest& request
void WebAPIRequestMapper::instanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response) void WebAPIRequestMapper::instanceLoggingService(qtwebapp::HttpRequest& request, qtwebapp::HttpResponse& response)
{ {
SWGSDRangel::SWGLoggingInfo query;
SWGSDRangel::SWGLoggingInfo normalResponse; SWGSDRangel::SWGLoggingInfo normalResponse;
SWGSDRangel::SWGErrorResponse errorResponse; SWGSDRangel::SWGErrorResponse errorResponse;
response.setHeader("Content-Type", "application/json"); response.setHeader("Content-Type", "application/json");
@ -263,8 +264,8 @@ void WebAPIRequestMapper::instanceLoggingService(qtwebapp::HttpRequest& request,
if (parseJsonBody(jsonStr, jsonObject, response)) if (parseJsonBody(jsonStr, jsonObject, response))
{ {
normalResponse.fromJson(jsonStr); query.fromJson(jsonStr);
int status = m_adapter->instanceLoggingPut(normalResponse, errorResponse); int status = m_adapter->instanceLoggingPut(query, normalResponse, errorResponse);
response.setStatus(status); response.setStatus(status);
if (status/100 == 2) { if (status/100 == 2) {

View File

@ -56,6 +56,7 @@
#include "SWGChannelSettings.h" #include "SWGChannelSettings.h"
#include "SWGSuccessResponse.h" #include "SWGSuccessResponse.h"
#include "SWGErrorResponse.h" #include "SWGErrorResponse.h"
#include "SWGDeviceState.h"
#include "webapiadaptergui.h" #include "webapiadaptergui.h"
@ -72,7 +73,7 @@ int WebAPIAdapterGUI::instanceSummary(
SWGSDRangel::SWGInstanceSummaryResponse& response, SWGSDRangel::SWGInstanceSummaryResponse& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
*response.getAppname() = qApp->applicationName(); *response.getAppname() = qApp->applicationName();
*response.getVersion() = qApp->applicationVersion(); *response.getVersion() = qApp->applicationVersion();
*response.getQtVersion() = QString(QT_VERSION_STR); *response.getQtVersion() = QString(QT_VERSION_STR);
@ -114,6 +115,7 @@ int WebAPIAdapterGUI::instanceDevices(
SWGSDRangel::SWGInstanceDevicesResponse& response, SWGSDRangel::SWGInstanceDevicesResponse& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
int nbSamplingDevices = tx ? DeviceEnumerator::instance()->getNbTxSamplingDevices() : DeviceEnumerator::instance()->getNbRxSamplingDevices(); int nbSamplingDevices = tx ? DeviceEnumerator::instance()->getNbTxSamplingDevices() : DeviceEnumerator::instance()->getNbRxSamplingDevices();
response.setDevicecount(nbSamplingDevices); response.setDevicecount(nbSamplingDevices);
QList<SWGSDRangel::SWGDeviceListItem*> *devices = response.getDevices(); QList<SWGSDRangel::SWGDeviceListItem*> *devices = response.getDevices();
@ -122,6 +124,7 @@ int WebAPIAdapterGUI::instanceDevices(
{ {
PluginInterface::SamplingDevice samplingDevice = tx ? DeviceEnumerator::instance()->getTxSamplingDevice(i) : DeviceEnumerator::instance()->getRxSamplingDevice(i); PluginInterface::SamplingDevice samplingDevice = tx ? DeviceEnumerator::instance()->getTxSamplingDevice(i) : DeviceEnumerator::instance()->getRxSamplingDevice(i);
devices->append(new SWGSDRangel::SWGDeviceListItem); devices->append(new SWGSDRangel::SWGDeviceListItem);
devices->back()->init();
*devices->back()->getDisplayedName() = samplingDevice.displayedName; *devices->back()->getDisplayedName() = samplingDevice.displayedName;
*devices->back()->getHwType() = samplingDevice.hardwareId; *devices->back()->getHwType() = samplingDevice.hardwareId;
*devices->back()->getSerial() = samplingDevice.serial; *devices->back()->getSerial() = samplingDevice.serial;
@ -140,6 +143,7 @@ int WebAPIAdapterGUI::instanceChannels(
SWGSDRangel::SWGInstanceChannelsResponse& response, SWGSDRangel::SWGInstanceChannelsResponse& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
PluginAPI::ChannelRegistrations *channelRegistrations = tx ? m_mainWindow.m_pluginManager->getTxChannelRegistrations() : m_mainWindow.m_pluginManager->getRxChannelRegistrations(); PluginAPI::ChannelRegistrations *channelRegistrations = tx ? m_mainWindow.m_pluginManager->getTxChannelRegistrations() : m_mainWindow.m_pluginManager->getRxChannelRegistrations();
int nbChannelDevices = channelRegistrations->size(); int nbChannelDevices = channelRegistrations->size();
response.setChannelcount(nbChannelDevices); response.setChannelcount(nbChannelDevices);
@ -148,6 +152,7 @@ int WebAPIAdapterGUI::instanceChannels(
for (int i = 0; i < nbChannelDevices; i++) for (int i = 0; i < nbChannelDevices; i++)
{ {
channels->append(new SWGSDRangel::SWGChannelListItem); channels->append(new SWGSDRangel::SWGChannelListItem);
channels->back()->init();
PluginInterface *channelInterface = channelRegistrations->at(i).m_plugin; PluginInterface *channelInterface = channelRegistrations->at(i).m_plugin;
const PluginDescriptor& pluginDescriptor = channelInterface->getPluginDescriptor(); const PluginDescriptor& pluginDescriptor = channelInterface->getPluginDescriptor();
*channels->back()->getVersion() = pluginDescriptor.version; *channels->back()->getVersion() = pluginDescriptor.version;
@ -165,6 +170,7 @@ int WebAPIAdapterGUI::instanceLoggingGet(
SWGSDRangel::SWGLoggingInfo& response, SWGSDRangel::SWGLoggingInfo& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
response.setDumpToFile(m_mainWindow.m_logger->getUseFileLogger() ? 1 : 0); response.setDumpToFile(m_mainWindow.m_logger->getUseFileLogger() ? 1 : 0);
if (response.getDumpToFile()) { if (response.getDumpToFile()) {
@ -178,14 +184,15 @@ int WebAPIAdapterGUI::instanceLoggingGet(
} }
int WebAPIAdapterGUI::instanceLoggingPut( int WebAPIAdapterGUI::instanceLoggingPut(
SWGSDRangel::SWGLoggingInfo& query,
SWGSDRangel::SWGLoggingInfo& response, SWGSDRangel::SWGLoggingInfo& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
// response input is the query actually // response input is the query actually
bool dumpToFile = (response.getDumpToFile() != 0); bool dumpToFile = (query.getDumpToFile() != 0);
QString* consoleLevel = response.getConsoleLevel(); QString* consoleLevel = query.getConsoleLevel();
QString* fileLevel = response.getFileLevel(); QString* fileLevel = query.getFileLevel();
QString* fileName = response.getFileName(); QString* fileName = query.getFileName();
// perform actions // perform actions
if (consoleLevel) { if (consoleLevel) {
@ -235,12 +242,14 @@ int WebAPIAdapterGUI::instanceAudioGet(
for (int i = 0; i < nbInputDevices; i++) for (int i = 0; i < nbInputDevices; i++)
{ {
inputDevices->append(new SWGSDRangel::SWGAudioDevice); inputDevices->append(new SWGSDRangel::SWGAudioDevice);
inputDevices->back()->init();
*inputDevices->back()->getName() = audioInputDevices.at(i).deviceName(); *inputDevices->back()->getName() = audioInputDevices.at(i).deviceName();
} }
for (int i = 0; i < nbOutputDevices; i++) for (int i = 0; i < nbOutputDevices; i++)
{ {
outputDevices->append(new SWGSDRangel::SWGAudioDevice); outputDevices->append(new SWGSDRangel::SWGAudioDevice);
outputDevices->back()->init();
*outputDevices->back()->getName() = audioOutputDevices.at(i).deviceName(); *outputDevices->back()->getName() = audioOutputDevices.at(i).deviceName();
} }
@ -284,6 +293,7 @@ int WebAPIAdapterGUI::instanceLocationGet(
SWGSDRangel::SWGLocationInformation& response, SWGSDRangel::SWGLocationInformation& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
response.setLatitude(m_mainWindow.m_settings.getLatitude()); response.setLatitude(m_mainWindow.m_settings.getLatitude());
response.setLongitude(m_mainWindow.m_settings.getLongitude()); response.setLongitude(m_mainWindow.m_settings.getLongitude());
@ -331,6 +341,7 @@ int WebAPIAdapterGUI::instanceDVSerialPatch(
while (it != deviceNames.end()) while (it != deviceNames.end())
{ {
deviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice); deviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice);
deviceNamesList->back()->init();
*deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it); *deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it);
++it; ++it;
} }
@ -843,6 +854,8 @@ int WebAPIAdapterGUI::devicesetDeviceRunGet(
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
SWGSDRangel::SWGErrorResponse& error) SWGSDRangel::SWGErrorResponse& error)
{ {
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{ {
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
@ -850,25 +863,24 @@ int WebAPIAdapterGUI::devicesetDeviceRunGet(
if (deviceSet->m_deviceSourceEngine) // Rx if (deviceSet->m_deviceSourceEngine) // Rx
{ {
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
response.init();
return source->webapiRunGet(response, *error.getMessage()); return source->webapiRunGet(response, *error.getMessage());
} }
else if (deviceSet->m_deviceSinkEngine) // Tx else if (deviceSet->m_deviceSinkEngine) // Tx
{ {
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
response.init();
return sink->webapiRunGet(response, *error.getMessage()); return sink->webapiRunGet(response, *error.getMessage());
} }
else else
{ {
error.init();
*error.getMessage() = QString("DeviceSet error"); *error.getMessage() = QString("DeviceSet error");
return 500; return 500;
} }
} }
else else
{ {
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404; return 404;
} }
} }
@ -878,6 +890,8 @@ int WebAPIAdapterGUI::devicesetDeviceRunPost(
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
SWGSDRangel::SWGErrorResponse& error) SWGSDRangel::SWGErrorResponse& error)
{ {
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{ {
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
@ -885,25 +899,24 @@ int WebAPIAdapterGUI::devicesetDeviceRunPost(
if (deviceSet->m_deviceSourceEngine) // Rx if (deviceSet->m_deviceSourceEngine) // Rx
{ {
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
response.init();
return source->webapiRun(true, response, *error.getMessage()); return source->webapiRun(true, response, *error.getMessage());
} }
else if (deviceSet->m_deviceSinkEngine) // Tx else if (deviceSet->m_deviceSinkEngine) // Tx
{ {
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
response.init();
return sink->webapiRun(true, response, *error.getMessage()); return sink->webapiRun(true, response, *error.getMessage());
} }
else else
{ {
error.init();
*error.getMessage() = QString("DeviceSet error"); *error.getMessage() = QString("DeviceSet error");
return 500; return 500;
} }
} }
else else
{ {
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404; return 404;
} }
} }
@ -913,6 +926,8 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete(
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
SWGSDRangel::SWGErrorResponse& error) SWGSDRangel::SWGErrorResponse& error)
{ {
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size())) if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainWindow.m_deviceUIs.size()))
{ {
DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex]; DeviceUISet *deviceSet = m_mainWindow.m_deviceUIs[deviceSetIndex];
@ -920,25 +935,24 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete(
if (deviceSet->m_deviceSourceEngine) // Rx if (deviceSet->m_deviceSourceEngine) // Rx
{ {
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
response.init();
return source->webapiRun(false, response, *error.getMessage()); return source->webapiRun(false, response, *error.getMessage());
} }
else if (deviceSet->m_deviceSinkEngine) // Tx else if (deviceSet->m_deviceSinkEngine) // Tx
{ {
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
response.init();
return sink->webapiRun(false, response, *error.getMessage()); return sink->webapiRun(false, response, *error.getMessage());
} }
else else
{ {
error.init();
*error.getMessage() = QString("DeviceSet error"); *error.getMessage() = QString("DeviceSet error");
return 500; return 500;
} }
} }
else else
{ {
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404; return 404;
} }
} }

View File

@ -54,6 +54,7 @@ public:
SWGSDRangel::SWGErrorResponse& error); SWGSDRangel::SWGErrorResponse& error);
virtual int instanceLoggingPut( virtual int instanceLoggingPut(
SWGSDRangel::SWGLoggingInfo& query,
SWGSDRangel::SWGLoggingInfo& response, SWGSDRangel::SWGLoggingInfo& response,
SWGSDRangel::SWGErrorResponse& error); SWGSDRangel::SWGErrorResponse& error);

View File

@ -39,6 +39,7 @@
#include "SWGChannelSettings.h" #include "SWGChannelSettings.h"
#include "SWGSuccessResponse.h" #include "SWGSuccessResponse.h"
#include "SWGErrorResponse.h" #include "SWGErrorResponse.h"
#include "SWGDeviceState.h"
#include "maincore.h" #include "maincore.h"
#include "loggerwithfile.h" #include "loggerwithfile.h"
@ -68,7 +69,7 @@ int WebAPIAdapterSrv::instanceSummary(
SWGSDRangel::SWGInstanceSummaryResponse& response, SWGSDRangel::SWGInstanceSummaryResponse& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
*response.getAppname() = QCoreApplication::applicationName(); *response.getAppname() = QCoreApplication::applicationName();
*response.getVersion() = QCoreApplication::applicationVersion(); *response.getVersion() = QCoreApplication::applicationVersion();
*response.getQtVersion() = QString(QT_VERSION_STR); *response.getQtVersion() = QString(QT_VERSION_STR);
@ -115,6 +116,7 @@ int WebAPIAdapterSrv::instanceDevices(
SWGSDRangel::SWGInstanceDevicesResponse& response, SWGSDRangel::SWGInstanceDevicesResponse& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
int nbSamplingDevices = tx ? DeviceEnumerator::instance()->getNbTxSamplingDevices() : DeviceEnumerator::instance()->getNbRxSamplingDevices(); int nbSamplingDevices = tx ? DeviceEnumerator::instance()->getNbTxSamplingDevices() : DeviceEnumerator::instance()->getNbRxSamplingDevices();
response.setDevicecount(nbSamplingDevices); response.setDevicecount(nbSamplingDevices);
QList<SWGSDRangel::SWGDeviceListItem*> *devices = response.getDevices(); QList<SWGSDRangel::SWGDeviceListItem*> *devices = response.getDevices();
@ -123,6 +125,7 @@ int WebAPIAdapterSrv::instanceDevices(
{ {
PluginInterface::SamplingDevice samplingDevice = tx ? DeviceEnumerator::instance()->getTxSamplingDevice(i) : DeviceEnumerator::instance()->getRxSamplingDevice(i); PluginInterface::SamplingDevice samplingDevice = tx ? DeviceEnumerator::instance()->getTxSamplingDevice(i) : DeviceEnumerator::instance()->getRxSamplingDevice(i);
devices->append(new SWGSDRangel::SWGDeviceListItem); devices->append(new SWGSDRangel::SWGDeviceListItem);
devices->back()->init();
*devices->back()->getDisplayedName() = samplingDevice.displayedName; *devices->back()->getDisplayedName() = samplingDevice.displayedName;
*devices->back()->getHwType() = samplingDevice.hardwareId; *devices->back()->getHwType() = samplingDevice.hardwareId;
*devices->back()->getSerial() = samplingDevice.serial; *devices->back()->getSerial() = samplingDevice.serial;
@ -141,6 +144,7 @@ int WebAPIAdapterSrv::instanceChannels(
SWGSDRangel::SWGInstanceChannelsResponse& response, SWGSDRangel::SWGInstanceChannelsResponse& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
PluginAPI::ChannelRegistrations *channelRegistrations = tx ? m_mainCore.m_pluginManager->getTxChannelRegistrations() : m_mainCore.m_pluginManager->getRxChannelRegistrations(); PluginAPI::ChannelRegistrations *channelRegistrations = tx ? m_mainCore.m_pluginManager->getTxChannelRegistrations() : m_mainCore.m_pluginManager->getRxChannelRegistrations();
int nbChannelDevices = channelRegistrations->size(); int nbChannelDevices = channelRegistrations->size();
response.setChannelcount(nbChannelDevices); response.setChannelcount(nbChannelDevices);
@ -149,6 +153,7 @@ int WebAPIAdapterSrv::instanceChannels(
for (int i = 0; i < nbChannelDevices; i++) for (int i = 0; i < nbChannelDevices; i++)
{ {
channels->append(new SWGSDRangel::SWGChannelListItem); channels->append(new SWGSDRangel::SWGChannelListItem);
channels->back()->init();
PluginInterface *channelInterface = channelRegistrations->at(i).m_plugin; PluginInterface *channelInterface = channelRegistrations->at(i).m_plugin;
const PluginDescriptor& pluginDescriptor = channelInterface->getPluginDescriptor(); const PluginDescriptor& pluginDescriptor = channelInterface->getPluginDescriptor();
*channels->back()->getVersion() = pluginDescriptor.version; *channels->back()->getVersion() = pluginDescriptor.version;
@ -166,6 +171,7 @@ int WebAPIAdapterSrv::instanceLoggingGet(
SWGSDRangel::SWGLoggingInfo& response, SWGSDRangel::SWGLoggingInfo& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
response.setDumpToFile(m_mainCore.m_logger->getUseFileLogger() ? 1 : 0); response.setDumpToFile(m_mainCore.m_logger->getUseFileLogger() ? 1 : 0);
if (response.getDumpToFile()) { if (response.getDumpToFile()) {
@ -179,14 +185,15 @@ int WebAPIAdapterSrv::instanceLoggingGet(
} }
int WebAPIAdapterSrv::instanceLoggingPut( int WebAPIAdapterSrv::instanceLoggingPut(
SWGSDRangel::SWGLoggingInfo& query,
SWGSDRangel::SWGLoggingInfo& response, SWGSDRangel::SWGLoggingInfo& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
// response input is the query actually // response input is the query actually
bool dumpToFile = (response.getDumpToFile() != 0); bool dumpToFile = (query.getDumpToFile() != 0);
QString* consoleLevel = response.getConsoleLevel(); QString* consoleLevel = query.getConsoleLevel();
QString* fileLevel = response.getFileLevel(); QString* fileLevel = query.getFileLevel();
QString* fileName = response.getFileName(); QString* fileName = query.getFileName();
// perform actions // perform actions
if (consoleLevel) { if (consoleLevel) {
@ -236,12 +243,14 @@ int WebAPIAdapterSrv::instanceAudioGet(
for (int i = 0; i < nbInputDevices; i++) for (int i = 0; i < nbInputDevices; i++)
{ {
inputDevices->append(new SWGSDRangel::SWGAudioDevice); inputDevices->append(new SWGSDRangel::SWGAudioDevice);
inputDevices->back()->init();
*inputDevices->back()->getName() = audioInputDevices.at(i).deviceName(); *inputDevices->back()->getName() = audioInputDevices.at(i).deviceName();
} }
for (int i = 0; i < nbOutputDevices; i++) for (int i = 0; i < nbOutputDevices; i++)
{ {
outputDevices->append(new SWGSDRangel::SWGAudioDevice); outputDevices->append(new SWGSDRangel::SWGAudioDevice);
outputDevices->back()->init();
*outputDevices->back()->getName() = audioOutputDevices.at(i).deviceName(); *outputDevices->back()->getName() = audioOutputDevices.at(i).deviceName();
} }
@ -285,6 +294,7 @@ int WebAPIAdapterSrv::instanceLocationGet(
SWGSDRangel::SWGLocationInformation& response, SWGSDRangel::SWGLocationInformation& response,
SWGSDRangel::SWGErrorResponse& error __attribute__((unused))) SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
{ {
response.init();
response.setLatitude(m_mainCore.m_settings.getLatitude()); response.setLatitude(m_mainCore.m_settings.getLatitude());
response.setLongitude(m_mainCore.m_settings.getLongitude()); response.setLongitude(m_mainCore.m_settings.getLongitude());
@ -331,6 +341,7 @@ int WebAPIAdapterSrv::instanceDVSerialPatch(
while (it != deviceNames.end()) while (it != deviceNames.end())
{ {
deviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice); deviceNamesList->append(new SWGSDRangel::SWGDVSerialDevice);
deviceNamesList->back()->init();
*deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it); *deviceNamesList->back()->getDeviceName() = QString::fromStdString(*it);
++it; ++it;
} }
@ -948,6 +959,8 @@ int WebAPIAdapterSrv::devicesetDeviceRunGet(
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
SWGSDRangel::SWGErrorResponse& error) SWGSDRangel::SWGErrorResponse& error)
{ {
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size())) if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
{ {
DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
@ -955,25 +968,24 @@ int WebAPIAdapterSrv::devicesetDeviceRunGet(
if (deviceSet->m_deviceSourceEngine) // Rx if (deviceSet->m_deviceSourceEngine) // Rx
{ {
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
response.init();
return source->webapiRunGet(response, *error.getMessage()); return source->webapiRunGet(response, *error.getMessage());
} }
else if (deviceSet->m_deviceSinkEngine) // Tx else if (deviceSet->m_deviceSinkEngine) // Tx
{ {
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
response.init();
return sink->webapiRunGet(response, *error.getMessage()); return sink->webapiRunGet(response, *error.getMessage());
} }
else else
{ {
error.init();
*error.getMessage() = QString("DeviceSet error"); *error.getMessage() = QString("DeviceSet error");
return 500; return 500;
} }
} }
else else
{ {
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404; return 404;
} }
} }
@ -983,6 +995,8 @@ int WebAPIAdapterSrv::devicesetDeviceRunPost(
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
SWGSDRangel::SWGErrorResponse& error) SWGSDRangel::SWGErrorResponse& error)
{ {
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size())) if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
{ {
DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
@ -990,25 +1004,24 @@ int WebAPIAdapterSrv::devicesetDeviceRunPost(
if (deviceSet->m_deviceSourceEngine) // Rx if (deviceSet->m_deviceSourceEngine) // Rx
{ {
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
response.init();
return source->webapiRun(true, response, *error.getMessage()); return source->webapiRun(true, response, *error.getMessage());
} }
else if (deviceSet->m_deviceSinkEngine) // Tx else if (deviceSet->m_deviceSinkEngine) // Tx
{ {
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
response.init();
return sink->webapiRun(true, response, *error.getMessage()); return sink->webapiRun(true, response, *error.getMessage());
} }
else else
{ {
error.init();
*error.getMessage() = QString("DeviceSet error"); *error.getMessage() = QString("DeviceSet error");
return 500; return 500;
} }
} }
else else
{ {
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404; return 404;
} }
} }
@ -1018,6 +1031,8 @@ int WebAPIAdapterSrv::devicesetDeviceRunDelete(
SWGSDRangel::SWGDeviceState& response, SWGSDRangel::SWGDeviceState& response,
SWGSDRangel::SWGErrorResponse& error) SWGSDRangel::SWGErrorResponse& error)
{ {
error.init();
if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size())) if ((deviceSetIndex >= 0) && (deviceSetIndex < (int) m_mainCore.m_deviceSets.size()))
{ {
DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex]; DeviceSet *deviceSet = m_mainCore.m_deviceSets[deviceSetIndex];
@ -1025,25 +1040,24 @@ int WebAPIAdapterSrv::devicesetDeviceRunDelete(
if (deviceSet->m_deviceSourceEngine) // Rx if (deviceSet->m_deviceSourceEngine) // Rx
{ {
DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource(); DeviceSampleSource *source = deviceSet->m_deviceSourceAPI->getSampleSource();
response.init();
return source->webapiRun(false, response, *error.getMessage()); return source->webapiRun(false, response, *error.getMessage());
} }
else if (deviceSet->m_deviceSinkEngine) // Tx else if (deviceSet->m_deviceSinkEngine) // Tx
{ {
DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink(); DeviceSampleSink *sink = deviceSet->m_deviceSinkAPI->getSampleSink();
response.init();
return sink->webapiRun(false, response, *error.getMessage()); return sink->webapiRun(false, response, *error.getMessage());
} }
else else
{ {
error.init();
*error.getMessage() = QString("DeviceSet error"); *error.getMessage() = QString("DeviceSet error");
return 500; return 500;
} }
} }
else else
{ {
error.init();
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex); *error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
return 404; return 404;
} }
} }

View File

@ -55,6 +55,7 @@ public:
SWGSDRangel::SWGErrorResponse& error); SWGSDRangel::SWGErrorResponse& error);
virtual int instanceLoggingPut( virtual int instanceLoggingPut(
SWGSDRangel::SWGLoggingInfo& query,
SWGSDRangel::SWGLoggingInfo& response, SWGSDRangel::SWGLoggingInfo& response,
SWGSDRangel::SWGErrorResponse& error); SWGSDRangel::SWGErrorResponse& error);

View File

@ -16922,7 +16922,7 @@ except ApiException as e:
</div> </div>
<div id="generator"> <div id="generator">
<div class="content"> <div class="content">
Generated 2018-02-12T16:42:25.289+01:00 Generated 2018-02-14T00:45:07.183+01:00
</div> </div>
</div> </div>
</div> </div>

View File

@ -22,13 +22,14 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGAudioDevice::SWGAudioDevice(QString json) { SWGAudioDevice::SWGAudioDevice(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGAudioDevice::SWGAudioDevice() { SWGAudioDevice::SWGAudioDevice() {
init(); name = nullptr;
m_name_isSet = false;
} }
SWGAudioDevice::~SWGAudioDevice() { SWGAudioDevice::~SWGAudioDevice() {
@ -49,7 +50,7 @@ SWGAudioDevice::cleanup() {
} }
SWGAudioDevice* SWGAudioDevice*
SWGAudioDevice::fromJson(QString json) { SWGAudioDevice::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,7 +59,7 @@ SWGAudioDevice::fromJson(QString json) {
} }
void void
SWGAudioDevice::fromJsonObject(QJsonObject pJson) { SWGAudioDevice::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString"); ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
} }
@ -66,15 +67,17 @@ SWGAudioDevice::fromJsonObject(QJsonObject pJson) {
QString QString
SWGAudioDevice::asJson () SWGAudioDevice::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGAudioDevice::asJsonObject() { SWGAudioDevice::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(name != nullptr && *name != QString("")){ if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("name"), name, obj, QString("QString"));
} }

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGAudioDevice: public SWGObject { class SWGAudioDevice: public SWGObject {
public: public:
SWGAudioDevice(); SWGAudioDevice();
SWGAudioDevice(QString json); SWGAudioDevice(QString* json);
~SWGAudioDevice(); virtual ~SWGAudioDevice();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGAudioDevice* fromJson(QString jsonString); SWGAudioDevice* fromJson(QString &jsonString);
QString* getName(); QString* getName();
void setName(QString* name); void setName(QString* name);

View File

@ -22,13 +22,26 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGAudioDevices::SWGAudioDevices(QString json) { SWGAudioDevices::SWGAudioDevices(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGAudioDevices::SWGAudioDevices() { SWGAudioDevices::SWGAudioDevices() {
init(); input_volume = 0.0f;
m_input_volume_isSet = false;
nb_input_devices = 0;
m_nb_input_devices_isSet = false;
input_device_selected_index = 0;
m_input_device_selected_index_isSet = false;
input_devices = nullptr;
m_input_devices_isSet = false;
nb_output_devices = 0;
m_nb_output_devices_isSet = false;
output_device_selected_index = 0;
m_output_device_selected_index_isSet = false;
output_devices = nullptr;
m_output_devices_isSet = false;
} }
SWGAudioDevices::~SWGAudioDevices() { SWGAudioDevices::~SWGAudioDevices() {
@ -77,7 +90,7 @@ SWGAudioDevices::cleanup() {
} }
SWGAudioDevices* SWGAudioDevices*
SWGAudioDevices::fromJson(QString json) { SWGAudioDevices::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -86,7 +99,7 @@ SWGAudioDevices::fromJson(QString json) {
} }
void void
SWGAudioDevices::fromJsonObject(QJsonObject pJson) { SWGAudioDevices::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&input_volume, pJson["inputVolume"], "float", ""); ::SWGSDRangel::setValue(&input_volume, pJson["inputVolume"], "float", "");
::SWGSDRangel::setValue(&nb_input_devices, pJson["nbInputDevices"], "qint32", ""); ::SWGSDRangel::setValue(&nb_input_devices, pJson["nbInputDevices"], "qint32", "");
@ -106,32 +119,34 @@ SWGAudioDevices::fromJsonObject(QJsonObject pJson) {
QString QString
SWGAudioDevices::asJson () SWGAudioDevices::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGAudioDevices::asJsonObject() { SWGAudioDevices::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_input_volume_isSet){ if(m_input_volume_isSet){
obj.insert("inputVolume", QJsonValue(input_volume)); obj->insert("inputVolume", QJsonValue(input_volume));
} }
if(m_nb_input_devices_isSet){ if(m_nb_input_devices_isSet){
obj.insert("nbInputDevices", QJsonValue(nb_input_devices)); obj->insert("nbInputDevices", QJsonValue(nb_input_devices));
} }
if(m_input_device_selected_index_isSet){ if(m_input_device_selected_index_isSet){
obj.insert("inputDeviceSelectedIndex", QJsonValue(input_device_selected_index)); obj->insert("inputDeviceSelectedIndex", QJsonValue(input_device_selected_index));
} }
if(input_devices->size() > 0){ if(input_devices->size() > 0){
toJsonArray((QList<void*>*)input_devices, obj, "inputDevices", "SWGAudioDevice"); toJsonArray((QList<void*>*)input_devices, obj, "inputDevices", "SWGAudioDevice");
} }
if(m_nb_output_devices_isSet){ if(m_nb_output_devices_isSet){
obj.insert("nbOutputDevices", QJsonValue(nb_output_devices)); obj->insert("nbOutputDevices", QJsonValue(nb_output_devices));
} }
if(m_output_device_selected_index_isSet){ if(m_output_device_selected_index_isSet){
obj.insert("outputDeviceSelectedIndex", QJsonValue(output_device_selected_index)); obj->insert("outputDeviceSelectedIndex", QJsonValue(output_device_selected_index));
} }
if(output_devices->size() > 0){ if(output_devices->size() > 0){
toJsonArray((QList<void*>*)output_devices, obj, "outputDevices", "SWGAudioDevice"); toJsonArray((QList<void*>*)output_devices, obj, "outputDevices", "SWGAudioDevice");

View File

@ -32,15 +32,15 @@ namespace SWGSDRangel {
class SWGAudioDevices: public SWGObject { class SWGAudioDevices: public SWGObject {
public: public:
SWGAudioDevices(); SWGAudioDevices();
SWGAudioDevices(QString json); SWGAudioDevices(QString* json);
~SWGAudioDevices(); virtual ~SWGAudioDevices();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGAudioDevices* fromJson(QString jsonString); SWGAudioDevices* fromJson(QString &jsonString);
float getInputVolume(); float getInputVolume();
void setInputVolume(float input_volume); void setInputVolume(float input_volume);

View File

@ -22,13 +22,18 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGAudioDevicesSelect::SWGAudioDevicesSelect(QString json) { SWGAudioDevicesSelect::SWGAudioDevicesSelect(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGAudioDevicesSelect::SWGAudioDevicesSelect() { SWGAudioDevicesSelect::SWGAudioDevicesSelect() {
init(); input_volume = 0.0f;
m_input_volume_isSet = false;
input_index = 0;
m_input_index_isSet = false;
output_index = 0;
m_output_index_isSet = false;
} }
SWGAudioDevicesSelect::~SWGAudioDevicesSelect() { SWGAudioDevicesSelect::~SWGAudioDevicesSelect() {
@ -53,7 +58,7 @@ SWGAudioDevicesSelect::cleanup() {
} }
SWGAudioDevicesSelect* SWGAudioDevicesSelect*
SWGAudioDevicesSelect::fromJson(QString json) { SWGAudioDevicesSelect::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -62,7 +67,7 @@ SWGAudioDevicesSelect::fromJson(QString json) {
} }
void void
SWGAudioDevicesSelect::fromJsonObject(QJsonObject pJson) { SWGAudioDevicesSelect::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&input_volume, pJson["inputVolume"], "float", ""); ::SWGSDRangel::setValue(&input_volume, pJson["inputVolume"], "float", "");
::SWGSDRangel::setValue(&input_index, pJson["inputIndex"], "qint32", ""); ::SWGSDRangel::setValue(&input_index, pJson["inputIndex"], "qint32", "");
@ -74,23 +79,25 @@ SWGAudioDevicesSelect::fromJsonObject(QJsonObject pJson) {
QString QString
SWGAudioDevicesSelect::asJson () SWGAudioDevicesSelect::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGAudioDevicesSelect::asJsonObject() { SWGAudioDevicesSelect::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_input_volume_isSet){ if(m_input_volume_isSet){
obj.insert("inputVolume", QJsonValue(input_volume)); obj->insert("inputVolume", QJsonValue(input_volume));
} }
if(m_input_index_isSet){ if(m_input_index_isSet){
obj.insert("inputIndex", QJsonValue(input_index)); obj->insert("inputIndex", QJsonValue(input_index));
} }
if(m_output_index_isSet){ if(m_output_index_isSet){
obj.insert("outputIndex", QJsonValue(output_index)); obj->insert("outputIndex", QJsonValue(output_index));
} }
return obj; return obj;

View File

@ -30,15 +30,15 @@ namespace SWGSDRangel {
class SWGAudioDevicesSelect: public SWGObject { class SWGAudioDevicesSelect: public SWGObject {
public: public:
SWGAudioDevicesSelect(); SWGAudioDevicesSelect();
SWGAudioDevicesSelect(QString json); SWGAudioDevicesSelect(QString* json);
~SWGAudioDevicesSelect(); virtual ~SWGAudioDevicesSelect();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGAudioDevicesSelect* fromJson(QString jsonString); SWGAudioDevicesSelect* fromJson(QString &jsonString);
float getInputVolume(); float getInputVolume();
void setInputVolume(float input_volume); void setInputVolume(float input_volume);

View File

@ -22,13 +22,22 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGCWKeyerSettings::SWGCWKeyerSettings(QString json) { SWGCWKeyerSettings::SWGCWKeyerSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGCWKeyerSettings::SWGCWKeyerSettings() { SWGCWKeyerSettings::SWGCWKeyerSettings() {
init(); sample_rate = 0;
m_sample_rate_isSet = false;
wpm = 0;
m_wpm_isSet = false;
mode = 0;
m_mode_isSet = false;
text = nullptr;
m_text_isSet = false;
loop = 0;
m_loop_isSet = false;
} }
SWGCWKeyerSettings::~SWGCWKeyerSettings() { SWGCWKeyerSettings::~SWGCWKeyerSettings() {
@ -61,7 +70,7 @@ SWGCWKeyerSettings::cleanup() {
} }
SWGCWKeyerSettings* SWGCWKeyerSettings*
SWGCWKeyerSettings::fromJson(QString json) { SWGCWKeyerSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -70,7 +79,7 @@ SWGCWKeyerSettings::fromJson(QString json) {
} }
void void
SWGCWKeyerSettings::fromJsonObject(QJsonObject pJson) { SWGCWKeyerSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", "");
::SWGSDRangel::setValue(&wpm, pJson["wpm"], "qint32", ""); ::SWGSDRangel::setValue(&wpm, pJson["wpm"], "qint32", "");
@ -86,29 +95,31 @@ SWGCWKeyerSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGCWKeyerSettings::asJson () SWGCWKeyerSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGCWKeyerSettings::asJsonObject() { SWGCWKeyerSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_sample_rate_isSet){ if(m_sample_rate_isSet){
obj.insert("sampleRate", QJsonValue(sample_rate)); obj->insert("sampleRate", QJsonValue(sample_rate));
} }
if(m_wpm_isSet){ if(m_wpm_isSet){
obj.insert("wpm", QJsonValue(wpm)); obj->insert("wpm", QJsonValue(wpm));
} }
if(m_mode_isSet){ if(m_mode_isSet){
obj.insert("mode", QJsonValue(mode)); obj->insert("mode", QJsonValue(mode));
} }
if(text != nullptr && *text != QString("")){ if(text != nullptr && *text != QString("")){
toJsonValue(QString("text"), text, obj, QString("QString")); toJsonValue(QString("text"), text, obj, QString("QString"));
} }
if(m_loop_isSet){ if(m_loop_isSet){
obj.insert("loop", QJsonValue(loop)); obj->insert("loop", QJsonValue(loop));
} }
return obj; return obj;

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGCWKeyerSettings: public SWGObject { class SWGCWKeyerSettings: public SWGObject {
public: public:
SWGCWKeyerSettings(); SWGCWKeyerSettings();
SWGCWKeyerSettings(QString json); SWGCWKeyerSettings(QString* json);
~SWGCWKeyerSettings(); virtual ~SWGCWKeyerSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGCWKeyerSettings* fromJson(QString jsonString); SWGCWKeyerSettings* fromJson(QString &jsonString);
qint32 getSampleRate(); qint32 getSampleRate();
void setSampleRate(qint32 sample_rate); void setSampleRate(qint32 sample_rate);

View File

@ -22,13 +22,22 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGChannel::SWGChannel(QString json) { SWGChannel::SWGChannel(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGChannel::SWGChannel() { SWGChannel::SWGChannel() {
init(); index = 0;
m_index_isSet = false;
id = nullptr;
m_id_isSet = false;
uid = 0L;
m_uid_isSet = false;
title = nullptr;
m_title_isSet = false;
delta_frequency = 0;
m_delta_frequency_isSet = false;
} }
SWGChannel::~SWGChannel() { SWGChannel::~SWGChannel() {
@ -63,7 +72,7 @@ SWGChannel::cleanup() {
} }
SWGChannel* SWGChannel*
SWGChannel::fromJson(QString json) { SWGChannel::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -72,7 +81,7 @@ SWGChannel::fromJson(QString json) {
} }
void void
SWGChannel::fromJsonObject(QJsonObject pJson) { SWGChannel::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", ""); ::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString"); ::SWGSDRangel::setValue(&id, pJson["id"], "QString", "QString");
@ -88,29 +97,31 @@ SWGChannel::fromJsonObject(QJsonObject pJson) {
QString QString
SWGChannel::asJson () SWGChannel::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGChannel::asJsonObject() { SWGChannel::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_index_isSet){ if(m_index_isSet){
obj.insert("index", QJsonValue(index)); obj->insert("index", QJsonValue(index));
} }
if(id != nullptr && *id != QString("")){ if(id != nullptr && *id != QString("")){
toJsonValue(QString("id"), id, obj, QString("QString")); toJsonValue(QString("id"), id, obj, QString("QString"));
} }
if(m_uid_isSet){ if(m_uid_isSet){
obj.insert("uid", QJsonValue(uid)); obj->insert("uid", QJsonValue(uid));
} }
if(title != nullptr && *title != QString("")){ if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString")); toJsonValue(QString("title"), title, obj, QString("QString"));
} }
if(m_delta_frequency_isSet){ if(m_delta_frequency_isSet){
obj.insert("deltaFrequency", QJsonValue(delta_frequency)); obj->insert("deltaFrequency", QJsonValue(delta_frequency));
} }
return obj; return obj;

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGChannel: public SWGObject { class SWGChannel: public SWGObject {
public: public:
SWGChannel(); SWGChannel();
SWGChannel(QString json); SWGChannel(QString* json);
~SWGChannel(); virtual ~SWGChannel();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGChannel* fromJson(QString jsonString); SWGChannel* fromJson(QString &jsonString);
qint32 getIndex(); qint32 getIndex();
void setIndex(qint32 index); void setIndex(qint32 index);

View File

@ -22,13 +22,24 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGChannelListItem::SWGChannelListItem(QString json) { SWGChannelListItem::SWGChannelListItem(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGChannelListItem::SWGChannelListItem() { SWGChannelListItem::SWGChannelListItem() {
init(); name = nullptr;
m_name_isSet = false;
id_uri = nullptr;
m_id_uri_isSet = false;
id = nullptr;
m_id_isSet = false;
tx = 0;
m_tx_isSet = false;
version = nullptr;
m_version_isSet = false;
index = 0;
m_index_isSet = false;
} }
SWGChannelListItem::~SWGChannelListItem() { SWGChannelListItem::~SWGChannelListItem() {
@ -70,7 +81,7 @@ SWGChannelListItem::cleanup() {
} }
SWGChannelListItem* SWGChannelListItem*
SWGChannelListItem::fromJson(QString json) { SWGChannelListItem::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -79,7 +90,7 @@ SWGChannelListItem::fromJson(QString json) {
} }
void void
SWGChannelListItem::fromJsonObject(QJsonObject pJson) { SWGChannelListItem::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString"); ::SWGSDRangel::setValue(&name, pJson["name"], "QString", "QString");
::SWGSDRangel::setValue(&id_uri, pJson["idURI"], "QString", "QString"); ::SWGSDRangel::setValue(&id_uri, pJson["idURI"], "QString", "QString");
@ -97,15 +108,17 @@ SWGChannelListItem::fromJsonObject(QJsonObject pJson) {
QString QString
SWGChannelListItem::asJson () SWGChannelListItem::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGChannelListItem::asJsonObject() { SWGChannelListItem::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(name != nullptr && *name != QString("")){ if(name != nullptr && *name != QString("")){
toJsonValue(QString("name"), name, obj, QString("QString")); toJsonValue(QString("name"), name, obj, QString("QString"));
} }
@ -116,13 +129,13 @@ SWGChannelListItem::asJsonObject() {
toJsonValue(QString("id"), id, obj, QString("QString")); toJsonValue(QString("id"), id, obj, QString("QString"));
} }
if(m_tx_isSet){ if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx)); obj->insert("tx", QJsonValue(tx));
} }
if(version != nullptr && *version != QString("")){ if(version != nullptr && *version != QString("")){
toJsonValue(QString("version"), version, obj, QString("QString")); toJsonValue(QString("version"), version, obj, QString("QString"));
} }
if(m_index_isSet){ if(m_index_isSet){
obj.insert("index", QJsonValue(index)); obj->insert("index", QJsonValue(index));
} }
return obj; return obj;

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGChannelListItem: public SWGObject { class SWGChannelListItem: public SWGObject {
public: public:
SWGChannelListItem(); SWGChannelListItem();
SWGChannelListItem(QString json); SWGChannelListItem(QString* json);
~SWGChannelListItem(); virtual ~SWGChannelListItem();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGChannelListItem* fromJson(QString jsonString); SWGChannelListItem* fromJson(QString &jsonString);
QString* getName(); QString* getName();
void setName(QString* name); void setName(QString* name);

View File

@ -22,13 +22,20 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGChannelSettings::SWGChannelSettings(QString json) { SWGChannelSettings::SWGChannelSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGChannelSettings::SWGChannelSettings() { SWGChannelSettings::SWGChannelSettings() {
init(); channel_type = nullptr;
m_channel_type_isSet = false;
tx = 0;
m_tx_isSet = false;
nfm_demod_settings = nullptr;
m_nfm_demod_settings_isSet = false;
nfm_mod_settings = nullptr;
m_nfm_mod_settings_isSet = false;
} }
SWGChannelSettings::~SWGChannelSettings() { SWGChannelSettings::~SWGChannelSettings() {
@ -62,7 +69,7 @@ SWGChannelSettings::cleanup() {
} }
SWGChannelSettings* SWGChannelSettings*
SWGChannelSettings::fromJson(QString json) { SWGChannelSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -71,7 +78,7 @@ SWGChannelSettings::fromJson(QString json) {
} }
void void
SWGChannelSettings::fromJsonObject(QJsonObject pJson) { SWGChannelSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&channel_type, pJson["channelType"], "QString", "QString"); ::SWGSDRangel::setValue(&channel_type, pJson["channelType"], "QString", "QString");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
@ -85,20 +92,22 @@ SWGChannelSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGChannelSettings::asJson () SWGChannelSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGChannelSettings::asJsonObject() { SWGChannelSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(channel_type != nullptr && *channel_type != QString("")){ if(channel_type != nullptr && *channel_type != QString("")){
toJsonValue(QString("channelType"), channel_type, obj, QString("QString")); toJsonValue(QString("channelType"), channel_type, obj, QString("QString"));
} }
if(m_tx_isSet){ if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx)); obj->insert("tx", QJsonValue(tx));
} }
if((nfm_demod_settings != nullptr) && (nfm_demod_settings->isSet())){ if((nfm_demod_settings != nullptr) && (nfm_demod_settings->isSet())){
toJsonValue(QString("NFMDemodSettings"), nfm_demod_settings, obj, QString("SWGNFMDemodSettings")); toJsonValue(QString("NFMDemodSettings"), nfm_demod_settings, obj, QString("SWGNFMDemodSettings"));

View File

@ -33,15 +33,15 @@ namespace SWGSDRangel {
class SWGChannelSettings: public SWGObject { class SWGChannelSettings: public SWGObject {
public: public:
SWGChannelSettings(); SWGChannelSettings();
SWGChannelSettings(QString json); SWGChannelSettings(QString* json);
~SWGChannelSettings(); virtual ~SWGChannelSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGChannelSettings* fromJson(QString jsonString); SWGChannelSettings* fromJson(QString &jsonString);
QString* getChannelType(); QString* getChannelType();
void setChannelType(QString* channel_type); void setChannelType(QString* channel_type);

View File

@ -22,13 +22,16 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDVSeralDevices::SWGDVSeralDevices(QString json) { SWGDVSeralDevices::SWGDVSeralDevices(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGDVSeralDevices::SWGDVSeralDevices() { SWGDVSeralDevices::SWGDVSeralDevices() {
init(); nb_devices = 0;
m_nb_devices_isSet = false;
dv_serial_devices = nullptr;
m_dv_serial_devices_isSet = false;
} }
SWGDVSeralDevices::~SWGDVSeralDevices() { SWGDVSeralDevices::~SWGDVSeralDevices() {
@ -56,7 +59,7 @@ SWGDVSeralDevices::cleanup() {
} }
SWGDVSeralDevices* SWGDVSeralDevices*
SWGDVSeralDevices::fromJson(QString json) { SWGDVSeralDevices::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -65,7 +68,7 @@ SWGDVSeralDevices::fromJson(QString json) {
} }
void void
SWGDVSeralDevices::fromJsonObject(QJsonObject pJson) { SWGDVSeralDevices::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&nb_devices, pJson["nbDevices"], "qint32", ""); ::SWGSDRangel::setValue(&nb_devices, pJson["nbDevices"], "qint32", "");
@ -75,17 +78,19 @@ SWGDVSeralDevices::fromJsonObject(QJsonObject pJson) {
QString QString
SWGDVSeralDevices::asJson () SWGDVSeralDevices::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGDVSeralDevices::asJsonObject() { SWGDVSeralDevices::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_nb_devices_isSet){ if(m_nb_devices_isSet){
obj.insert("nbDevices", QJsonValue(nb_devices)); obj->insert("nbDevices", QJsonValue(nb_devices));
} }
if(dv_serial_devices->size() > 0){ if(dv_serial_devices->size() > 0){
toJsonArray((QList<void*>*)dv_serial_devices, obj, "dvSerialDevices", "SWGDVSerialDevice"); toJsonArray((QList<void*>*)dv_serial_devices, obj, "dvSerialDevices", "SWGDVSerialDevice");

View File

@ -32,15 +32,15 @@ namespace SWGSDRangel {
class SWGDVSeralDevices: public SWGObject { class SWGDVSeralDevices: public SWGObject {
public: public:
SWGDVSeralDevices(); SWGDVSeralDevices();
SWGDVSeralDevices(QString json); SWGDVSeralDevices(QString* json);
~SWGDVSeralDevices(); virtual ~SWGDVSeralDevices();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGDVSeralDevices* fromJson(QString jsonString); SWGDVSeralDevices* fromJson(QString &jsonString);
qint32 getNbDevices(); qint32 getNbDevices();
void setNbDevices(qint32 nb_devices); void setNbDevices(qint32 nb_devices);

View File

@ -22,13 +22,14 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDVSerialDevice::SWGDVSerialDevice(QString json) { SWGDVSerialDevice::SWGDVSerialDevice(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGDVSerialDevice::SWGDVSerialDevice() { SWGDVSerialDevice::SWGDVSerialDevice() {
init(); device_name = nullptr;
m_device_name_isSet = false;
} }
SWGDVSerialDevice::~SWGDVSerialDevice() { SWGDVSerialDevice::~SWGDVSerialDevice() {
@ -49,7 +50,7 @@ SWGDVSerialDevice::cleanup() {
} }
SWGDVSerialDevice* SWGDVSerialDevice*
SWGDVSerialDevice::fromJson(QString json) { SWGDVSerialDevice::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,7 +59,7 @@ SWGDVSerialDevice::fromJson(QString json) {
} }
void void
SWGDVSerialDevice::fromJsonObject(QJsonObject pJson) { SWGDVSerialDevice::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&device_name, pJson["deviceName"], "QString", "QString"); ::SWGSDRangel::setValue(&device_name, pJson["deviceName"], "QString", "QString");
} }
@ -66,15 +67,17 @@ SWGDVSerialDevice::fromJsonObject(QJsonObject pJson) {
QString QString
SWGDVSerialDevice::asJson () SWGDVSerialDevice::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGDVSerialDevice::asJsonObject() { SWGDVSerialDevice::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(device_name != nullptr && *device_name != QString("")){ if(device_name != nullptr && *device_name != QString("")){
toJsonValue(QString("deviceName"), device_name, obj, QString("QString")); toJsonValue(QString("deviceName"), device_name, obj, QString("QString"));
} }

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGDVSerialDevice: public SWGObject { class SWGDVSerialDevice: public SWGObject {
public: public:
SWGDVSerialDevice(); SWGDVSerialDevice();
SWGDVSerialDevice(QString json); SWGDVSerialDevice(QString* json);
~SWGDVSerialDevice(); virtual ~SWGDVSerialDevice();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGDVSerialDevice* fromJson(QString jsonString); SWGDVSerialDevice* fromJson(QString &jsonString);
QString* getDeviceName(); QString* getDeviceName();
void setDeviceName(QString* device_name); void setDeviceName(QString* device_name);

View File

@ -22,13 +22,30 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceListItem::SWGDeviceListItem(QString json) { SWGDeviceListItem::SWGDeviceListItem(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGDeviceListItem::SWGDeviceListItem() { SWGDeviceListItem::SWGDeviceListItem() {
init(); displayed_name = nullptr;
m_displayed_name_isSet = false;
hw_type = nullptr;
m_hw_type_isSet = false;
serial = nullptr;
m_serial_isSet = false;
sequence = 0;
m_sequence_isSet = false;
tx = 0;
m_tx_isSet = false;
nb_streams = 0;
m_nb_streams_isSet = false;
stream_index = 0;
m_stream_index_isSet = false;
device_set_index = 0;
m_device_set_index_isSet = false;
index = 0;
m_index_isSet = false;
} }
SWGDeviceListItem::~SWGDeviceListItem() { SWGDeviceListItem::~SWGDeviceListItem() {
@ -77,7 +94,7 @@ SWGDeviceListItem::cleanup() {
} }
SWGDeviceListItem* SWGDeviceListItem*
SWGDeviceListItem::fromJson(QString json) { SWGDeviceListItem::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -86,7 +103,7 @@ SWGDeviceListItem::fromJson(QString json) {
} }
void void
SWGDeviceListItem::fromJsonObject(QJsonObject pJson) { SWGDeviceListItem::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&displayed_name, pJson["displayedName"], "QString", "QString"); ::SWGSDRangel::setValue(&displayed_name, pJson["displayedName"], "QString", "QString");
::SWGSDRangel::setValue(&hw_type, pJson["hwType"], "QString", "QString"); ::SWGSDRangel::setValue(&hw_type, pJson["hwType"], "QString", "QString");
@ -110,15 +127,17 @@ SWGDeviceListItem::fromJsonObject(QJsonObject pJson) {
QString QString
SWGDeviceListItem::asJson () SWGDeviceListItem::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGDeviceListItem::asJsonObject() { SWGDeviceListItem::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(displayed_name != nullptr && *displayed_name != QString("")){ if(displayed_name != nullptr && *displayed_name != QString("")){
toJsonValue(QString("displayedName"), displayed_name, obj, QString("QString")); toJsonValue(QString("displayedName"), displayed_name, obj, QString("QString"));
} }
@ -129,22 +148,22 @@ SWGDeviceListItem::asJsonObject() {
toJsonValue(QString("serial"), serial, obj, QString("QString")); toJsonValue(QString("serial"), serial, obj, QString("QString"));
} }
if(m_sequence_isSet){ if(m_sequence_isSet){
obj.insert("sequence", QJsonValue(sequence)); obj->insert("sequence", QJsonValue(sequence));
} }
if(m_tx_isSet){ if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx)); obj->insert("tx", QJsonValue(tx));
} }
if(m_nb_streams_isSet){ if(m_nb_streams_isSet){
obj.insert("nbStreams", QJsonValue(nb_streams)); obj->insert("nbStreams", QJsonValue(nb_streams));
} }
if(m_stream_index_isSet){ if(m_stream_index_isSet){
obj.insert("streamIndex", QJsonValue(stream_index)); obj->insert("streamIndex", QJsonValue(stream_index));
} }
if(m_device_set_index_isSet){ if(m_device_set_index_isSet){
obj.insert("deviceSetIndex", QJsonValue(device_set_index)); obj->insert("deviceSetIndex", QJsonValue(device_set_index));
} }
if(m_index_isSet){ if(m_index_isSet){
obj.insert("index", QJsonValue(index)); obj->insert("index", QJsonValue(index));
} }
return obj; return obj;

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGDeviceListItem: public SWGObject { class SWGDeviceListItem: public SWGObject {
public: public:
SWGDeviceListItem(); SWGDeviceListItem();
SWGDeviceListItem(QString json); SWGDeviceListItem(QString* json);
~SWGDeviceListItem(); virtual ~SWGDeviceListItem();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGDeviceListItem* fromJson(QString jsonString); SWGDeviceListItem* fromJson(QString &jsonString);
QString* getDisplayedName(); QString* getDisplayedName();
void setDisplayedName(QString* displayed_name); void setDisplayedName(QString* displayed_name);

View File

@ -22,13 +22,18 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceSet::SWGDeviceSet(QString json) { SWGDeviceSet::SWGDeviceSet(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGDeviceSet::SWGDeviceSet() { SWGDeviceSet::SWGDeviceSet() {
init(); sampling_device = nullptr;
m_sampling_device_isSet = false;
channelcount = 0;
m_channelcount_isSet = false;
channels = nullptr;
m_channels_isSet = false;
} }
SWGDeviceSet::~SWGDeviceSet() { SWGDeviceSet::~SWGDeviceSet() {
@ -61,7 +66,7 @@ SWGDeviceSet::cleanup() {
} }
SWGDeviceSet* SWGDeviceSet*
SWGDeviceSet::fromJson(QString json) { SWGDeviceSet::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -70,7 +75,7 @@ SWGDeviceSet::fromJson(QString json) {
} }
void void
SWGDeviceSet::fromJsonObject(QJsonObject pJson) { SWGDeviceSet::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&sampling_device, pJson["samplingDevice"], "SWGSamplingDevice", "SWGSamplingDevice"); ::SWGSDRangel::setValue(&sampling_device, pJson["samplingDevice"], "SWGSamplingDevice", "SWGSamplingDevice");
::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", ""); ::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", "");
@ -82,20 +87,22 @@ SWGDeviceSet::fromJsonObject(QJsonObject pJson) {
QString QString
SWGDeviceSet::asJson () SWGDeviceSet::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGDeviceSet::asJsonObject() { SWGDeviceSet::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if((sampling_device != nullptr) && (sampling_device->isSet())){ if((sampling_device != nullptr) && (sampling_device->isSet())){
toJsonValue(QString("samplingDevice"), sampling_device, obj, QString("SWGSamplingDevice")); toJsonValue(QString("samplingDevice"), sampling_device, obj, QString("SWGSamplingDevice"));
} }
if(m_channelcount_isSet){ if(m_channelcount_isSet){
obj.insert("channelcount", QJsonValue(channelcount)); obj->insert("channelcount", QJsonValue(channelcount));
} }
if(channels->size() > 0){ if(channels->size() > 0){
toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannel"); toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannel");

View File

@ -33,15 +33,15 @@ namespace SWGSDRangel {
class SWGDeviceSet: public SWGObject { class SWGDeviceSet: public SWGObject {
public: public:
SWGDeviceSet(); SWGDeviceSet();
SWGDeviceSet(QString json); SWGDeviceSet(QString* json);
~SWGDeviceSet(); virtual ~SWGDeviceSet();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGDeviceSet* fromJson(QString jsonString); SWGDeviceSet* fromJson(QString &jsonString);
SWGSamplingDevice* getSamplingDevice(); SWGSamplingDevice* getSamplingDevice();
void setSamplingDevice(SWGSamplingDevice* sampling_device); void setSamplingDevice(SWGSamplingDevice* sampling_device);

View File

@ -22,13 +22,18 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceSetList::SWGDeviceSetList(QString json) { SWGDeviceSetList::SWGDeviceSetList(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGDeviceSetList::SWGDeviceSetList() { SWGDeviceSetList::SWGDeviceSetList() {
init(); devicesetcount = 0;
m_devicesetcount_isSet = false;
devicesetfocus = 0;
m_devicesetfocus_isSet = false;
device_sets = nullptr;
m_device_sets_isSet = false;
} }
SWGDeviceSetList::~SWGDeviceSetList() { SWGDeviceSetList::~SWGDeviceSetList() {
@ -59,7 +64,7 @@ SWGDeviceSetList::cleanup() {
} }
SWGDeviceSetList* SWGDeviceSetList*
SWGDeviceSetList::fromJson(QString json) { SWGDeviceSetList::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -68,7 +73,7 @@ SWGDeviceSetList::fromJson(QString json) {
} }
void void
SWGDeviceSetList::fromJsonObject(QJsonObject pJson) { SWGDeviceSetList::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&devicesetcount, pJson["devicesetcount"], "qint32", ""); ::SWGSDRangel::setValue(&devicesetcount, pJson["devicesetcount"], "qint32", "");
::SWGSDRangel::setValue(&devicesetfocus, pJson["devicesetfocus"], "qint32", ""); ::SWGSDRangel::setValue(&devicesetfocus, pJson["devicesetfocus"], "qint32", "");
@ -80,20 +85,22 @@ SWGDeviceSetList::fromJsonObject(QJsonObject pJson) {
QString QString
SWGDeviceSetList::asJson () SWGDeviceSetList::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGDeviceSetList::asJsonObject() { SWGDeviceSetList::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_devicesetcount_isSet){ if(m_devicesetcount_isSet){
obj.insert("devicesetcount", QJsonValue(devicesetcount)); obj->insert("devicesetcount", QJsonValue(devicesetcount));
} }
if(m_devicesetfocus_isSet){ if(m_devicesetfocus_isSet){
obj.insert("devicesetfocus", QJsonValue(devicesetfocus)); obj->insert("devicesetfocus", QJsonValue(devicesetfocus));
} }
if(device_sets->size() > 0){ if(device_sets->size() > 0){
toJsonArray((QList<void*>*)device_sets, obj, "deviceSets", "SWGDeviceSet"); toJsonArray((QList<void*>*)device_sets, obj, "deviceSets", "SWGDeviceSet");

View File

@ -32,15 +32,15 @@ namespace SWGSDRangel {
class SWGDeviceSetList: public SWGObject { class SWGDeviceSetList: public SWGObject {
public: public:
SWGDeviceSetList(); SWGDeviceSetList();
SWGDeviceSetList(QString json); SWGDeviceSetList(QString* json);
~SWGDeviceSetList(); virtual ~SWGDeviceSetList();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGDeviceSetList* fromJson(QString jsonString); SWGDeviceSetList* fromJson(QString &jsonString);
qint32 getDevicesetcount(); qint32 getDevicesetcount();
void setDevicesetcount(qint32 devicesetcount); void setDevicesetcount(qint32 devicesetcount);

View File

@ -22,13 +22,28 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceSettings::SWGDeviceSettings(QString json) { SWGDeviceSettings::SWGDeviceSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGDeviceSettings::SWGDeviceSettings() { SWGDeviceSettings::SWGDeviceSettings() {
init(); device_hw_type = nullptr;
m_device_hw_type_isSet = false;
tx = 0;
m_tx_isSet = false;
file_source_settings = nullptr;
m_file_source_settings_isSet = false;
hack_rf_input_settings = nullptr;
m_hack_rf_input_settings_isSet = false;
hack_rf_output_settings = nullptr;
m_hack_rf_output_settings_isSet = false;
lime_sdr_input_settings = nullptr;
m_lime_sdr_input_settings_isSet = false;
lime_sdr_output_settings = nullptr;
m_lime_sdr_output_settings_isSet = false;
rtl_sdr_settings = nullptr;
m_rtl_sdr_settings_isSet = false;
} }
SWGDeviceSettings::~SWGDeviceSettings() { SWGDeviceSettings::~SWGDeviceSettings() {
@ -82,7 +97,7 @@ SWGDeviceSettings::cleanup() {
} }
SWGDeviceSettings* SWGDeviceSettings*
SWGDeviceSettings::fromJson(QString json) { SWGDeviceSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -91,7 +106,7 @@ SWGDeviceSettings::fromJson(QString json) {
} }
void void
SWGDeviceSettings::fromJsonObject(QJsonObject pJson) { SWGDeviceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&device_hw_type, pJson["deviceHwType"], "QString", "QString"); ::SWGSDRangel::setValue(&device_hw_type, pJson["deviceHwType"], "QString", "QString");
::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", ""); ::SWGSDRangel::setValue(&tx, pJson["tx"], "qint32", "");
@ -113,20 +128,22 @@ SWGDeviceSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGDeviceSettings::asJson () SWGDeviceSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGDeviceSettings::asJsonObject() { SWGDeviceSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(device_hw_type != nullptr && *device_hw_type != QString("")){ if(device_hw_type != nullptr && *device_hw_type != QString("")){
toJsonValue(QString("deviceHwType"), device_hw_type, obj, QString("QString")); toJsonValue(QString("deviceHwType"), device_hw_type, obj, QString("QString"));
} }
if(m_tx_isSet){ if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx)); obj->insert("tx", QJsonValue(tx));
} }
if((file_source_settings != nullptr) && (file_source_settings->isSet())){ if((file_source_settings != nullptr) && (file_source_settings->isSet())){
toJsonValue(QString("fileSourceSettings"), file_source_settings, obj, QString("SWGFileSourceSettings")); toJsonValue(QString("fileSourceSettings"), file_source_settings, obj, QString("SWGFileSourceSettings"));

View File

@ -37,15 +37,15 @@ namespace SWGSDRangel {
class SWGDeviceSettings: public SWGObject { class SWGDeviceSettings: public SWGObject {
public: public:
SWGDeviceSettings(); SWGDeviceSettings();
SWGDeviceSettings(QString json); SWGDeviceSettings(QString* json);
~SWGDeviceSettings(); virtual ~SWGDeviceSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGDeviceSettings* fromJson(QString jsonString); SWGDeviceSettings* fromJson(QString &jsonString);
QString* getDeviceHwType(); QString* getDeviceHwType();
void setDeviceHwType(QString* device_hw_type); void setDeviceHwType(QString* device_hw_type);

View File

@ -22,13 +22,14 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGDeviceState::SWGDeviceState(QString json) { SWGDeviceState::SWGDeviceState(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGDeviceState::SWGDeviceState() { SWGDeviceState::SWGDeviceState() {
init(); state = nullptr;
m_state_isSet = false;
} }
SWGDeviceState::~SWGDeviceState() { SWGDeviceState::~SWGDeviceState() {
@ -49,7 +50,7 @@ SWGDeviceState::cleanup() {
} }
SWGDeviceState* SWGDeviceState*
SWGDeviceState::fromJson(QString json) { SWGDeviceState::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,7 +59,7 @@ SWGDeviceState::fromJson(QString json) {
} }
void void
SWGDeviceState::fromJsonObject(QJsonObject pJson) { SWGDeviceState::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString"); ::SWGSDRangel::setValue(&state, pJson["state"], "QString", "QString");
} }
@ -66,15 +67,17 @@ SWGDeviceState::fromJsonObject(QJsonObject pJson) {
QString QString
SWGDeviceState::asJson () SWGDeviceState::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGDeviceState::asJsonObject() { SWGDeviceState::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(state != nullptr && *state != QString("")){ if(state != nullptr && *state != QString("")){
toJsonValue(QString("state"), state, obj, QString("QString")); toJsonValue(QString("state"), state, obj, QString("QString"));
} }

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGDeviceState: public SWGObject { class SWGDeviceState: public SWGObject {
public: public:
SWGDeviceState(); SWGDeviceState();
SWGDeviceState(QString json); SWGDeviceState(QString* json);
~SWGDeviceState(); virtual ~SWGDeviceState();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGDeviceState* fromJson(QString jsonString); SWGDeviceState* fromJson(QString &jsonString);
QString* getState(); QString* getState();
void setState(QString* state); void setState(QString* state);

View File

@ -22,13 +22,14 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGErrorResponse::SWGErrorResponse(QString json) { SWGErrorResponse::SWGErrorResponse(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGErrorResponse::SWGErrorResponse() { SWGErrorResponse::SWGErrorResponse() {
init(); message = nullptr;
m_message_isSet = false;
} }
SWGErrorResponse::~SWGErrorResponse() { SWGErrorResponse::~SWGErrorResponse() {
@ -49,7 +50,7 @@ SWGErrorResponse::cleanup() {
} }
SWGErrorResponse* SWGErrorResponse*
SWGErrorResponse::fromJson(QString json) { SWGErrorResponse::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,7 +59,7 @@ SWGErrorResponse::fromJson(QString json) {
} }
void void
SWGErrorResponse::fromJsonObject(QJsonObject pJson) { SWGErrorResponse::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString"); ::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString");
} }
@ -66,15 +67,17 @@ SWGErrorResponse::fromJsonObject(QJsonObject pJson) {
QString QString
SWGErrorResponse::asJson () SWGErrorResponse::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGErrorResponse::asJsonObject() { SWGErrorResponse::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(message != nullptr && *message != QString("")){ if(message != nullptr && *message != QString("")){
toJsonValue(QString("message"), message, obj, QString("QString")); toJsonValue(QString("message"), message, obj, QString("QString"));
} }

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGErrorResponse: public SWGObject { class SWGErrorResponse: public SWGObject {
public: public:
SWGErrorResponse(); SWGErrorResponse();
SWGErrorResponse(QString json); SWGErrorResponse(QString* json);
~SWGErrorResponse(); virtual ~SWGErrorResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGErrorResponse* fromJson(QString jsonString); SWGErrorResponse* fromJson(QString &jsonString);
QString* getMessage(); QString* getMessage();
void setMessage(QString* message); void setMessage(QString* message);

View File

@ -22,13 +22,14 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGFileSourceSettings::SWGFileSourceSettings(QString json) { SWGFileSourceSettings::SWGFileSourceSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGFileSourceSettings::SWGFileSourceSettings() { SWGFileSourceSettings::SWGFileSourceSettings() {
init(); file_name = nullptr;
m_file_name_isSet = false;
} }
SWGFileSourceSettings::~SWGFileSourceSettings() { SWGFileSourceSettings::~SWGFileSourceSettings() {
@ -49,7 +50,7 @@ SWGFileSourceSettings::cleanup() {
} }
SWGFileSourceSettings* SWGFileSourceSettings*
SWGFileSourceSettings::fromJson(QString json) { SWGFileSourceSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,7 +59,7 @@ SWGFileSourceSettings::fromJson(QString json) {
} }
void void
SWGFileSourceSettings::fromJsonObject(QJsonObject pJson) { SWGFileSourceSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&file_name, pJson["fileName"], "QString", "QString"); ::SWGSDRangel::setValue(&file_name, pJson["fileName"], "QString", "QString");
} }
@ -66,15 +67,17 @@ SWGFileSourceSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGFileSourceSettings::asJson () SWGFileSourceSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGFileSourceSettings::asJsonObject() { SWGFileSourceSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(file_name != nullptr && *file_name != QString("")){ if(file_name != nullptr && *file_name != QString("")){
toJsonValue(QString("fileName"), file_name, obj, QString("QString")); toJsonValue(QString("fileName"), file_name, obj, QString("QString"));
} }

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGFileSourceSettings: public SWGObject { class SWGFileSourceSettings: public SWGObject {
public: public:
SWGFileSourceSettings(); SWGFileSourceSettings();
SWGFileSourceSettings(QString json); SWGFileSourceSettings(QString* json);
~SWGFileSourceSettings(); virtual ~SWGFileSourceSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGFileSourceSettings* fromJson(QString jsonString); SWGFileSourceSettings* fromJson(QString &jsonString);
QString* getFileName(); QString* getFileName();
void setFileName(QString* file_name); void setFileName(QString* file_name);

View File

@ -22,13 +22,38 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGHackRFInputSettings::SWGHackRFInputSettings(QString json) { SWGHackRFInputSettings::SWGHackRFInputSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGHackRFInputSettings::SWGHackRFInputSettings() { SWGHackRFInputSettings::SWGHackRFInputSettings() {
init(); center_frequency = 0L;
m_center_frequency_isSet = false;
l_oppm_tenths = 0;
m_l_oppm_tenths_isSet = false;
bandwidth = 0;
m_bandwidth_isSet = false;
lna_gain = 0;
m_lna_gain_isSet = false;
vga_gain = 0;
m_vga_gain_isSet = false;
log2_decim = 0;
m_log2_decim_isSet = false;
fc_pos = 0;
m_fc_pos_isSet = false;
dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
bias_t = 0;
m_bias_t_isSet = false;
lna_ext = 0;
m_lna_ext_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
iq_correction = 0;
m_iq_correction_isSet = false;
link_tx_frequency = 0;
m_link_tx_frequency_isSet = false;
} }
SWGHackRFInputSettings::~SWGHackRFInputSettings() { SWGHackRFInputSettings::~SWGHackRFInputSettings() {
@ -83,7 +108,7 @@ SWGHackRFInputSettings::cleanup() {
} }
SWGHackRFInputSettings* SWGHackRFInputSettings*
SWGHackRFInputSettings::fromJson(QString json) { SWGHackRFInputSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -92,7 +117,7 @@ SWGHackRFInputSettings::fromJson(QString json) {
} }
void void
SWGHackRFInputSettings::fromJsonObject(QJsonObject pJson) { SWGHackRFInputSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", ""); ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
@ -124,53 +149,55 @@ SWGHackRFInputSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGHackRFInputSettings::asJson () SWGHackRFInputSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGHackRFInputSettings::asJsonObject() { SWGHackRFInputSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_center_frequency_isSet){ if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency)); obj->insert("centerFrequency", QJsonValue(center_frequency));
} }
if(m_l_oppm_tenths_isSet){ if(m_l_oppm_tenths_isSet){
obj.insert("LOppmTenths", QJsonValue(l_oppm_tenths)); obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
} }
if(m_bandwidth_isSet){ if(m_bandwidth_isSet){
obj.insert("bandwidth", QJsonValue(bandwidth)); obj->insert("bandwidth", QJsonValue(bandwidth));
} }
if(m_lna_gain_isSet){ if(m_lna_gain_isSet){
obj.insert("lnaGain", QJsonValue(lna_gain)); obj->insert("lnaGain", QJsonValue(lna_gain));
} }
if(m_vga_gain_isSet){ if(m_vga_gain_isSet){
obj.insert("vgaGain", QJsonValue(vga_gain)); obj->insert("vgaGain", QJsonValue(vga_gain));
} }
if(m_log2_decim_isSet){ if(m_log2_decim_isSet){
obj.insert("log2Decim", QJsonValue(log2_decim)); obj->insert("log2Decim", QJsonValue(log2_decim));
} }
if(m_fc_pos_isSet){ if(m_fc_pos_isSet){
obj.insert("fcPos", QJsonValue(fc_pos)); obj->insert("fcPos", QJsonValue(fc_pos));
} }
if(m_dev_sample_rate_isSet){ if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate)); obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
} }
if(m_bias_t_isSet){ if(m_bias_t_isSet){
obj.insert("biasT", QJsonValue(bias_t)); obj->insert("biasT", QJsonValue(bias_t));
} }
if(m_lna_ext_isSet){ if(m_lna_ext_isSet){
obj.insert("lnaExt", QJsonValue(lna_ext)); obj->insert("lnaExt", QJsonValue(lna_ext));
} }
if(m_dc_block_isSet){ if(m_dc_block_isSet){
obj.insert("dcBlock", QJsonValue(dc_block)); obj->insert("dcBlock", QJsonValue(dc_block));
} }
if(m_iq_correction_isSet){ if(m_iq_correction_isSet){
obj.insert("iqCorrection", QJsonValue(iq_correction)); obj->insert("iqCorrection", QJsonValue(iq_correction));
} }
if(m_link_tx_frequency_isSet){ if(m_link_tx_frequency_isSet){
obj.insert("linkTxFrequency", QJsonValue(link_tx_frequency)); obj->insert("linkTxFrequency", QJsonValue(link_tx_frequency));
} }
return obj; return obj;

View File

@ -30,15 +30,15 @@ namespace SWGSDRangel {
class SWGHackRFInputSettings: public SWGObject { class SWGHackRFInputSettings: public SWGObject {
public: public:
SWGHackRFInputSettings(); SWGHackRFInputSettings();
SWGHackRFInputSettings(QString json); SWGHackRFInputSettings(QString* json);
~SWGHackRFInputSettings(); virtual ~SWGHackRFInputSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGHackRFInputSettings* fromJson(QString jsonString); SWGHackRFInputSettings* fromJson(QString &jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);

View File

@ -22,13 +22,28 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGHackRFOutputSettings::SWGHackRFOutputSettings(QString json) { SWGHackRFOutputSettings::SWGHackRFOutputSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGHackRFOutputSettings::SWGHackRFOutputSettings() { SWGHackRFOutputSettings::SWGHackRFOutputSettings() {
init(); center_frequency = 0L;
m_center_frequency_isSet = false;
l_oppm_tenths = 0;
m_l_oppm_tenths_isSet = false;
bandwidth = 0;
m_bandwidth_isSet = false;
vga_gain = 0;
m_vga_gain_isSet = false;
log2_interp = 0;
m_log2_interp_isSet = false;
dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
bias_t = 0;
m_bias_t_isSet = false;
lna_ext = 0;
m_lna_ext_isSet = false;
} }
SWGHackRFOutputSettings::~SWGHackRFOutputSettings() { SWGHackRFOutputSettings::~SWGHackRFOutputSettings() {
@ -68,7 +83,7 @@ SWGHackRFOutputSettings::cleanup() {
} }
SWGHackRFOutputSettings* SWGHackRFOutputSettings*
SWGHackRFOutputSettings::fromJson(QString json) { SWGHackRFOutputSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -77,7 +92,7 @@ SWGHackRFOutputSettings::fromJson(QString json) {
} }
void void
SWGHackRFOutputSettings::fromJsonObject(QJsonObject pJson) { SWGHackRFOutputSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", ""); ::SWGSDRangel::setValue(&l_oppm_tenths, pJson["LOppmTenths"], "qint32", "");
@ -99,38 +114,40 @@ SWGHackRFOutputSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGHackRFOutputSettings::asJson () SWGHackRFOutputSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGHackRFOutputSettings::asJsonObject() { SWGHackRFOutputSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_center_frequency_isSet){ if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency)); obj->insert("centerFrequency", QJsonValue(center_frequency));
} }
if(m_l_oppm_tenths_isSet){ if(m_l_oppm_tenths_isSet){
obj.insert("LOppmTenths", QJsonValue(l_oppm_tenths)); obj->insert("LOppmTenths", QJsonValue(l_oppm_tenths));
} }
if(m_bandwidth_isSet){ if(m_bandwidth_isSet){
obj.insert("bandwidth", QJsonValue(bandwidth)); obj->insert("bandwidth", QJsonValue(bandwidth));
} }
if(m_vga_gain_isSet){ if(m_vga_gain_isSet){
obj.insert("vgaGain", QJsonValue(vga_gain)); obj->insert("vgaGain", QJsonValue(vga_gain));
} }
if(m_log2_interp_isSet){ if(m_log2_interp_isSet){
obj.insert("log2Interp", QJsonValue(log2_interp)); obj->insert("log2Interp", QJsonValue(log2_interp));
} }
if(m_dev_sample_rate_isSet){ if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate)); obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
} }
if(m_bias_t_isSet){ if(m_bias_t_isSet){
obj.insert("biasT", QJsonValue(bias_t)); obj->insert("biasT", QJsonValue(bias_t));
} }
if(m_lna_ext_isSet){ if(m_lna_ext_isSet){
obj.insert("lnaExt", QJsonValue(lna_ext)); obj->insert("lnaExt", QJsonValue(lna_ext));
} }
return obj; return obj;

View File

@ -30,15 +30,15 @@ namespace SWGSDRangel {
class SWGHackRFOutputSettings: public SWGObject { class SWGHackRFOutputSettings: public SWGObject {
public: public:
SWGHackRFOutputSettings(); SWGHackRFOutputSettings();
SWGHackRFOutputSettings(QString json); SWGHackRFOutputSettings(QString* json);
~SWGHackRFOutputSettings(); virtual ~SWGHackRFOutputSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGHackRFOutputSettings* fromJson(QString jsonString); SWGHackRFOutputSettings* fromJson(QString &jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);

View File

@ -41,7 +41,7 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
} }
else if(QStringLiteral("float").compare(type) == 0) { else if(QStringLiteral("float").compare(type) == 0) {
float *val = static_cast<float*>(value); float *val = static_cast<float*>(value);
*val = static_cast<float>(obj.toDouble()); *val = obj.toDouble();
} }
else if(QStringLiteral("double").compare(type) == 0) { else if(QStringLiteral("double").compare(type) == 0) {
double *val = static_cast<double*>(value); double *val = static_cast<double*>(value);
@ -51,14 +51,20 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
QString **val = static_cast<QString**>(value); QString **val = static_cast<QString**>(value);
if(val != nullptr) { if(val != nullptr) {
if(!obj.isNull()) { if(!obj.isNull()) {
(*val)->clear(); // create a new value and return
(*val)->append(obj.toString()); if(*val != nullptr) delete *val;
*val = new QString(obj.toString());
return; return;
} }
else { else {
(*val)->clear(); // set target to nullptr
if(*val != nullptr) delete *val;
*val = nullptr;
} }
} }
else {
qDebug() << "Can't set value because the target pointer is nullptr";
}
} }
else if (QStringLiteral("QDateTime").compare(type) == 0) { else if (QStringLiteral("QDateTime").compare(type) == 0) {
QDateTime **val = static_cast<QDateTime**>(value); QDateTime **val = static_cast<QDateTime**>(value);
@ -374,74 +380,78 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
} }
void void
toJsonValue(QString name, void* value, QJsonObject& output, QString type) { toJsonValue(QString name, void* value, QJsonObject* output, QString type) {
if(value == nullptr) { if(value == nullptr) {
return; return;
} }
if(type.startsWith("SWG")) { if(type.startsWith("SWG")) {
SWGObject *SWGobject = reinterpret_cast<SWGObject *>(value); SWGObject *SWGobject = reinterpret_cast<SWGObject *>(value);
if(SWGobject != nullptr) { if(SWGobject != nullptr) {
QJsonObject o = SWGobject->asJsonObject(); QJsonObject* o = (*SWGobject).asJsonObject();
if(!name.isNull()) { if(name != nullptr) {
output.insert(name, o); output->insert(name, *o);
if(o != nullptr) delete o;
} }
else { else {
output.empty(); output->empty();
for(QString key : o.keys()) { for(QString key : o->keys()) {
output.insert(key, o.value(key)); output->insert(key, o->value(key));
} }
} }
} }
} }
else if(QStringLiteral("QString").compare(type) == 0) { else if(QStringLiteral("QString").compare(type) == 0) {
QString* str = static_cast<QString*>(value); QString* str = static_cast<QString*>(value);
output.insert(name, QJsonValue(*str)); output->insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("qint32").compare(type) == 0) { else if(QStringLiteral("qint32").compare(type) == 0) {
qint32* str = static_cast<qint32*>(value); qint32* str = static_cast<qint32*>(value);
output.insert(name, QJsonValue(*str)); output->insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("qint64").compare(type) == 0) { else if(QStringLiteral("qint64").compare(type) == 0) {
qint64* str = static_cast<qint64*>(value); qint64* str = static_cast<qint64*>(value);
output.insert(name, QJsonValue(*str)); output->insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("bool").compare(type) == 0) { else if(QStringLiteral("bool").compare(type) == 0) {
bool* str = static_cast<bool*>(value); bool* str = static_cast<bool*>(value);
output.insert(name, QJsonValue(*str)); output->insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("float").compare(type) == 0) { else if(QStringLiteral("float").compare(type) == 0) {
float* str = static_cast<float*>(value); float* str = static_cast<float*>(value);
output.insert(name, QJsonValue((double)*str)); output->insert(name, QJsonValue((double)*str));
} }
else if(QStringLiteral("double").compare(type) == 0) { else if(QStringLiteral("double").compare(type) == 0) {
double* str = static_cast<double*>(value); double* str = static_cast<double*>(value);
output.insert(name, QJsonValue(*str)); output->insert(name, QJsonValue(*str));
} }
else if(QStringLiteral("QDate").compare(type) == 0) { else if(QStringLiteral("QDate").compare(type) == 0) {
QDate* date = static_cast<QDate*>(value); QDate* date = static_cast<QDate*>(value);
output.insert(name, QJsonValue(date->toString(Qt::ISODate))); output->insert(name, QJsonValue(date->toString(Qt::ISODate)));
} }
else if(QStringLiteral("QDateTime").compare(type) == 0) { else if(QStringLiteral("QDateTime").compare(type) == 0) {
QDateTime* datetime = static_cast<QDateTime*>(value); QDateTime* datetime = static_cast<QDateTime*>(value);
output.insert(name, QJsonValue(datetime->toString(Qt::ISODate))); output->insert(name, QJsonValue(datetime->toString(Qt::ISODate)));
} }
else if(QStringLiteral("QByteArray").compare(type) == 0) { else if(QStringLiteral("QByteArray").compare(type) == 0) {
QByteArray* byteArray = static_cast<QByteArray*>(value); QByteArray* byteArray = static_cast<QByteArray*>(value);
output.insert(name, QJsonValue(QString(byteArray->toBase64()))); output->insert(name, QJsonValue(QString(byteArray->toBase64())));
} }
} }
void void
toJsonArray(QList<void*>* value, QJsonObject& output, QString innerName, QString innerType) { toJsonArray(QList<void*>* value, QJsonObject* output, QString innerName, QString innerType) {
if(value == nullptr) { if((value == nullptr) || (output == nullptr)) {
return; return;
} }
QJsonArray outputarray; QJsonArray outputarray;
if(innerType.startsWith("SWG")){ if(innerType.startsWith("SWG")){
for(void* obj : *value) { for(void* obj : *value) {
SWGObject *SWGobject = reinterpret_cast<SWGObject *>(obj); SWGObject *SWGobject = reinterpret_cast<SWGObject *>(obj);
if(SWGobject != nullptr) { if(SWGobject != nullptr)
outputarray.append(SWGobject->asJsonObject()); {
QJsonObject* o = SWGobject->asJsonObject();
outputarray.append(*o);
delete o;
} }
} }
} }
@ -484,81 +494,81 @@ toJsonArray(QList<void*>* value, QJsonObject& output, QString innerName, QString
for(double obj : *(reinterpret_cast<QList<double>*>(value))) for(double obj : *(reinterpret_cast<QList<double>*>(value)))
outputarray.append(QJsonValue(obj)); outputarray.append(QJsonValue(obj));
} }
output.insert(innerName, outputarray); output->insert(innerName, outputarray);
} }
void void
toJsonMap(QMap<QString, void*>* value, QJsonObject& output, QString innerName, QString innerType) { toJsonMap(QMap<QString, void*>* value, QJsonObject* output, QString innerName, QString innerType) {
if(value == nullptr) { if((value == nullptr) || (output == nullptr)) {
return; return;
} }
QJsonObject mapobj; QJsonObject mapobj;
if(innerType.startsWith("SWG")){ if(innerType.startsWith("SWG")){
auto items = reinterpret_cast< QMap<QString, SWGObject*> *>(value); auto items = reinterpret_cast< QMap<QString, SWGObject*> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey),mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), &mapobj, innerType);
} }
} }
else if(QStringLiteral("QString").compare(innerType) == 0) { else if(QStringLiteral("QString").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, QString*> *>(value); auto items = reinterpret_cast< QMap<QString, QString*> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), &mapobj, innerType);
} }
} }
else if(QStringLiteral("QDate").compare(innerType) == 0) { else if(QStringLiteral("QDate").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, QDate*> *>(value); auto items = reinterpret_cast< QMap<QString, QDate*> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), &mapobj, innerType);
} }
} }
else if(QStringLiteral("QDateTime").compare(innerType) == 0) { else if(QStringLiteral("QDateTime").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, QDateTime*> *>(value); auto items = reinterpret_cast< QMap<QString, QDateTime*> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), &mapobj, innerType);
} }
} }
else if(QStringLiteral("QByteArray").compare(innerType) == 0) { else if(QStringLiteral("QByteArray").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, QByteArray*> *>(value); auto items = reinterpret_cast< QMap<QString, QByteArray*> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, items->value(itemkey), &mapobj, innerType);
} }
} }
else if(QStringLiteral("qint32").compare(innerType) == 0) { else if(QStringLiteral("qint32").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, qint32> *>(value); auto items = reinterpret_cast< QMap<QString, qint32> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
auto val = items->value(itemkey); auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, &val, &mapobj, innerType);
} }
} }
else if(QStringLiteral("qint64").compare(innerType) == 0) { else if(QStringLiteral("qint64").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, qint64> *>(value); auto items = reinterpret_cast< QMap<QString, qint64> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
auto val = items->value(itemkey); auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, &val, &mapobj, innerType);
} }
} }
else if(QStringLiteral("bool").compare(innerType) == 0) { else if(QStringLiteral("bool").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, bool> *>(value); auto items = reinterpret_cast< QMap<QString, bool> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
auto val = items->value(itemkey); auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, &val, &mapobj, innerType);
} }
} }
else if(QStringLiteral("float").compare(innerType) == 0) { else if(QStringLiteral("float").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, float> *>(value); auto items = reinterpret_cast< QMap<QString, float> *>(value);
for(auto itemkey: items->keys()) { for(auto itemkey: items->keys()) {
auto val = items->value(itemkey); auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, &val, &mapobj, innerType);
} }
} }
else if(QStringLiteral("double").compare(innerType) == 0) { else if(QStringLiteral("double").compare(innerType) == 0) {
auto items = reinterpret_cast< QMap<QString, double> *>(value); auto items = reinterpret_cast< QMap<QString, double> *>(value);
for(auto itemkey: items->keys() ) { for(auto itemkey: items->keys() ) {
auto val = items->value(itemkey); auto val = items->value(itemkey);
::SWGSDRangel::toJsonValue(itemkey, &val, mapobj, innerType); ::SWGSDRangel::toJsonValue(itemkey, &val, &mapobj, innerType);
} }
} }
output.insert(innerName, mapobj); output->insert(innerName, mapobj);
} }
QString QString

View File

@ -20,9 +20,9 @@
namespace SWGSDRangel { namespace SWGSDRangel {
void setValue(void* value, QJsonValue obj, QString type, QString complexType); void setValue(void* value, QJsonValue obj, QString type, QString complexType);
void toJsonArray(QList<void*>* value, QJsonObject& output, QString innerName, QString innerType); void toJsonArray(QList<void*>* value, QJsonObject* output, QString innerName, QString innerType);
void toJsonValue(QString name, void* value, QJsonObject& output, QString type); void toJsonValue(QString name, void* value, QJsonObject* output, QString type);
void toJsonMap(QMap<QString, void*>* value, QJsonObject& output, QString innerName, QString innerType); void toJsonMap(QMap<QString, void*>* value, QJsonObject* output, QString innerName, QString innerType);
bool isCompatibleJsonValue(QString type); bool isCompatibleJsonValue(QString type);
QString stringValue(QString* value); QString stringValue(QString* value);
QString stringValue(qint32 value); QString stringValue(qint32 value);

View File

@ -56,7 +56,7 @@ SWGHttpRequestWorker::SWGHttpRequestWorker(QObject *parent)
qsrand(QDateTime::currentDateTime().toTime_t()); qsrand(QDateTime::currentDateTime().toTime_t());
manager = new QNetworkAccessManager(this); manager = new QNetworkAccessManager(this);
connect(manager, &QNetworkAccessManager::finished, this, &SWGHttpRequestWorker::on_manager_finished); connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(on_manager_finished(QNetworkReply*)));
} }
SWGHttpRequestWorker::~SWGHttpRequestWorker() { SWGHttpRequestWorker::~SWGHttpRequestWorker() {

View File

@ -22,13 +22,16 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGInstanceChannelsResponse::SWGInstanceChannelsResponse(QString json) { SWGInstanceChannelsResponse::SWGInstanceChannelsResponse(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGInstanceChannelsResponse::SWGInstanceChannelsResponse() { SWGInstanceChannelsResponse::SWGInstanceChannelsResponse() {
init(); channelcount = 0;
m_channelcount_isSet = false;
channels = nullptr;
m_channels_isSet = false;
} }
SWGInstanceChannelsResponse::~SWGInstanceChannelsResponse() { SWGInstanceChannelsResponse::~SWGInstanceChannelsResponse() {
@ -56,7 +59,7 @@ SWGInstanceChannelsResponse::cleanup() {
} }
SWGInstanceChannelsResponse* SWGInstanceChannelsResponse*
SWGInstanceChannelsResponse::fromJson(QString json) { SWGInstanceChannelsResponse::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -65,7 +68,7 @@ SWGInstanceChannelsResponse::fromJson(QString json) {
} }
void void
SWGInstanceChannelsResponse::fromJsonObject(QJsonObject pJson) { SWGInstanceChannelsResponse::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", ""); ::SWGSDRangel::setValue(&channelcount, pJson["channelcount"], "qint32", "");
@ -75,17 +78,19 @@ SWGInstanceChannelsResponse::fromJsonObject(QJsonObject pJson) {
QString QString
SWGInstanceChannelsResponse::asJson () SWGInstanceChannelsResponse::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGInstanceChannelsResponse::asJsonObject() { SWGInstanceChannelsResponse::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_channelcount_isSet){ if(m_channelcount_isSet){
obj.insert("channelcount", QJsonValue(channelcount)); obj->insert("channelcount", QJsonValue(channelcount));
} }
if(channels->size() > 0){ if(channels->size() > 0){
toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannelListItem"); toJsonArray((QList<void*>*)channels, obj, "channels", "SWGChannelListItem");

View File

@ -32,15 +32,15 @@ namespace SWGSDRangel {
class SWGInstanceChannelsResponse: public SWGObject { class SWGInstanceChannelsResponse: public SWGObject {
public: public:
SWGInstanceChannelsResponse(); SWGInstanceChannelsResponse();
SWGInstanceChannelsResponse(QString json); SWGInstanceChannelsResponse(QString* json);
~SWGInstanceChannelsResponse(); virtual ~SWGInstanceChannelsResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGInstanceChannelsResponse* fromJson(QString jsonString); SWGInstanceChannelsResponse* fromJson(QString &jsonString);
qint32 getChannelcount(); qint32 getChannelcount();
void setChannelcount(qint32 channelcount); void setChannelcount(qint32 channelcount);

View File

@ -22,13 +22,16 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGInstanceDevicesResponse::SWGInstanceDevicesResponse(QString json) { SWGInstanceDevicesResponse::SWGInstanceDevicesResponse(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGInstanceDevicesResponse::SWGInstanceDevicesResponse() { SWGInstanceDevicesResponse::SWGInstanceDevicesResponse() {
init(); devicecount = 0;
m_devicecount_isSet = false;
devices = nullptr;
m_devices_isSet = false;
} }
SWGInstanceDevicesResponse::~SWGInstanceDevicesResponse() { SWGInstanceDevicesResponse::~SWGInstanceDevicesResponse() {
@ -56,7 +59,7 @@ SWGInstanceDevicesResponse::cleanup() {
} }
SWGInstanceDevicesResponse* SWGInstanceDevicesResponse*
SWGInstanceDevicesResponse::fromJson(QString json) { SWGInstanceDevicesResponse::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -65,7 +68,7 @@ SWGInstanceDevicesResponse::fromJson(QString json) {
} }
void void
SWGInstanceDevicesResponse::fromJsonObject(QJsonObject pJson) { SWGInstanceDevicesResponse::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&devicecount, pJson["devicecount"], "qint32", ""); ::SWGSDRangel::setValue(&devicecount, pJson["devicecount"], "qint32", "");
@ -75,17 +78,19 @@ SWGInstanceDevicesResponse::fromJsonObject(QJsonObject pJson) {
QString QString
SWGInstanceDevicesResponse::asJson () SWGInstanceDevicesResponse::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGInstanceDevicesResponse::asJsonObject() { SWGInstanceDevicesResponse::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_devicecount_isSet){ if(m_devicecount_isSet){
obj.insert("devicecount", QJsonValue(devicecount)); obj->insert("devicecount", QJsonValue(devicecount));
} }
if(devices->size() > 0){ if(devices->size() > 0){
toJsonArray((QList<void*>*)devices, obj, "devices", "SWGDeviceListItem"); toJsonArray((QList<void*>*)devices, obj, "devices", "SWGDeviceListItem");

View File

@ -32,15 +32,15 @@ namespace SWGSDRangel {
class SWGInstanceDevicesResponse: public SWGObject { class SWGInstanceDevicesResponse: public SWGObject {
public: public:
SWGInstanceDevicesResponse(); SWGInstanceDevicesResponse();
SWGInstanceDevicesResponse(QString json); SWGInstanceDevicesResponse(QString* json);
~SWGInstanceDevicesResponse(); virtual ~SWGInstanceDevicesResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGInstanceDevicesResponse* fromJson(QString jsonString); SWGInstanceDevicesResponse* fromJson(QString &jsonString);
qint32 getDevicecount(); qint32 getDevicecount();
void setDevicecount(qint32 devicecount); void setDevicecount(qint32 devicecount);

View File

@ -22,13 +22,32 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGInstanceSummaryResponse::SWGInstanceSummaryResponse(QString json) { SWGInstanceSummaryResponse::SWGInstanceSummaryResponse(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGInstanceSummaryResponse::SWGInstanceSummaryResponse() { SWGInstanceSummaryResponse::SWGInstanceSummaryResponse() {
init(); version = nullptr;
m_version_isSet = false;
qt_version = nullptr;
m_qt_version_isSet = false;
dsp_rx_bits = 0;
m_dsp_rx_bits_isSet = false;
dsp_tx_bits = 0;
m_dsp_tx_bits_isSet = false;
pid = 0;
m_pid_isSet = false;
appname = nullptr;
m_appname_isSet = false;
architecture = nullptr;
m_architecture_isSet = false;
os = nullptr;
m_os_isSet = false;
logging = nullptr;
m_logging_isSet = false;
devicesetlist = nullptr;
m_devicesetlist_isSet = false;
} }
SWGInstanceSummaryResponse::~SWGInstanceSummaryResponse() { SWGInstanceSummaryResponse::~SWGInstanceSummaryResponse() {
@ -88,7 +107,7 @@ SWGInstanceSummaryResponse::cleanup() {
} }
SWGInstanceSummaryResponse* SWGInstanceSummaryResponse*
SWGInstanceSummaryResponse::fromJson(QString json) { SWGInstanceSummaryResponse::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -97,7 +116,7 @@ SWGInstanceSummaryResponse::fromJson(QString json) {
} }
void void
SWGInstanceSummaryResponse::fromJsonObject(QJsonObject pJson) { SWGInstanceSummaryResponse::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&version, pJson["version"], "QString", "QString"); ::SWGSDRangel::setValue(&version, pJson["version"], "QString", "QString");
::SWGSDRangel::setValue(&qt_version, pJson["qtVersion"], "QString", "QString"); ::SWGSDRangel::setValue(&qt_version, pJson["qtVersion"], "QString", "QString");
@ -123,15 +142,17 @@ SWGInstanceSummaryResponse::fromJsonObject(QJsonObject pJson) {
QString QString
SWGInstanceSummaryResponse::asJson () SWGInstanceSummaryResponse::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGInstanceSummaryResponse::asJsonObject() { SWGInstanceSummaryResponse::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(version != nullptr && *version != QString("")){ if(version != nullptr && *version != QString("")){
toJsonValue(QString("version"), version, obj, QString("QString")); toJsonValue(QString("version"), version, obj, QString("QString"));
} }
@ -139,13 +160,13 @@ SWGInstanceSummaryResponse::asJsonObject() {
toJsonValue(QString("qtVersion"), qt_version, obj, QString("QString")); toJsonValue(QString("qtVersion"), qt_version, obj, QString("QString"));
} }
if(m_dsp_rx_bits_isSet){ if(m_dsp_rx_bits_isSet){
obj.insert("dspRxBits", QJsonValue(dsp_rx_bits)); obj->insert("dspRxBits", QJsonValue(dsp_rx_bits));
} }
if(m_dsp_tx_bits_isSet){ if(m_dsp_tx_bits_isSet){
obj.insert("dspTxBits", QJsonValue(dsp_tx_bits)); obj->insert("dspTxBits", QJsonValue(dsp_tx_bits));
} }
if(m_pid_isSet){ if(m_pid_isSet){
obj.insert("pid", QJsonValue(pid)); obj->insert("pid", QJsonValue(pid));
} }
if(appname != nullptr && *appname != QString("")){ if(appname != nullptr && *appname != QString("")){
toJsonValue(QString("appname"), appname, obj, QString("QString")); toJsonValue(QString("appname"), appname, obj, QString("QString"));

View File

@ -33,15 +33,15 @@ namespace SWGSDRangel {
class SWGInstanceSummaryResponse: public SWGObject { class SWGInstanceSummaryResponse: public SWGObject {
public: public:
SWGInstanceSummaryResponse(); SWGInstanceSummaryResponse();
SWGInstanceSummaryResponse(QString json); SWGInstanceSummaryResponse(QString* json);
~SWGInstanceSummaryResponse(); virtual ~SWGInstanceSummaryResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGInstanceSummaryResponse* fromJson(QString jsonString); SWGInstanceSummaryResponse* fromJson(QString &jsonString);
QString* getVersion(); QString* getVersion();
void setVersion(QString* version); void setVersion(QString* version);

View File

@ -22,13 +22,50 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGLimeSdrInputSettings::SWGLimeSdrInputSettings(QString json) { SWGLimeSdrInputSettings::SWGLimeSdrInputSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGLimeSdrInputSettings::SWGLimeSdrInputSettings() { SWGLimeSdrInputSettings::SWGLimeSdrInputSettings() {
init(); center_frequency = 0L;
m_center_frequency_isSet = false;
dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
log2_hard_decim = 0;
m_log2_hard_decim_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
iq_correction = 0;
m_iq_correction_isSet = false;
log2_soft_decim = 0;
m_log2_soft_decim_isSet = false;
lpf_bw = 0;
m_lpf_bw_isSet = false;
lpf_fir_enable = 0;
m_lpf_fir_enable_isSet = false;
lpf_firbw = 0;
m_lpf_firbw_isSet = false;
gain = 0;
m_gain_isSet = false;
nco_enable = 0;
m_nco_enable_isSet = false;
nco_frequency = 0;
m_nco_frequency_isSet = false;
antenna_path = 0;
m_antenna_path_isSet = false;
gain_mode = 0;
m_gain_mode_isSet = false;
lna_gain = 0;
m_lna_gain_isSet = false;
tia_gain = 0;
m_tia_gain_isSet = false;
pga_gain = 0;
m_pga_gain_isSet = false;
ext_clock = 0;
m_ext_clock_isSet = false;
ext_clock_freq = 0;
m_ext_clock_freq_isSet = false;
} }
SWGLimeSdrInputSettings::~SWGLimeSdrInputSettings() { SWGLimeSdrInputSettings::~SWGLimeSdrInputSettings() {
@ -101,7 +138,7 @@ SWGLimeSdrInputSettings::cleanup() {
} }
SWGLimeSdrInputSettings* SWGLimeSdrInputSettings*
SWGLimeSdrInputSettings::fromJson(QString json) { SWGLimeSdrInputSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -110,7 +147,7 @@ SWGLimeSdrInputSettings::fromJson(QString json) {
} }
void void
SWGLimeSdrInputSettings::fromJsonObject(QJsonObject pJson) { SWGLimeSdrInputSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
@ -154,71 +191,73 @@ SWGLimeSdrInputSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGLimeSdrInputSettings::asJson () SWGLimeSdrInputSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGLimeSdrInputSettings::asJsonObject() { SWGLimeSdrInputSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_center_frequency_isSet){ if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency)); obj->insert("centerFrequency", QJsonValue(center_frequency));
} }
if(m_dev_sample_rate_isSet){ if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate)); obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
} }
if(m_log2_hard_decim_isSet){ if(m_log2_hard_decim_isSet){
obj.insert("log2HardDecim", QJsonValue(log2_hard_decim)); obj->insert("log2HardDecim", QJsonValue(log2_hard_decim));
} }
if(m_dc_block_isSet){ if(m_dc_block_isSet){
obj.insert("dcBlock", QJsonValue(dc_block)); obj->insert("dcBlock", QJsonValue(dc_block));
} }
if(m_iq_correction_isSet){ if(m_iq_correction_isSet){
obj.insert("iqCorrection", QJsonValue(iq_correction)); obj->insert("iqCorrection", QJsonValue(iq_correction));
} }
if(m_log2_soft_decim_isSet){ if(m_log2_soft_decim_isSet){
obj.insert("log2SoftDecim", QJsonValue(log2_soft_decim)); obj->insert("log2SoftDecim", QJsonValue(log2_soft_decim));
} }
if(m_lpf_bw_isSet){ if(m_lpf_bw_isSet){
obj.insert("lpfBW", QJsonValue(lpf_bw)); obj->insert("lpfBW", QJsonValue(lpf_bw));
} }
if(m_lpf_fir_enable_isSet){ if(m_lpf_fir_enable_isSet){
obj.insert("lpfFIREnable", QJsonValue(lpf_fir_enable)); obj->insert("lpfFIREnable", QJsonValue(lpf_fir_enable));
} }
if(m_lpf_firbw_isSet){ if(m_lpf_firbw_isSet){
obj.insert("lpfFIRBW", QJsonValue(lpf_firbw)); obj->insert("lpfFIRBW", QJsonValue(lpf_firbw));
} }
if(m_gain_isSet){ if(m_gain_isSet){
obj.insert("gain", QJsonValue(gain)); obj->insert("gain", QJsonValue(gain));
} }
if(m_nco_enable_isSet){ if(m_nco_enable_isSet){
obj.insert("ncoEnable", QJsonValue(nco_enable)); obj->insert("ncoEnable", QJsonValue(nco_enable));
} }
if(m_nco_frequency_isSet){ if(m_nco_frequency_isSet){
obj.insert("ncoFrequency", QJsonValue(nco_frequency)); obj->insert("ncoFrequency", QJsonValue(nco_frequency));
} }
if(m_antenna_path_isSet){ if(m_antenna_path_isSet){
obj.insert("antennaPath", QJsonValue(antenna_path)); obj->insert("antennaPath", QJsonValue(antenna_path));
} }
if(m_gain_mode_isSet){ if(m_gain_mode_isSet){
obj.insert("gainMode", QJsonValue(gain_mode)); obj->insert("gainMode", QJsonValue(gain_mode));
} }
if(m_lna_gain_isSet){ if(m_lna_gain_isSet){
obj.insert("lnaGain", QJsonValue(lna_gain)); obj->insert("lnaGain", QJsonValue(lna_gain));
} }
if(m_tia_gain_isSet){ if(m_tia_gain_isSet){
obj.insert("tiaGain", QJsonValue(tia_gain)); obj->insert("tiaGain", QJsonValue(tia_gain));
} }
if(m_pga_gain_isSet){ if(m_pga_gain_isSet){
obj.insert("pgaGain", QJsonValue(pga_gain)); obj->insert("pgaGain", QJsonValue(pga_gain));
} }
if(m_ext_clock_isSet){ if(m_ext_clock_isSet){
obj.insert("extClock", QJsonValue(ext_clock)); obj->insert("extClock", QJsonValue(ext_clock));
} }
if(m_ext_clock_freq_isSet){ if(m_ext_clock_freq_isSet){
obj.insert("extClockFreq", QJsonValue(ext_clock_freq)); obj->insert("extClockFreq", QJsonValue(ext_clock_freq));
} }
return obj; return obj;

View File

@ -30,15 +30,15 @@ namespace SWGSDRangel {
class SWGLimeSdrInputSettings: public SWGObject { class SWGLimeSdrInputSettings: public SWGObject {
public: public:
SWGLimeSdrInputSettings(); SWGLimeSdrInputSettings();
SWGLimeSdrInputSettings(QString json); SWGLimeSdrInputSettings(QString* json);
~SWGLimeSdrInputSettings(); virtual ~SWGLimeSdrInputSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGLimeSdrInputSettings* fromJson(QString jsonString); SWGLimeSdrInputSettings* fromJson(QString &jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);

View File

@ -22,13 +22,38 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings(QString json) { SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings() { SWGLimeSdrOutputSettings::SWGLimeSdrOutputSettings() {
init(); center_frequency = 0L;
m_center_frequency_isSet = false;
dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
log2_hard_interp = 0;
m_log2_hard_interp_isSet = false;
log2_soft_interp = 0;
m_log2_soft_interp_isSet = false;
lpf_bw = 0;
m_lpf_bw_isSet = false;
lpf_fir_enable = 0;
m_lpf_fir_enable_isSet = false;
lpf_firbw = 0;
m_lpf_firbw_isSet = false;
gain = 0;
m_gain_isSet = false;
nco_enable = 0;
m_nco_enable_isSet = false;
nco_frequency = 0;
m_nco_frequency_isSet = false;
antenna_path = 0;
m_antenna_path_isSet = false;
ext_clock = 0;
m_ext_clock_isSet = false;
ext_clock_freq = 0;
m_ext_clock_freq_isSet = false;
} }
SWGLimeSdrOutputSettings::~SWGLimeSdrOutputSettings() { SWGLimeSdrOutputSettings::~SWGLimeSdrOutputSettings() {
@ -83,7 +108,7 @@ SWGLimeSdrOutputSettings::cleanup() {
} }
SWGLimeSdrOutputSettings* SWGLimeSdrOutputSettings*
SWGLimeSdrOutputSettings::fromJson(QString json) { SWGLimeSdrOutputSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -92,7 +117,7 @@ SWGLimeSdrOutputSettings::fromJson(QString json) {
} }
void void
SWGLimeSdrOutputSettings::fromJsonObject(QJsonObject pJson) { SWGLimeSdrOutputSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
@ -124,53 +149,55 @@ SWGLimeSdrOutputSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGLimeSdrOutputSettings::asJson () SWGLimeSdrOutputSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGLimeSdrOutputSettings::asJsonObject() { SWGLimeSdrOutputSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_center_frequency_isSet){ if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency)); obj->insert("centerFrequency", QJsonValue(center_frequency));
} }
if(m_dev_sample_rate_isSet){ if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate)); obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
} }
if(m_log2_hard_interp_isSet){ if(m_log2_hard_interp_isSet){
obj.insert("log2HardInterp", QJsonValue(log2_hard_interp)); obj->insert("log2HardInterp", QJsonValue(log2_hard_interp));
} }
if(m_log2_soft_interp_isSet){ if(m_log2_soft_interp_isSet){
obj.insert("log2SoftInterp", QJsonValue(log2_soft_interp)); obj->insert("log2SoftInterp", QJsonValue(log2_soft_interp));
} }
if(m_lpf_bw_isSet){ if(m_lpf_bw_isSet){
obj.insert("lpfBW", QJsonValue(lpf_bw)); obj->insert("lpfBW", QJsonValue(lpf_bw));
} }
if(m_lpf_fir_enable_isSet){ if(m_lpf_fir_enable_isSet){
obj.insert("lpfFIREnable", QJsonValue(lpf_fir_enable)); obj->insert("lpfFIREnable", QJsonValue(lpf_fir_enable));
} }
if(m_lpf_firbw_isSet){ if(m_lpf_firbw_isSet){
obj.insert("lpfFIRBW", QJsonValue(lpf_firbw)); obj->insert("lpfFIRBW", QJsonValue(lpf_firbw));
} }
if(m_gain_isSet){ if(m_gain_isSet){
obj.insert("gain", QJsonValue(gain)); obj->insert("gain", QJsonValue(gain));
} }
if(m_nco_enable_isSet){ if(m_nco_enable_isSet){
obj.insert("ncoEnable", QJsonValue(nco_enable)); obj->insert("ncoEnable", QJsonValue(nco_enable));
} }
if(m_nco_frequency_isSet){ if(m_nco_frequency_isSet){
obj.insert("ncoFrequency", QJsonValue(nco_frequency)); obj->insert("ncoFrequency", QJsonValue(nco_frequency));
} }
if(m_antenna_path_isSet){ if(m_antenna_path_isSet){
obj.insert("antennaPath", QJsonValue(antenna_path)); obj->insert("antennaPath", QJsonValue(antenna_path));
} }
if(m_ext_clock_isSet){ if(m_ext_clock_isSet){
obj.insert("extClock", QJsonValue(ext_clock)); obj->insert("extClock", QJsonValue(ext_clock));
} }
if(m_ext_clock_freq_isSet){ if(m_ext_clock_freq_isSet){
obj.insert("extClockFreq", QJsonValue(ext_clock_freq)); obj->insert("extClockFreq", QJsonValue(ext_clock_freq));
} }
return obj; return obj;

View File

@ -30,15 +30,15 @@ namespace SWGSDRangel {
class SWGLimeSdrOutputSettings: public SWGObject { class SWGLimeSdrOutputSettings: public SWGObject {
public: public:
SWGLimeSdrOutputSettings(); SWGLimeSdrOutputSettings();
SWGLimeSdrOutputSettings(QString json); SWGLimeSdrOutputSettings(QString* json);
~SWGLimeSdrOutputSettings(); virtual ~SWGLimeSdrOutputSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGLimeSdrOutputSettings* fromJson(QString jsonString); SWGLimeSdrOutputSettings* fromJson(QString &jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);

View File

@ -22,13 +22,16 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGLocationInformation::SWGLocationInformation(QString json) { SWGLocationInformation::SWGLocationInformation(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGLocationInformation::SWGLocationInformation() { SWGLocationInformation::SWGLocationInformation() {
init(); latitude = 0.0f;
m_latitude_isSet = false;
longitude = 0.0f;
m_longitude_isSet = false;
} }
SWGLocationInformation::~SWGLocationInformation() { SWGLocationInformation::~SWGLocationInformation() {
@ -50,7 +53,7 @@ SWGLocationInformation::cleanup() {
} }
SWGLocationInformation* SWGLocationInformation*
SWGLocationInformation::fromJson(QString json) { SWGLocationInformation::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -59,7 +62,7 @@ SWGLocationInformation::fromJson(QString json) {
} }
void void
SWGLocationInformation::fromJsonObject(QJsonObject pJson) { SWGLocationInformation::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&latitude, pJson["latitude"], "float", ""); ::SWGSDRangel::setValue(&latitude, pJson["latitude"], "float", "");
::SWGSDRangel::setValue(&longitude, pJson["longitude"], "float", ""); ::SWGSDRangel::setValue(&longitude, pJson["longitude"], "float", "");
@ -69,20 +72,22 @@ SWGLocationInformation::fromJsonObject(QJsonObject pJson) {
QString QString
SWGLocationInformation::asJson () SWGLocationInformation::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGLocationInformation::asJsonObject() { SWGLocationInformation::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_latitude_isSet){ if(m_latitude_isSet){
obj.insert("latitude", QJsonValue(latitude)); obj->insert("latitude", QJsonValue(latitude));
} }
if(m_longitude_isSet){ if(m_longitude_isSet){
obj.insert("longitude", QJsonValue(longitude)); obj->insert("longitude", QJsonValue(longitude));
} }
return obj; return obj;

View File

@ -30,15 +30,15 @@ namespace SWGSDRangel {
class SWGLocationInformation: public SWGObject { class SWGLocationInformation: public SWGObject {
public: public:
SWGLocationInformation(); SWGLocationInformation();
SWGLocationInformation(QString json); SWGLocationInformation(QString* json);
~SWGLocationInformation(); virtual ~SWGLocationInformation();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGLocationInformation* fromJson(QString jsonString); SWGLocationInformation* fromJson(QString &jsonString);
float getLatitude(); float getLatitude();
void setLatitude(float latitude); void setLatitude(float latitude);

View File

@ -22,13 +22,20 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGLoggingInfo::SWGLoggingInfo(QString json) { SWGLoggingInfo::SWGLoggingInfo(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGLoggingInfo::SWGLoggingInfo() { SWGLoggingInfo::SWGLoggingInfo() {
init(); console_level = nullptr;
m_console_level_isSet = false;
file_level = nullptr;
m_file_level_isSet = false;
dump_to_file = 0;
m_dump_to_file_isSet = false;
file_name = nullptr;
m_file_name_isSet = false;
} }
SWGLoggingInfo::~SWGLoggingInfo() { SWGLoggingInfo::~SWGLoggingInfo() {
@ -62,7 +69,7 @@ SWGLoggingInfo::cleanup() {
} }
SWGLoggingInfo* SWGLoggingInfo*
SWGLoggingInfo::fromJson(QString json) { SWGLoggingInfo::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -71,7 +78,7 @@ SWGLoggingInfo::fromJson(QString json) {
} }
void void
SWGLoggingInfo::fromJsonObject(QJsonObject pJson) { SWGLoggingInfo::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&console_level, pJson["consoleLevel"], "QString", "QString"); ::SWGSDRangel::setValue(&console_level, pJson["consoleLevel"], "QString", "QString");
::SWGSDRangel::setValue(&file_level, pJson["fileLevel"], "QString", "QString"); ::SWGSDRangel::setValue(&file_level, pJson["fileLevel"], "QString", "QString");
@ -85,15 +92,17 @@ SWGLoggingInfo::fromJsonObject(QJsonObject pJson) {
QString QString
SWGLoggingInfo::asJson () SWGLoggingInfo::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGLoggingInfo::asJsonObject() { SWGLoggingInfo::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(console_level != nullptr && *console_level != QString("")){ if(console_level != nullptr && *console_level != QString("")){
toJsonValue(QString("consoleLevel"), console_level, obj, QString("QString")); toJsonValue(QString("consoleLevel"), console_level, obj, QString("QString"));
} }
@ -101,7 +110,7 @@ SWGLoggingInfo::asJsonObject() {
toJsonValue(QString("fileLevel"), file_level, obj, QString("QString")); toJsonValue(QString("fileLevel"), file_level, obj, QString("QString"));
} }
if(m_dump_to_file_isSet){ if(m_dump_to_file_isSet){
obj.insert("dumpToFile", QJsonValue(dump_to_file)); obj->insert("dumpToFile", QJsonValue(dump_to_file));
} }
if(file_name != nullptr && *file_name != QString("")){ if(file_name != nullptr && *file_name != QString("")){
toJsonValue(QString("fileName"), file_name, obj, QString("QString")); toJsonValue(QString("fileName"), file_name, obj, QString("QString"));

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGLoggingInfo: public SWGObject { class SWGLoggingInfo: public SWGObject {
public: public:
SWGLoggingInfo(); SWGLoggingInfo();
SWGLoggingInfo(QString json); SWGLoggingInfo(QString* json);
~SWGLoggingInfo(); virtual ~SWGLoggingInfo();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGLoggingInfo* fromJson(QString jsonString); SWGLoggingInfo* fromJson(QString &jsonString);
QString* getConsoleLevel(); QString* getConsoleLevel();
void setConsoleLevel(QString* console_level); void setConsoleLevel(QString* console_level);

View File

@ -171,12 +171,13 @@ namespace SWGSDRangel {
} }
inline void* create(QString json, QString type) { inline void* create(QString json, QString type) {
void* val = create(type);
if(val != nullptr) {
SWGObject* obj = static_cast<SWGObject*>(val);
return obj->fromJson(json);
}
if(type.startsWith("QString")) { if(type.startsWith("QString")) {
return new QString(); return new QString();
}
auto val = static_cast<SWGObject*>(create(type));
if(val != nullptr) {
return val->fromJson(json);
} }
return nullptr; return nullptr;
} }

View File

@ -22,13 +22,46 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGNFMDemodSettings::SWGNFMDemodSettings(QString json) { SWGNFMDemodSettings::SWGNFMDemodSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGNFMDemodSettings::SWGNFMDemodSettings() { SWGNFMDemodSettings::SWGNFMDemodSettings() {
init(); input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false;
af_bandwidth = 0.0f;
m_af_bandwidth_isSet = false;
fm_deviation = 0;
m_fm_deviation_isSet = false;
squelch_gate = 0;
m_squelch_gate_isSet = false;
delta_squelch = 0;
m_delta_squelch_isSet = false;
squelch = 0.0f;
m_squelch_isSet = false;
volume = 0.0f;
m_volume_isSet = false;
ctcss_on = 0;
m_ctcss_on_isSet = false;
audio_mute = 0;
m_audio_mute_isSet = false;
ctcss_index = 0;
m_ctcss_index_isSet = false;
audio_sample_rate = 0;
m_audio_sample_rate_isSet = false;
copy_audio_to_udp = 0;
m_copy_audio_to_udp_isSet = false;
udp_address = nullptr;
m_udp_address_isSet = false;
udp_port = 0;
m_udp_port_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = nullptr;
m_title_isSet = false;
} }
SWGNFMDemodSettings::~SWGNFMDemodSettings() { SWGNFMDemodSettings::~SWGNFMDemodSettings() {
@ -99,7 +132,7 @@ SWGNFMDemodSettings::cleanup() {
} }
SWGNFMDemodSettings* SWGNFMDemodSettings*
SWGNFMDemodSettings::fromJson(QString json) { SWGNFMDemodSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -108,7 +141,7 @@ SWGNFMDemodSettings::fromJson(QString json) {
} }
void void
SWGNFMDemodSettings::fromJsonObject(QJsonObject pJson) { SWGNFMDemodSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
@ -148,62 +181,64 @@ SWGNFMDemodSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGNFMDemodSettings::asJson () SWGNFMDemodSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGNFMDemodSettings::asJsonObject() { SWGNFMDemodSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_input_frequency_offset_isSet){ if(m_input_frequency_offset_isSet){
obj.insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
} }
if(m_rf_bandwidth_isSet){ if(m_rf_bandwidth_isSet){
obj.insert("rfBandwidth", QJsonValue(rf_bandwidth)); obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
} }
if(m_af_bandwidth_isSet){ if(m_af_bandwidth_isSet){
obj.insert("afBandwidth", QJsonValue(af_bandwidth)); obj->insert("afBandwidth", QJsonValue(af_bandwidth));
} }
if(m_fm_deviation_isSet){ if(m_fm_deviation_isSet){
obj.insert("fmDeviation", QJsonValue(fm_deviation)); obj->insert("fmDeviation", QJsonValue(fm_deviation));
} }
if(m_squelch_gate_isSet){ if(m_squelch_gate_isSet){
obj.insert("squelchGate", QJsonValue(squelch_gate)); obj->insert("squelchGate", QJsonValue(squelch_gate));
} }
if(m_delta_squelch_isSet){ if(m_delta_squelch_isSet){
obj.insert("deltaSquelch", QJsonValue(delta_squelch)); obj->insert("deltaSquelch", QJsonValue(delta_squelch));
} }
if(m_squelch_isSet){ if(m_squelch_isSet){
obj.insert("squelch", QJsonValue(squelch)); obj->insert("squelch", QJsonValue(squelch));
} }
if(m_volume_isSet){ if(m_volume_isSet){
obj.insert("volume", QJsonValue(volume)); obj->insert("volume", QJsonValue(volume));
} }
if(m_ctcss_on_isSet){ if(m_ctcss_on_isSet){
obj.insert("ctcssOn", QJsonValue(ctcss_on)); obj->insert("ctcssOn", QJsonValue(ctcss_on));
} }
if(m_audio_mute_isSet){ if(m_audio_mute_isSet){
obj.insert("audioMute", QJsonValue(audio_mute)); obj->insert("audioMute", QJsonValue(audio_mute));
} }
if(m_ctcss_index_isSet){ if(m_ctcss_index_isSet){
obj.insert("ctcssIndex", QJsonValue(ctcss_index)); obj->insert("ctcssIndex", QJsonValue(ctcss_index));
} }
if(m_audio_sample_rate_isSet){ if(m_audio_sample_rate_isSet){
obj.insert("audioSampleRate", QJsonValue(audio_sample_rate)); obj->insert("audioSampleRate", QJsonValue(audio_sample_rate));
} }
if(m_copy_audio_to_udp_isSet){ if(m_copy_audio_to_udp_isSet){
obj.insert("copyAudioToUDP", QJsonValue(copy_audio_to_udp)); obj->insert("copyAudioToUDP", QJsonValue(copy_audio_to_udp));
} }
if(udp_address != nullptr && *udp_address != QString("")){ if(udp_address != nullptr && *udp_address != QString("")){
toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString")); toJsonValue(QString("udpAddress"), udp_address, obj, QString("QString"));
} }
if(m_udp_port_isSet){ if(m_udp_port_isSet){
obj.insert("udpPort", QJsonValue(udp_port)); obj->insert("udpPort", QJsonValue(udp_port));
} }
if(m_rgb_color_isSet){ if(m_rgb_color_isSet){
obj.insert("rgbColor", QJsonValue(rgb_color)); obj->insert("rgbColor", QJsonValue(rgb_color));
} }
if(title != nullptr && *title != QString("")){ if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString")); toJsonValue(QString("title"), title, obj, QString("QString"));

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGNFMDemodSettings: public SWGObject { class SWGNFMDemodSettings: public SWGObject {
public: public:
SWGNFMDemodSettings(); SWGNFMDemodSettings();
SWGNFMDemodSettings(QString json); SWGNFMDemodSettings(QString* json);
~SWGNFMDemodSettings(); virtual ~SWGNFMDemodSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGNFMDemodSettings* fromJson(QString jsonString); SWGNFMDemodSettings* fromJson(QString &jsonString);
qint64 getInputFrequencyOffset(); qint64 getInputFrequencyOffset();
void setInputFrequencyOffset(qint64 input_frequency_offset); void setInputFrequencyOffset(qint64 input_frequency_offset);

View File

@ -22,13 +22,42 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGNFMModSettings::SWGNFMModSettings(QString json) { SWGNFMModSettings::SWGNFMModSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGNFMModSettings::SWGNFMModSettings() { SWGNFMModSettings::SWGNFMModSettings() {
init(); input_frequency_offset = 0L;
m_input_frequency_offset_isSet = false;
rf_bandwidth = 0.0f;
m_rf_bandwidth_isSet = false;
af_bandwidth = 0.0f;
m_af_bandwidth_isSet = false;
fm_deviation = 0.0f;
m_fm_deviation_isSet = false;
tone_frequency = 0.0f;
m_tone_frequency_isSet = false;
volume_factor = 0.0f;
m_volume_factor_isSet = false;
audio_sample_rate = 0;
m_audio_sample_rate_isSet = false;
channel_mute = 0;
m_channel_mute_isSet = false;
play_loop = 0;
m_play_loop_isSet = false;
ctcss_on = 0;
m_ctcss_on_isSet = false;
ctcss_index = 0;
m_ctcss_index_isSet = false;
rgb_color = 0;
m_rgb_color_isSet = false;
title = nullptr;
m_title_isSet = false;
mod_af_input = 0;
m_mod_af_input_isSet = false;
cw_keyer = nullptr;
m_cw_keyer_isSet = false;
} }
SWGNFMModSettings::~SWGNFMModSettings() { SWGNFMModSettings::~SWGNFMModSettings() {
@ -93,7 +122,7 @@ SWGNFMModSettings::cleanup() {
} }
SWGNFMModSettings* SWGNFMModSettings*
SWGNFMModSettings::fromJson(QString json) { SWGNFMModSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -102,7 +131,7 @@ SWGNFMModSettings::fromJson(QString json) {
} }
void void
SWGNFMModSettings::fromJsonObject(QJsonObject pJson) { SWGNFMModSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", ""); ::SWGSDRangel::setValue(&input_frequency_offset, pJson["inputFrequencyOffset"], "qint64", "");
::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", ""); ::SWGSDRangel::setValue(&rf_bandwidth, pJson["rfBandwidth"], "float", "");
@ -138,56 +167,58 @@ SWGNFMModSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGNFMModSettings::asJson () SWGNFMModSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGNFMModSettings::asJsonObject() { SWGNFMModSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_input_frequency_offset_isSet){ if(m_input_frequency_offset_isSet){
obj.insert("inputFrequencyOffset", QJsonValue(input_frequency_offset)); obj->insert("inputFrequencyOffset", QJsonValue(input_frequency_offset));
} }
if(m_rf_bandwidth_isSet){ if(m_rf_bandwidth_isSet){
obj.insert("rfBandwidth", QJsonValue(rf_bandwidth)); obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
} }
if(m_af_bandwidth_isSet){ if(m_af_bandwidth_isSet){
obj.insert("afBandwidth", QJsonValue(af_bandwidth)); obj->insert("afBandwidth", QJsonValue(af_bandwidth));
} }
if(m_fm_deviation_isSet){ if(m_fm_deviation_isSet){
obj.insert("fmDeviation", QJsonValue(fm_deviation)); obj->insert("fmDeviation", QJsonValue(fm_deviation));
} }
if(m_tone_frequency_isSet){ if(m_tone_frequency_isSet){
obj.insert("toneFrequency", QJsonValue(tone_frequency)); obj->insert("toneFrequency", QJsonValue(tone_frequency));
} }
if(m_volume_factor_isSet){ if(m_volume_factor_isSet){
obj.insert("volumeFactor", QJsonValue(volume_factor)); obj->insert("volumeFactor", QJsonValue(volume_factor));
} }
if(m_audio_sample_rate_isSet){ if(m_audio_sample_rate_isSet){
obj.insert("audioSampleRate", QJsonValue(audio_sample_rate)); obj->insert("audioSampleRate", QJsonValue(audio_sample_rate));
} }
if(m_channel_mute_isSet){ if(m_channel_mute_isSet){
obj.insert("channelMute", QJsonValue(channel_mute)); obj->insert("channelMute", QJsonValue(channel_mute));
} }
if(m_play_loop_isSet){ if(m_play_loop_isSet){
obj.insert("playLoop", QJsonValue(play_loop)); obj->insert("playLoop", QJsonValue(play_loop));
} }
if(m_ctcss_on_isSet){ if(m_ctcss_on_isSet){
obj.insert("ctcssOn", QJsonValue(ctcss_on)); obj->insert("ctcssOn", QJsonValue(ctcss_on));
} }
if(m_ctcss_index_isSet){ if(m_ctcss_index_isSet){
obj.insert("ctcssIndex", QJsonValue(ctcss_index)); obj->insert("ctcssIndex", QJsonValue(ctcss_index));
} }
if(m_rgb_color_isSet){ if(m_rgb_color_isSet){
obj.insert("rgbColor", QJsonValue(rgb_color)); obj->insert("rgbColor", QJsonValue(rgb_color));
} }
if(title != nullptr && *title != QString("")){ if(title != nullptr && *title != QString("")){
toJsonValue(QString("title"), title, obj, QString("QString")); toJsonValue(QString("title"), title, obj, QString("QString"));
} }
if(m_mod_af_input_isSet){ if(m_mod_af_input_isSet){
obj.insert("modAFInput", QJsonValue(mod_af_input)); obj->insert("modAFInput", QJsonValue(mod_af_input));
} }
if((cw_keyer != nullptr) && (cw_keyer->isSet())){ if((cw_keyer != nullptr) && (cw_keyer->isSet())){
toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings")); toJsonValue(QString("cwKeyer"), cw_keyer, obj, QString("SWGCWKeyerSettings"));

View File

@ -32,15 +32,15 @@ namespace SWGSDRangel {
class SWGNFMModSettings: public SWGObject { class SWGNFMModSettings: public SWGObject {
public: public:
SWGNFMModSettings(); SWGNFMModSettings();
SWGNFMModSettings(QString json); SWGNFMModSettings(QString* json);
~SWGNFMModSettings(); virtual ~SWGNFMModSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGNFMModSettings* fromJson(QString jsonString); SWGNFMModSettings* fromJson(QString &jsonString);
qint64 getInputFrequencyOffset(); qint64 getInputFrequencyOffset();
void setInputFrequencyOffset(qint64 input_frequency_offset); void setInputFrequencyOffset(qint64 input_frequency_offset);

View File

@ -19,15 +19,15 @@ namespace SWGSDRangel {
class SWGObject { class SWGObject {
public: public:
virtual QJsonObject asJsonObject() { virtual QJsonObject* asJsonObject() {
return QJsonObject(); return new QJsonObject();
} }
virtual ~SWGObject() {} virtual ~SWGObject() {}
virtual SWGObject* fromJson(QString jsonString) { virtual SWGObject* fromJson(QString &jsonString) {
Q_UNUSED(jsonString); Q_UNUSED(jsonString);
return new SWGObject(); return new SWGObject();
} }
virtual void fromJsonObject(QJsonObject json) { virtual void fromJsonObject(QJsonObject &json) {
Q_UNUSED(json); Q_UNUSED(json);
} }
virtual QString asJson() { virtual QString asJson() {

View File

@ -22,13 +22,16 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetExport::SWGPresetExport(QString json) { SWGPresetExport::SWGPresetExport(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGPresetExport::SWGPresetExport() { SWGPresetExport::SWGPresetExport() {
init(); file_path = nullptr;
m_file_path_isSet = false;
preset = nullptr;
m_preset_isSet = false;
} }
SWGPresetExport::~SWGPresetExport() { SWGPresetExport::~SWGPresetExport() {
@ -54,7 +57,7 @@ SWGPresetExport::cleanup() {
} }
SWGPresetExport* SWGPresetExport*
SWGPresetExport::fromJson(QString json) { SWGPresetExport::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -63,7 +66,7 @@ SWGPresetExport::fromJson(QString json) {
} }
void void
SWGPresetExport::fromJsonObject(QJsonObject pJson) { SWGPresetExport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString"); ::SWGSDRangel::setValue(&file_path, pJson["filePath"], "QString", "QString");
::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier"); ::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier");
@ -73,15 +76,17 @@ SWGPresetExport::fromJsonObject(QJsonObject pJson) {
QString QString
SWGPresetExport::asJson () SWGPresetExport::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGPresetExport::asJsonObject() { SWGPresetExport::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(file_path != nullptr && *file_path != QString("")){ if(file_path != nullptr && *file_path != QString("")){
toJsonValue(QString("filePath"), file_path, obj, QString("QString")); toJsonValue(QString("filePath"), file_path, obj, QString("QString"));
} }

View File

@ -32,15 +32,15 @@ namespace SWGSDRangel {
class SWGPresetExport: public SWGObject { class SWGPresetExport: public SWGObject {
public: public:
SWGPresetExport(); SWGPresetExport();
SWGPresetExport(QString json); SWGPresetExport(QString* json);
~SWGPresetExport(); virtual ~SWGPresetExport();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGPresetExport* fromJson(QString jsonString); SWGPresetExport* fromJson(QString &jsonString);
QString* getFilePath(); QString* getFilePath();
void setFilePath(QString* file_path); void setFilePath(QString* file_path);

View File

@ -22,13 +22,18 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetGroup::SWGPresetGroup(QString json) { SWGPresetGroup::SWGPresetGroup(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGPresetGroup::SWGPresetGroup() { SWGPresetGroup::SWGPresetGroup() {
init(); group_name = nullptr;
m_group_name_isSet = false;
nb_presets = 0;
m_nb_presets_isSet = false;
presets = nullptr;
m_presets_isSet = false;
} }
SWGPresetGroup::~SWGPresetGroup() { SWGPresetGroup::~SWGPresetGroup() {
@ -61,7 +66,7 @@ SWGPresetGroup::cleanup() {
} }
SWGPresetGroup* SWGPresetGroup*
SWGPresetGroup::fromJson(QString json) { SWGPresetGroup::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -70,7 +75,7 @@ SWGPresetGroup::fromJson(QString json) {
} }
void void
SWGPresetGroup::fromJsonObject(QJsonObject pJson) { SWGPresetGroup::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString"); ::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
::SWGSDRangel::setValue(&nb_presets, pJson["nbPresets"], "qint32", ""); ::SWGSDRangel::setValue(&nb_presets, pJson["nbPresets"], "qint32", "");
@ -82,20 +87,22 @@ SWGPresetGroup::fromJsonObject(QJsonObject pJson) {
QString QString
SWGPresetGroup::asJson () SWGPresetGroup::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGPresetGroup::asJsonObject() { SWGPresetGroup::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(group_name != nullptr && *group_name != QString("")){ if(group_name != nullptr && *group_name != QString("")){
toJsonValue(QString("groupName"), group_name, obj, QString("QString")); toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
} }
if(m_nb_presets_isSet){ if(m_nb_presets_isSet){
obj.insert("nbPresets", QJsonValue(nb_presets)); obj->insert("nbPresets", QJsonValue(nb_presets));
} }
if(presets->size() > 0){ if(presets->size() > 0){
toJsonArray((QList<void*>*)presets, obj, "presets", "SWGPresetItem"); toJsonArray((QList<void*>*)presets, obj, "presets", "SWGPresetItem");

View File

@ -33,15 +33,15 @@ namespace SWGSDRangel {
class SWGPresetGroup: public SWGObject { class SWGPresetGroup: public SWGObject {
public: public:
SWGPresetGroup(); SWGPresetGroup();
SWGPresetGroup(QString json); SWGPresetGroup(QString* json);
~SWGPresetGroup(); virtual ~SWGPresetGroup();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGPresetGroup* fromJson(QString jsonString); SWGPresetGroup* fromJson(QString &jsonString);
QString* getGroupName(); QString* getGroupName();
void setGroupName(QString* group_name); void setGroupName(QString* group_name);

View File

@ -22,13 +22,20 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetIdentifier::SWGPresetIdentifier(QString json) { SWGPresetIdentifier::SWGPresetIdentifier(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGPresetIdentifier::SWGPresetIdentifier() { SWGPresetIdentifier::SWGPresetIdentifier() {
init(); group_name = nullptr;
m_group_name_isSet = false;
center_frequency = 0L;
m_center_frequency_isSet = false;
type = nullptr;
m_type_isSet = false;
name = nullptr;
m_name_isSet = false;
} }
SWGPresetIdentifier::~SWGPresetIdentifier() { SWGPresetIdentifier::~SWGPresetIdentifier() {
@ -62,7 +69,7 @@ SWGPresetIdentifier::cleanup() {
} }
SWGPresetIdentifier* SWGPresetIdentifier*
SWGPresetIdentifier::fromJson(QString json) { SWGPresetIdentifier::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -71,7 +78,7 @@ SWGPresetIdentifier::fromJson(QString json) {
} }
void void
SWGPresetIdentifier::fromJsonObject(QJsonObject pJson) { SWGPresetIdentifier::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString"); ::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
@ -85,20 +92,22 @@ SWGPresetIdentifier::fromJsonObject(QJsonObject pJson) {
QString QString
SWGPresetIdentifier::asJson () SWGPresetIdentifier::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGPresetIdentifier::asJsonObject() { SWGPresetIdentifier::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(group_name != nullptr && *group_name != QString("")){ if(group_name != nullptr && *group_name != QString("")){
toJsonValue(QString("groupName"), group_name, obj, QString("QString")); toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
} }
if(m_center_frequency_isSet){ if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency)); obj->insert("centerFrequency", QJsonValue(center_frequency));
} }
if(type != nullptr && *type != QString("")){ if(type != nullptr && *type != QString("")){
toJsonValue(QString("type"), type, obj, QString("QString")); toJsonValue(QString("type"), type, obj, QString("QString"));

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGPresetIdentifier: public SWGObject { class SWGPresetIdentifier: public SWGObject {
public: public:
SWGPresetIdentifier(); SWGPresetIdentifier();
SWGPresetIdentifier(QString json); SWGPresetIdentifier(QString* json);
~SWGPresetIdentifier(); virtual ~SWGPresetIdentifier();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGPresetIdentifier* fromJson(QString jsonString); SWGPresetIdentifier* fromJson(QString &jsonString);
QString* getGroupName(); QString* getGroupName();
void setGroupName(QString* group_name); void setGroupName(QString* group_name);

View File

@ -22,13 +22,18 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetImport::SWGPresetImport(QString json) { SWGPresetImport::SWGPresetImport(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGPresetImport::SWGPresetImport() { SWGPresetImport::SWGPresetImport() {
init(); group_name = nullptr;
m_group_name_isSet = false;
description = nullptr;
m_description_isSet = false;
file_path = nullptr;
m_file_path_isSet = false;
} }
SWGPresetImport::~SWGPresetImport() { SWGPresetImport::~SWGPresetImport() {
@ -59,7 +64,7 @@ SWGPresetImport::cleanup() {
} }
SWGPresetImport* SWGPresetImport*
SWGPresetImport::fromJson(QString json) { SWGPresetImport::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -68,7 +73,7 @@ SWGPresetImport::fromJson(QString json) {
} }
void void
SWGPresetImport::fromJsonObject(QJsonObject pJson) { SWGPresetImport::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString"); ::SWGSDRangel::setValue(&group_name, pJson["groupName"], "QString", "QString");
::SWGSDRangel::setValue(&description, pJson["description"], "QString", "QString"); ::SWGSDRangel::setValue(&description, pJson["description"], "QString", "QString");
@ -80,15 +85,17 @@ SWGPresetImport::fromJsonObject(QJsonObject pJson) {
QString QString
SWGPresetImport::asJson () SWGPresetImport::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGPresetImport::asJsonObject() { SWGPresetImport::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(group_name != nullptr && *group_name != QString("")){ if(group_name != nullptr && *group_name != QString("")){
toJsonValue(QString("groupName"), group_name, obj, QString("QString")); toJsonValue(QString("groupName"), group_name, obj, QString("QString"));
} }

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGPresetImport: public SWGObject { class SWGPresetImport: public SWGObject {
public: public:
SWGPresetImport(); SWGPresetImport();
SWGPresetImport(QString json); SWGPresetImport(QString* json);
~SWGPresetImport(); virtual ~SWGPresetImport();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGPresetImport* fromJson(QString jsonString); SWGPresetImport* fromJson(QString &jsonString);
QString* getGroupName(); QString* getGroupName();
void setGroupName(QString* group_name); void setGroupName(QString* group_name);

View File

@ -22,13 +22,18 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetItem::SWGPresetItem(QString json) { SWGPresetItem::SWGPresetItem(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGPresetItem::SWGPresetItem() { SWGPresetItem::SWGPresetItem() {
init(); center_frequency = 0L;
m_center_frequency_isSet = false;
type = nullptr;
m_type_isSet = false;
name = nullptr;
m_name_isSet = false;
} }
SWGPresetItem::~SWGPresetItem() { SWGPresetItem::~SWGPresetItem() {
@ -57,7 +62,7 @@ SWGPresetItem::cleanup() {
} }
SWGPresetItem* SWGPresetItem*
SWGPresetItem::fromJson(QString json) { SWGPresetItem::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -66,7 +71,7 @@ SWGPresetItem::fromJson(QString json) {
} }
void void
SWGPresetItem::fromJsonObject(QJsonObject pJson) { SWGPresetItem::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", ""); ::SWGSDRangel::setValue(&center_frequency, pJson["centerFrequency"], "qint64", "");
::SWGSDRangel::setValue(&type, pJson["type"], "QString", "QString"); ::SWGSDRangel::setValue(&type, pJson["type"], "QString", "QString");
@ -78,17 +83,19 @@ SWGPresetItem::fromJsonObject(QJsonObject pJson) {
QString QString
SWGPresetItem::asJson () SWGPresetItem::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGPresetItem::asJsonObject() { SWGPresetItem::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_center_frequency_isSet){ if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency)); obj->insert("centerFrequency", QJsonValue(center_frequency));
} }
if(type != nullptr && *type != QString("")){ if(type != nullptr && *type != QString("")){
toJsonValue(QString("type"), type, obj, QString("QString")); toJsonValue(QString("type"), type, obj, QString("QString"));

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGPresetItem: public SWGObject { class SWGPresetItem: public SWGObject {
public: public:
SWGPresetItem(); SWGPresetItem();
SWGPresetItem(QString json); SWGPresetItem(QString* json);
~SWGPresetItem(); virtual ~SWGPresetItem();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGPresetItem* fromJson(QString jsonString); SWGPresetItem* fromJson(QString &jsonString);
qint64 getCenterFrequency(); qint64 getCenterFrequency();
void setCenterFrequency(qint64 center_frequency); void setCenterFrequency(qint64 center_frequency);

View File

@ -22,13 +22,16 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresetTransfer::SWGPresetTransfer(QString json) { SWGPresetTransfer::SWGPresetTransfer(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGPresetTransfer::SWGPresetTransfer() { SWGPresetTransfer::SWGPresetTransfer() {
init(); device_set_index = 0;
m_device_set_index_isSet = false;
preset = nullptr;
m_preset_isSet = false;
} }
SWGPresetTransfer::~SWGPresetTransfer() { SWGPresetTransfer::~SWGPresetTransfer() {
@ -52,7 +55,7 @@ SWGPresetTransfer::cleanup() {
} }
SWGPresetTransfer* SWGPresetTransfer*
SWGPresetTransfer::fromJson(QString json) { SWGPresetTransfer::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -61,7 +64,7 @@ SWGPresetTransfer::fromJson(QString json) {
} }
void void
SWGPresetTransfer::fromJsonObject(QJsonObject pJson) { SWGPresetTransfer::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", ""); ::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", "");
::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier"); ::SWGSDRangel::setValue(&preset, pJson["preset"], "SWGPresetIdentifier", "SWGPresetIdentifier");
@ -71,17 +74,19 @@ SWGPresetTransfer::fromJsonObject(QJsonObject pJson) {
QString QString
SWGPresetTransfer::asJson () SWGPresetTransfer::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGPresetTransfer::asJsonObject() { SWGPresetTransfer::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_device_set_index_isSet){ if(m_device_set_index_isSet){
obj.insert("deviceSetIndex", QJsonValue(device_set_index)); obj->insert("deviceSetIndex", QJsonValue(device_set_index));
} }
if((preset != nullptr) && (preset->isSet())){ if((preset != nullptr) && (preset->isSet())){
toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier")); toJsonValue(QString("preset"), preset, obj, QString("SWGPresetIdentifier"));

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGPresetTransfer: public SWGObject { class SWGPresetTransfer: public SWGObject {
public: public:
SWGPresetTransfer(); SWGPresetTransfer();
SWGPresetTransfer(QString json); SWGPresetTransfer(QString* json);
~SWGPresetTransfer(); virtual ~SWGPresetTransfer();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGPresetTransfer* fromJson(QString jsonString); SWGPresetTransfer* fromJson(QString &jsonString);
qint32 getDeviceSetIndex(); qint32 getDeviceSetIndex();
void setDeviceSetIndex(qint32 device_set_index); void setDeviceSetIndex(qint32 device_set_index);

View File

@ -22,13 +22,16 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGPresets::SWGPresets(QString json) { SWGPresets::SWGPresets(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGPresets::SWGPresets() { SWGPresets::SWGPresets() {
init(); nb_groups = 0;
m_nb_groups_isSet = false;
groups = nullptr;
m_groups_isSet = false;
} }
SWGPresets::~SWGPresets() { SWGPresets::~SWGPresets() {
@ -56,7 +59,7 @@ SWGPresets::cleanup() {
} }
SWGPresets* SWGPresets*
SWGPresets::fromJson(QString json) { SWGPresets::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -65,7 +68,7 @@ SWGPresets::fromJson(QString json) {
} }
void void
SWGPresets::fromJsonObject(QJsonObject pJson) { SWGPresets::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&nb_groups, pJson["nbGroups"], "qint32", ""); ::SWGSDRangel::setValue(&nb_groups, pJson["nbGroups"], "qint32", "");
@ -75,17 +78,19 @@ SWGPresets::fromJsonObject(QJsonObject pJson) {
QString QString
SWGPresets::asJson () SWGPresets::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGPresets::asJsonObject() { SWGPresets::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_nb_groups_isSet){ if(m_nb_groups_isSet){
obj.insert("nbGroups", QJsonValue(nb_groups)); obj->insert("nbGroups", QJsonValue(nb_groups));
} }
if(groups->size() > 0){ if(groups->size() > 0){
toJsonArray((QList<void*>*)groups, obj, "groups", "SWGPresetGroup"); toJsonArray((QList<void*>*)groups, obj, "groups", "SWGPresetGroup");

View File

@ -32,15 +32,15 @@ namespace SWGSDRangel {
class SWGPresets: public SWGObject { class SWGPresets: public SWGObject {
public: public:
SWGPresets(); SWGPresets();
SWGPresets(QString json); SWGPresets(QString* json);
~SWGPresets(); virtual ~SWGPresets();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGPresets* fromJson(QString jsonString); SWGPresets* fromJson(QString &jsonString);
qint32 getNbGroups(); qint32 getNbGroups();
void setNbGroups(qint32 nb_groups); void setNbGroups(qint32 nb_groups);

View File

@ -22,13 +22,40 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGRtlSdrSettings::SWGRtlSdrSettings(QString json) { SWGRtlSdrSettings::SWGRtlSdrSettings(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGRtlSdrSettings::SWGRtlSdrSettings() { SWGRtlSdrSettings::SWGRtlSdrSettings() {
init(); dev_sample_rate = 0;
m_dev_sample_rate_isSet = false;
low_sample_rate = 0;
m_low_sample_rate_isSet = false;
center_frequency = 0L;
m_center_frequency_isSet = false;
gain = 0;
m_gain_isSet = false;
lo_ppm_correction = 0;
m_lo_ppm_correction_isSet = false;
log2_decim = 0;
m_log2_decim_isSet = false;
fc_pos = 0;
m_fc_pos_isSet = false;
dc_block = 0;
m_dc_block_isSet = false;
iq_imbalance = 0;
m_iq_imbalance_isSet = false;
agc = 0;
m_agc_isSet = false;
no_mod_mode = 0;
m_no_mod_mode_isSet = false;
transverter_mode = 0;
m_transverter_mode_isSet = false;
transverter_delta_frequency = 0L;
m_transverter_delta_frequency_isSet = false;
rf_bandwidth = 0;
m_rf_bandwidth_isSet = false;
} }
SWGRtlSdrSettings::~SWGRtlSdrSettings() { SWGRtlSdrSettings::~SWGRtlSdrSettings() {
@ -86,7 +113,7 @@ SWGRtlSdrSettings::cleanup() {
} }
SWGRtlSdrSettings* SWGRtlSdrSettings*
SWGRtlSdrSettings::fromJson(QString json) { SWGRtlSdrSettings::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -95,7 +122,7 @@ SWGRtlSdrSettings::fromJson(QString json) {
} }
void void
SWGRtlSdrSettings::fromJsonObject(QJsonObject pJson) { SWGRtlSdrSettings::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&dev_sample_rate, pJson["devSampleRate"], "qint32", "");
::SWGSDRangel::setValue(&low_sample_rate, pJson["lowSampleRate"], "qint32", ""); ::SWGSDRangel::setValue(&low_sample_rate, pJson["lowSampleRate"], "qint32", "");
@ -129,56 +156,58 @@ SWGRtlSdrSettings::fromJsonObject(QJsonObject pJson) {
QString QString
SWGRtlSdrSettings::asJson () SWGRtlSdrSettings::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGRtlSdrSettings::asJsonObject() { SWGRtlSdrSettings::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_dev_sample_rate_isSet){ if(m_dev_sample_rate_isSet){
obj.insert("devSampleRate", QJsonValue(dev_sample_rate)); obj->insert("devSampleRate", QJsonValue(dev_sample_rate));
} }
if(m_low_sample_rate_isSet){ if(m_low_sample_rate_isSet){
obj.insert("lowSampleRate", QJsonValue(low_sample_rate)); obj->insert("lowSampleRate", QJsonValue(low_sample_rate));
} }
if(m_center_frequency_isSet){ if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency)); obj->insert("centerFrequency", QJsonValue(center_frequency));
} }
if(m_gain_isSet){ if(m_gain_isSet){
obj.insert("gain", QJsonValue(gain)); obj->insert("gain", QJsonValue(gain));
} }
if(m_lo_ppm_correction_isSet){ if(m_lo_ppm_correction_isSet){
obj.insert("loPpmCorrection", QJsonValue(lo_ppm_correction)); obj->insert("loPpmCorrection", QJsonValue(lo_ppm_correction));
} }
if(m_log2_decim_isSet){ if(m_log2_decim_isSet){
obj.insert("log2Decim", QJsonValue(log2_decim)); obj->insert("log2Decim", QJsonValue(log2_decim));
} }
if(m_fc_pos_isSet){ if(m_fc_pos_isSet){
obj.insert("fcPos", QJsonValue(fc_pos)); obj->insert("fcPos", QJsonValue(fc_pos));
} }
if(m_dc_block_isSet){ if(m_dc_block_isSet){
obj.insert("dcBlock", QJsonValue(dc_block)); obj->insert("dcBlock", QJsonValue(dc_block));
} }
if(m_iq_imbalance_isSet){ if(m_iq_imbalance_isSet){
obj.insert("iqImbalance", QJsonValue(iq_imbalance)); obj->insert("iqImbalance", QJsonValue(iq_imbalance));
} }
if(m_agc_isSet){ if(m_agc_isSet){
obj.insert("agc", QJsonValue(agc)); obj->insert("agc", QJsonValue(agc));
} }
if(m_no_mod_mode_isSet){ if(m_no_mod_mode_isSet){
obj.insert("noModMode", QJsonValue(no_mod_mode)); obj->insert("noModMode", QJsonValue(no_mod_mode));
} }
if(m_transverter_mode_isSet){ if(m_transverter_mode_isSet){
obj.insert("transverterMode", QJsonValue(transverter_mode)); obj->insert("transverterMode", QJsonValue(transverter_mode));
} }
if(m_transverter_delta_frequency_isSet){ if(m_transverter_delta_frequency_isSet){
obj.insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency)); obj->insert("transverterDeltaFrequency", QJsonValue(transverter_delta_frequency));
} }
if(m_rf_bandwidth_isSet){ if(m_rf_bandwidth_isSet){
obj.insert("rfBandwidth", QJsonValue(rf_bandwidth)); obj->insert("rfBandwidth", QJsonValue(rf_bandwidth));
} }
return obj; return obj;

View File

@ -30,15 +30,15 @@ namespace SWGSDRangel {
class SWGRtlSdrSettings: public SWGObject { class SWGRtlSdrSettings: public SWGObject {
public: public:
SWGRtlSdrSettings(); SWGRtlSdrSettings();
SWGRtlSdrSettings(QString json); SWGRtlSdrSettings(QString* json);
~SWGRtlSdrSettings(); virtual ~SWGRtlSdrSettings();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGRtlSdrSettings* fromJson(QString jsonString); SWGRtlSdrSettings* fromJson(QString &jsonString);
qint32 getDevSampleRate(); qint32 getDevSampleRate();
void setDevSampleRate(qint32 dev_sample_rate); void setDevSampleRate(qint32 dev_sample_rate);

View File

@ -22,13 +22,32 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGSamplingDevice::SWGSamplingDevice(QString json) { SWGSamplingDevice::SWGSamplingDevice(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGSamplingDevice::SWGSamplingDevice() { SWGSamplingDevice::SWGSamplingDevice() {
init(); index = 0;
m_index_isSet = false;
hw_type = nullptr;
m_hw_type_isSet = false;
tx = 0;
m_tx_isSet = false;
nb_streams = 0;
m_nb_streams_isSet = false;
stream_index = 0;
m_stream_index_isSet = false;
sequence = 0;
m_sequence_isSet = false;
serial = nullptr;
m_serial_isSet = false;
center_frequency = 0L;
m_center_frequency_isSet = false;
bandwidth = 0;
m_bandwidth_isSet = false;
state = nullptr;
m_state_isSet = false;
} }
SWGSamplingDevice::~SWGSamplingDevice() { SWGSamplingDevice::~SWGSamplingDevice() {
@ -80,7 +99,7 @@ SWGSamplingDevice::cleanup() {
} }
SWGSamplingDevice* SWGSamplingDevice*
SWGSamplingDevice::fromJson(QString json) { SWGSamplingDevice::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -89,7 +108,7 @@ SWGSamplingDevice::fromJson(QString json) {
} }
void void
SWGSamplingDevice::fromJsonObject(QJsonObject pJson) { SWGSamplingDevice::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&index, pJson["index"], "qint32", ""); ::SWGSDRangel::setValue(&index, pJson["index"], "qint32", "");
::SWGSDRangel::setValue(&hw_type, pJson["hwType"], "QString", "QString"); ::SWGSDRangel::setValue(&hw_type, pJson["hwType"], "QString", "QString");
@ -115,41 +134,43 @@ SWGSamplingDevice::fromJsonObject(QJsonObject pJson) {
QString QString
SWGSamplingDevice::asJson () SWGSamplingDevice::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGSamplingDevice::asJsonObject() { SWGSamplingDevice::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(m_index_isSet){ if(m_index_isSet){
obj.insert("index", QJsonValue(index)); obj->insert("index", QJsonValue(index));
} }
if(hw_type != nullptr && *hw_type != QString("")){ if(hw_type != nullptr && *hw_type != QString("")){
toJsonValue(QString("hwType"), hw_type, obj, QString("QString")); toJsonValue(QString("hwType"), hw_type, obj, QString("QString"));
} }
if(m_tx_isSet){ if(m_tx_isSet){
obj.insert("tx", QJsonValue(tx)); obj->insert("tx", QJsonValue(tx));
} }
if(m_nb_streams_isSet){ if(m_nb_streams_isSet){
obj.insert("nbStreams", QJsonValue(nb_streams)); obj->insert("nbStreams", QJsonValue(nb_streams));
} }
if(m_stream_index_isSet){ if(m_stream_index_isSet){
obj.insert("streamIndex", QJsonValue(stream_index)); obj->insert("streamIndex", QJsonValue(stream_index));
} }
if(m_sequence_isSet){ if(m_sequence_isSet){
obj.insert("sequence", QJsonValue(sequence)); obj->insert("sequence", QJsonValue(sequence));
} }
if(serial != nullptr && *serial != QString("")){ if(serial != nullptr && *serial != QString("")){
toJsonValue(QString("serial"), serial, obj, QString("QString")); toJsonValue(QString("serial"), serial, obj, QString("QString"));
} }
if(m_center_frequency_isSet){ if(m_center_frequency_isSet){
obj.insert("centerFrequency", QJsonValue(center_frequency)); obj->insert("centerFrequency", QJsonValue(center_frequency));
} }
if(m_bandwidth_isSet){ if(m_bandwidth_isSet){
obj.insert("bandwidth", QJsonValue(bandwidth)); obj->insert("bandwidth", QJsonValue(bandwidth));
} }
if(state != nullptr && *state != QString("")){ if(state != nullptr && *state != QString("")){
toJsonValue(QString("state"), state, obj, QString("QString")); toJsonValue(QString("state"), state, obj, QString("QString"));

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGSamplingDevice: public SWGObject { class SWGSamplingDevice: public SWGObject {
public: public:
SWGSamplingDevice(); SWGSamplingDevice();
SWGSamplingDevice(QString json); SWGSamplingDevice(QString* json);
~SWGSamplingDevice(); virtual ~SWGSamplingDevice();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGSamplingDevice* fromJson(QString jsonString); SWGSamplingDevice* fromJson(QString &jsonString);
qint32 getIndex(); qint32 getIndex();
void setIndex(qint32 index); void setIndex(qint32 index);

View File

@ -22,13 +22,14 @@
namespace SWGSDRangel { namespace SWGSDRangel {
SWGSuccessResponse::SWGSuccessResponse(QString json) { SWGSuccessResponse::SWGSuccessResponse(QString* json) {
init(); init();
this->fromJson(json); this->fromJson(*json);
} }
SWGSuccessResponse::SWGSuccessResponse() { SWGSuccessResponse::SWGSuccessResponse() {
init(); message = nullptr;
m_message_isSet = false;
} }
SWGSuccessResponse::~SWGSuccessResponse() { SWGSuccessResponse::~SWGSuccessResponse() {
@ -49,7 +50,7 @@ SWGSuccessResponse::cleanup() {
} }
SWGSuccessResponse* SWGSuccessResponse*
SWGSuccessResponse::fromJson(QString json) { SWGSuccessResponse::fromJson(QString &json) {
QByteArray array (json.toStdString().c_str()); QByteArray array (json.toStdString().c_str());
QJsonDocument doc = QJsonDocument::fromJson(array); QJsonDocument doc = QJsonDocument::fromJson(array);
QJsonObject jsonObject = doc.object(); QJsonObject jsonObject = doc.object();
@ -58,7 +59,7 @@ SWGSuccessResponse::fromJson(QString json) {
} }
void void
SWGSuccessResponse::fromJsonObject(QJsonObject pJson) { SWGSuccessResponse::fromJsonObject(QJsonObject &pJson) {
::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString"); ::SWGSDRangel::setValue(&message, pJson["message"], "QString", "QString");
} }
@ -66,15 +67,17 @@ SWGSuccessResponse::fromJsonObject(QJsonObject pJson) {
QString QString
SWGSuccessResponse::asJson () SWGSuccessResponse::asJson ()
{ {
QJsonObject obj = this->asJsonObject(); QJsonObject* obj = this->asJsonObject();
QJsonDocument doc(obj);
QJsonDocument doc(*obj);
QByteArray bytes = doc.toJson(); QByteArray bytes = doc.toJson();
delete obj;
return QString(bytes); return QString(bytes);
} }
QJsonObject QJsonObject*
SWGSuccessResponse::asJsonObject() { SWGSuccessResponse::asJsonObject() {
QJsonObject obj; QJsonObject* obj = new QJsonObject();
if(message != nullptr && *message != QString("")){ if(message != nullptr && *message != QString("")){
toJsonValue(QString("message"), message, obj, QString("QString")); toJsonValue(QString("message"), message, obj, QString("QString"));
} }

View File

@ -31,15 +31,15 @@ namespace SWGSDRangel {
class SWGSuccessResponse: public SWGObject { class SWGSuccessResponse: public SWGObject {
public: public:
SWGSuccessResponse(); SWGSuccessResponse();
SWGSuccessResponse(QString json); SWGSuccessResponse(QString* json);
~SWGSuccessResponse(); virtual ~SWGSuccessResponse();
void init(); void init();
void cleanup(); void cleanup();
QString asJson (); QString asJson ();
QJsonObject asJsonObject(); QJsonObject* asJsonObject();
void fromJsonObject(QJsonObject json); void fromJsonObject(QJsonObject &json);
SWGSuccessResponse* fromJson(QString jsonString); SWGSuccessResponse* fromJson(QString &jsonString);
QString* getMessage(); QString* getMessage();
void setMessage(QString* message); void setMessage(QString* message);