Browse Source

Merge pull request #3049 from rgetz/rgetz-fix-various-coverity-mediums

Improve runtime robustness and address static analysis findings
chirpmodem-v8.1.0
Edouard Griffiths 4 weeks ago committed by GitHub
parent
commit
c4d70a7ada
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ft8/packing.cpp
  2. 3
      httpserver/httprequest.cpp
  3. 2
      modemdab/dabofdm.cpp
  4. 2
      modemdab/dabtables.cpp
  5. 3
      modemdrm/drmchannelestimator.cpp
  6. 1
      modemdvb/dvbs2receiver.cpp
  7. 2
      modemdvb/dvbt2fec.cpp
  8. 13
      modemdvb/dvbtreceiver.cpp
  9. 1
      modemdvb/ldpcpool.cpp
  10. 2
      modemm17/ax25_frame.h
  11. 61
      plugins/channelrx/demoddatv/datvdemodgui.cpp
  12. 4
      plugins/channelrx/demoddatv/leansdr/dvb.h
  13. 2
      plugins/channelrx/demodm17/m17demodprocessor.cpp
  14. 4
      plugins/channelrx/demodwefax/wefaxtonemeter.cpp
  15. 2
      plugins/channelrx/freqtracker/freqtrackersink.cpp
  16. 3
      plugins/channelrx/remotetcpsink/remotetcpsinksink.cpp
  17. 2
      plugins/channeltx/moddatv/datvmod.cpp
  18. 2
      plugins/feature/aprs/aprs.cpp
  19. 3
      plugins/feature/sid/sidsettings.cpp
  20. 2
      plugins/samplemimo/audiocatsiso/audiocatsiso.cpp
  21. 7
      plugins/samplemimo/audiocatsiso/audiocatsisocatworker.cpp
  22. 89
      plugins/samplemimo/plutosdrmimo/plutosdrmimo.cpp
  23. 2
      plugins/samplesource/audioinput/audioinput.cpp
  24. 7
      plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.cpp
  25. 2
      plugins/samplesource/sdrplayv3/sdrplayv3input.cpp
  26. 24
      sdrbase/channel/channelwebapiutils.cpp
  27. 2
      sdrbase/dsp/fftfactory.cpp
  28. 4
      sdrbase/dsp/wavfilerecord.cpp
  29. 5
      sdrbase/util/httpdownloadmanager.cpp
  30. 2
      sdrgui/dsp/scopevisxy.cpp
  31. 5
      sdrgui/gui/basicchannelsettingsdialog.cpp
  32. 2
      sdrgui/gui/websitebrowser.cpp
  33. 90
      sdrgui/mainwindow.cpp
  34. 24
      sdrsrv/mainserver.cpp

2
ft8/packing.cpp

