mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-02-03 09:44:01 -05:00
Web API: removed call to init() on generated Swagger objects as this is now handled automatically at construction time. Suppresses memory leaks.
This commit is contained in:
parent
213f8993cf
commit
aa796c30b6
@ -85,7 +85,6 @@ int WebAPIAdapterGUI::instanceSummary(
|
||||
#endif
|
||||
|
||||
SWGSDRangel::SWGLoggingInfo *logging = response.getLogging();
|
||||
logging->init();
|
||||
logging->setDumpToFile(m_mainWindow.m_logger->getUseFileLogger() ? 1 : 0);
|
||||
|
||||
if (logging->getDumpToFile()) {
|
||||
@ -205,7 +204,6 @@ int WebAPIAdapterGUI::instanceLoggingPut(
|
||||
m_mainWindow.setLoggingOptions();
|
||||
|
||||
// build response
|
||||
response.init();
|
||||
getMsgTypeString(m_mainWindow.m_settings.getConsoleMinLogLevel(), *response.getConsoleLevel());
|
||||
response.setDumpToFile(m_mainWindow.m_settings.getUseLogFile() ? 1 : 0);
|
||||
getMsgTypeString(m_mainWindow.m_settings.getFileMinLogLevel(), *response.getFileLevel());
|
||||
@ -223,7 +221,6 @@ int WebAPIAdapterGUI::instanceAudioGet(
|
||||
int nbInputDevices = audioInputDevices.size();
|
||||
int nbOutputDevices = audioOutputDevices.size();
|
||||
|
||||
response.init();
|
||||
response.setNbInputDevices(nbInputDevices);
|
||||
response.setInputDeviceSelectedIndex(m_mainWindow.m_audioDeviceInfo.getInputDeviceIndex());
|
||||
response.setNbOutputDevices(nbOutputDevices);
|
||||
@ -316,7 +313,6 @@ int WebAPIAdapterGUI::instanceDVSerialPatch(
|
||||
{
|
||||
m_mainWindow.m_dspEngine->setDVSerialSupport(dvserial);
|
||||
m_mainWindow.ui->action_DV_Serial->setChecked(dvserial);
|
||||
response.init();
|
||||
|
||||
if (dvserial)
|
||||
{
|
||||
@ -351,7 +347,6 @@ int WebAPIAdapterGUI::instancePresetsGet(
|
||||
int nbGroups = 0;
|
||||
int nbPresetsThisGroup = 0;
|
||||
QString groupName;
|
||||
response.init();
|
||||
QList<SWGSDRangel::SWGPresetGroup*> *groups = response.getGroups();
|
||||
QList<SWGSDRangel::SWGPresetItem*> *swgPresets = 0;
|
||||
int i = 0;
|
||||
@ -366,7 +361,6 @@ int WebAPIAdapterGUI::instancePresetsGet(
|
||||
{
|
||||
if (i > 0) { groups->back()->setNbPresets(nbPresetsThisGroup); }
|
||||
groups->append(new SWGSDRangel::SWGPresetGroup);
|
||||
groups->back()->init();
|
||||
groupName = preset->getGroup();
|
||||
*groups->back()->getGroupName() = groupName;
|
||||
swgPresets = groups->back()->getPresets();
|
||||
@ -432,7 +426,6 @@ int WebAPIAdapterGUI::instancePresetPatch(
|
||||
MainWindow::MsgLoadPreset *msg = MainWindow::MsgLoadPreset::create(selectedPreset, deviceSetIndex);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
|
||||
@ -488,7 +481,6 @@ int WebAPIAdapterGUI::instancePresetPut(
|
||||
MainWindow::MsgSavePreset *msg = MainWindow::MsgSavePreset::create(const_cast<Preset*>(selectedPreset), deviceSetIndex, false);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
|
||||
@ -532,7 +524,6 @@ int WebAPIAdapterGUI::instancePresetPost(
|
||||
MainWindow::MsgSavePreset *msg = MainWindow::MsgSavePreset::create(const_cast<Preset*>(selectedPreset), deviceSetIndex, true);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
|
||||
@ -585,7 +576,6 @@ int WebAPIAdapterGUI::instanceDeviceSetPost(
|
||||
MainWindow::MsgAddDeviceSet *msg = MainWindow::MsgAddDeviceSet::create(tx);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to add a new device set (MsgAddDeviceSet) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
@ -600,14 +590,12 @@ int WebAPIAdapterGUI::instanceDeviceSetDelete(
|
||||
MainWindow::MsgRemoveLastDeviceSet *msg = MainWindow::MsgRemoveLastDeviceSet::create();
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to remove last device set (MsgRemoveLastDeviceSet) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = "No more device sets to be removed";
|
||||
|
||||
return 404;
|
||||
@ -628,7 +616,6 @@ int WebAPIAdapterGUI::devicesetGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -645,14 +632,12 @@ int WebAPIAdapterGUI::devicesetFocusPatch(
|
||||
MainWindow::MsgDeviceSetFocus *msg = MainWindow::MsgDeviceSetFocus::create(deviceSetIndex);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to focus on device set (MsgDeviceSetFocus) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -710,7 +695,6 @@ int WebAPIAdapterGUI::devicesetDevicePut(
|
||||
MainWindow::MsgSetDevice *msg = MainWindow::MsgSetDevice::create(deviceSetIndex, i, response.getTx() != 0);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getDisplayedName() = samplingDevice.displayedName;
|
||||
*response.getHwType() = samplingDevice.hardwareId;
|
||||
*response.getSerial() = samplingDevice.serial;
|
||||
@ -729,7 +713,6 @@ int WebAPIAdapterGUI::devicesetDevicePut(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -761,14 +744,12 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -824,14 +805,12 @@ int WebAPIAdapterGUI::devicesetDeviceSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -859,14 +838,12 @@ int WebAPIAdapterGUI::devicesetDeviceRunGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -894,14 +871,12 @@ int WebAPIAdapterGUI::devicesetDeviceRunPost(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -929,14 +904,12 @@ int WebAPIAdapterGUI::devicesetDeviceRunDelete(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -957,7 +930,6 @@ int WebAPIAdapterGUI::devicesetChannelPost(
|
||||
{
|
||||
if (deviceSet->m_deviceSourceEngine == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Device set at %1 is not a receive device set").arg(deviceSetIndex);
|
||||
return 400;
|
||||
}
|
||||
@ -977,14 +949,12 @@ int WebAPIAdapterGUI::devicesetChannelPost(
|
||||
MainWindow::MsgAddChannel *msg = MainWindow::MsgAddChannel::create(deviceSetIndex, index, false);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no receive channel with id %1").arg(*query.getChannelType());
|
||||
return 404;
|
||||
}
|
||||
@ -993,7 +963,6 @@ int WebAPIAdapterGUI::devicesetChannelPost(
|
||||
{
|
||||
if (deviceSet->m_deviceSinkEngine == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Device set at %1 is not a transmit device set").arg(deviceSetIndex);
|
||||
return 400;
|
||||
}
|
||||
@ -1013,14 +982,12 @@ int WebAPIAdapterGUI::devicesetChannelPost(
|
||||
MainWindow::MsgAddChannel *msg = MainWindow::MsgAddChannel::create(deviceSetIndex, index, true);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no transmit channel with id %1").arg(*query.getChannelType());
|
||||
return 404;
|
||||
}
|
||||
@ -1028,7 +995,6 @@ int WebAPIAdapterGUI::devicesetChannelPost(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1051,14 +1017,12 @@ int WebAPIAdapterGUI::devicesetChannelDelete(
|
||||
MainWindow::MsgDeleteChannel *msg = MainWindow::MsgDeleteChannel::create(deviceSetIndex, channelIndex, false);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel at index %1. There are %2 Rx channels")
|
||||
.arg(channelIndex)
|
||||
.arg(channelIndex < deviceSet->getNumberOfRxChannels());
|
||||
@ -1072,14 +1036,12 @@ int WebAPIAdapterGUI::devicesetChannelDelete(
|
||||
MainWindow::MsgDeleteChannel *msg = MainWindow::MsgDeleteChannel::create(deviceSetIndex, channelIndex, true);
|
||||
m_mainWindow.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel at index %1. There are %2 Tx channels")
|
||||
.arg(channelIndex)
|
||||
.arg(channelIndex < deviceSet->getNumberOfRxChannels());
|
||||
@ -1088,14 +1050,12 @@ int WebAPIAdapterGUI::devicesetChannelDelete(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1117,7 +1077,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1135,7 +1094,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1149,14 +1107,12 @@ int WebAPIAdapterGUI::devicesetChannelSettingsGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1180,7 +1136,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1195,7 +1150,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
|
||||
.arg(*response.getChannelType())
|
||||
.arg(channelIndex)
|
||||
@ -1210,7 +1164,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1225,7 +1178,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
|
||||
.arg(*response.getChannelType())
|
||||
.arg(channelIndex)
|
||||
@ -1236,14 +1188,12 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -1253,7 +1203,6 @@ int WebAPIAdapterGUI::devicesetChannelSettingsPutPatch(
|
||||
|
||||
void WebAPIAdapterGUI::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList)
|
||||
{
|
||||
deviceSetList->init();
|
||||
deviceSetList->setDevicesetcount((int) m_mainWindow.m_deviceUIs.size());
|
||||
|
||||
if (m_mainWindow.m_deviceUIs.size() > 0) {
|
||||
@ -1274,7 +1223,6 @@ void WebAPIAdapterGUI::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSet
|
||||
void WebAPIAdapterGUI::getDeviceSet(SWGSDRangel::SWGDeviceSet *deviceSet, const DeviceUISet* deviceUISet, int deviceUISetIndex)
|
||||
{
|
||||
SWGSDRangel::SWGSamplingDevice *samplingDevice = deviceSet->getSamplingDevice();
|
||||
samplingDevice->init();
|
||||
samplingDevice->setIndex(deviceUISetIndex);
|
||||
samplingDevice->setTx(deviceUISet->m_deviceSinkEngine != 0);
|
||||
|
||||
|
@ -81,7 +81,6 @@ int WebAPIAdapterSrv::instanceSummary(
|
||||
#endif
|
||||
|
||||
SWGSDRangel::SWGLoggingInfo *logging = response.getLogging();
|
||||
logging->init();
|
||||
logging->setDumpToFile(m_mainCore.m_logger->getUseFileLogger() ? 1 : 0);
|
||||
|
||||
if (logging->getDumpToFile()) {
|
||||
@ -104,7 +103,6 @@ int WebAPIAdapterSrv::instanceDelete(
|
||||
MainCore::MsgDeleteInstance *msg = MainCore::MsgDeleteInstance::create();
|
||||
m_mainCore.getInputMessageQueue()->push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to stop the SDRangel instance (MsgDeleteInstance) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
@ -206,7 +204,6 @@ int WebAPIAdapterSrv::instanceLoggingPut(
|
||||
m_mainCore.setLoggingOptions();
|
||||
|
||||
// build response
|
||||
response.init();
|
||||
getMsgTypeString(m_mainCore.m_settings.getConsoleMinLogLevel(), *response.getConsoleLevel());
|
||||
response.setDumpToFile(m_mainCore.m_settings.getUseLogFile() ? 1 : 0);
|
||||
getMsgTypeString(m_mainCore.m_settings.getFileMinLogLevel(), *response.getFileLevel());
|
||||
@ -224,7 +221,6 @@ int WebAPIAdapterSrv::instanceAudioGet(
|
||||
int nbInputDevices = audioInputDevices.size();
|
||||
int nbOutputDevices = audioOutputDevices.size();
|
||||
|
||||
response.init();
|
||||
response.setNbInputDevices(nbInputDevices);
|
||||
response.setInputDeviceSelectedIndex(m_mainCore.m_audioDeviceInfo.getInputDeviceIndex());
|
||||
response.setNbOutputDevices(nbOutputDevices);
|
||||
@ -316,7 +312,6 @@ int WebAPIAdapterSrv::instanceDVSerialPatch(
|
||||
SWGSDRangel::SWGErrorResponse& error __attribute__((unused)))
|
||||
{
|
||||
m_mainCore.m_dspEngine->setDVSerialSupport(dvserial);
|
||||
response.init();
|
||||
|
||||
if (dvserial)
|
||||
{
|
||||
@ -372,7 +367,6 @@ int WebAPIAdapterSrv::instancePresetFilePut(
|
||||
preset->setDescription(*query.getDescription());
|
||||
}
|
||||
|
||||
response.init();
|
||||
response.setCenterFrequency(preset->getCenterFrequency());
|
||||
*response.getGroupName() = preset->getGroup();
|
||||
*response.getType() = preset->isSourcePreset() ? "R" : "T";
|
||||
@ -432,7 +426,6 @@ int WebAPIAdapterSrv::instancePresetFilePost(
|
||||
outstream << base64Str;
|
||||
exportFile.close();
|
||||
|
||||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
|
||||
@ -461,7 +454,6 @@ int WebAPIAdapterSrv::instancePresetsGet(
|
||||
int nbGroups = 0;
|
||||
int nbPresetsThisGroup = 0;
|
||||
QString groupName;
|
||||
response.init();
|
||||
QList<SWGSDRangel::SWGPresetGroup*> *groups = response.getGroups();
|
||||
QList<SWGSDRangel::SWGPresetItem*> *swgPresets = 0;
|
||||
int i = 0;
|
||||
@ -476,7 +468,6 @@ int WebAPIAdapterSrv::instancePresetsGet(
|
||||
{
|
||||
if (i > 0) { groups->back()->setNbPresets(nbPresetsThisGroup); }
|
||||
groups->append(new SWGSDRangel::SWGPresetGroup);
|
||||
groups->back()->init();
|
||||
groupName = preset->getGroup();
|
||||
*groups->back()->getGroupName() = groupName;
|
||||
swgPresets = groups->back()->getPresets();
|
||||
@ -542,7 +533,6 @@ int WebAPIAdapterSrv::instancePresetPatch(
|
||||
MainCore::MsgLoadPreset *msg = MainCore::MsgLoadPreset::create(selectedPreset, deviceSetIndex);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
|
||||
@ -598,7 +588,6 @@ int WebAPIAdapterSrv::instancePresetPut(
|
||||
MainCore::MsgSavePreset *msg = MainCore::MsgSavePreset::create(const_cast<Preset*>(selectedPreset), deviceSetIndex, false);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
|
||||
@ -654,7 +643,6 @@ int WebAPIAdapterSrv::instancePresetPost(
|
||||
MainCore::MsgSavePreset *msg = MainCore::MsgSavePreset::create(const_cast<Preset*>(selectedPreset), deviceSetIndex, true);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
response.setCenterFrequency(selectedPreset->getCenterFrequency());
|
||||
*response.getGroupName() = selectedPreset->getGroup();
|
||||
*response.getType() = selectedPreset->isSourcePreset() ? "R" : "T";
|
||||
@ -707,7 +695,6 @@ int WebAPIAdapterSrv::instanceDeviceSetPost(
|
||||
MainCore::MsgAddDeviceSet *msg = MainCore::MsgAddDeviceSet::create(tx);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to add a new device set (MsgAddDeviceSet) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
@ -722,14 +709,12 @@ int WebAPIAdapterSrv::instanceDeviceSetDelete(
|
||||
MainCore::MsgRemoveLastDeviceSet *msg = MainCore::MsgRemoveLastDeviceSet::create();
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to remove last device set (MsgRemoveLastDeviceSet) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = "No more device sets to be removed";
|
||||
|
||||
return 404;
|
||||
@ -750,7 +735,6 @@ int WebAPIAdapterSrv::devicesetGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -817,7 +801,6 @@ int WebAPIAdapterSrv::devicesetDevicePut(
|
||||
MainCore::MsgSetDevice *msg = MainCore::MsgSetDevice::create(deviceSetIndex, i, response.getTx() != 0);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getDisplayedName() = samplingDevice.displayedName;
|
||||
*response.getHwType() = samplingDevice.hardwareId;
|
||||
*response.getSerial() = samplingDevice.serial;
|
||||
@ -836,7 +819,6 @@ int WebAPIAdapterSrv::devicesetDevicePut(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -868,14 +850,12 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -930,14 +910,12 @@ int WebAPIAdapterSrv::devicesetDeviceSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -964,14 +942,12 @@ int WebAPIAdapterSrv::devicesetDeviceRunGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -999,14 +975,12 @@ int WebAPIAdapterSrv::devicesetDeviceRunPost(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -1034,14 +1008,12 @@ int WebAPIAdapterSrv::devicesetDeviceRunDelete(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -1062,7 +1034,6 @@ int WebAPIAdapterSrv::devicesetChannelPost(
|
||||
{
|
||||
if (deviceSet->m_deviceSourceEngine == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Device set at %1 is not a receive device set").arg(deviceSetIndex);
|
||||
return 400;
|
||||
}
|
||||
@ -1082,14 +1053,12 @@ int WebAPIAdapterSrv::devicesetChannelPost(
|
||||
MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, false);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no receive channel with id %1").arg(*query.getChannelType());
|
||||
return 404;
|
||||
}
|
||||
@ -1098,7 +1067,6 @@ int WebAPIAdapterSrv::devicesetChannelPost(
|
||||
{
|
||||
if (deviceSet->m_deviceSinkEngine == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("Device set at %1 is not a transmit device set").arg(deviceSetIndex);
|
||||
return 400;
|
||||
}
|
||||
@ -1118,14 +1086,12 @@ int WebAPIAdapterSrv::devicesetChannelPost(
|
||||
MainCore::MsgAddChannel *msg = MainCore::MsgAddChannel::create(deviceSetIndex, index, true);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to add a channel (MsgAddChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no transmit channel with id %1").arg(*query.getChannelType());
|
||||
return 404;
|
||||
}
|
||||
@ -1133,7 +1099,6 @@ int WebAPIAdapterSrv::devicesetChannelPost(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1156,14 +1121,12 @@ int WebAPIAdapterSrv::devicesetChannelDelete(
|
||||
MainCore::MsgDeleteChannel *msg = MainCore::MsgDeleteChannel::create(deviceSetIndex, channelIndex, false);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel at index %1. There are %2 Rx channels")
|
||||
.arg(channelIndex)
|
||||
.arg(channelIndex < deviceSet->getNumberOfRxChannels());
|
||||
@ -1177,14 +1140,12 @@ int WebAPIAdapterSrv::devicesetChannelDelete(
|
||||
MainCore::MsgDeleteChannel *msg = MainCore::MsgDeleteChannel::create(deviceSetIndex, channelIndex, true);
|
||||
m_mainCore.m_inputMessageQueue.push(msg);
|
||||
|
||||
response.init();
|
||||
*response.getMessage() = QString("Message to delete a channel (MsgDeleteChannel) was submitted successfully");
|
||||
|
||||
return 202;
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel at index %1. There are %2 Tx channels")
|
||||
.arg(channelIndex)
|
||||
.arg(channelIndex < deviceSet->getNumberOfRxChannels());
|
||||
@ -1193,14 +1154,12 @@ int WebAPIAdapterSrv::devicesetChannelDelete(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1222,7 +1181,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet(
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1240,7 +1198,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet(
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1254,14 +1211,12 @@ int WebAPIAdapterSrv::devicesetChannelSettingsGet(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1285,7 +1240,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1300,7 +1254,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
|
||||
.arg(*response.getChannelType())
|
||||
.arg(channelIndex)
|
||||
@ -1315,7 +1268,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
|
||||
|
||||
if (channelAPI == 0)
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel with index %1").arg(channelIndex);
|
||||
return 404;
|
||||
}
|
||||
@ -1330,7 +1282,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no channel type %1 at index %2. Found %3.")
|
||||
.arg(*response.getChannelType())
|
||||
.arg(channelIndex)
|
||||
@ -1341,14 +1292,12 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("DeviceSet error");
|
||||
return 500;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error.init();
|
||||
*error.getMessage() = QString("There is no device set with index %1").arg(deviceSetIndex);
|
||||
|
||||
return 404;
|
||||
@ -1358,7 +1307,6 @@ int WebAPIAdapterSrv::devicesetChannelSettingsPutPatch(
|
||||
|
||||
void WebAPIAdapterSrv::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSetList)
|
||||
{
|
||||
deviceSetList->init();
|
||||
deviceSetList->setDevicesetcount((int) m_mainCore.m_deviceSets.size());
|
||||
|
||||
std::vector<DeviceSet*>::const_iterator it = m_mainCore.m_deviceSets.begin();
|
||||
@ -1375,7 +1323,6 @@ void WebAPIAdapterSrv::getDeviceSetList(SWGSDRangel::SWGDeviceSetList* deviceSet
|
||||
void WebAPIAdapterSrv::getDeviceSet(SWGSDRangel::SWGDeviceSet *swgDeviceSet, const DeviceSet* deviceSet, int deviceUISetIndex)
|
||||
{
|
||||
SWGSDRangel::SWGSamplingDevice *samplingDevice = swgDeviceSet->getSamplingDevice();
|
||||
samplingDevice->init();
|
||||
samplingDevice->setIndex(deviceUISetIndex);
|
||||
samplingDevice->setTx(deviceSet->m_deviceSinkEngine != 0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user