1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-21 23:55:13 -05:00

Compare commits

...

7 Commits

15 changed files with 182 additions and 112 deletions

View File

@ -352,8 +352,17 @@ void NoiseFigure::nextState()
void NoiseFigure::powerOn()
{
QString command = m_settings.m_powerOnCommand.trimmed();
if (!command.isEmpty()) {
QProcess::execute(command);
if (!command.isEmpty())
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = command.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = command.split(" ", QString::SkipEmptyParts);
#endif
QString program = allArgs[0];
allArgs.pop_front();
QProcess::execute(program, allArgs);
}
QStringList commands = m_settings.m_powerOnSCPI.split("\n");
@ -366,8 +375,17 @@ void NoiseFigure::powerOff()
processVISA(commands);
QString command = m_settings.m_powerOffCommand.trimmed();
if (!command.isEmpty()) {
QProcess::execute(command);
if (!command.isEmpty())
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = command.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = command.split(" ", QString::SkipEmptyParts);
#endif
QString program = allArgs[0];
allArgs.pop_front();
QProcess::execute(program, allArgs);
}
}

View File

@ -301,8 +301,16 @@ void RadioAstronomy::startCal(bool hot)
}
// Execute command to enable calibration
if (!m_settings.m_startCalCommand.isEmpty()) {
QProcess::startDetached(m_settings.m_startCalCommand);
if (!m_settings.m_startCalCommand.isEmpty())
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = m_settings.m_startCalCommand.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = m_settings.m_startCalCommand.split(" ", QString::SkipEmptyParts);
#endif
QString program = allArgs[0];
allArgs.pop_front();
QProcess::startDetached(program, allArgs);
}
// Start calibration after requested delay
@ -334,8 +342,16 @@ void RadioAstronomy::calComplete(MsgCalComplete* report)
}
// Execute command to disable calibration
if (!m_settings.m_stopCalCommand.isEmpty()) {
QProcess::startDetached(m_settings.m_stopCalCommand);
if (!m_settings.m_stopCalCommand.isEmpty())
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = m_settings.m_stopCalCommand.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = m_settings.m_stopCalCommand.split(" ", QString::SkipEmptyParts);
#endif
QString program = allArgs[0];
allArgs.pop_front();
QProcess::startDetached(program, allArgs);
}
// Send calibration result to GUI

View File

@ -794,7 +794,7 @@ void MapGUI::setBeacons(QList<Beacon *> *beacons)
void MapGUI::addIBPBeacons()
{
// Add to Map
for (const auto beacon : IBPBeacon::m_beacons)
for (const auto& beacon : IBPBeacon::m_beacons)
{
SWGSDRangel::SWGMapItem beaconMapItem;
beaconMapItem.setName(new QString(beacon.m_callsign));

View File

@ -544,7 +544,14 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name)
if (!m_settings.m_aosCommand.isEmpty())
{
qDebug() << "SatelliteTrackerWorker::aos: executing command: " << m_settings.m_aosCommand;
QProcess::startDetached(m_settings.m_aosCommand);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = m_settings.m_aosCommand.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = m_settings.m_aosCommand.split(" ", QString::SkipEmptyParts);
#endif
QString program = allArgs[0];
allArgs.pop_front();
QProcess::startDetached(program, allArgs);
}
// Update device set
@ -614,7 +621,14 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name)
if (!devSettings->m_aosCommand.isEmpty())
{
qDebug() << "SatelliteTrackerWorker::aos: executing command: " << devSettings->m_aosCommand;
QProcess::startDetached(devSettings->m_aosCommand);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = m_settings.m_aosCommand.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = m_settings.m_aosCommand.split(" ", QString::SkipEmptyParts);
#endif
QString program = allArgs[0];
allArgs.pop_front();
QProcess::startDetached(program, allArgs);
}
}
@ -752,7 +766,14 @@ void SatelliteTrackerWorker::los(SatWorkerState *satWorkerState)
if (!m_settings.m_losCommand.isEmpty())
{
qDebug() << "SatelliteTrackerWorker::los: executing command: " << m_settings.m_losCommand;
QProcess::startDetached(m_settings.m_losCommand);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = m_settings.m_losCommand.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = m_settings.m_losCommand.split(" ", QString::SkipEmptyParts);
#endif
QString program = allArgs[0];
allArgs.pop_front();
QProcess::startDetached(program, allArgs);
}
if (m_settings.m_deviceSettings.contains(satWorkerState->m_name))
@ -792,7 +813,14 @@ void SatelliteTrackerWorker::los(SatWorkerState *satWorkerState)
if (!devSettings->m_losCommand.isEmpty())
{
qDebug() << "SatelliteTrackerWorker::los: executing command: " << devSettings->m_losCommand;
QProcess::startDetached(devSettings->m_losCommand);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = devSettings->m_losCommand.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = devSettings->m_losCommand.split(" ", QString::SkipEmptyParts);
#endif
QString program = allArgs[0];
allArgs.pop_front();
QProcess::startDetached(program, allArgs);
}
}
}