@ -380,7 +380,7 @@ std::string Packing::unpack_5(int a77[], std::string& call1str, std::string& cal @@ -380,7 +380,7 @@ std::string Packing::unpack_5(int a77[], std::string& call1str, std::string& cal
int x22 = un64(a77, 12, 22);
if (hashes22.count(x22) > 0) {
ocall = hashes12[x22];
ocall = hashes22[x22];
} else {
ocall = "<...22>";
}

3
httpserver/httprequest.cpp

@ -544,6 +544,9 @@ HttpRequest::~HttpRequest() @@ -544,6 +544,9 @@ HttpRequest::~HttpRequest()
foreach(QByteArray key, uploadedFiles.keys())
{
QTemporaryFile* file=uploadedFiles.value(key);
if (!file) {
continue;
}
if (file->isOpen())
{
file->close();

2
modemdab/dabofdm.cpp

@ -736,7 +736,7 @@ bool DABFrontEnd::processFrame() @@ -736,7 +736,7 @@ bool DABFrontEnd::processFrame()
for (int n = ModeI::NullSize; n < ModeI::FrameSize; n += 7) {
symbolPower += std::norm(m_mixed[Margin + shift + n]);
}
symbolPower /= (ModeI::FrameSize - ModeI::NullSize) / 7;
symbolPower /= ((ModeI::FrameSize - ModeI::NullSize + 6) / 7.0);
m_frame.startSample = frameStart + shift;
m_frame.frequencyOffsetHz = static_cast<float>(m_frequency);

2
modemdab/dabtables.cpp

@ -446,7 +446,7 @@ uint16_t DABTables::crc16(const uint8_t *data, std::size_t length) @@ -446,7 +446,7 @@ uint16_t DABTables::crc16(const uint8_t *data, std::size_t length)
crc = (crc & 0x8000) ? static_cast<uint16_t>((crc << 1) ^ 0x1021) : static_cast<uint16_t>(crc << 1);
}
}
return static_cast<uint16_t>(~crc);
return static_cast<uint16_t>(~crc ^ 0xffff);
}
bool DABTables::crc16Check(const uint8_t *data, std::size_t lengthWithCRC)

3
modemdrm/drmchannelestimator.cpp

@ -1578,6 +1578,9 @@ bool ChannelEstimationContext::estimateFrameWiener( @@ -1578,6 +1578,9 @@ bool ChannelEstimationContext::estimateFrameWiener(
const auto& fftFrames = *m_frames;
const ModeParameters& parameters = Parameters::forMode(mode);
const SpectrumParameters* spectrum = Parameters::forSpectrum(mode, occupancy);
if (!spectrum) {
return false;
}
const int carrierCount = spectrum->maximumCarrier - spectrum->minimumCarrier + 1;
const float temporalCorrelation = m_temporalCorrelation;
const TemporalWeights weights = temporalWeights(temporalCorrelation);

1
modemdvb/dvbs2receiver.cpp

@ -948,6 +948,7 @@ void Receiver::deframe(FrameSlot& slot) @@ -948,6 +948,7 @@ void Receiver::deframe(FrameSlot& slot)
// Not from a frame of before a reset (still being decoded when it came): the front end's set for the
// signal since
std::lock_guard<std::mutex> lock(m_mutex);
if (slot.m_epoch == m_resetEpoch) {
m_matypeRollOff = header.rollOff() + (m_lowRollOffs ? 4 : 0);
}

2
modemdvb/dvbt2fec.cpp

@ -951,7 +951,7 @@ CellInterleaver::CellInterleaver(int ncells) : @@ -951,7 +951,7 @@ CellInterleaver::CellInterleaver(int ncells) :
r = (r >> 1) | (bit << (m_nd - 2));
}
int value = (int) (((i & 1) << (m_nd - 1)) | r);
int value = m_nd > 0 ? (int) (((i & 1) << (m_nd - 1)) | r) : (int) r;
if (value < ncells) {
m_l0[q++] = value;

13
modemdvb/dvbtreceiver.cpp

@ -103,6 +103,8 @@ void Receiver::reset() @@ -103,6 +103,8 @@ void Receiver::reset()
m_ofdm.reset();
m_clockUpdateSymbols = 0;
std::vector<double> notches;
double inputRate;
{
std::lock_guard<std::mutex> lock(m_ofdmMutex);
m_ofdmStatus = m_ofdm.getStatus();
@ -120,9 +122,11 @@ void Receiver::reset() @@ -120,9 +122,11 @@ void Receiver::reset()
}
m_notchesQueued = m_notchFrequencies;
notches = m_notchesQueued;
inputRate = m_inputRate;
}
m_ofdm.setNotches(m_notchesQueued, m_inputRate); // The demodulator thread isn't running
m_ofdm.setNotches(notches, inputRate); // The demodulator thread isn't running
if (m_threaded)
{
@ -334,7 +338,12 @@ void Receiver::correctClock() @@ -334,7 +338,12 @@ void Receiver::correctClock()
m_resampling = true;
m_resampler.setRatioCorrection(1.0);
m_resampler.configure(m_inputRate, m_outputRate, 0.4165 * m_outputRate);
double inputRate;
{
std::lock_guard<std::mutex> lock(m_ofdmMutex);
inputRate = m_inputRate;
}
m_resampler.configure(inputRate, m_outputRate, 0.4165 * m_outputRate);
m_resampler.prime(m_lastInput);
setRatioCorrection(1.0 - ppm * 1e-6); // The measurement is accurate, so start with all of it
return;

1
modemdvb/ldpcpool.cpp

@ -156,6 +156,7 @@ void LDPCPool::run(Job& job, Context& context) @@ -156,6 +156,7 @@ void LDPCPool::run(Job& job, Context& context)
}
}
// Caller must hold m_mutex.
void LDPCPool::cancel(Job& job)
{
job.m_done += job.m_batches - job.m_next;

2
modemm17/ax25_frame.h

@ -256,7 +256,9 @@ void write(std::ostream& os, const ax25_frame& frame) @@ -256,7 +256,9 @@ void write(std::ostream& os, const ax25_frame& frame)
if (frame.pid())
{
std::ios_base::fmtflags flags = os.flags();
os << "PID: " << std::setbase(16) << int(frame.pid()) << std::endl;
os.flags(flags);
}
os << "Info: " << std::endl << frame.info() << std::endl;
}

61
plugins/channelrx/demoddatv/datvdemodgui.cpp

@ -547,39 +547,48 @@ void DATVDemodGUI::ldpcToolSelect(const QPoint& p) @@ -547,39 +547,48 @@ void DATVDemodGUI::ldpcToolSelect(const QPoint& p)
void DATVDemodGUI::tick()
{
if (m_datvDemod)
if((m_intLastDecodedData - m_intPreviousDecodedData)>=0)
{
m_objMagSqAverage(m_datvDemod->getMagSq());
double magSqDB = CalcDb::dbPower(m_objMagSqAverage / (SDR_RX_SCALED*SDR_RX_SCALED));
ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1));
m_intLastSpeed = 8 * (m_intLastDecodedData - m_intPreviousDecodedData);
ui->lblRate->setText(QString("Speed: %1b/s").arg(formatBytes(m_intLastSpeed)));
}
if ((m_modcodModulationIndex != m_datvDemod->getModcodModulation()) || (m_modcodCodeRateIndex != m_datvDemod->getModcodCodeRate()))
{
m_modcodModulationIndex = m_datvDemod->getModcodModulation();
m_modcodCodeRateIndex = m_datvDemod->getModcodCodeRate();
DATVDemodSettings::DATVModulation modulation = DATVDemodSettings::getModulationFromLeanDVBCode(m_modcodModulationIndex);
DATVDemodSettings::DATVCodeRate rate = DATVDemodSettings::getCodeRateFromLeanDVBCode(m_modcodCodeRateIndex);
QString modcodModulationStr = DATVDemodSettings::getStrFromModulation(modulation);
QString modcodCodeRateStr = DATVDemodSettings::getStrFromCodeRate(rate);
ui->statusText->setText(tr("MCOD %1 %2").arg(modcodModulationStr).arg(modcodCodeRateStr));
}
if (!m_datvDemod)
{
ui->audioMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
ui->videoMute->setStyleSheet("QToolButton { background:rgb(79,79,79); }");
ui->playerIndicator->setStyleSheet("QLabel { background-color: gray; border-radius: 8px; }");
ui->udpIndicator->setStyleSheet("QLabel { background-color: gray; border-radius: 8px; }");
ui->channePowerText->setText("---");
ui->statusText->setText("---");
ui->statusText->setStyleSheet("QLabel { background:rgb(79,79,79); }");
return;
}
if (m_cstlnSetByModcod != m_datvDemod->isCstlnSetByModcod())
{
m_cstlnSetByModcod = m_datvDemod->isCstlnSetByModcod();
m_objMagSqAverage(m_datvDemod->getMagSq());
double magSqDB = CalcDb::dbPower(m_objMagSqAverage / (SDR_RX_SCALED*SDR_RX_SCALED));
ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1));
if (m_cstlnSetByModcod) {
ui->statusText->setStyleSheet("QLabel { background-color : green; }");
} else {
ui->statusText->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
}
if ((m_modcodModulationIndex != m_datvDemod->getModcodModulation()) || (m_modcodCodeRateIndex != m_datvDemod->getModcodCodeRate()))
{
m_modcodModulationIndex = m_datvDemod->getModcodModulation();
m_modcodCodeRateIndex = m_datvDemod->getModcodCodeRate();
DATVDemodSettings::DATVModulation modulation = DATVDemodSettings::getModulationFromLeanDVBCode(m_modcodModulationIndex);
DATVDemodSettings::DATVCodeRate rate = DATVDemodSettings::getCodeRateFromLeanDVBCode(m_modcodCodeRateIndex);
QString modcodModulationStr = DATVDemodSettings::getStrFromModulation(modulation);
QString modcodCodeRateStr = DATVDemodSettings::getStrFromCodeRate(rate);
ui->statusText->setText(tr("MCOD %1 %2").arg(modcodModulationStr).arg(modcodCodeRateStr));
}
if((m_intLastDecodedData-m_intPreviousDecodedData)>=0)
if (m_cstlnSetByModcod != m_datvDemod->isCstlnSetByModcod())
{
m_intLastSpeed = 8*(m_intLastDecodedData-m_intPreviousDecodedData);
ui->lblRate->setText(QString("Speed: %1b/s").arg(formatBytes(m_intLastSpeed)));
m_cstlnSetByModcod = m_datvDemod->isCstlnSetByModcod();
if (m_cstlnSetByModcod) {
ui->statusText->setStyleSheet("QLabel { background-color : green; }");
} else {
ui->statusText->setStyleSheet("QLabel { background:rgb(79,79,79); }");
}
}
if (m_datvDemod->audioActive())

4
plugins/channelrx/demoddatv/leansdr/dvb.h

@ -260,9 +260,11 @@ struct deconvol_sync : runnable @@ -260,9 +260,11 @@ struct deconvol_sync : runnable
if (parity(prefix & response[b]) != ((exp >> b) & 1))
{
// Current candidate does not solve this column.
if ((response[b] >> nprefix) == 0)
if (nprefix >= sizeof(iq_t) * 8 || (response[b] >> nprefix) == 0)
{
// No more bits to trace back.
return;
}
solved = 0;
}
}

2
plugins/channelrx/demodm17/m17demodprocessor.cpp

@ -344,7 +344,7 @@ bool M17DemodProcessor::decode_packet(modemm17::M17FrameDecoder::packet_buffer_t @@ -344,7 +344,7 @@ bool M17DemodProcessor::decode_packet(modemm17::M17FrameDecoder::packet_buffer_t
}
uint16_t calcChecksum = crc16.get_bytes()[1] + (crc16.get_bytes()[0]<<8);
uint16_t xmitChecksum = m_currentPacket.back() + (m_currentPacket.end()[-2]<<8);
uint16_t xmitChecksum = m_currentPacket.back() + (m_currentPacket[m_currentPacket.size() - 2] << 8);
if (calcChecksum == xmitChecksum) // (checksum == 0x0f47)
{

4
plugins/channelrx/demodwefax/wefaxtonemeter.cpp

@ -97,7 +97,7 @@ void WefaxToneMeter::evaluate() @@ -97,7 +97,7 @@ void WefaxToneMeter::evaluate()
const double halfWidth = 0.25 * m_shiftHz;
for (double hz = centreHz - halfWidth; hz <= centreHz + halfWidth; hz += binHz)
{
const int bin = binOf(hz);
const int bin = std::clamp(binOf(hz), 0, FFTSize - 1);
const double power = m_spectrum[bin];
if ((power > 10.0 * median)
&& (power > m_spectrum[(bin + FFTSize - 1) % FFTSize])
@ -140,7 +140,7 @@ void WefaxToneMeter::evaluate() @@ -140,7 +140,7 @@ void WefaxToneMeter::evaluate()
// Parabolic interpolation on log power refines each peak within a bin.
const auto refine = [&](double hz) {
const int bin = binOf(hz);
const int bin = std::clamp(binOf(hz), 0, FFTSize - 1);
const double left = std::log(m_spectrum[(bin + FFTSize - 1) % FFTSize]);
const double centre = std::log(m_spectrum[bin]);
const double right = std::log(m_spectrum[(bin + 1) % FFTSize]);

2
plugins/channelrx/freqtracker/freqtrackersink.cpp

@ -63,7 +63,7 @@ FreqTrackerSink::FreqTrackerSink() : @@ -63,7 +63,7 @@ FreqTrackerSink::FreqTrackerSink() :
m_rrcFilter = new FIRFilterRRC();
m_rrcFilter->create(m_settings.m_rfBandwidth / m_sinkSampleRate, m_settings.m_rrcRolloff / 100.0f, 8, FIRFilterRRC::Normalization::Energy);
m_pll.computeCoefficients(0.002f, 0.5f, 10.0f); // bandwidth, damping factor, loop gain
applyChannelSettings(m_channelSampleRate, m_inputFrequencyOffset, true);
applyChannelSettings(m_sinkSampleRate, m_channelSampleRate, m_inputFrequencyOffset, true);
}
FreqTrackerSink::~FreqTrackerSink()

3
plugins/channelrx/remotetcpsink/remotetcpsinksink.cpp

@ -1213,10 +1213,11 @@ void RemoteTCPSinkSink::processCommand() @@ -1213,10 +1213,11 @@ void RemoteTCPSinkSink::processCommand()
quint32 msgLen = RemoteTCPProtocol::extractUInt32(&cmd[1]);
try
{
char *buf = new char[msgLen];
char *buf = new char[msgLen + 1];
len = client->read((char *)buf, msgLen);
if (len == (int) msgLen && msgLen)
{
buf[msgLen] = '\0';
bool broadcast = (bool) buf[0];
int i;
for (i = 1; i < (int) msgLen; i++)

2
plugins/channeltx/moddatv/datvmod.cpp

@ -561,12 +561,12 @@ void DATVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo @@ -561,12 +561,12 @@ void DATVMod::webapiFormatChannelSettings(SWGSDRangel::SWGChannelSettings& respo
void DATVMod::webapiFormatChannelReport(SWGSDRangel::SWGChannelReport& response)
{
response.getDatvModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
int tsBitrate = 0, tsSize = 0, channelSampleRate = 0, dataRate = 0;
int64_t udpBytes = 0;
if (m_basebandSource)
{
response.getDatvModReport()->setChannelPowerDb(CalcDb::dbPower(getMagSq()));
channelSampleRate = m_basebandSource->getChannelSampleRate();
m_basebandSource->geTsFileInfos(tsBitrate, tsSize);
udpBytes = m_basebandSource->getUdpByteCount();

2
plugins/feature/aprs/aprs.cpp

@ -896,7 +896,7 @@ void APRS::webapiReverseSendSettings(const QList<QString>& featureSettingsKeys, @@ -896,7 +896,7 @@ void APRS::webapiReverseSendSettings(const QList<QString>& featureSettingsKeys,
swgAPRSSettings->setMessagesTableColumnIndexes(new QList<int>());
}
swgAPRSSettings->getStatusTableColumnSizes()->clear();
swgAPRSSettings->getMessagesTableColumnIndexes()->clear();
for (int i = 0; i < APRS_MESSAGES_TABLE_COLUMNS; i++) {
swgAPRSSettings->getMessagesTableColumnIndexes()->push_back(settings.m_messagesTableColumnIndexes[i]);

3
plugins/feature/sid/sidsettings.cpp

@ -645,6 +645,9 @@ void SIDSettings::getChannels(QStringList& ids, QStringList& titles) @@ -645,6 +645,9 @@ void SIDSettings::getChannels(QStringList& ids, QStringList& titles)
if (ChannelWebAPIUtils::getChannelReportValue(deviceSetIndex, channelIndex, "channelPowerDB", power))
{
ChannelAPI *channel = mainCore->getChannel(deviceSetIndex, channelIndex);
if (!channel) {
continue;
}
QString id = mainCore->getChannelId(channel);

2
plugins/samplemimo/audiocatsiso/audiocatsiso.cpp

@ -549,7 +549,7 @@ void AudioCATSISO::applySettings(const AudioCATSISOSettings& settings, const QLi @@ -549,7 +549,7 @@ void AudioCATSISO::applySettings(const AudioCATSISOSettings& settings, const QLi
{
forwardRxChange = true;
if (m_rxRunning) {
if (m_rxRunning && m_inputWorker) {
m_inputWorker->setIQMapping(settings.m_rxIQMapping);
}
}

7
plugins/samplemimo/audiocatsiso/audiocatsisocatworker.cpp

@ -226,11 +226,10 @@ void AudioCATSISOCATWorker::catConnect() @@ -226,11 +226,10 @@ void AudioCATSISOCATWorker::catConnect()
);
m_inputMessageQueueToGUI->push(msg);
}
return;
}
else
{
qDebug("AudioCATSISOCATWorker::catConnect: rig initialized with num: %u", m_settings.m_hamlibModel);
}
qDebug("AudioCATSISOCATWorker::catConnect: rig initialized with num: %u", m_settings.m_hamlibModel);
m_rig->state.rigport.type.rig = RIG_PORT_SERIAL;
m_rig->state.rigport.parm.serial.rate = AudioCATSISOSettings::m_catSpeeds[m_settings.m_catSpeedIndex];

89
plugins/samplemimo/plutosdrmimo/plutosdrmimo.cpp

@ -680,11 +680,11 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, const QLi @@ -680,11 +680,11 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, const QLi
// Tx
// Change affecting device sample rate chain and other buddies
if (settingsKeys.contains("devSampleRate") ||
if (plutoBox && (settingsKeys.contains("devSampleRate") ||
settingsKeys.contains("lpfTxFIREnable") ||
settingsKeys.contains("lpfTxFIRlog2Interp") ||
settingsKeys.contains("lpfTxFIRBW") ||
settingsKeys.contains("lpfTxFIRGain") || force)
settingsKeys.contains("lpfTxFIRGain") || force))
{
plutoBox->setFIR(
settings.m_devSampleRate,
@ -779,7 +779,7 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, const QLi @@ -779,7 +779,7 @@ bool PlutoSDRMIMO::applySettings(const PlutoSDRMIMOSettings& settings, const QLi
paramsToSet = true;
}
if (paramsToSet) {
if (plutoBox && paramsToSet) {
plutoBox->set_params(DevicePlutoSDRBox::DEVICE_PHY, params);
}
@ -1343,13 +1343,9 @@ void PlutoSDRMIMO::getRxRSSI(std::string& rssiStr, int chan) @@ -1343,13 +1343,9 @@ void PlutoSDRMIMO::getRxRSSI(std::string& rssiStr, int chan)
return;
}
if (m_plutoParams)
{
DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox();
if (!plutoBox->getRxRSSI(rssiStr, chan)) {
rssiStr = "xxx dB";
}
DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr;
if (plutoBox && !plutoBox->getRxRSSI(rssiStr, chan)) {
rssiStr = "xxx dB";
}
}
@ -1361,15 +1357,10 @@ void PlutoSDRMIMO::getTxRSSI(std::string& rssiStr, int chan) @@ -1361,15 +1357,10 @@ void PlutoSDRMIMO::getTxRSSI(std::string& rssiStr, int chan)
return;
}
if (m_plutoParams)
{
DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox();
if (!plutoBox->getTxRSSI(rssiStr, chan)) {
rssiStr = "xxx dB";
}
DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr;
if (plutoBox && !plutoBox->getTxRSSI(rssiStr, chan)) {
rssiStr = "xxx dB";
}
}
void PlutoSDRMIMO::getRxGain(int& gaindB, int chan)
@ -1380,13 +1371,9 @@ void PlutoSDRMIMO::getRxGain(int& gaindB, int chan) @@ -1380,13 +1371,9 @@ void PlutoSDRMIMO::getRxGain(int& gaindB, int chan)
return;
}
if (m_plutoParams)
{
DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox();
if (!plutoBox->getRxGain(gaindB, chan)) {
gaindB = 0;
}
DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr;
if (plutoBox && !plutoBox->getRxGain(gaindB, chan)) {
gaindB = 0;
}
}
@ -1398,17 +1385,13 @@ void PlutoSDRMIMO::getbbLPRange(quint32& minLimit, quint32& maxLimit) @@ -1398,17 +1385,13 @@ void PlutoSDRMIMO::getbbLPRange(quint32& minLimit, quint32& maxLimit)
return;
}
if (m_plutoParams)
DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr;
if (plutoBox)
{
DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox();
if (plutoBox)
{
uint32_t min, max;
plutoBox->getbbLPRxRange(min, max);
minLimit = min;
maxLimit = max;
}
uint32_t min, max;
plutoBox->getbbLPRxRange(min, max);
minLimit = min;
maxLimit = max;
}
}
@ -1420,17 +1403,13 @@ void PlutoSDRMIMO::getLORange(qint64& minLimit, qint64& maxLimit) @@ -1420,17 +1403,13 @@ void PlutoSDRMIMO::getLORange(qint64& minLimit, qint64& maxLimit)
return;
}
if (m_plutoParams)
DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr;
if (plutoBox)
{
DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox();
if (plutoBox)
{
uint64_t min, max;
plutoBox->getRxLORange(min, max);
minLimit = min;
maxLimit = max;
}
uint64_t min, max;
plutoBox->getRxLORange(min, max);
minLimit = min;
maxLimit = max;
}
}
@ -1442,13 +1421,9 @@ bool PlutoSDRMIMO::fetchTemperature() @@ -1442,13 +1421,9 @@ bool PlutoSDRMIMO::fetchTemperature()
return false;
}
if (m_plutoParams)
{
DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox();
if (plutoBox) {
return plutoBox->fetchTemp();
}
DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr;
if (plutoBox) {
return plutoBox->fetchTemp();
}
return false;
@ -1462,13 +1437,9 @@ float PlutoSDRMIMO::getTemperature() @@ -1462,13 +1437,9 @@ float PlutoSDRMIMO::getTemperature()
return 0.0;
}
if (m_plutoParams)
{
DevicePlutoSDRBox *plutoBox = m_plutoParams->getBox();
if (plutoBox) {
return plutoBox->getTemp();
}
DevicePlutoSDRBox *plutoBox = m_plutoParams ? m_plutoParams->getBox() : nullptr;
if (plutoBox) {
return plutoBox->getTemp();
}
return 0.0;

2
plugins/samplesource/audioinput/audioinput.cpp

@ -297,7 +297,7 @@ void AudioInput::applySettings(const AudioInputSettings& settings, QList<QString @@ -297,7 +297,7 @@ void AudioInput::applySettings(const AudioInputSettings& settings, QList<QString
{
forwardChange = true;
if (m_running) {
if (m_running && m_worker) {
m_worker->setIQMapping(settings.m_iqMapping);
}
}

7
plugins/samplesource/remotetcpinput/remotetcpinputtcphandler.cpp

@ -1948,11 +1948,12 @@ void RemoteTCPInputTCPHandler::processCommands() @@ -1948,11 +1948,12 @@ void RemoteTCPInputTCPHandler::processCommands()
case RemoteTCPProtocol::sendMessage:
{
char *buf = new char[m_commandLength];
char *buf = new char[m_commandLength + 1];
qint64 bytesRead = m_dataSocket->read(buf, m_commandLength);
if (bytesRead == m_commandLength)
{
buf[m_commandLength] = '\0';
bool broadcast = (bool) buf[0];
int i;
for (i = 1; i < (int) m_commandLength; i++)
@ -1962,7 +1963,9 @@ void RemoteTCPInputTCPHandler::processCommands() @@ -1962,7 +1963,9 @@ void RemoteTCPInputTCPHandler::processCommands()
}
}
QString callsign = QString::fromUtf8(&buf[1]);
QString text = QString::fromUtf8(&buf[i+1]);
QString text = (i < (int) m_commandLength)
? QString::fromUtf8(&buf[i+1])
: QString();
qDebug() << "RemoteTCPInputTCPHandler::processCommands: Message " << m_dataSocket->peerAddress() << m_dataSocket->peerPort() << callsign << broadcast << text;
if (m_messageQueueToGUI) {

2
plugins/samplesource/sdrplayv3/sdrplayv3input.cpp

@ -474,7 +474,7 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, const QLis @@ -474,7 +474,7 @@ bool SDRPlayV3Input::applySettings(const SDRPlayV3Settings& settings, const QLis
forwardChange = true;
if (m_running)
if (m_running && m_sdrPlayThread)
{
if (setDeviceCenterFrequency(deviceCenterFrequency)) {
qDebug() << "SDRPlayV3Input::applySettings: center freq: " << settings.m_centerFrequency << " Hz";

24
sdrbase/channel/channelwebapiutils.cpp

@ -397,8 +397,9 @@ bool ChannelWebAPIUtils::setCenterFrequency(unsigned int deviceIndex, double fre @@ -397,8 +397,9 @@ bool ChannelWebAPIUtils::setCenterFrequency(unsigned int deviceIndex, double fre
}
else
{
QString *message = errorResponse2.getMessage();
qWarning("ChannelWebAPIUtils::setCenterFrequency: set device frequency error %d: %s",
httpRC, qPrintable(*errorResponse2.getMessage()));
httpRC, message ? qPrintable(*message) : "Unknown error");
return false;
}
}
@ -1444,8 +1445,9 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr @@ -1444,8 +1445,9 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr
}
else
{
QString *message = errorResponse2.getMessage();
qWarning("ChannelWebAPIUtils::patchDeviceSetting: set device setting error %d: %s",
httpRC, qPrintable(*errorResponse2.getMessage()));
httpRC, message ? qPrintable(*message) : "Unknown error");
return false;
}
}
@ -1501,8 +1503,9 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr @@ -1501,8 +1503,9 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr
}
else
{
QString *message = errorResponse2.getMessage();
qWarning("ChannelWebAPIUtils::patchDeviceSetting: set device setting error %d: %s",
httpRC, qPrintable(*errorResponse2.getMessage()));
httpRC, message ? qPrintable(*message) : "Unknown error");
return false;
}
}
@ -1550,8 +1553,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig @@ -1550,8 +1553,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig
}
else
{
QString *message = errorResponse2.getMessage();
qWarning("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %s error %d: %s",
qPrintable(setting), qPrintable(value), httpRC, qPrintable(*errorResponse2.getMessage()));
qPrintable(setting), qPrintable(value), httpRC, message ? qPrintable(*message) : "Unknown error");
return false;
}
}
@ -1599,8 +1603,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig @@ -1599,8 +1603,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig
}
else
{
QString *message = errorResponse2.getMessage();
qWarning("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %f error %d: %s",
qPrintable(setting), value, httpRC, qPrintable(*errorResponse2.getMessage()));
qPrintable(setting), value, httpRC, message ? qPrintable(*message) : "Unknown error");
return false;
}
}
@ -1680,8 +1685,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig @@ -1680,8 +1685,9 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig
}
else
{
QString *message = errorResponse2.getMessage();
qWarning("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s error %d: %s",
qPrintable(setting), httpRC, qPrintable(*errorResponse2.getMessage()));
qPrintable(setting), httpRC, message ? qPrintable(*message) : "Unknown error");
return false;
}
}
@ -1720,8 +1726,9 @@ bool ChannelWebAPIUtils::patchChannelSetting(ChannelAPI *channel, const QString @@ -1720,8 +1726,9 @@ bool ChannelWebAPIUtils::patchChannelSetting(ChannelAPI *channel, const QString
}
else
{
QString *message = errorResponse2.getMessage();
qWarning("ChannelWebAPIUtils::patchChannelSetting: set feature setting %s to %s error %d: %s",
qPrintable(setting), qPrintable(value.toString()), httpRC, qPrintable(*errorResponse2.getMessage()));
qPrintable(setting), qPrintable(value.toString()), httpRC, message ? qPrintable(*message) : "Unknown error");
return false;
}
}
@ -1834,8 +1841,9 @@ bool ChannelWebAPIUtils::patchChannelSetting(unsigned int deviceSetIndex, unsign @@ -1834,8 +1841,9 @@ bool ChannelWebAPIUtils::patchChannelSetting(unsigned int deviceSetIndex, unsign
}
else
{
QString *message = errorResponse2.getMessage();
qWarning("ChannelWebAPIUtils::patchChannelSetting: set channel setting error %d: %s",
httpRC, qPrintable(*errorResponse2.getMessage()));
httpRC, message ? qPrintable(*message) : "Unknown error");
return false;
}
}