View File

@ -1546,7 +1546,7 @@ void SoapySDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings&
response.getSoapySdrOutputSettings()->setTunableElements(new QList<SWGSDRangel::SWGArgValue*>);
}
for (const auto itName : settings.m_tunableElements.keys())
for (const auto& itName : settings.m_tunableElements.keys())
{
response.getSoapySdrOutputSettings()->getTunableElements()->append(new SWGSDRangel::SWGArgValue);
response.getSoapySdrOutputSettings()->getTunableElements()->back()->setKey(new QString( itName));
@ -1564,7 +1564,7 @@ void SoapySDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings&
response.getSoapySdrOutputSettings()->setIndividualGains(new QList<SWGSDRangel::SWGArgValue*>);
}
for (const auto itName : settings.m_individualGains.keys())
for (const auto& itName : settings.m_individualGains.keys())
{
response.getSoapySdrOutputSettings()->getIndividualGains()->append(new SWGSDRangel::SWGArgValue);
response.getSoapySdrOutputSettings()->getIndividualGains()->back()->setKey(new QString(itName));
@ -1597,7 +1597,7 @@ void SoapySDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings&
response.getSoapySdrOutputSettings()->setStreamArgSettings(new QList<SWGSDRangel::SWGArgValue*>);
}
for (const auto itName : settings.m_streamArgSettings.keys())
for (const auto& itName : settings.m_streamArgSettings.keys())
{
response.getSoapySdrOutputSettings()->getStreamArgSettings()->append(new SWGSDRangel::SWGArgValue);
response.getSoapySdrOutputSettings()->getStreamArgSettings()->back()->setKey(new QString(itName));
@ -1611,7 +1611,7 @@ void SoapySDROutput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings&
response.getSoapySdrOutputSettings()->setDeviceArgSettings(new QList<SWGSDRangel::SWGArgValue*>);
}
for (const auto itName : settings.m_deviceArgSettings.keys())
for (const auto& itName : settings.m_deviceArgSettings.keys())
{
response.getSoapySdrOutputSettings()->getDeviceArgSettings()->append(new SWGSDRangel::SWGArgValue);
response.getSoapySdrOutputSettings()->getDeviceArgSettings()->back()->setKey(new QString(itName));
@ -1637,7 +1637,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
response.getSoapySdrOutputReport()->setDeviceSettingsArgs(new QList<SWGSDRangel::SWGArgInfo*>);
for (const auto itArg : m_deviceShared.m_deviceParams->getDeviceArgs())
for (const auto& itArg : m_deviceShared.m_deviceParams->getDeviceArgs())
{
response.getSoapySdrOutputReport()->getDeviceSettingsArgs()->append(new SWGSDRangel::SWGArgInfo);
webapiFormatArgInfo(itArg, response.getSoapySdrOutputReport()->getDeviceSettingsArgs()->back());
@ -1645,7 +1645,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
response.getSoapySdrOutputReport()->setStreamSettingsArgs(new QList<SWGSDRangel::SWGArgInfo*>);
for (const auto itArg : channelSettings->m_streamSettingsArgs)
for (const auto& itArg : channelSettings->m_streamSettingsArgs)
{
response.getSoapySdrOutputReport()->getStreamSettingsArgs()->append(new SWGSDRangel::SWGArgInfo);
webapiFormatArgInfo(itArg, response.getSoapySdrOutputReport()->getStreamSettingsArgs()->back());
@ -1653,7 +1653,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
response.getSoapySdrOutputReport()->setFrequencySettingsArgs(new QList<SWGSDRangel::SWGArgInfo*>);
for (const auto itArg : channelSettings->m_frequencySettingsArgs)
for (const auto& itArg : channelSettings->m_frequencySettingsArgs)
{
response.getSoapySdrOutputReport()->getFrequencySettingsArgs()->append(new SWGSDRangel::SWGArgInfo);
webapiFormatArgInfo(itArg, response.getSoapySdrOutputReport()->getFrequencySettingsArgs()->back());
@ -1669,7 +1669,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
{
response.getSoapySdrOutputReport()->setAntennas(new QList<QString *>);
for (const auto itAntenna : channelSettings->m_antennas) {
for (const auto& itAntenna : channelSettings->m_antennas) {
response.getSoapySdrOutputReport()->getAntennas()->append(new QString(itAntenna.c_str()));
}
}
@ -1685,7 +1685,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
{
response.getSoapySdrOutputReport()->setGainSettings(new QList<SWGSDRangel::SWGSoapySDRGainSetting*>);
for (const auto itGain : channelSettings->m_gainSettings)
for (const auto& itGain : channelSettings->m_gainSettings)
{
response.getSoapySdrOutputReport()->getGainSettings()->append(new SWGSDRangel::SWGSoapySDRGainSetting());
response.getSoapySdrOutputReport()->getGainSettings()->back()->setRange(new SWGSDRangel::SWGRangeFloat());
@ -1699,7 +1699,7 @@ void SoapySDROutput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& resp
{
response.getSoapySdrOutputReport()->setFrequencySettings(new QList<SWGSDRangel::SWGSoapySDRFrequencySetting*>);
for (const auto itFreq : channelSettings->m_frequencySettings)
for (const auto& itFreq : channelSettings->m_frequencySettings)
{
response.getSoapySdrOutputReport()->getFrequencySettings()->append(new SWGSDRangel::SWGSoapySDRFrequencySetting());
response.getSoapySdrOutputReport()->getFrequencySettings()->back()->setRanges(new QList<SWGSDRangel::SWGRangeFloat*>);
@ -1805,13 +1805,13 @@ void SoapySDROutput::webapiFormatArgInfo(const SoapySDR::ArgInfo& arg, SWGSDRang
argInfo->setValueOptions(new QList<QString*>);
for (const auto itOpt : arg.options) {
for (const auto& itOpt : arg.options) {
argInfo->getValueOptions()->append(new QString(itOpt.c_str()));
}
argInfo->setOptionNames(new QList<QString*>);
for (const auto itOpt : arg.optionNames) {
for (const auto& itOpt : arg.optionNames) {
argInfo->getOptionNames()->append(new QString(itOpt.c_str()));
}
}

View File

@ -221,6 +221,7 @@ bool RemoteInputGui::handleMessage(const Message& message)
ui->apiAddressLabel->setStyleSheet("QLabel { background-color : green; }");
const RemoteInput::MsgReportRemoteFixedData& report = (const RemoteInput::MsgReportRemoteFixedData&) message;
displayRemoteFixedData(report.getData());
ui->statusText->setText("OK");
return true;
}
else if (RemoteInput::MsgReportRemoteAPIError::match(message))

View File

@ -1638,7 +1638,7 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
response.getSoapySdrInputSettings()->setTunableElements(new QList<SWGSDRangel::SWGArgValue*>);
}
for (const auto itName : settings.m_tunableElements.keys())
for (const auto& itName : settings.m_tunableElements.keys())
{
response.getSoapySdrInputSettings()->getTunableElements()->append(new SWGSDRangel::SWGArgValue);
response.getSoapySdrInputSettings()->getTunableElements()->back()->setKey(new QString(itName));
@ -1656,7 +1656,7 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
response.getSoapySdrInputSettings()->setIndividualGains(new QList<SWGSDRangel::SWGArgValue*>);
}
for (const auto itName : settings.m_individualGains.keys())
for (const auto& itName : settings.m_individualGains.keys())
{
response.getSoapySdrInputSettings()->getIndividualGains()->append(new SWGSDRangel::SWGArgValue);
response.getSoapySdrInputSettings()->getIndividualGains()->back()->setKey(new QString(itName));
@ -1689,7 +1689,7 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
response.getSoapySdrInputSettings()->setStreamArgSettings(new QList<SWGSDRangel::SWGArgValue*>);
}
for (const auto itName : settings.m_streamArgSettings.keys())
for (const auto& itName : settings.m_streamArgSettings.keys())
{
response.getSoapySdrInputSettings()->getStreamArgSettings()->append(new SWGSDRangel::SWGArgValue);
response.getSoapySdrInputSettings()->getStreamArgSettings()->back()->setKey(new QString(itName));
@ -1703,7 +1703,7 @@ void SoapySDRInput::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& r
response.getSoapySdrInputSettings()->setDeviceArgSettings(new QList<SWGSDRangel::SWGArgValue*>);
}
for (const auto itName : settings.m_deviceArgSettings.keys())
for (const auto& itName : settings.m_deviceArgSettings.keys())
{
response.getSoapySdrInputSettings()->getDeviceArgSettings()->append(new SWGSDRangel::SWGArgValue);
response.getSoapySdrInputSettings()->getDeviceArgSettings()->back()->setKey(new QString(itName));
@ -1729,7 +1729,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
response.getSoapySdrInputReport()->setDeviceSettingsArgs(new QList<SWGSDRangel::SWGArgInfo*>);
for (const auto itArg : m_deviceShared.m_deviceParams->getDeviceArgs())
for (const auto& itArg : m_deviceShared.m_deviceParams->getDeviceArgs())
{
response.getSoapySdrInputReport()->getDeviceSettingsArgs()->append(new SWGSDRangel::SWGArgInfo());
webapiFormatArgInfo(itArg, response.getSoapySdrInputReport()->getDeviceSettingsArgs()->back());
@ -1737,7 +1737,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
response.getSoapySdrInputReport()->setStreamSettingsArgs(new QList<SWGSDRangel::SWGArgInfo*>);
for (const auto itArg : channelSettings->m_streamSettingsArgs)
for (const auto& itArg : channelSettings->m_streamSettingsArgs)
{
response.getSoapySdrInputReport()->getStreamSettingsArgs()->append(new SWGSDRangel::SWGArgInfo());
webapiFormatArgInfo(itArg, response.getSoapySdrInputReport()->getStreamSettingsArgs()->back());
@ -1745,7 +1745,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
response.getSoapySdrInputReport()->setFrequencySettingsArgs(new QList<SWGSDRangel::SWGArgInfo*>);
for (const auto itArg : channelSettings->m_frequencySettingsArgs)
for (const auto& itArg : channelSettings->m_frequencySettingsArgs)
{
response.getSoapySdrInputReport()->getFrequencySettingsArgs()->append(new SWGSDRangel::SWGArgInfo());
webapiFormatArgInfo(itArg, response.getSoapySdrInputReport()->getFrequencySettingsArgs()->back());
@ -1761,7 +1761,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
{
response.getSoapySdrInputReport()->setAntennas(new QList<QString *>);
for (const auto itAntenna : channelSettings->m_antennas) {
for (const auto& itAntenna : channelSettings->m_antennas) {
response.getSoapySdrInputReport()->getAntennas()->append(new QString(itAntenna.c_str()));
}
}
@ -1777,7 +1777,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
{
response.getSoapySdrInputReport()->setGainSettings(new QList<SWGSDRangel::SWGSoapySDRGainSetting*>);
for (const auto itGain : channelSettings->m_gainSettings)
for (const auto& itGain : channelSettings->m_gainSettings)
{
response.getSoapySdrInputReport()->getGainSettings()->append(new SWGSDRangel::SWGSoapySDRGainSetting());
response.getSoapySdrInputReport()->getGainSettings()->back()->setRange(new SWGSDRangel::SWGRangeFloat());
@ -1791,7 +1791,7 @@ void SoapySDRInput::webapiFormatDeviceReport(SWGSDRangel::SWGDeviceReport& respo
{
response.getSoapySdrInputReport()->setFrequencySettings(new QList<SWGSDRangel::SWGSoapySDRFrequencySetting*>);
for (const auto itFreq : channelSettings->m_frequencySettings)
for (const auto& itFreq : channelSettings->m_frequencySettings)
{
response.getSoapySdrInputReport()->getFrequencySettings()->append(new SWGSDRangel::SWGSoapySDRFrequencySetting());
response.getSoapySdrInputReport()->getFrequencySettings()->back()->setRanges(new QList<SWGSDRangel::SWGRangeFloat*>);
@ -1897,13 +1897,13 @@ void SoapySDRInput::webapiFormatArgInfo(const SoapySDR::ArgInfo& arg, SWGSDRange
argInfo->setValueOptions(new QList<QString*>);
for (const auto itOpt : arg.options) {
for (const auto& itOpt : arg.options) {
argInfo->getValueOptions()->append(new QString(itOpt.c_str()));
}
argInfo->setOptionNames(new QList<QString*>);
for (const auto itOpt : arg.optionNames) {
for (const auto& itOpt : arg.optionNames) {
argInfo->getOptionNames()->append(new QString(itOpt.c_str()));
}
}

View File

@ -203,7 +203,12 @@ void Command::run(const QString& apiAddress, int apiPort, int deviceSetIndex)
m_currentProcess->setProcessChannelMode(QProcess::MergedChannels);
m_currentProcessStartTimeStampms = TimeUtil::nowms();
m_currentProcess->start(m_currentProcessCommandLine);
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QStringList allArgs = args.split(" ", Qt::SkipEmptyParts);
#else
QStringList allArgs = args.split(" ", QString::SkipEmptyParts);
#endif
m_currentProcess->start(m_command, allArgs);
}
void Command::kill()

View File

@ -51634,7 +51634,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-12-24T20:37:17.750+01:00
Generated 2021-12-27T21:57:14.290+01:00
</div>
</div>
</div>

View File

@ -150,7 +150,7 @@ QHash<QString, int> CSV::readHeader(QTextStream &in, QStringList requiredColumns
colNumbers.insert(row[i], i);
}
// Check all required columns exist
for (const auto col : requiredColumns)
for (const auto& col : requiredColumns)
{
if (!colNumbers.contains(col)) {
error = QString("Missing column %1").arg(col);

View File

@ -51634,7 +51634,7 @@ except ApiException as e:
</div>
<div id="generator">
<div class="content">
Generated 2021-12-24T20:37:17.750+01:00
Generated 2021-12-27T21:57:14.290+01:00
</div>
</div>
</div>

View File

@ -45,7 +45,7 @@ SWGDeviceSetApi::devicesetChannelActionsPost(qint32 device_set_index, qint32 cha
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -158,7 +158,7 @@ SWGDeviceSetApi::devicesetChannelPost(qint32 device_set_index, SWGChannelSetting
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -329,7 +329,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPatch(qint32 device_set_index, qint32 c
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -388,7 +388,7 @@ SWGDeviceSetApi::devicesetChannelSettingsPut(qint32 device_set_index, qint32 cha
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -499,7 +499,7 @@ SWGDeviceSetApi::devicesetDeviceActionsPost(qint32 device_set_index, SWGDeviceAc
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -556,7 +556,7 @@ SWGDeviceSetApi::devicesetDevicePut(qint32 device_set_index, SWGDeviceListItem&
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -667,7 +667,7 @@ SWGDeviceSetApi::devicesetDeviceRunDelete(qint32 device_set_index, SWGDeviceSett
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -778,7 +778,7 @@ SWGDeviceSetApi::devicesetDeviceRunPost(qint32 device_set_index, SWGDeviceSettin
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -889,7 +889,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPatch(qint32 device_set_index, SWGDevice
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -946,7 +946,7 @@ SWGDeviceSetApi::devicesetDeviceSettingsPut(qint32 device_set_index, SWGDeviceSe
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1005,7 +1005,7 @@ SWGDeviceSetApi::devicesetDeviceSubsystemRunDelete(qint32 device_set_index, qint
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1120,7 +1120,7 @@ SWGDeviceSetApi::devicesetDeviceSubsystemRunPost(qint32 device_set_index, qint32
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1501,7 +1501,7 @@ SWGDeviceSetApi::devicesetSpectrumSettingsPatch(qint32 device_set_index, SWGGLSp
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1558,7 +1558,7 @@ SWGDeviceSetApi::devicesetSpectrumSettingsPut(qint32 device_set_index, SWGGLSpec
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());

View File

@ -45,7 +45,7 @@ SWGFeatureSetApi::featuresetFEatureSettingsPut(qint32 feature_set_index, qint32
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -104,7 +104,7 @@ SWGFeatureSetApi::featuresetFeatureActionsPost(qint32 feature_set_index, qint32
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -217,7 +217,7 @@ SWGFeatureSetApi::featuresetFeaturePost(qint32 feature_set_index, SWGFeatureSett
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -556,7 +556,7 @@ SWGFeatureSetApi::featuresetFeatureSettingsPatch(qint32 feature_set_index, qint3
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -667,7 +667,7 @@ SWGFeatureSetApi::featuresetPresetPatch(qint32 feature_set_index, SWGFeaturePres
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -724,7 +724,7 @@ SWGFeatureSetApi::featuresetPresetPost(qint32 feature_set_index, SWGFeaturePrese
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -781,7 +781,7 @@ SWGFeatureSetApi::featuresetPresetPut(qint32 feature_set_index, SWGFeaturePreset
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());

View File

@ -16,6 +16,7 @@
#include <QFileInfo>
#include <QBuffer>
#include <QtGlobal>
#include <QRandomGenerator>
namespace SWGSDRangel {
@ -53,7 +54,7 @@ void SWGHttpRequestInput::add_file(QString variable_name, QString local_filename
SWGHttpRequestWorker::SWGHttpRequestWorker(QObject *parent)
: QObject(parent), manager(nullptr)
{
qsrand(QDateTime::currentDateTime().toTime_t());
QRandomGenerator::global()->seed(QDateTime::currentDateTime().toTime_t());
manager = new QNetworkAccessManager(this);
connect(manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(on_manager_finished(QNetworkReply*)));
@ -143,12 +144,12 @@ void SWGHttpRequestWorker::execute(SWGHttpRequestInput *input) {
isFormData = true;
foreach (QString key, input->vars.keys()) {
if (!first) {
request_content.append("&");
request_content.append('&');
}
first = false;
request_content.append(QUrl::toPercentEncoding(key));
request_content.append("=");
request_content.append('=');
request_content.append(QUrl::toPercentEncoding(input->vars.value(key)));
}
@ -163,30 +164,30 @@ void SWGHttpRequestWorker::execute(SWGHttpRequestInput *input) {
boundary = "__-----------------------"
+ QString::number(QDateTime::currentDateTime().toTime_t())
+ QString::number(qrand());
+ QString::number(QRandomGenerator::global()->generate());
QString boundary_delimiter = "--";
QString new_line = "\r\n";
// add variables
foreach (QString key, input->vars.keys()) {
// add boundary
request_content.append(boundary_delimiter);
request_content.append(boundary);
request_content.append(new_line);
request_content.append(boundary_delimiter.toUtf8());
request_content.append(boundary.toUtf8());
request_content.append(new_line.toUtf8());
// add header
request_content.append("Content-Disposition: form-data; ");
request_content.append(http_attribute_encode("name", key));
request_content.append(new_line);
request_content.append("Content-Type: text/plain");
request_content.append(new_line);
request_content.append(QString("Content-Disposition: form-data; ").toUtf8());
request_content.append(http_attribute_encode("name", key).toUtf8());
request_content.append(new_line.toUtf8());
request_content.append(QString("Content-Type: text/plain").toUtf8());
request_content.append(new_line.toUtf8());
// add header to body splitter
request_content.append(new_line);
request_content.append(new_line.toUtf8());
// add variable content
request_content.append(input->vars.value(key));
request_content.append(new_line);
request_content.append((input->vars.value(key)).toUtf8());
request_content.append(new_line.toUtf8());
}
// add files
@ -218,40 +219,41 @@ void SWGHttpRequestWorker::execute(SWGHttpRequestInput *input) {
}
// add boundary
request_content.append(boundary_delimiter);
request_content.append(boundary);
request_content.append(new_line);
request_content.append(boundary_delimiter.toUtf8());
request_content.append(boundary.toUtf8());
request_content.append(new_line.toUtf8());
// add header
request_content.append(QString("Content-Disposition: form-data; %1; %2").arg(
QString s = QString("Content-Disposition: form-data; %1; %2").arg(
http_attribute_encode("name", file_info->variable_name),
http_attribute_encode("filename", file_info->request_filename)
));
request_content.append(new_line);
);
request_content.append(s.toUtf8());
request_content.append(new_line.toUtf8());
if (file_info->mime_type != nullptr && !file_info->mime_type.isEmpty()) {
request_content.append("Content-Type: ");
request_content.append(file_info->mime_type);
request_content.append(new_line);
request_content.append(QString("Content-Type: ").toUtf8());
request_content.append((file_info->mime_type).toUtf8());
request_content.append(new_line.toUtf8());
}
request_content.append("Content-Transfer-Encoding: binary");
request_content.append(new_line);
request_content.append(QString("Content-Transfer-Encoding: binary").toUtf8());
request_content.append(new_line.toUtf8());
// add header to body splitter
request_content.append(new_line);
request_content.append(new_line.toUtf8());
// add file content
request_content.append(file.readAll());
request_content.append(new_line);
request_content.append(new_line.toUtf8());
file.close();
}
// add end of body
request_content.append(boundary_delimiter);
request_content.append(boundary);
request_content.append(boundary_delimiter);
request_content.append(boundary_delimiter.toUtf8());
request_content.append(boundary.toUtf8());
request_content.append(boundary_delimiter.toUtf8());
}
if(input->request_body.size() > 0) {

View File

@ -145,7 +145,7 @@ SWGInstanceApi::instanceAMBEDevicesPatch(SWGAMBEDevices& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -200,7 +200,7 @@ SWGInstanceApi::instanceAMBEDevicesPut(SWGAMBEDevices& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -411,7 +411,7 @@ SWGInstanceApi::instanceAudioInputDelete(SWGAudioInputDevice& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -466,7 +466,7 @@ SWGInstanceApi::instanceAudioInputPatch(SWGAudioInputDevice& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -573,7 +573,7 @@ SWGInstanceApi::instanceAudioOutputDelete(SWGAudioOutputDevice& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -628,7 +628,7 @@ SWGInstanceApi::instanceAudioOutputPatch(SWGAudioOutputDevice& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -795,7 +795,7 @@ SWGInstanceApi::instanceConfigPatch(SWGInstanceConfigResponse& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -850,7 +850,7 @@ SWGInstanceApi::instanceConfigPut(SWGInstanceConfigResponse& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1069,7 +1069,7 @@ SWGInstanceApi::instanceFeaturePresetDelete(SWGFeaturePresetIdentifier& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1340,7 +1340,7 @@ SWGInstanceApi::instanceLimeRFEConfigPut(SWGLimeRFESettings& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1455,7 +1455,7 @@ SWGInstanceApi::instanceLimeRFERunPut(SWGLimeRFESettings& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1614,7 +1614,7 @@ SWGInstanceApi::instanceLocationPut(SWGLocationInformation& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1721,7 +1721,7 @@ SWGInstanceApi::instanceLoggingPut(SWGLoggingInfo& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1776,7 +1776,7 @@ SWGInstanceApi::instancePresetDelete(SWGPresetIdentifier& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1831,7 +1831,7 @@ SWGInstanceApi::instancePresetFilePost(SWGPresetExport& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1886,7 +1886,7 @@ SWGInstanceApi::instancePresetFilePut(SWGPresetImport& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -1993,7 +1993,7 @@ SWGInstanceApi::instancePresetPatch(SWGPresetTransfer& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -2048,7 +2048,7 @@ SWGInstanceApi::instancePresetPost(SWGPresetTransfer& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());
@ -2103,7 +2103,7 @@ SWGInstanceApi::instancePresetPut(SWGPresetTransfer& body) {
QString output = body.asJson();
input.request_body.append(output);
input.request_body.append(output.toUtf8());