2
sdrbase/dsp/fftfactory.cpp

@ -65,7 +65,7 @@ void FFTFactory::preallocate( @@ -65,7 +65,7 @@ void FFTFactory::preallocate(
{
invFFTEngines.push_back(AllocatedEngine());
invFFTEngines.back().m_engine = FFTEngine::create(m_fftwWisdomFileName);
fftEngines.back().m_engine->setReuse(false);
invFFTEngines.back().m_engine->setReuse(false);
invFFTEngines.back().m_engine->configure(fftSize, true);
}
}

4
sdrbase/dsp/wavfilerecord.cpp

@ -220,13 +220,13 @@ void addString(QByteArray& buffer, const QString& type, const QString text) @@ -220,13 +220,13 @@ void addString(QByteArray& buffer, const QString& type, const QString text)
s.append('\0');
}
quint16 textSize = s.size();
quint32 textSize = s.size();
buffer.append(textSize & 0xff);
buffer.append((textSize >> 8) & 0xff);
buffer.append((textSize >> 16) & 0xff);
buffer.append((textSize >> 24) & 0xff);
buffer.append(s, textSize);
buffer.append(s);
}
void addTag(QByteArray& buffer, const QString& id, const QString text)

5
sdrbase/util/httpdownloadmanager.cpp

@ -123,6 +123,11 @@ void HttpDownloadManager::downloadFinished(QNetworkReply *reply) @@ -123,6 +123,11 @@ void HttpDownloadManager::downloadFinished(QNetworkReply *reply)
{
QString url = reply->url().toEncoded().constData();
int idx = m_downloads.indexOf(reply);
if (idx < 0) {
qWarning("HttpDownloadManager::downloadFinished: reply not found in downloads");
reply->deleteLater();
return;
}
QString filename = m_filenames[idx];
bool success = false;
bool retry = false;

2
sdrgui/dsp/scopevisxy.cpp

@ -75,7 +75,7 @@ void ScopeVisXY::feed(const SampleVector::const_iterator& cbegin, const SampleVe @@ -75,7 +75,7 @@ void ScopeVisXY::feed(const SampleVector::const_iterator& cbegin, const SampleVe
if (m_pixelCount == m_pixelsPerFrame)
{
int rows, cols;
m_tvScreen->getSize(rows, cols);
m_tvScreen->getSize(cols, rows);
if ((rows != m_rows) || (cols != m_cols))
{

5
sdrgui/gui/basicchannelsettingsdialog.cpp

@ -187,6 +187,11 @@ void BasicChannelSettingsDialog::on_presets_clicked() @@ -187,6 +187,11 @@ void BasicChannelSettingsDialog::on_presets_clicked()
return;
}
ChannelAPI *channel = MainCore::instance()->getChannel(channelGUI->getDeviceSetIndex(), channelGUI->getIndex());
if (!channel)
{
qDebug() << "BasicChannelSettingsDialog::on_presets_clicked: not a valid channel";
return;
}
const QString& id = channel->getURI();
PluginPresetsDialog dialog(id);

2
sdrgui/gui/websitebrowser.cpp

@ -391,7 +391,7 @@ QVariant WebsiteBrowser::loadResource(int type, const QUrl& name) @@ -391,7 +391,7 @@ QVariant WebsiteBrowser::loadResource(int type, const QUrl& name)
m_used[url.toString(QUrl::RemoveFragment)] = use(*m_website, url);
}
if (!found.empty())
if (m_website && !found.empty())
{
const auto file = m_website->files.find(found);

90
sdrgui/mainwindow.cpp

@ -413,6 +413,10 @@ void AddSampleSourceFSM::addDevice() @@ -413,6 +413,10 @@ void AddSampleSourceFSM::addDevice()
// Create a file source instance by default if requested device was not enumerated (index = -1)
if (m_deviceIndex < 0) {
m_deviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
if (m_deviceIndex < 0) {
qWarning("AddSampleSourceFSM::addDevice: File Input is not available");
return;
}
}
m_mainWindow->sampleSourceCreate(m_deviceSetIndex, m_deviceIndex, m_deviceUISet);
@ -528,6 +532,10 @@ void AddSampleSinkFSM::addDevice() @@ -528,6 +532,10 @@ void AddSampleSinkFSM::addDevice()
// Create a file sink instance by default if requested device was not enumerated (index = -1)
if (m_deviceIndex < 0) {
m_deviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
if (m_deviceIndex < 0) {
qWarning("AddSampleSinkFSM::addDevice: File Output is not available");
return;
}
}
m_mainWindow->sampleSinkCreate(m_deviceSetIndex, m_deviceIndex, m_deviceUISet);
@ -650,6 +658,10 @@ void AddSampleMIMOFSM::addDevice() @@ -650,6 +658,10 @@ void AddSampleMIMOFSM::addDevice()
// Create a Test MIMO instance by default if requested device was not enumerated (index = -1)
if (m_deviceIndex < 0) {
m_deviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
if (m_deviceIndex < 0) {
qWarning("AddSampleMIMOFSM::addDevice: Test MIMO device is not available");
return;
}
}
m_mainWindow->sampleMIMOCreate(m_deviceSetIndex, m_deviceIndex, m_deviceUISet);
@ -1340,6 +1352,10 @@ void MainWindow::sampleSourceCreate( @@ -1340,6 +1352,10 @@ void MainWindow::sampleSourceCreate(
{
qDebug("MainWindow::sampleSourceCreate: non existent device replaced by File Input");
int fileInputDeviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
if (fileInputDeviceIndex < 0) {
qWarning("MainWindow::sampleSourceCreate: File Input is not available");
return;
}
deviceIndex = fileInputDeviceIndex;
samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileInputDeviceIndex);
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
@ -1498,6 +1514,10 @@ void MainWindow::sampleSinkCreate( @@ -1498,6 +1514,10 @@ void MainWindow::sampleSinkCreate(
{
qDebug("MainWindow::sampleSinkCreate: non existent device replaced by File Sink");
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
if (fileSinkDeviceIndex < 0) {
qWarning("MainWindow::sampleSinkCreate: File Sink is not available");
return;
}
deviceIndex = fileSinkDeviceIndex;
samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
@ -1656,6 +1676,10 @@ void MainWindow::sampleMIMOCreate( @@ -1656,6 +1676,10 @@ void MainWindow::sampleMIMOCreate(
{
qDebug("MainWindow::sampleMIMOCreate: non existent device replaced by Test MIMO");
int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
if (testMIMODeviceIndex < 0) {
qWarning("MainWindow::sampleMIMOCreate: Test MIMO device is not available");
return;
}
deviceIndex = testMIMODeviceIndex;
samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex);
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
@ -3885,6 +3909,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int @@ -3885,6 +3909,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int
BasebandSampleSink *rxChannel = nullptr;
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI);
gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
if (!gui)
{
qWarning("MainWindow::channelAddClicked: RxChannelGUI not available");
return;
}
deviceUI->registerRxChannelInstance(channelAPI, gui);
gui->setDeviceType(ChannelGUI::DeviceType::DeviceRx);
gui->setIndex(channelAPI->getIndexInDeviceSet());
@ -3897,6 +3926,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int @@ -3897,6 +3926,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int
BasebandSampleSource *txChannel = nullptr;
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI);
gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel);
if (!gui)
{
qWarning("MainWindow::channelAddClicked: TxChannelGUI not available");
return;
}
deviceUI->registerTxChannelInstance(channelAPI, gui);
gui->setDeviceType(ChannelGUI::DeviceType::DeviceTx);
gui->setIndex(channelAPI->getIndexInDeviceSet());
@ -3917,6 +3951,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int @@ -3917,6 +3951,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int
MIMOChannel *mimoChannel = nullptr;
pluginInterface->createMIMOChannel(deviceUI->m_deviceAPI, &mimoChannel, &channelAPI);
gui = pluginInterface->createMIMOChannelGUI(deviceUI, mimoChannel);
if (!gui)
{
qWarning("MainWindow::channelAddClicked: MIMOChannelGUI not available");
return;
}
deviceUI->registerChannelInstance(channelAPI, gui);
gui->setIndex(channelAPI->getIndexInDeviceSet());
gui->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
@ -3928,6 +3967,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int @@ -3928,6 +3967,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int
BasebandSampleSink *rxChannel = nullptr;
pluginInterface->createRxChannel(deviceUI->m_deviceAPI, &rxChannel, &channelAPI);
gui = pluginInterface->createRxChannelGUI(deviceUI, rxChannel);
if (!gui)
{
qWarning("MainWindow::channelAddClicked: RxChannelGUI not available");
return;
}
deviceUI->registerRxChannelInstance(channelAPI, gui);
gui->setIndex(channelAPI->getIndexInDeviceSet());
gui->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
@ -3939,6 +3983,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int @@ -3939,6 +3983,11 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int
BasebandSampleSource *txChannel = nullptr;
pluginInterface->createTxChannel(deviceUI->m_deviceAPI, &txChannel, &channelAPI);
gui = pluginInterface->createTxChannelGUI(deviceUI, txChannel);
if (!gui)
{
qWarning("MainWindow::channelAddClicked: TxChannelGUI not available");
return;
}
deviceUI->registerTxChannelInstance(channelAPI, gui);
gui->setIndex(channelAPI->getIndexInDeviceSet());
gui->setDisplayedame(pluginInterface->getPluginDescriptor().displayedName);
@ -3955,35 +4004,32 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int @@ -3955,35 +4004,32 @@ void MainWindow::channelAddClicked(Workspace *workspace, int deviceSetIndex, int
return;
}
if (gui)
{
QObject::connect(
gui,
&ChannelGUI::moveToWorkspace,
this,
[this, gui](int wsIndexDest){ this->channelMove(gui, wsIndexDest); }
);
QObject::connect(
gui,
&ChannelGUI::duplicateChannelEmitted,
this,
[this, gui](){ this->channelDuplicate(gui); }
);
QObject::connect(
gui,
&ChannelGUI::moveToDeviceSet,
this,
[this, gui](int dsIndexDest){ this->channelMoveToDeviceSet(gui, dsIndexDest); }
);
QObject::connect(
gui,
&ChannelGUI::moveToWorkspace,
this,
[this, gui](int wsIndexDest){ this->channelMove(gui, wsIndexDest); }
);
QObject::connect(
gui,
&ChannelGUI::duplicateChannelEmitted,
this,
[this, gui](){ this->channelDuplicate(gui); }
);
QObject::connect(
gui,
&ChannelGUI::moveToDeviceSet,
this,
[this, gui](int dsIndexDest){ this->channelMoveToDeviceSet(gui, dsIndexDest); }
);
gui->setDeviceSetIndex(deviceSetIndex);
gui->setDeviceSetIndex(deviceSetIndex);
gui->setIndexToolTip(deviceAPI->getSamplingDeviceDisplayName());
gui->setWorkspaceIndex(workspace->getIndex());
qDebug("MainWindow::channelAddClicked: adding %s to workspace #%d",
qPrintable(gui->getTitle()), workspace->getIndex());
workspace->addToMdiArea((QMdiSubWindow*) gui);
loadDefaultPreset(channelAPI->getURI(), gui);
}
}
}

24
sdrsrv/mainserver.cpp

@ -285,6 +285,10 @@ void MainServer::addSinkDevice() @@ -285,6 +285,10 @@ void MainServer::addSinkDevice()
// create a file sink by default
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
if (fileSinkDeviceIndex < 0) {
qWarning("MainServer::addSinkDevice: File Output is not available");
return;
}
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
@ -324,6 +328,10 @@ void MainServer::addSourceDevice() @@ -324,6 +328,10 @@ void MainServer::addSourceDevice()
// Create a file source instance by default
int fileSourceDeviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
if (fileSourceDeviceIndex < 0) {
qWarning("MainServer::addSourceDevice: File Input device is not available");
return;
}
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(fileSourceDeviceIndex);
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
@ -361,6 +369,10 @@ void MainServer::addMIMODevice() @@ -361,6 +369,10 @@ void MainServer::addMIMODevice()
// create a test MIMO by default
int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
if (testMIMODeviceIndex < 0) {
qWarning("MainServer::addMIMODevice: Test MIMO device is not available");
return;
}
const PluginInterface::SamplingDevice *samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex);
deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
@ -463,6 +475,10 @@ void MainServer::changeSampleSource(int deviceSetIndex, int selectedDeviceIndex) @@ -463,6 +475,10 @@ void MainServer::changeSampleSource(int deviceSetIndex, int selectedDeviceIndex)
{
qDebug("MainServer::changeSampleSource: non existent device replaced by File Input");
int deviceIndex = DeviceEnumerator::instance()->getFileInputDeviceIndex();
if (deviceIndex < 0) {
qWarning("MainServer::changeSampleSource: File Input is not available");
return;
}
samplingDevice = DeviceEnumerator::instance()->getRxSamplingDevice(deviceIndex);
deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
@ -543,6 +559,10 @@ void MainServer::changeSampleSink(int deviceSetIndex, int selectedDeviceIndex) @@ -543,6 +559,10 @@ void MainServer::changeSampleSink(int deviceSetIndex, int selectedDeviceIndex)
{
qDebug("MainServer::changeSampleSink: non existent device replaced by File Sink");
int fileSinkDeviceIndex = DeviceEnumerator::instance()->getFileOutputDeviceIndex();
if (fileSinkDeviceIndex < 0) {
qWarning("MainServer::changeSampleSink: File Sink is not available");
return;
}
samplingDevice = DeviceEnumerator::instance()->getTxSamplingDevice(fileSinkDeviceIndex);
deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);
@ -622,6 +642,10 @@ void MainServer::changeSampleMIMO(int deviceSetIndex, int selectedDeviceIndex) @@ -622,6 +642,10 @@ void MainServer::changeSampleMIMO(int deviceSetIndex, int selectedDeviceIndex)
{
qDebug("MainServer::changeSampleMIMO: non existent device replaced by Test MIMO");
int testMIMODeviceIndex = DeviceEnumerator::instance()->getTestMIMODeviceIndex();
if (testMIMODeviceIndex < 0) {
qWarning("MainServer::changeSampleMIMO: Test MIMO device is not available");
return;
}
samplingDevice = DeviceEnumerator::instance()->getMIMOSamplingDevice(testMIMODeviceIndex);
deviceSet->m_deviceAPI->setSamplingDeviceSequence(samplingDevice->sequence);
deviceSet->m_deviceAPI->setDeviceNbItems(samplingDevice->deviceNbItems);

Loading…
Cancel
Save