diff --git a/plugins/samplemimo/testmi/testmi.cpp b/plugins/samplemimo/testmi/testmi.cpp index 8e11b548c..8780743b4 100644 --- a/plugins/samplemimo/testmi/testmi.cpp +++ b/plugins/samplemimo/testmi/testmi.cpp @@ -25,6 +25,7 @@ #include "SWGDeviceSettings.h" #include "SWGDeviceState.h" +#include "SWGTestMISettings.h" #include "device/deviceapi.h" #include "dsp/dspcommands.h" @@ -44,16 +45,17 @@ MESSAGE_CLASS_DEFINITION(TestMI::MsgStartStop, Message) TestMI::TestMI(DeviceAPI *deviceAPI) : m_deviceAPI(deviceAPI), m_settings(), - m_testSourceThread(0), m_deviceDescription(), m_running(false), m_masterTimer(deviceAPI->getMasterTimer()) { m_fileSink = new FileRecord(QString("test_%1.sdriq").arg(m_deviceAPI->getDeviceUID())); - m_deviceAPI->setNbSourceStreams(1); + m_deviceAPI->setNbSourceStreams(2); + m_deviceAPI->addSourceStream(); // Add a new source stream data set in the engine m_deviceAPI->addSourceStream(); // Add a new source stream data set in the engine m_deviceAPI->addAncillarySink(m_fileSink); m_sampleSinkFifos.push_back(SampleSinkFifo(96000 * 4)); + m_sampleSinkFifos.push_back(SampleSinkFifo(96000 * 4)); m_networkManager = new QNetworkAccessManager(); connect(m_networkManager, SIGNAL(finished(QNetworkReply*)), this, SLOT(networkManagerFinished(QNetworkReply*))); } @@ -69,6 +71,7 @@ TestMI::~TestMI() m_deviceAPI->removeAncillarySink(m_fileSink); m_deviceAPI->removeLastSourceStream(); // Remove the last source stream data set in the engine + m_deviceAPI->removeLastSourceStream(); // Remove the last source stream data set in the engine delete m_fileSink; } @@ -88,9 +91,13 @@ bool TestMI::start() if (m_running) stop(); - m_testSourceThread = new TestMIThread(&m_sampleSinkFifos[0]); - m_testSourceThread->setSamplerate(m_settings.m_sampleRate); - m_testSourceThread->startStop(true); + m_testSourceThreads.push_back(new TestMIThread(&m_sampleSinkFifos[0])); + m_testSourceThreads.back()->setSamplerate(m_settings.m_streams[0].m_sampleRate); + m_testSourceThreads.back()->startStop(true); + + m_testSourceThreads.push_back(new TestMIThread(&m_sampleSinkFifos[1])); + m_testSourceThreads.back()->setSamplerate(m_settings.m_streams[1].m_sampleRate); + m_testSourceThreads.back()->startStop(true); mutexLocker.unlock(); @@ -104,13 +111,15 @@ void TestMI::stop() { QMutexLocker mutexLocker(&m_mutex); - if (m_testSourceThread != 0) - { - m_testSourceThread->startStop(false); - m_testSourceThread->deleteLater(); - m_testSourceThread = 0; - } + std::vector::iterator it = m_testSourceThreads.begin(); + for (; it != m_testSourceThreads.end(); ++it) + { + (*it)->startStop(false); + (*it)->deleteLater(); + } + + m_testSourceThreads.clear(); m_running = false; } @@ -148,29 +157,38 @@ const QString& TestMI::getDeviceDescription() const int TestMI::getSourceSampleRate(int index) const { - (void) index; - return m_settings.m_sampleRate/(1<push(messageToGUI); + settings.m_streams[index].m_centerFrequency = centerFrequency; + + MsgConfigureTestSource* message = MsgConfigureTestSource::create(settings, false); + m_inputMessageQueue.push(message); + + if (m_guiMessageQueue) + { + MsgConfigureTestSource* messageToGUI = MsgConfigureTestSource::create(settings, false); + m_guiMessageQueue->push(messageToGUI); + } } } @@ -243,204 +261,213 @@ bool TestMI::handleMessage(const Message& message) bool TestMI::applySettings(const TestMISettings& settings, bool force) { - QList reverseAPIKeys; + DeviceSettingsKeys deviceSettingsKeys; - if ((m_settings.m_autoCorrOptions != settings.m_autoCorrOptions) || force) + QList> streamReverseAPIKeys; // FIXME: one set of keys per streams + + for (unsigned int istream = 0; istream < m_settings.m_streams.size(); istream++) { - reverseAPIKeys.append("autoCorrOptions"); + deviceSettingsKeys.m_streamsSettingsKeys.push_back(QList()); + QList& reverseAPIKeys = streamReverseAPIKeys.back(); - switch(settings.m_autoCorrOptions) + if ((m_settings.m_streams[istream].m_autoCorrOptions != settings.m_streams[istream].m_autoCorrOptions) || force) { - case TestMISettings::AutoCorrDC: - m_deviceAPI->configureCorrections(true, false); - break; - case TestMISettings::AutoCorrDCAndIQ: - m_deviceAPI->configureCorrections(true, true); - break; - case TestMISettings::AutoCorrNone: - default: - m_deviceAPI->configureCorrections(false, false); - break; - } - } + reverseAPIKeys.append("autoCorrOptions"); - if ((m_settings.m_sampleRate != settings.m_sampleRate) || force) - { - reverseAPIKeys.append("sampleRate"); - - if (m_testSourceThread != 0) - { - m_testSourceThread->setSamplerate(settings.m_sampleRate); - qDebug("TestMI::applySettings: sample rate set to %d", settings.m_sampleRate); - } - } - - if ((m_settings.m_log2Decim != settings.m_log2Decim) || force) - { - reverseAPIKeys.append("log2Decim"); - - if (m_testSourceThread != 0) - { - m_testSourceThread->setLog2Decimation(settings.m_log2Decim); - qDebug() << "TestMI::applySettings: set decimation to " << (1<setFcPos((int) settings.m_fcPos); - m_testSourceThread->setFrequencyShift(frequencyShift); - qDebug() << "TestMI::applySettings:" - << " center freq: " << settings.m_centerFrequency << " Hz" - << " device center freq: " << deviceCenterFrequency << " Hz" - << " device sample rate: " << devSampleRate << "Hz" - << " Actual sample rate: " << devSampleRate/(1<setAmplitudeBits(settings.m_amplitudeBits); - } - } - - if ((m_settings.m_dcFactor != settings.m_dcFactor) || force) - { - reverseAPIKeys.append("dcFactor"); - - if (m_testSourceThread != 0) { - m_testSourceThread->setDCFactor(settings.m_dcFactor); - } - } - - if ((m_settings.m_iFactor != settings.m_iFactor) || force) - { - reverseAPIKeys.append("iFactor"); - - if (m_testSourceThread != 0) { - m_testSourceThread->setIFactor(settings.m_iFactor); - } - } - - if ((m_settings.m_qFactor != settings.m_qFactor) || force) - { - reverseAPIKeys.append("qFactor"); - - if (m_testSourceThread != 0) { - m_testSourceThread->setQFactor(settings.m_qFactor); - } - } - - if ((m_settings.m_phaseImbalance != settings.m_phaseImbalance) || force) - { - reverseAPIKeys.append("phaseImbalance"); - - if (m_testSourceThread != 0) { - m_testSourceThread->setPhaseImbalance(settings.m_phaseImbalance); - } - } - - if ((m_settings.m_sampleSizeIndex != settings.m_sampleSizeIndex) || force) - { - reverseAPIKeys.append("sampleSizeIndex"); - - if (m_testSourceThread != 0) { - m_testSourceThread->setBitSize(settings.m_sampleSizeIndex); - } - } - - if ((m_settings.m_sampleRate != settings.m_sampleRate) - || (m_settings.m_centerFrequency != settings.m_centerFrequency) - || (m_settings.m_log2Decim != settings.m_log2Decim) - || (m_settings.m_fcPos != settings.m_fcPos) || force) - { - int sampleRate = settings.m_sampleRate/(1<handleMessage(*notif); // forward to file sink - DSPDeviceMIMOEngine::SignalNotification *engineNotif = new DSPDeviceMIMOEngine::SignalNotification( - sampleRate, settings.m_centerFrequency, true, 0); - m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif); - } - - if ((m_settings.m_modulationTone != settings.m_modulationTone) || force) - { - reverseAPIKeys.append("modulationTone"); - - if (m_testSourceThread != 0) { - m_testSourceThread->setToneFrequency(settings.m_modulationTone * 10); - } - } - - if ((m_settings.m_modulation != settings.m_modulation) || force) - { - reverseAPIKeys.append("modulation"); - - if (m_testSourceThread != 0) - { - m_testSourceThread->setModulation(settings.m_modulation); - - if (settings.m_modulation == TestMISettings::ModulationPattern0) { - m_testSourceThread->setPattern0(); - } else if (settings.m_modulation == TestMISettings::ModulationPattern1) { - m_testSourceThread->setPattern1(); - } else if (settings.m_modulation == TestMISettings::ModulationPattern2) { - m_testSourceThread->setPattern2(); + switch(settings.m_streams[istream].m_autoCorrOptions) + { + case TestMIStreamSettings::AutoCorrDC: + m_deviceAPI->configureCorrections(true, false, istream); + break; + case TestMIStreamSettings::AutoCorrDCAndIQ: + m_deviceAPI->configureCorrections(true, true, istream); + break; + case TestMIStreamSettings::AutoCorrNone: + default: + m_deviceAPI->configureCorrections(false, false, istream); + break; } } - } - if ((m_settings.m_amModulation != settings.m_amModulation) || force) - { - reverseAPIKeys.append("amModulation"); + if ((m_settings.m_streams[istream].m_sampleRate != settings.m_streams[istream].m_sampleRate) || force) + { + reverseAPIKeys.append("sampleRate"); - if (m_testSourceThread != 0) { - m_testSourceThread->setAMModulation(settings.m_amModulation / 100.0f); + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) + { + m_testSourceThreads[istream]->setSamplerate(settings.m_streams[istream].m_sampleRate); + qDebug("TestMI::applySettings: sample rate set to %d", settings.m_streams[istream].m_sampleRate); + } } - } - if ((m_settings.m_fmDeviation != settings.m_fmDeviation) || force) - { - reverseAPIKeys.append("fmDeviation"); + if ((m_settings.m_streams[istream].m_log2Decim != settings.m_streams[istream].m_log2Decim) || force) + { + reverseAPIKeys.append("log2Decim"); - if (m_testSourceThread != 0) { - m_testSourceThread->setFMDeviation(settings.m_fmDeviation * 100.0f); + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) + { + m_testSourceThreads[istream]->setLog2Decimation(settings.m_streams[istream].m_log2Decim); + qDebug() << "TestMI::applySettings: set decimation to " << (1<setFcPos((int) settings.m_streams[istream].m_fcPos); + m_testSourceThreads[istream]->setFrequencyShift(frequencyShift); + qDebug() << "TestMI::applySettings:" + << " istream: " << istream + << " center freq: " << settings.m_streams[istream].m_centerFrequency << " Hz" + << " device center freq: " << deviceCenterFrequency << " Hz" + << " device sample rate: " << devSampleRate << "Hz" + << " Actual sample rate: " << devSampleRate/(1<setAmplitudeBits(settings.m_streams[istream].m_amplitudeBits); + } + } + + if ((m_settings.m_streams[istream].m_dcFactor != settings.m_streams[istream].m_dcFactor) || force) + { + reverseAPIKeys.append("dcFactor"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { + m_testSourceThreads[istream]->setDCFactor(settings.m_streams[istream].m_dcFactor); + } + } + + if ((m_settings.m_streams[istream].m_iFactor != settings.m_streams[istream].m_iFactor) || force) + { + reverseAPIKeys.append("iFactor"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { + m_testSourceThreads[istream]->setIFactor(settings.m_streams[istream].m_iFactor); + } + } + + if ((m_settings.m_streams[istream].m_qFactor != settings.m_streams[istream].m_qFactor) || force) + { + reverseAPIKeys.append("qFactor"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { + m_testSourceThreads[istream]->setQFactor(settings.m_streams[istream].m_qFactor); + } + } + + if ((m_settings.m_streams[istream].m_phaseImbalance != settings.m_streams[istream].m_phaseImbalance) || force) + { + reverseAPIKeys.append("phaseImbalance"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { + m_testSourceThreads[istream]->setPhaseImbalance(settings.m_streams[istream].m_phaseImbalance); + } + } + + if ((m_settings.m_streams[istream].m_sampleSizeIndex != settings.m_streams[istream].m_sampleSizeIndex) || force) + { + reverseAPIKeys.append("sampleSizeIndex"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { + m_testSourceThreads[istream]->setBitSize(settings.m_streams[istream].m_sampleSizeIndex); + } + } + + if ((m_settings.m_streams[istream].m_sampleRate != settings.m_streams[istream].m_sampleRate) + || (m_settings.m_streams[istream].m_centerFrequency != settings.m_streams[istream].m_centerFrequency) + || (m_settings.m_streams[istream].m_log2Decim != settings.m_streams[istream].m_log2Decim) + || (m_settings.m_streams[istream].m_fcPos != settings.m_streams[istream].m_fcPos) || force) + { + int sampleRate = settings.m_streams[istream].m_sampleRate/(1<handleMessage(*notif); // forward to file sink + DSPDeviceMIMOEngine::SignalNotification *engineNotif = new DSPDeviceMIMOEngine::SignalNotification( + sampleRate, settings.m_streams[istream].m_centerFrequency, true, 0); + m_deviceAPI->getDeviceEngineInputMessageQueue()->push(engineNotif); + } + + if ((m_settings.m_streams[istream].m_modulationTone != settings.m_streams[istream].m_modulationTone) || force) + { + reverseAPIKeys.append("modulationTone"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { + m_testSourceThreads[istream]->setToneFrequency(settings.m_streams[istream].m_modulationTone * 10); + } + } + + if ((m_settings.m_streams[istream].m_modulation != settings.m_streams[istream].m_modulation) || force) + { + reverseAPIKeys.append("modulation"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) + { + m_testSourceThreads[istream]->setModulation(settings.m_streams[istream].m_modulation); + + if (settings.m_streams[istream].m_modulation == TestMIStreamSettings::ModulationPattern0) { + m_testSourceThreads[istream]->setPattern0(); + } else if (settings.m_streams[istream].m_modulation == TestMIStreamSettings::ModulationPattern1) { + m_testSourceThreads[istream]->setPattern1(); + } else if (settings.m_streams[istream].m_modulation == TestMIStreamSettings::ModulationPattern2) { + m_testSourceThreads[istream]->setPattern2(); + } + } + } + + if ((m_settings.m_streams[istream].m_amModulation != settings.m_streams[istream].m_amModulation) || force) + { + reverseAPIKeys.append("amModulation"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { + m_testSourceThreads[istream]->setAMModulation(settings.m_streams[istream].m_amModulation / 100.0f); + } + } + + if ((m_settings.m_streams[istream].m_fmDeviation != settings.m_streams[istream].m_fmDeviation) || force) + { + reverseAPIKeys.append("fmDeviation"); + + if ((istream < m_testSourceThreads.size()) && (m_testSourceThreads[istream])) { + m_testSourceThreads[istream]->setFMDeviation(settings.m_streams[istream].m_fmDeviation * 100.0f); + } + } + } // for each stream index if (settings.m_useReverseAPI) { @@ -449,7 +476,7 @@ bool TestMI::applySettings(const TestMISettings& settings, bool force) (m_settings.m_reverseAPIAddress != settings.m_reverseAPIAddress) || (m_settings.m_reverseAPIPort != settings.m_reverseAPIPort) || (m_settings.m_reverseAPIDeviceIndex != settings.m_reverseAPIDeviceIndex); - webapiReverseSendSettings(reverseAPIKeys, settings, fullUpdate || force); + webapiReverseSendSettings(deviceSettingsKeys, settings, fullUpdate || force); } m_settings = settings; @@ -504,62 +531,75 @@ int TestMI::webapiSettingsPutPatch( (void) errorMessage; TestMISettings settings = m_settings; - if (deviceSettingsKeys.contains("centerFrequency")) { - settings.m_centerFrequency = response.getTestMiSettings()->getCenterFrequency(); + if (deviceSettingsKeys.contains("streams")) + { + QList *streamsSettings = response.getTestMiSettings()->getStreams(); + QList::const_iterator it = streamsSettings->begin(); + + for (; it != streamsSettings->end(); ++it) + { + int istream = (*it)->getStreamIndex(); + + if (deviceSettingsKeys.contains(tr("streams[%1].centerFrequency").arg(istream))) { + settings.m_streams[istream].m_centerFrequency = (*it)->getCenterFrequency(); + } + if (deviceSettingsKeys.contains(tr("streams[%1].frequencyShift").arg(istream))) { + settings.m_streams[istream].m_frequencyShift = (*it)->getFrequencyShift(); + } + if (deviceSettingsKeys.contains(tr("streams[%1].sampleRate").arg(istream))) { + settings.m_streams[istream].m_sampleRate = (*it)->getSampleRate(); + } + if (deviceSettingsKeys.contains(tr("streams[%1].log2Decim").arg(istream))) { + settings.m_streams[istream].m_log2Decim = (*it)->getLog2Decim(); + } + if (deviceSettingsKeys.contains(tr("streams[%1].fcPos").arg(istream))) { + int fcPos = (*it)->getFcPos(); + fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos; + settings.m_streams[istream].m_fcPos = (TestMIStreamSettings::fcPos_t) fcPos; + } + if (deviceSettingsKeys.contains(tr("streams[%1].sampleSizeIndex").arg(istream))) { + int sampleSizeIndex = (*it)->getSampleSizeIndex(); + sampleSizeIndex = sampleSizeIndex < 0 ? 0 : sampleSizeIndex > 1 ? 2 : sampleSizeIndex; + settings.m_streams[istream].m_sampleSizeIndex = sampleSizeIndex; + } + if (deviceSettingsKeys.contains(tr("streams[%1].amplitudeBits").arg(istream))) { + settings.m_streams[istream].m_amplitudeBits = (*it)->getAmplitudeBits(); + } + if (deviceSettingsKeys.contains(tr("streams[%1].autoCorrOptions").arg(istream))) { + int autoCorrOptions = (*it)->getAutoCorrOptions(); + autoCorrOptions = autoCorrOptions < 0 ? 0 : autoCorrOptions >= TestMIStreamSettings::AutoCorrLast ? TestMIStreamSettings::AutoCorrLast-1 : autoCorrOptions; + settings.m_streams[istream].m_sampleSizeIndex = (TestMIStreamSettings::AutoCorrOptions) autoCorrOptions; + } + if (deviceSettingsKeys.contains(tr("streams[%1].modulation").arg(istream))) { + int modulation = (*it)->getModulation(); + modulation = modulation < 0 ? 0 : modulation >= TestMIStreamSettings::ModulationLast ? TestMIStreamSettings::ModulationLast-1 : modulation; + settings.m_streams[istream].m_modulation = (TestMIStreamSettings::Modulation) modulation; + } + if (deviceSettingsKeys.contains(tr("streams[%1].modulationTone").arg(istream))) { + settings.m_streams[istream].m_modulationTone = (*it)->getModulationTone(); + } + if (deviceSettingsKeys.contains(tr("streams[%1].amModulation").arg(istream))) { + settings.m_streams[istream].m_amModulation = (*it)->getAmModulation(); + }; + if (deviceSettingsKeys.contains(tr("streams[%1].fmDeviation").arg(istream))) { + settings.m_streams[istream].m_fmDeviation = (*it)->getFmDeviation(); + }; + if (deviceSettingsKeys.contains(tr("streams[%1].dcFactor").arg(istream))) { + settings.m_streams[istream].m_dcFactor = (*it)->getDcFactor(); + }; + if (deviceSettingsKeys.contains(tr("streams[%1].iFactor").arg(istream))) { + settings.m_streams[istream].m_iFactor = (*it)->getIFactor(); + }; + if (deviceSettingsKeys.contains(tr("streams[%1].qFactor").arg(istream))) { + settings.m_streams[istream].m_qFactor = (*it)->getQFactor(); + }; + if (deviceSettingsKeys.contains(tr("streams[%1].phaseImbalance").arg(istream))) { + settings.m_streams[istream].m_phaseImbalance = (*it)->getPhaseImbalance(); + }; + } + } - if (deviceSettingsKeys.contains("frequencyShift")) { - settings.m_frequencyShift = response.getTestMiSettings()->getFrequencyShift(); - } - if (deviceSettingsKeys.contains("sampleRate")) { - settings.m_sampleRate = response.getTestMiSettings()->getSampleRate(); - } - if (deviceSettingsKeys.contains("log2Decim")) { - settings.m_log2Decim = response.getTestMiSettings()->getLog2Decim(); - } - if (deviceSettingsKeys.contains("fcPos")) { - int fcPos = response.getTestMiSettings()->getFcPos(); - fcPos = fcPos < 0 ? 0 : fcPos > 2 ? 2 : fcPos; - settings.m_fcPos = (TestMISettings::fcPos_t) fcPos; - } - if (deviceSettingsKeys.contains("sampleSizeIndex")) { - int sampleSizeIndex = response.getTestMiSettings()->getSampleSizeIndex(); - sampleSizeIndex = sampleSizeIndex < 0 ? 0 : sampleSizeIndex > 1 ? 2 : sampleSizeIndex; - settings.m_sampleSizeIndex = sampleSizeIndex; - } - if (deviceSettingsKeys.contains("amplitudeBits")) { - settings.m_amplitudeBits = response.getTestMiSettings()->getAmplitudeBits(); - } - if (deviceSettingsKeys.contains("autoCorrOptions")) { - int autoCorrOptions = response.getTestMiSettings()->getAutoCorrOptions(); - autoCorrOptions = autoCorrOptions < 0 ? 0 : autoCorrOptions >= TestMISettings::AutoCorrLast ? TestMISettings::AutoCorrLast-1 : autoCorrOptions; - settings.m_sampleSizeIndex = (TestMISettings::AutoCorrOptions) autoCorrOptions; - } - if (deviceSettingsKeys.contains("modulation")) { - int modulation = response.getTestMiSettings()->getModulation(); - modulation = modulation < 0 ? 0 : modulation >= TestMISettings::ModulationLast ? TestMISettings::ModulationLast-1 : modulation; - settings.m_modulation = (TestMISettings::Modulation) modulation; - } - if (deviceSettingsKeys.contains("modulationTone")) { - settings.m_modulationTone = response.getTestMiSettings()->getModulationTone(); - } - if (deviceSettingsKeys.contains("amModulation")) { - settings.m_amModulation = response.getTestMiSettings()->getAmModulation(); - }; - if (deviceSettingsKeys.contains("fmDeviation")) { - settings.m_fmDeviation = response.getTestMiSettings()->getFmDeviation(); - }; - if (deviceSettingsKeys.contains("dcFactor")) { - settings.m_dcFactor = response.getTestMiSettings()->getDcFactor(); - }; - if (deviceSettingsKeys.contains("iFactor")) { - settings.m_iFactor = response.getTestMiSettings()->getIFactor(); - }; - if (deviceSettingsKeys.contains("qFactor")) { - settings.m_qFactor = response.getTestMiSettings()->getQFactor(); - }; - if (deviceSettingsKeys.contains("phaseImbalance")) { - settings.m_phaseImbalance = response.getTestMiSettings()->getPhaseImbalance(); - }; + if (deviceSettingsKeys.contains("fileRecordName")) { settings.m_fileRecordName = *response.getTestMiSettings()->getFileRecordName(); } @@ -591,22 +631,32 @@ int TestMI::webapiSettingsPutPatch( void TestMI::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const TestMISettings& settings) { - response.getTestMiSettings()->setCenterFrequency(settings.m_centerFrequency); - response.getTestMiSettings()->setFrequencyShift(settings.m_frequencyShift); - response.getTestMiSettings()->setSampleRate(settings.m_sampleRate); - response.getTestMiSettings()->setLog2Decim(settings.m_log2Decim); - response.getTestMiSettings()->setFcPos((int) settings.m_fcPos); - response.getTestMiSettings()->setSampleSizeIndex((int) settings.m_sampleSizeIndex); - response.getTestMiSettings()->setAmplitudeBits(settings.m_amplitudeBits); - response.getTestMiSettings()->setAutoCorrOptions((int) settings.m_autoCorrOptions); - response.getTestMiSettings()->setModulation((int) settings.m_modulation); - response.getTestMiSettings()->setModulationTone(settings.m_modulationTone); - response.getTestMiSettings()->setAmModulation(settings.m_amModulation); - response.getTestMiSettings()->setFmDeviation(settings.m_fmDeviation); - response.getTestMiSettings()->setDcFactor(settings.m_dcFactor); - response.getTestMiSettings()->setIFactor(settings.m_iFactor); - response.getTestMiSettings()->setQFactor(settings.m_qFactor); - response.getTestMiSettings()->setPhaseImbalance(settings.m_phaseImbalance); + std::vector::const_iterator it = settings.m_streams.begin(); + int istream = 0; + + for (; it != settings.m_streams.end(); ++it, istream++) + { + QList *streams = response.getTestMiSettings()->getStreams(); + streams->append(new SWGSDRangel::SWGTestMiStreamSettings); + streams->back()->init(); + streams->back()->setStreamIndex(istream); + streams->back()->setCenterFrequency(it->m_centerFrequency); + streams->back()->setFrequencyShift(it->m_frequencyShift); + streams->back()->setSampleRate(it->m_sampleRate); + streams->back()->setLog2Decim(it->m_log2Decim); + streams->back()->setFcPos((int) it->m_fcPos); + streams->back()->setSampleSizeIndex((int) it->m_sampleSizeIndex); + streams->back()->setAmplitudeBits(it->m_amplitudeBits); + streams->back()->setAutoCorrOptions((int) it->m_autoCorrOptions); + streams->back()->setModulation((int) it->m_modulation); + streams->back()->setModulationTone(it->m_modulationTone); + streams->back()->setAmModulation(it->m_amModulation); + streams->back()->setFmDeviation(it->m_fmDeviation); + streams->back()->setDcFactor(it->m_dcFactor); + streams->back()->setIFactor(it->m_iFactor); + streams->back()->setQFactor(it->m_qFactor); + streams->back()->setPhaseImbalance(it->m_phaseImbalance); + } if (response.getTestMiSettings()->getFileRecordName()) { *response.getTestMiSettings()->getFileRecordName() = settings.m_fileRecordName; @@ -626,7 +676,7 @@ void TestMI::webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response response.getTestMiSettings()->setReverseApiDeviceIndex(settings.m_reverseAPIDeviceIndex); } -void TestMI::webapiReverseSendSettings(QList& deviceSettingsKeys, const TestMISettings& settings, bool force) +void TestMI::webapiReverseSendSettings(const DeviceSettingsKeys& deviceSettingsKeys, const TestMISettings& settings, bool force) { SWGSDRangel::SWGDeviceSettings *swgDeviceSettings = new SWGSDRangel::SWGDeviceSettings(); swgDeviceSettings->setDirection(0); // single Rx @@ -637,55 +687,71 @@ void TestMI::webapiReverseSendSettings(QList& deviceSettingsKeys, const // transfer data that has been modified. When force is on transfer all data except reverse API data - if (deviceSettingsKeys.contains("centerFrequency") || force) { - swgTestMISettings->setCenterFrequency(settings.m_centerFrequency); + QList>::const_iterator it = deviceSettingsKeys.m_streamsSettingsKeys.begin(); + int istream = 0; + + for (; it != deviceSettingsKeys.m_streamsSettingsKeys.end(); ++it, istream++) + { + if ((it->size() > 0) || force) + { + QList *streams = swgTestMISettings->getStreams(); + streams->append(new SWGSDRangel::SWGTestMiStreamSettings); + streams->back()->init(); + streams->back()->setStreamIndex(istream); + const QList& streamSettingsKeys = *it; + + if (streamSettingsKeys.contains("centerFrequency") || force) { + streams->back()->setCenterFrequency(settings.m_streams[istream].m_centerFrequency); + } + if (streamSettingsKeys.contains("frequencyShift") || force) { + streams->back()->setFrequencyShift(settings.m_streams[istream].m_frequencyShift); + } + if (streamSettingsKeys.contains("sampleRate") || force) { + streams->back()->setSampleRate(settings.m_streams[istream].m_sampleRate); + } + if (streamSettingsKeys.contains("log2Decim") || force) { + streams->back()->setLog2Decim(settings.m_streams[istream].m_log2Decim); + } + if (streamSettingsKeys.contains("fcPos") || force) { + streams->back()->setFcPos((int) settings.m_streams[istream].m_fcPos); + } + if (streamSettingsKeys.contains("sampleSizeIndex") || force) { + streams->back()->setSampleSizeIndex(settings.m_streams[istream].m_sampleSizeIndex); + } + if (streamSettingsKeys.contains("amplitudeBits") || force) { + streams->back()->setAmplitudeBits(settings.m_streams[istream].m_amplitudeBits); + } + if (streamSettingsKeys.contains("autoCorrOptions") || force) { + streams->back()->setAutoCorrOptions((int) settings.m_streams[istream].m_sampleSizeIndex); + } + if (streamSettingsKeys.contains("modulation") || force) { + streams->back()->setModulation((int) settings.m_streams[istream].m_modulation); + } + if (streamSettingsKeys.contains("modulationTone")) { + streams->back()->setModulationTone(settings.m_streams[istream].m_modulationTone); + } + if (streamSettingsKeys.contains("amModulation") || force) { + streams->back()->setAmModulation(settings.m_streams[istream].m_amModulation); + }; + if (streamSettingsKeys.contains("fmDeviation") || force) { + streams->back()->setFmDeviation(settings.m_streams[istream].m_fmDeviation); + }; + if (streamSettingsKeys.contains("dcFactor") || force) { + streams->back()->setDcFactor(settings.m_streams[istream].m_dcFactor); + }; + if (streamSettingsKeys.contains("iFactor") || force) { + streams->back()->setIFactor(settings.m_streams[istream].m_iFactor); + }; + if (streamSettingsKeys.contains("qFactor") || force) { + streams->back()->setQFactor(settings.m_streams[istream].m_qFactor); + }; + if (streamSettingsKeys.contains("phaseImbalance") || force) { + streams->back()->setPhaseImbalance(settings.m_streams[istream].m_phaseImbalance); + }; + } } - if (deviceSettingsKeys.contains("frequencyShift") || force) { - swgTestMISettings->setFrequencyShift(settings.m_frequencyShift); - } - if (deviceSettingsKeys.contains("sampleRate") || force) { - swgTestMISettings->setSampleRate(settings.m_sampleRate); - } - if (deviceSettingsKeys.contains("log2Decim") || force) { - swgTestMISettings->setLog2Decim(settings.m_log2Decim); - } - if (deviceSettingsKeys.contains("fcPos") || force) { - swgTestMISettings->setFcPos((int) settings.m_fcPos); - } - if (deviceSettingsKeys.contains("sampleSizeIndex") || force) { - swgTestMISettings->setSampleSizeIndex(settings.m_sampleSizeIndex); - } - if (deviceSettingsKeys.contains("amplitudeBits") || force) { - swgTestMISettings->setAmplitudeBits(settings.m_amplitudeBits); - } - if (deviceSettingsKeys.contains("autoCorrOptions") || force) { - swgTestMISettings->setAutoCorrOptions((int) settings.m_sampleSizeIndex); - } - if (deviceSettingsKeys.contains("modulation") || force) { - swgTestMISettings->setModulation((int) settings.m_modulation); - } - if (deviceSettingsKeys.contains("modulationTone")) { - swgTestMISettings->setModulationTone(settings.m_modulationTone); - } - if (deviceSettingsKeys.contains("amModulation") || force) { - swgTestMISettings->setAmModulation(settings.m_amModulation); - }; - if (deviceSettingsKeys.contains("fmDeviation") || force) { - swgTestMISettings->setFmDeviation(settings.m_fmDeviation); - }; - if (deviceSettingsKeys.contains("dcFactor") || force) { - swgTestMISettings->setDcFactor(settings.m_dcFactor); - }; - if (deviceSettingsKeys.contains("iFactor") || force) { - swgTestMISettings->setIFactor(settings.m_iFactor); - }; - if (deviceSettingsKeys.contains("qFactor") || force) { - swgTestMISettings->setQFactor(settings.m_qFactor); - }; - if (deviceSettingsKeys.contains("phaseImbalance") || force) { - swgTestMISettings->setPhaseImbalance(settings.m_phaseImbalance); - }; - if (deviceSettingsKeys.contains("fileRecordName") || force) { + + if (deviceSettingsKeys.m_commonSettingsKeys.contains("fileRecordName") || force) { swgTestMISettings->setFileRecordName(new QString(settings.m_fileRecordName)); } @@ -700,8 +766,6 @@ void TestMI::webapiReverseSendSettings(QList& deviceSettingsKeys, const buffer->open((QBuffer::ReadWrite)); buffer->write(swgDeviceSettings->asJson().toUtf8()); buffer->seek(0); -// qDebug("TestMI::webapiReverseSendSettings: %s", channelSettingsURL.toStdString().c_str()); -// qDebug("TestMI::webapiReverseSendSettings: query:\n%s", swgDeviceSettings->asJson().toStdString().c_str()); // Always use PATCH to avoid passing reverse API settings m_networkManager->sendCustomRequest(m_networkRequest, "PATCH", buffer); diff --git a/plugins/samplemimo/testmi/testmi.h b/plugins/samplemimo/testmi/testmi.h index be13a535b..2e5be0c7c 100644 --- a/plugins/samplemimo/testmi/testmi.h +++ b/plugins/samplemimo/testmi/testmi.h @@ -142,11 +142,17 @@ public: QString& errorMessage); private: + struct DeviceSettingsKeys + { + QList m_commonSettingsKeys; + QList> m_streamsSettingsKeys; + }; + DeviceAPI *m_deviceAPI; FileRecord *m_fileSink; //!< File sink to record device I/Q output QMutex m_mutex; TestMISettings m_settings; - TestMIThread* m_testSourceThread; + std::vector m_testSourceThreads; QString m_deviceDescription; bool m_running; const QTimer& m_masterTimer; @@ -155,7 +161,7 @@ private: bool applySettings(const TestMISettings& settings, bool force); void webapiFormatDeviceSettings(SWGSDRangel::SWGDeviceSettings& response, const TestMISettings& settings); - void webapiReverseSendSettings(QList& deviceSettingsKeys, const TestMISettings& settings, bool force); + void webapiReverseSendSettings(const DeviceSettingsKeys& deviceSettingsKeys, const TestMISettings& settings, bool force); void webapiReverseSendStartStop(bool start); private slots: diff --git a/plugins/samplemimo/testmi/testmigui.cpp b/plugins/samplemimo/testmi/testmigui.cpp index fe9ece930..68d715b5b 100644 --- a/plugins/samplemimo/testmi/testmigui.cpp +++ b/plugins/samplemimo/testmi/testmigui.cpp @@ -52,6 +52,7 @@ TestMIGui::TestMIGui(DeviceUISet *deviceUISet, QWidget* parent) : { qDebug("TestMIGui::TestMIGui"); m_sampleMIMO = m_deviceUISet->m_deviceAPI->getSampleMIMO(); + m_streamIndex = 0; ui->setupUi(this); ui->centerFrequency->setColorMapper(ColorMapper(ColorMapper::GrayGold)); @@ -104,12 +105,12 @@ void TestMIGui::resetToDefaults() qint64 TestMIGui::getCenterFrequency() const { - return m_settings.m_centerFrequency; + return m_settings.m_streams[m_streamIndex].m_centerFrequency; } void TestMIGui::setCenterFrequency(qint64 centerFrequency) { - m_settings.m_centerFrequency = centerFrequency; + m_settings.m_streams[m_streamIndex].m_centerFrequency = centerFrequency; displaySettings(); sendSettings(); } @@ -141,25 +142,31 @@ void TestMIGui::on_startStop_toggled(bool checked) } } +void TestMIGui::on_streamIndex_currentIndexChanged(int index) +{ + m_streamIndex = index; + displaySettings(); +} + void TestMIGui::on_centerFrequency_changed(quint64 value) { - m_settings.m_centerFrequency = value * 1000; + m_settings.m_streams[m_streamIndex].m_centerFrequency = value * 1000; sendSettings(); } void TestMIGui::on_autoCorr_currentIndexChanged(int index) { - if ((index < 0) || (index > TestMISettings::AutoCorrLast)) { + if ((index < 0) || (index > TestMIStreamSettings::AutoCorrLast)) { return; } - m_settings.m_autoCorrOptions = (TestMISettings::AutoCorrOptions) index; + m_settings.m_streams[m_streamIndex].m_autoCorrOptions = (TestMIStreamSettings::AutoCorrOptions) index; sendSettings(); } void TestMIGui::on_frequencyShift_changed(qint64 value) { - m_settings.m_frequencyShift = value; + m_settings.m_streams[m_streamIndex].m_frequencyShift = value; sendSettings(); } @@ -169,7 +176,7 @@ void TestMIGui::on_decimation_currentIndexChanged(int index) return; } - m_settings.m_log2Decim = index; + m_settings.m_streams[m_streamIndex].m_log2Decim = index; sendSettings(); } @@ -179,15 +186,15 @@ void TestMIGui::on_fcPos_currentIndexChanged(int index) return; } - m_settings.m_fcPos = (TestMISettings::fcPos_t) index; + m_settings.m_streams[m_streamIndex].m_fcPos = (TestMIStreamSettings::fcPos_t) index; sendSettings(); } void TestMIGui::on_sampleRate_changed(quint64 value) { updateFrequencyShiftLimit(); - m_settings.m_frequencyShift = ui->frequencyShift->getValueNew(); - m_settings.m_sampleRate = value; + m_settings.m_streams[m_streamIndex].m_frequencyShift = ui->frequencyShift->getValueNew(); + m_settings.m_streams[m_streamIndex].m_sampleRate = value; sendSettings(); } @@ -200,8 +207,8 @@ void TestMIGui::on_sampleSize_currentIndexChanged(int index) updateAmpCoarseLimit(); updateAmpFineLimit(); displayAmplitude(); - m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); - m_settings.m_sampleSizeIndex = index; + m_settings.m_streams[m_streamIndex].m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); + m_settings.m_streams[m_streamIndex].m_sampleSizeIndex = index; sendSettings(); } @@ -210,7 +217,7 @@ void TestMIGui::on_amplitudeCoarse_valueChanged(int value) (void) value; updateAmpFineLimit(); displayAmplitude(); - m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); + m_settings.m_streams[m_streamIndex].m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); sendSettings(); } @@ -218,66 +225,66 @@ void TestMIGui::on_amplitudeFine_valueChanged(int value) { (void) value; displayAmplitude(); - m_settings.m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); + m_settings.m_streams[m_streamIndex].m_amplitudeBits = ui->amplitudeCoarse->value() * 100 + ui->amplitudeFine->value(); sendSettings(); } void TestMIGui::on_modulation_currentIndexChanged(int index) { - if ((index < 0) || (index > TestMISettings::ModulationLast)) { + if ((index < 0) || (index > TestMIStreamSettings::ModulationLast)) { return; } - m_settings.m_modulation = (TestMISettings::Modulation) index; + m_settings.m_streams[m_streamIndex].m_modulation = (TestMIStreamSettings::Modulation) index; sendSettings(); } void TestMIGui::on_modulationFrequency_valueChanged(int value) { - m_settings.m_modulationTone = value; - ui->modulationFrequencyText->setText(QString("%1").arg(m_settings.m_modulationTone / 100.0, 0, 'f', 2)); + m_settings.m_streams[m_streamIndex].m_modulationTone = value; + ui->modulationFrequencyText->setText(QString("%1").arg(m_settings.m_streams[m_streamIndex].m_modulationTone / 100.0, 0, 'f', 2)); sendSettings(); } void TestMIGui::on_amModulation_valueChanged(int value) { - m_settings.m_amModulation = value; - ui->amModulationText->setText(QString("%1").arg(m_settings.m_amModulation)); + m_settings.m_streams[m_streamIndex].m_amModulation = value; + ui->amModulationText->setText(QString("%1").arg(m_settings.m_streams[m_streamIndex].m_amModulation)); sendSettings(); } void TestMIGui::on_fmDeviation_valueChanged(int value) { - m_settings.m_fmDeviation = value; - ui->fmDeviationText->setText(QString("%1").arg(m_settings.m_fmDeviation / 10.0, 0, 'f', 1)); + m_settings.m_streams[m_streamIndex].m_fmDeviation = value; + ui->fmDeviationText->setText(QString("%1").arg(m_settings.m_streams[m_streamIndex].m_fmDeviation / 10.0, 0, 'f', 1)); sendSettings(); } void TestMIGui::on_dcBias_valueChanged(int value) { ui->dcBiasText->setText(QString(tr("%1 %").arg(value))); - m_settings.m_dcFactor = value / 100.0f; + m_settings.m_streams[m_streamIndex].m_dcFactor = value / 100.0f; sendSettings(); } void TestMIGui::on_iBias_valueChanged(int value) { ui->iBiasText->setText(QString(tr("%1 %").arg(value))); - m_settings.m_iFactor = value / 100.0f; + m_settings.m_streams[m_streamIndex].m_iFactor = value / 100.0f; sendSettings(); } void TestMIGui::on_qBias_valueChanged(int value) { ui->qBiasText->setText(QString(tr("%1 %").arg(value))); - m_settings.m_qFactor = value / 100.0f; + m_settings.m_streams[m_streamIndex].m_qFactor = value / 100.0f; sendSettings(); } void TestMIGui::on_phaseImbalance_valueChanged(int value) { ui->phaseImbalanceText->setText(QString(tr("%1 %").arg(value))); - m_settings.m_phaseImbalance = value / 100.0f; + m_settings.m_streams[m_streamIndex].m_phaseImbalance = value / 100.0f; sendSettings(); } @@ -374,40 +381,41 @@ void TestMIGui::displaySettings() blockApplySettings(true); ui->sampleSize->blockSignals(true); - ui->centerFrequency->setValue(m_settings.m_centerFrequency / 1000); - ui->decimation->setCurrentIndex(m_settings.m_log2Decim); - ui->fcPos->setCurrentIndex((int) m_settings.m_fcPos); - ui->sampleRate->setValue(m_settings.m_sampleRate); + ui->streamIndex->setCurrentIndex(m_streamIndex); + ui->centerFrequency->setValue(m_settings.m_streams[m_streamIndex].m_centerFrequency / 1000); + ui->decimation->setCurrentIndex(m_settings.m_streams[m_streamIndex].m_log2Decim); + ui->fcPos->setCurrentIndex((int) m_settings.m_streams[m_streamIndex].m_fcPos); + ui->sampleRate->setValue(m_settings.m_streams[m_streamIndex].m_sampleRate); updateFrequencyShiftLimit(); - ui->frequencyShift->setValue(m_settings.m_frequencyShift); - ui->sampleSize->setCurrentIndex(m_settings.m_sampleSizeIndex); + ui->frequencyShift->setValue(m_settings.m_streams[m_streamIndex].m_frequencyShift); + ui->sampleSize->setCurrentIndex(m_settings.m_streams[m_streamIndex].m_sampleSizeIndex); updateAmpCoarseLimit(); - int amplitudeBits = m_settings.m_amplitudeBits; + int amplitudeBits = m_settings.m_streams[m_streamIndex].m_amplitudeBits; ui->amplitudeCoarse->setValue(amplitudeBits/100); updateAmpFineLimit(); ui->amplitudeFine->setValue(amplitudeBits%100); displayAmplitude(); - int dcBiasPercent = roundf(m_settings.m_dcFactor * 100.0f); + int dcBiasPercent = roundf(m_settings.m_streams[m_streamIndex].m_dcFactor * 100.0f); ui->dcBias->setValue((int) dcBiasPercent); ui->dcBiasText->setText(QString(tr("%1 %").arg(dcBiasPercent))); - int iBiasPercent = roundf(m_settings.m_iFactor * 100.0f); + int iBiasPercent = roundf(m_settings.m_streams[m_streamIndex].m_iFactor * 100.0f); ui->iBias->setValue((int) iBiasPercent); ui->iBiasText->setText(QString(tr("%1 %").arg(iBiasPercent))); - int qBiasPercent = roundf(m_settings.m_qFactor * 100.0f); + int qBiasPercent = roundf(m_settings.m_streams[m_streamIndex].m_qFactor * 100.0f); ui->qBias->setValue((int) qBiasPercent); ui->qBiasText->setText(QString(tr("%1 %").arg(qBiasPercent))); - int phaseImbalancePercent = roundf(m_settings.m_phaseImbalance * 100.0f); + int phaseImbalancePercent = roundf(m_settings.m_streams[m_streamIndex].m_phaseImbalance * 100.0f); ui->phaseImbalance->setValue((int) phaseImbalancePercent); ui->phaseImbalanceText->setText(QString(tr("%1 %").arg(phaseImbalancePercent))); - ui->autoCorr->setCurrentIndex(m_settings.m_autoCorrOptions); + ui->autoCorr->setCurrentIndex(m_settings.m_streams[m_streamIndex].m_autoCorrOptions); ui->sampleSize->blockSignals(false); - ui->modulation->setCurrentIndex((int) m_settings.m_modulation); - ui->modulationFrequency->setValue(m_settings.m_modulationTone); - ui->modulationFrequencyText->setText(QString("%1").arg(m_settings.m_modulationTone / 100.0, 0, 'f', 2)); - ui->amModulation->setValue(m_settings.m_amModulation); - ui->amModulationText->setText(QString("%1").arg(m_settings.m_amModulation)); - ui->fmDeviation->setValue(m_settings.m_fmDeviation); - ui->fmDeviationText->setText(QString("%1").arg(m_settings.m_fmDeviation / 10.0, 0, 'f', 1)); + ui->modulation->setCurrentIndex((int) m_settings.m_streams[m_streamIndex].m_modulation); + ui->modulationFrequency->setValue(m_settings.m_streams[m_streamIndex].m_modulationTone); + ui->modulationFrequencyText->setText(QString("%1").arg(m_settings.m_streams[m_streamIndex].m_modulationTone / 100.0, 0, 'f', 2)); + ui->amModulation->setValue(m_settings.m_streams[m_streamIndex].m_amModulation); + ui->amModulationText->setText(QString("%1").arg(m_settings.m_streams[m_streamIndex].m_amModulation)); + ui->fmDeviation->setValue(m_settings.m_streams[m_streamIndex].m_fmDeviation); + ui->fmDeviationText->setText(QString("%1").arg(m_settings.m_streams[m_streamIndex].m_fmDeviation / 10.0, 0, 'f', 1)); blockApplySettings(false); } diff --git a/plugins/samplemimo/testmi/testmigui.h b/plugins/samplemimo/testmi/testmigui.h index 95d6b8a64..d50184047 100644 --- a/plugins/samplemimo/testmi/testmigui.h +++ b/plugins/samplemimo/testmi/testmigui.h @@ -57,6 +57,7 @@ private: DeviceUISet* m_deviceUISet; TestMISettings m_settings; + int m_streamIndex; //!< Current stream index being dealt with QTimer m_updateTimer; QTimer m_statusTimer; bool m_doApplySettings; @@ -80,6 +81,7 @@ private: private slots: void handleInputMessages(); void on_startStop_toggled(bool checked); + void on_streamIndex_currentIndexChanged(int index); void on_centerFrequency_changed(quint64 value); void on_autoCorr_currentIndexChanged(int index); void on_frequencyShift_changed(qint64 value); diff --git a/plugins/samplemimo/testmi/testmigui.ui b/plugins/samplemimo/testmi/testmigui.ui index d03340371..a6ce09b13 100644 --- a/plugins/samplemimo/testmi/testmigui.ui +++ b/plugins/samplemimo/testmi/testmigui.ui @@ -1,7 +1,7 @@ TestMIGui - + 0 @@ -188,6 +188,107 @@ + + + + + + Stream + + + + + + + + 40 + 16777215 + + + + Stream index + + + + 0 + + + + + 1 + + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 0 + 0 + + + + + 16 + 0 + + + + SR + + + + + + + + 0 + 0 + + + + + 32 + 16 + + + + + Liberation Mono + 12 + + + + PointingHandCursor + + + Generator sample rate (S/s) + + + + + + + S/s + + + + + @@ -380,60 +481,6 @@ 2 - - - - - 0 - 0 - - - - - 16 - 0 - - - - SR - - - - - - - - 0 - 0 - - - - - 32 - 16 - - - - - Liberation Mono - 12 - - - - PointingHandCursor - - - Generator sample rate (S/s) - - - - - - - S/s - - - diff --git a/plugins/samplemimo/testmi/testmisettings.cpp b/plugins/samplemimo/testmi/testmisettings.cpp index d36a858c2..2b580af24 100644 --- a/plugins/samplemimo/testmi/testmisettings.cpp +++ b/plugins/samplemimo/testmi/testmisettings.cpp @@ -19,12 +19,12 @@ #include "util/simpleserializer.h" #include "testmisettings.h" -TestMISettings::TestMISettings() +TestMIStreamSettings::TestMIStreamSettings() { resetToDefaults(); } -void TestMISettings::resetToDefaults() +void TestMIStreamSettings::resetToDefaults() { m_centerFrequency = 435000*1000; m_frequencyShift = 0; @@ -42,36 +42,64 @@ void TestMISettings::resetToDefaults() m_iFactor = 0.0f; m_qFactor = 0.0f; m_phaseImbalance = 0.0f; +} + +TestMISettings::TestMISettings() +{ m_fileRecordName = ""; m_useReverseAPI = false; m_reverseAPIAddress = "127.0.0.1"; m_reverseAPIPort = 8888; m_reverseAPIDeviceIndex = 0; + m_streams.push_back(TestMIStreamSettings()); + m_streams.push_back(TestMIStreamSettings()); +} + +TestMISettings::TestMISettings(const TestMISettings& other) : + m_streams(other.m_streams) +{ + m_fileRecordName = other.m_fileRecordName; + m_useReverseAPI = other.m_useReverseAPI; + m_reverseAPIAddress = other.m_reverseAPIAddress; + m_reverseAPIPort = other.m_reverseAPIPort; + m_reverseAPIDeviceIndex = other.m_reverseAPIDeviceIndex; +} + +void TestMISettings::resetToDefaults() +{ + for (unsigned int i = 0; i < m_streams.size(); i++) { + m_streams[i].resetToDefaults(); + } } QByteArray TestMISettings::serialize() const { SimpleSerializer s(1); - s.writeS32(2, m_frequencyShift); - s.writeU32(3, m_sampleRate); - s.writeU32(4, m_log2Decim); - s.writeS32(5, (int) m_fcPos); - s.writeU32(6, m_sampleSizeIndex); - s.writeS32(7, m_amplitudeBits); - s.writeS32(8, (int) m_autoCorrOptions); - s.writeFloat(10, m_dcFactor); - s.writeFloat(11, m_iFactor); - s.writeFloat(12, m_qFactor); - s.writeFloat(13, m_phaseImbalance); - s.writeS32(14, (int) m_modulation); - s.writeS32(15, m_modulationTone); - s.writeS32(16, m_amModulation); - s.writeS32(17, m_fmDeviation); - s.writeBool(18, m_useReverseAPI); - s.writeString(19, m_reverseAPIAddress); - s.writeU32(20, m_reverseAPIPort); - s.writeU32(21, m_reverseAPIDeviceIndex); + s.writeBool(1, m_useReverseAPI); + s.writeString(2, m_reverseAPIAddress); + s.writeU32(3, m_reverseAPIPort); + s.writeU32(4, m_reverseAPIDeviceIndex); + + for (unsigned int i = 0; i < m_streams.size(); i++) + { + s.writeS32(10 + 30*i, m_streams[i].m_frequencyShift); + s.writeU32(11 + 30*i, m_streams[i].m_sampleRate); + s.writeU32(12 + 30*i, m_streams[i].m_log2Decim); + s.writeS32(13 + 30*i, (int) m_streams[i].m_fcPos); + s.writeU32(14 + 30*i, m_streams[i].m_sampleSizeIndex); + s.writeS32(15 + 30*i, m_streams[i].m_amplitudeBits); + s.writeS32(16 + 30*i, (int) m_streams[i].m_autoCorrOptions); + s.writeFloat(17 + 30*i, m_streams[i].m_dcFactor); + s.writeFloat(18 + 30*i, m_streams[i].m_iFactor); + s.writeFloat(19 + 30*i, m_streams[i].m_qFactor); + s.writeFloat(20 + 30*i, m_streams[i].m_phaseImbalance); + s.writeS32(21 + 30*i, (int) m_streams[i].m_modulation); + s.writeS32(22 + 30*i, m_streams[i].m_modulationTone); + s.writeS32(23 + 30*i, m_streams[i].m_amModulation); + s.writeS32(24 + 30*i, m_streams[i].m_fmDeviation); + } + return s.final(); } @@ -90,40 +118,9 @@ bool TestMISettings::deserialize(const QByteArray& data) int intval; uint32_t utmp; - d.readS32(2, &m_frequencyShift, 0); - d.readU32(3, &m_sampleRate, 768*1000); - d.readU32(4, &m_log2Decim, 4); - d.readS32(5, &intval, 0); - m_fcPos = (fcPos_t) intval; - d.readU32(6, &m_sampleSizeIndex, 0); - d.readS32(7, &m_amplitudeBits, 128); - d.readS32(8, &intval, 0); - - if (intval < 0 || intval > (int) AutoCorrLast) { - m_autoCorrOptions = AutoCorrNone; - } else { - m_autoCorrOptions = (AutoCorrOptions) intval; - } - - d.readFloat(10, &m_dcFactor, 0.0f); - d.readFloat(11, &m_iFactor, 0.0f); - d.readFloat(12, &m_qFactor, 0.0f); - d.readFloat(13, &m_phaseImbalance, 0.0f); - d.readS32(14, &intval, 0); - - if (intval < 0 || intval > (int) ModulationLast) { - m_modulation = ModulationNone; - } else { - m_modulation = (Modulation) intval; - } - - d.readS32(15, &m_modulationTone, 44); - d.readS32(16, &m_amModulation, 50); - d.readS32(17, &m_fmDeviation, 50); - - d.readBool(18, &m_useReverseAPI, false); - d.readString(19, &m_reverseAPIAddress, "127.0.0.1"); - d.readU32(20, &utmp, 0); + d.readBool(1, &m_useReverseAPI, false); + d.readString(2, &m_reverseAPIAddress, "127.0.0.1"); + d.readU32(3, &utmp, 0); if ((utmp > 1023) && (utmp < 65535)) { m_reverseAPIPort = utmp; @@ -131,9 +128,43 @@ bool TestMISettings::deserialize(const QByteArray& data) m_reverseAPIPort = 8888; } - d.readU32(21, &utmp, 0); + d.readU32(4, &utmp, 0); m_reverseAPIDeviceIndex = utmp > 99 ? 99 : utmp; + for (unsigned int i = 0; i < m_streams.size(); i++) + { + d.readS32(10 + 30*i, &m_streams[i].m_frequencyShift, 0); + d.readU32(11 + 30*i, &m_streams[i].m_sampleRate, 768*1000); + d.readU32(12 + 30*i, &m_streams[i].m_log2Decim, 4); + d.readS32(13 + 30*i, &intval, 0); + m_streams[i].m_fcPos = (TestMIStreamSettings::fcPos_t) intval; + d.readU32(14 + 30*i, &m_streams[i].m_sampleSizeIndex, 0); + d.readS32(15 + 30*i, &m_streams[i].m_amplitudeBits, 128); + d.readS32(16 + 30*i, &intval, 0); + + if (intval < 0 || intval > (int) TestMIStreamSettings::AutoCorrLast) { + m_streams[i].m_autoCorrOptions = TestMIStreamSettings::AutoCorrNone; + } else { + m_streams[i].m_autoCorrOptions = (TestMIStreamSettings::AutoCorrOptions) intval; + } + + d.readFloat(17 + 30*i, &m_streams[i].m_dcFactor, 0.0f); + d.readFloat(18 + 30*i, &m_streams[i].m_iFactor, 0.0f); + d.readFloat(19 + 30*i, &m_streams[i].m_qFactor, 0.0f); + d.readFloat(20 + 30*i, &m_streams[i].m_phaseImbalance, 0.0f); + d.readS32(21 + 30*i, &intval, 0); + + if (intval < 0 || intval > (int) TestMIStreamSettings::ModulationLast) { + m_streams[i].m_modulation = TestMIStreamSettings::ModulationNone; + } else { + m_streams[i].m_modulation = (TestMIStreamSettings::Modulation) intval; + } + + d.readS32(22 + 30*i, &m_streams[i].m_modulationTone, 44); + d.readS32(23 + 30*i, &m_streams[i].m_amModulation, 50); + d.readS32(24 + 30*i, &m_streams[i].m_fmDeviation, 50); + } + return true; } else diff --git a/plugins/samplemimo/testmi/testmisettings.h b/plugins/samplemimo/testmi/testmisettings.h index 9a5daa8be..bf7da4265 100644 --- a/plugins/samplemimo/testmi/testmisettings.h +++ b/plugins/samplemimo/testmi/testmisettings.h @@ -20,7 +20,7 @@ #include -struct TestMISettings { +struct TestMIStreamSettings { typedef enum { FC_POS_INFRA = 0, FC_POS_SUPRA, @@ -60,20 +60,25 @@ struct TestMISettings { float m_iFactor; //!< -1.0 < x < 1.0 float m_qFactor; //!< -1.0 < x < 1.0 float m_phaseImbalance; //!< -1.0 < x < 1.0 + + TestMIStreamSettings(); + void resetToDefaults(); +}; + +struct TestMISettings { QString m_fileRecordName; bool m_useReverseAPI; QString m_reverseAPIAddress; uint16_t m_reverseAPIPort; uint16_t m_reverseAPIDeviceIndex; + std::vector m_streams; TestMISettings(); + TestMISettings(const TestMISettings& other); void resetToDefaults(); QByteArray serialize() const; bool deserialize(const QByteArray& data); }; - - - #endif /* _TESTMI_TESTMISETTINGS_H_ */ diff --git a/plugins/samplemimo/testmi/testmithread.cpp b/plugins/samplemimo/testmi/testmithread.cpp index 02aea93ce..bb06a9085 100644 --- a/plugins/samplemimo/testmi/testmithread.cpp +++ b/plugins/samplemimo/testmi/testmithread.cpp @@ -38,7 +38,7 @@ TestMIThread::TestMIThread(SampleSinkFifo* sampleFifo, QObject* parent) : m_sampleFifo(sampleFifo), m_frequencyShift(0), m_toneFrequency(440), - m_modulation(TestMISettings::ModulationNone), + m_modulation(TestMIStreamSettings::ModulationNone), m_amModulation(0.5f), m_fmDeviationUnit(0.0f), m_fmPhasor(0.0f), @@ -176,7 +176,7 @@ void TestMIThread::setToneFrequency(int toneFrequency) m_toneNco.setFreq(toneFrequency, m_samplerate); } -void TestMIThread::setModulation(TestMISettings::Modulation modulation) +void TestMIThread::setModulation(TestMIStreamSettings::Modulation modulation) { m_modulation = modulation; } @@ -247,7 +247,7 @@ void TestMIThread::generate(quint32 chunksize) { switch (m_modulation) { - case TestMISettings::ModulationAM: + case TestMIStreamSettings::ModulationAM: { Complex c = m_nco.nextIQ(); Real t, re, im; @@ -259,7 +259,7 @@ void TestMIThread::generate(quint32 chunksize) m_buf[i++] = (int16_t) (im * (float) m_amplitudeBitsQ); } break; - case TestMISettings::ModulationFM: + case TestMIStreamSettings::ModulationFM: { Complex c = m_nco.nextIQ(); Real t, re, im; @@ -272,7 +272,7 @@ void TestMIThread::generate(quint32 chunksize) m_buf[i++] = (int16_t) (im * (float) m_amplitudeBitsQ); } break; - case TestMISettings::ModulationPattern0: // binary pattern + case TestMIStreamSettings::ModulationPattern0: // binary pattern { if (m_pulseSampleCount < m_pulseWidth) // sync pattern: 0 { @@ -314,7 +314,7 @@ void TestMIThread::generate(quint32 chunksize) } } break; - case TestMISettings::ModulationPattern1: // sawtooth pattern + case TestMIStreamSettings::ModulationPattern1: // sawtooth pattern { Real re, im; re = (float) (m_pulseWidth - m_pulseSampleCount) / (float) m_pulseWidth; @@ -329,7 +329,7 @@ void TestMIThread::generate(quint32 chunksize) } } break; - case TestMISettings::ModulationPattern2: // 50% duty cycle square pattern + case TestMIStreamSettings::ModulationPattern2: // 50% duty cycle square pattern { if (m_pulseSampleCount < m_pulseWidth) // 1 { @@ -347,7 +347,7 @@ void TestMIThread::generate(quint32 chunksize) } } break; - case TestMISettings::ModulationNone: + case TestMIStreamSettings::ModulationNone: default: { Complex c = m_nco.nextIQ(m_phaseImbalance); diff --git a/plugins/samplemimo/testmi/testmithread.h b/plugins/samplemimo/testmi/testmithread.h index 27f094c83..2df410ae1 100644 --- a/plugins/samplemimo/testmi/testmithread.h +++ b/plugins/samplemimo/testmi/testmithread.h @@ -73,7 +73,7 @@ public: void setPhaseImbalance(float phaseImbalance); void setFrequencyShift(int shift); void setToneFrequency(int toneFrequency); - void setModulation(TestMISettings::Modulation modulation); + void setModulation(TestMIStreamSettings::Modulation modulation); void setAMModulation(float amModulation); void setFMDeviation(float deviation); void setPattern0(); @@ -94,7 +94,7 @@ private: NCOF m_toneNco; int m_frequencyShift; int m_toneFrequency; - TestMISettings::Modulation m_modulation; + TestMIStreamSettings::Modulation m_modulation; float m_amModulation; float m_fmDeviationUnit; float m_fmPhasor; diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index b840b4e26..369d948b9 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -5216,6 +5216,38 @@ margin-bottom: 20px; }; defs.TestMISettings = { "properties" : { + "fileRecordName" : { + "type" : "string" + }, + "useReverseAPI" : { + "type" : "integer", + "description" : "Synchronize with reverse API (1 for yes, 0 for no)" + }, + "reverseAPIAddress" : { + "type" : "string" + }, + "reverseAPIPort" : { + "type" : "integer" + }, + "reverseAPIDeviceIndex" : { + "type" : "integer" + }, + "streams" : { + "type" : "array", + "description" : "Settings for each of the streams", + "items" : { + "$ref" : "#/definitions/TestMiStreamSettings" + } + } + }, + "description" : "TestMISettings" +}; + defs.TestMiStreamSettings = { + "properties" : { + "streamIndex" : { + "type" : "integer", + "description" : "Index of the stream to which the settings apply" + }, "centerFrequency" : { "type" : "integer", "format" : "uint64" @@ -5268,25 +5300,9 @@ margin-bottom: 20px; "phaseImbalance" : { "type" : "number", "format" : "float" - }, - "fileRecordName" : { - "type" : "string" - }, - "useReverseAPI" : { - "type" : "integer", - "description" : "Synchronize with reverse API (1 for yes, 0 for no)" - }, - "reverseAPIAddress" : { - "type" : "string" - }, - "reverseAPIPort" : { - "type" : "integer" - }, - "reverseAPIDeviceIndex" : { - "type" : "integer" } }, - "description" : "TestSourceMI" + "description" : "TestMiStreamSettings" }; defs.TestSourceSettings = { "properties" : { @@ -25084,7 +25100,7 @@ except ApiException as e:
- Generated 2019-05-20T16:12:41.467+02:00 + Generated 2019-05-25T21:27:31.978+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/TestMI.yaml b/sdrbase/resources/webapi/doc/swagger/include/TestMI.yaml index 16008a5e8..0c8c3a481 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/TestMI.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/TestMI.yaml @@ -1,43 +1,6 @@ TestMISettings: - description: TestSourceMI + description: TestMISettings properties: - centerFrequency: - type: integer - format: uint64 - frequencyShift: - type: integer - sampleRate: - type: integer - log2Decim: - type: integer - fcPos: - type: integer - sampleSizeIndex: - type: integer - amplitudeBits: - type: integer - autoCorrOptions: - type: integer - modulation: - type: integer - modulationTone: - type: integer - amModulation: - type: integer - fmDeviation: - type: integer - dcFactor: - type: number - format: float - iFactor: - type: number - format: float - qFactor: - type: number - format: float - phaseImbalance: - type: number - format: float fileRecordName: type: string useReverseAPI: @@ -49,3 +12,53 @@ TestMISettings: type: integer reverseAPIDeviceIndex: type: integer + streams: + description: Settings for each of the streams + type: array + items: + $ref: "#/definitions/TestMiStreamSettings" + +definitions: + TestMiStreamSettings: + description: TestMiStreamSettings + properties: + streamIndex: + description: Index of the stream to which the settings apply + type: integer + centerFrequency: + type: integer + format: uint64 + frequencyShift: + type: integer + sampleRate: + type: integer + log2Decim: + type: integer + fcPos: + type: integer + sampleSizeIndex: + type: integer + amplitudeBits: + type: integer + autoCorrOptions: + type: integer + modulation: + type: integer + modulationTone: + type: integer + amModulation: + type: integer + fmDeviation: + type: integer + dcFactor: + type: number + format: float + iFactor: + type: number + format: float + qFactor: + type: number + format: float + phaseImbalance: + type: number + format: float diff --git a/sdrbase/webapi/webapirequestmapper.cpp b/sdrbase/webapi/webapirequestmapper.cpp index 3e9530e63..3aeeed1ae 100644 --- a/sdrbase/webapi/webapirequestmapper.cpp +++ b/sdrbase/webapi/webapirequestmapper.cpp @@ -2090,6 +2090,27 @@ bool WebAPIRequestMapper::validateDeviceSettings( return false; } } + else if ((*deviceHwType == "TestMI") && (deviceSettings.getDirection() == 2)) + { + if (jsonObject.contains("TestMISettings") && jsonObject["TestMISettings"].isObject()) + { + QJsonObject testMISettingsJsonObject = jsonObject["TestMISettings"].toObject(); + deviceSettingsKeys = testMISettingsJsonObject.keys(); + + if (deviceSettingsKeys.contains("streams") && testMISettingsJsonObject["streams"].isArray()) + { + appendSettingsArrayKeys(testMISettingsJsonObject, "streams", deviceSettingsKeys); + } + + deviceSettings.setTestMiSettings(new SWGSDRangel::SWGTestMISettings()); + deviceSettings.getTestMiSettings()->fromJsonObject(testMISettingsJsonObject); + return true; + } + else + { + return false; + } + } else if ((*deviceHwType == "XTRX") && (deviceSettings.getDirection() == 0)) { if (jsonObject.contains("xtrxInputSettings") && jsonObject["xtrxInputSettings"].isObject()) @@ -2595,6 +2616,30 @@ void WebAPIRequestMapper::appendSettingsSubKeys( } } +void WebAPIRequestMapper::appendSettingsArrayKeys( + const QJsonObject& parentSettingsJsonObject, + const QString& parentKey, + QStringList& keyList) +{ + QJsonArray streams = parentSettingsJsonObject[parentKey].toArray(); + + for (int istream = 0; istream < streams.count(); istream++) + { + QJsonValue v = streams.takeAt(istream); + + if (v.isObject()) + { + QJsonObject streamSettingsJsonObject = v.toObject(); + QStringList streamSettingsKeys = streamSettingsJsonObject.keys(); + + for (int i = 0; i < streamSettingsKeys.size(); i++) { + keyList.append(tr("streams[%1].%2").arg(istream).arg(streamSettingsKeys[i])); + } + } + } +} + + void WebAPIRequestMapper::resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings) { deviceSettings.cleanup(); diff --git a/sdrbase/webapi/webapirequestmapper.h b/sdrbase/webapi/webapirequestmapper.h index b506a75a7..3753b80aa 100644 --- a/sdrbase/webapi/webapirequestmapper.h +++ b/sdrbase/webapi/webapirequestmapper.h @@ -92,6 +92,11 @@ private: const QString& parentKey, QStringList& keyList); + void appendSettingsArrayKeys( + const QJsonObject& parentSettingsJsonObject, + const QString& parentKey, + QStringList& keyList); + bool parseJsonBody(QString& jsonStr, QJsonObject& jsonObject, qtwebapp::HttpResponse& response); void resetDeviceSettings(SWGSDRangel::SWGDeviceSettings& deviceSettings); diff --git a/swagger/sdrangel/api/swagger/include/TestMI.yaml b/swagger/sdrangel/api/swagger/include/TestMI.yaml index 16008a5e8..0c8c3a481 100644 --- a/swagger/sdrangel/api/swagger/include/TestMI.yaml +++ b/swagger/sdrangel/api/swagger/include/TestMI.yaml @@ -1,43 +1,6 @@ TestMISettings: - description: TestSourceMI + description: TestMISettings properties: - centerFrequency: - type: integer - format: uint64 - frequencyShift: - type: integer - sampleRate: - type: integer - log2Decim: - type: integer - fcPos: - type: integer - sampleSizeIndex: - type: integer - amplitudeBits: - type: integer - autoCorrOptions: - type: integer - modulation: - type: integer - modulationTone: - type: integer - amModulation: - type: integer - fmDeviation: - type: integer - dcFactor: - type: number - format: float - iFactor: - type: number - format: float - qFactor: - type: number - format: float - phaseImbalance: - type: number - format: float fileRecordName: type: string useReverseAPI: @@ -49,3 +12,53 @@ TestMISettings: type: integer reverseAPIDeviceIndex: type: integer + streams: + description: Settings for each of the streams + type: array + items: + $ref: "#/definitions/TestMiStreamSettings" + +definitions: + TestMiStreamSettings: + description: TestMiStreamSettings + properties: + streamIndex: + description: Index of the stream to which the settings apply + type: integer + centerFrequency: + type: integer + format: uint64 + frequencyShift: + type: integer + sampleRate: + type: integer + log2Decim: + type: integer + fcPos: + type: integer + sampleSizeIndex: + type: integer + amplitudeBits: + type: integer + autoCorrOptions: + type: integer + modulation: + type: integer + modulationTone: + type: integer + amModulation: + type: integer + fmDeviation: + type: integer + dcFactor: + type: number + format: float + iFactor: + type: number + format: float + qFactor: + type: number + format: float + phaseImbalance: + type: number + format: float diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index b840b4e26..369d948b9 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -5216,6 +5216,38 @@ margin-bottom: 20px; }; defs.TestMISettings = { "properties" : { + "fileRecordName" : { + "type" : "string" + }, + "useReverseAPI" : { + "type" : "integer", + "description" : "Synchronize with reverse API (1 for yes, 0 for no)" + }, + "reverseAPIAddress" : { + "type" : "string" + }, + "reverseAPIPort" : { + "type" : "integer" + }, + "reverseAPIDeviceIndex" : { + "type" : "integer" + }, + "streams" : { + "type" : "array", + "description" : "Settings for each of the streams", + "items" : { + "$ref" : "#/definitions/TestMiStreamSettings" + } + } + }, + "description" : "TestMISettings" +}; + defs.TestMiStreamSettings = { + "properties" : { + "streamIndex" : { + "type" : "integer", + "description" : "Index of the stream to which the settings apply" + }, "centerFrequency" : { "type" : "integer", "format" : "uint64" @@ -5268,25 +5300,9 @@ margin-bottom: 20px; "phaseImbalance" : { "type" : "number", "format" : "float" - }, - "fileRecordName" : { - "type" : "string" - }, - "useReverseAPI" : { - "type" : "integer", - "description" : "Synchronize with reverse API (1 for yes, 0 for no)" - }, - "reverseAPIAddress" : { - "type" : "string" - }, - "reverseAPIPort" : { - "type" : "integer" - }, - "reverseAPIDeviceIndex" : { - "type" : "integer" } }, - "description" : "TestSourceMI" + "description" : "TestMiStreamSettings" }; defs.TestSourceSettings = { "properties" : { @@ -25084,7 +25100,7 @@ except ApiException as e:
- Generated 2019-05-20T16:12:41.467+02:00 + Generated 2019-05-25T21:27:31.978+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h index 45f07d9fc..b3f4afdd6 100644 --- a/swagger/sdrangel/code/qt5/client/SWGModelFactory.h +++ b/swagger/sdrangel/code/qt5/client/SWGModelFactory.h @@ -133,6 +133,7 @@ #include "SWGSoapySDRReport.h" #include "SWGSuccessResponse.h" #include "SWGTestMISettings.h" +#include "SWGTestMiStreamSettings.h" #include "SWGTestSourceSettings.h" #include "SWGUDPSinkReport.h" #include "SWGUDPSinkSettings.h" @@ -507,6 +508,9 @@ namespace SWGSDRangel { if(QString("SWGTestMISettings").compare(type) == 0) { return new SWGTestMISettings(); } + if(QString("SWGTestMiStreamSettings").compare(type) == 0) { + return new SWGTestMiStreamSettings(); + } if(QString("SWGTestSourceSettings").compare(type) == 0) { return new SWGTestSourceSettings(); } diff --git a/swagger/sdrangel/code/qt5/client/SWGTestMISettings.cpp b/swagger/sdrangel/code/qt5/client/SWGTestMISettings.cpp index b77b161ff..91bd8a91d 100644 --- a/swagger/sdrangel/code/qt5/client/SWGTestMISettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGTestMISettings.cpp @@ -28,38 +28,6 @@ SWGTestMISettings::SWGTestMISettings(QString* json) { } SWGTestMISettings::SWGTestMISettings() { - center_frequency = 0; - m_center_frequency_isSet = false; - frequency_shift = 0; - m_frequency_shift_isSet = false; - sample_rate = 0; - m_sample_rate_isSet = false; - log2_decim = 0; - m_log2_decim_isSet = false; - fc_pos = 0; - m_fc_pos_isSet = false; - sample_size_index = 0; - m_sample_size_index_isSet = false; - amplitude_bits = 0; - m_amplitude_bits_isSet = false; - auto_corr_options = 0; - m_auto_corr_options_isSet = false; - modulation = 0; - m_modulation_isSet = false; - modulation_tone = 0; - m_modulation_tone_isSet = false; - am_modulation = 0; - m_am_modulation_isSet = false; - fm_deviation = 0; - m_fm_deviation_isSet = false; - dc_factor = 0.0f; - m_dc_factor_isSet = false; - i_factor = 0.0f; - m_i_factor_isSet = false; - q_factor = 0.0f; - m_q_factor_isSet = false; - phase_imbalance = 0.0f; - m_phase_imbalance_isSet = false; file_record_name = nullptr; m_file_record_name_isSet = false; use_reverse_api = 0; @@ -70,6 +38,8 @@ SWGTestMISettings::SWGTestMISettings() { m_reverse_api_port_isSet = false; reverse_api_device_index = 0; m_reverse_api_device_index_isSet = false; + streams = nullptr; + m_streams_isSet = false; } SWGTestMISettings::~SWGTestMISettings() { @@ -78,38 +48,6 @@ SWGTestMISettings::~SWGTestMISettings() { void SWGTestMISettings::init() { - center_frequency = 0; - m_center_frequency_isSet = false; - frequency_shift = 0; - m_frequency_shift_isSet = false; - sample_rate = 0; - m_sample_rate_isSet = false; - log2_decim = 0; - m_log2_decim_isSet = false; - fc_pos = 0; - m_fc_pos_isSet = false; - sample_size_index = 0; - m_sample_size_index_isSet = false; - amplitude_bits = 0; - m_amplitude_bits_isSet = false; - auto_corr_options = 0; - m_auto_corr_options_isSet = false; - modulation = 0; - m_modulation_isSet = false; - modulation_tone = 0; - m_modulation_tone_isSet = false; - am_modulation = 0; - m_am_modulation_isSet = false; - fm_deviation = 0; - m_fm_deviation_isSet = false; - dc_factor = 0.0f; - m_dc_factor_isSet = false; - i_factor = 0.0f; - m_i_factor_isSet = false; - q_factor = 0.0f; - m_q_factor_isSet = false; - phase_imbalance = 0.0f; - m_phase_imbalance_isSet = false; file_record_name = new QString(""); m_file_record_name_isSet = false; use_reverse_api = 0; @@ -120,26 +58,12 @@ SWGTestMISettings::init() { m_reverse_api_port_isSet = false; reverse_api_device_index = 0; m_reverse_api_device_index_isSet = false; + streams = new QList(); + m_streams_isSet = false; } void SWGTestMISettings::cleanup() { - - - - - - - - - - - - - - - - if(file_record_name != nullptr) { delete file_record_name; } @@ -149,6 +73,13 @@ SWGTestMISettings::cleanup() { } + if(streams != nullptr) { + auto arr = streams; + for(auto o: *arr) { + delete o; + } + delete streams; + } } SWGTestMISettings* @@ -162,38 +93,6 @@ SWGTestMISettings::fromJson(QString &json) { void SWGTestMISettings::fromJsonObject(QJsonObject &pJson) { - ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint32", ""); - - ::SWGSDRangel::setValue(&frequency_shift, pJson["frequencyShift"], "qint32", ""); - - ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", ""); - - ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", ""); - - ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", ""); - - ::SWGSDRangel::setValue(&sample_size_index, pJson["sampleSizeIndex"], "qint32", ""); - - ::SWGSDRangel::setValue(&litude_bits, pJson["amplitudeBits"], "qint32", ""); - - ::SWGSDRangel::setValue(&auto_corr_options, pJson["autoCorrOptions"], "qint32", ""); - - ::SWGSDRangel::setValue(&modulation, pJson["modulation"], "qint32", ""); - - ::SWGSDRangel::setValue(&modulation_tone, pJson["modulationTone"], "qint32", ""); - - ::SWGSDRangel::setValue(&am_modulation, pJson["amModulation"], "qint32", ""); - - ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "qint32", ""); - - ::SWGSDRangel::setValue(&dc_factor, pJson["dcFactor"], "float", ""); - - ::SWGSDRangel::setValue(&i_factor, pJson["iFactor"], "float", ""); - - ::SWGSDRangel::setValue(&q_factor, pJson["qFactor"], "float", ""); - - ::SWGSDRangel::setValue(&phase_imbalance, pJson["phaseImbalance"], "float", ""); - ::SWGSDRangel::setValue(&file_record_name, pJson["fileRecordName"], "QString", "QString"); ::SWGSDRangel::setValue(&use_reverse_api, pJson["useReverseAPI"], "qint32", ""); @@ -204,6 +103,8 @@ SWGTestMISettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&reverse_api_device_index, pJson["reverseAPIDeviceIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&streams, pJson["streams"], "QList", "SWGTestMiStreamSettings"); } QString @@ -220,54 +121,6 @@ SWGTestMISettings::asJson () QJsonObject* SWGTestMISettings::asJsonObject() { QJsonObject* obj = new QJsonObject(); - if(m_center_frequency_isSet){ - obj->insert("centerFrequency", QJsonValue(center_frequency)); - } - if(m_frequency_shift_isSet){ - obj->insert("frequencyShift", QJsonValue(frequency_shift)); - } - if(m_sample_rate_isSet){ - obj->insert("sampleRate", QJsonValue(sample_rate)); - } - if(m_log2_decim_isSet){ - obj->insert("log2Decim", QJsonValue(log2_decim)); - } - if(m_fc_pos_isSet){ - obj->insert("fcPos", QJsonValue(fc_pos)); - } - if(m_sample_size_index_isSet){ - obj->insert("sampleSizeIndex", QJsonValue(sample_size_index)); - } - if(m_amplitude_bits_isSet){ - obj->insert("amplitudeBits", QJsonValue(amplitude_bits)); - } - if(m_auto_corr_options_isSet){ - obj->insert("autoCorrOptions", QJsonValue(auto_corr_options)); - } - if(m_modulation_isSet){ - obj->insert("modulation", QJsonValue(modulation)); - } - if(m_modulation_tone_isSet){ - obj->insert("modulationTone", QJsonValue(modulation_tone)); - } - if(m_am_modulation_isSet){ - obj->insert("amModulation", QJsonValue(am_modulation)); - } - if(m_fm_deviation_isSet){ - obj->insert("fmDeviation", QJsonValue(fm_deviation)); - } - if(m_dc_factor_isSet){ - obj->insert("dcFactor", QJsonValue(dc_factor)); - } - if(m_i_factor_isSet){ - obj->insert("iFactor", QJsonValue(i_factor)); - } - if(m_q_factor_isSet){ - obj->insert("qFactor", QJsonValue(q_factor)); - } - if(m_phase_imbalance_isSet){ - obj->insert("phaseImbalance", QJsonValue(phase_imbalance)); - } if(file_record_name != nullptr && *file_record_name != QString("")){ toJsonValue(QString("fileRecordName"), file_record_name, obj, QString("QString")); } @@ -283,170 +136,13 @@ SWGTestMISettings::asJsonObject() { if(m_reverse_api_device_index_isSet){ obj->insert("reverseAPIDeviceIndex", QJsonValue(reverse_api_device_index)); } + if(streams->size() > 0){ + toJsonArray((QList*)streams, obj, "streams", "SWGTestMiStreamSettings"); + } return obj; } -qint32 -SWGTestMISettings::getCenterFrequency() { - return center_frequency; -} -void -SWGTestMISettings::setCenterFrequency(qint32 center_frequency) { - this->center_frequency = center_frequency; - this->m_center_frequency_isSet = true; -} - -qint32 -SWGTestMISettings::getFrequencyShift() { - return frequency_shift; -} -void -SWGTestMISettings::setFrequencyShift(qint32 frequency_shift) { - this->frequency_shift = frequency_shift; - this->m_frequency_shift_isSet = true; -} - -qint32 -SWGTestMISettings::getSampleRate() { - return sample_rate; -} -void -SWGTestMISettings::setSampleRate(qint32 sample_rate) { - this->sample_rate = sample_rate; - this->m_sample_rate_isSet = true; -} - -qint32 -SWGTestMISettings::getLog2Decim() { - return log2_decim; -} -void -SWGTestMISettings::setLog2Decim(qint32 log2_decim) { - this->log2_decim = log2_decim; - this->m_log2_decim_isSet = true; -} - -qint32 -SWGTestMISettings::getFcPos() { - return fc_pos; -} -void -SWGTestMISettings::setFcPos(qint32 fc_pos) { - this->fc_pos = fc_pos; - this->m_fc_pos_isSet = true; -} - -qint32 -SWGTestMISettings::getSampleSizeIndex() { - return sample_size_index; -} -void -SWGTestMISettings::setSampleSizeIndex(qint32 sample_size_index) { - this->sample_size_index = sample_size_index; - this->m_sample_size_index_isSet = true; -} - -qint32 -SWGTestMISettings::getAmplitudeBits() { - return amplitude_bits; -} -void -SWGTestMISettings::setAmplitudeBits(qint32 amplitude_bits) { - this->amplitude_bits = amplitude_bits; - this->m_amplitude_bits_isSet = true; -} - -qint32 -SWGTestMISettings::getAutoCorrOptions() { - return auto_corr_options; -} -void -SWGTestMISettings::setAutoCorrOptions(qint32 auto_corr_options) { - this->auto_corr_options = auto_corr_options; - this->m_auto_corr_options_isSet = true; -} - -qint32 -SWGTestMISettings::getModulation() { - return modulation; -} -void -SWGTestMISettings::setModulation(qint32 modulation) { - this->modulation = modulation; - this->m_modulation_isSet = true; -} - -qint32 -SWGTestMISettings::getModulationTone() { - return modulation_tone; -} -void -SWGTestMISettings::setModulationTone(qint32 modulation_tone) { - this->modulation_tone = modulation_tone; - this->m_modulation_tone_isSet = true; -} - -qint32 -SWGTestMISettings::getAmModulation() { - return am_modulation; -} -void -SWGTestMISettings::setAmModulation(qint32 am_modulation) { - this->am_modulation = am_modulation; - this->m_am_modulation_isSet = true; -} - -qint32 -SWGTestMISettings::getFmDeviation() { - return fm_deviation; -} -void -SWGTestMISettings::setFmDeviation(qint32 fm_deviation) { - this->fm_deviation = fm_deviation; - this->m_fm_deviation_isSet = true; -} - -float -SWGTestMISettings::getDcFactor() { - return dc_factor; -} -void -SWGTestMISettings::setDcFactor(float dc_factor) { - this->dc_factor = dc_factor; - this->m_dc_factor_isSet = true; -} - -float -SWGTestMISettings::getIFactor() { - return i_factor; -} -void -SWGTestMISettings::setIFactor(float i_factor) { - this->i_factor = i_factor; - this->m_i_factor_isSet = true; -} - -float -SWGTestMISettings::getQFactor() { - return q_factor; -} -void -SWGTestMISettings::setQFactor(float q_factor) { - this->q_factor = q_factor; - this->m_q_factor_isSet = true; -} - -float -SWGTestMISettings::getPhaseImbalance() { - return phase_imbalance; -} -void -SWGTestMISettings::setPhaseImbalance(float phase_imbalance) { - this->phase_imbalance = phase_imbalance; - this->m_phase_imbalance_isSet = true; -} - QString* SWGTestMISettings::getFileRecordName() { return file_record_name; @@ -497,32 +193,27 @@ SWGTestMISettings::setReverseApiDeviceIndex(qint32 reverse_api_device_index) { this->m_reverse_api_device_index_isSet = true; } +QList* +SWGTestMISettings::getStreams() { + return streams; +} +void +SWGTestMISettings::setStreams(QList* streams) { + this->streams = streams; + this->m_streams_isSet = true; +} + bool SWGTestMISettings::isSet(){ bool isObjectUpdated = false; do{ - if(m_center_frequency_isSet){ isObjectUpdated = true; break;} - if(m_frequency_shift_isSet){ isObjectUpdated = true; break;} - if(m_sample_rate_isSet){ isObjectUpdated = true; break;} - if(m_log2_decim_isSet){ isObjectUpdated = true; break;} - if(m_fc_pos_isSet){ isObjectUpdated = true; break;} - if(m_sample_size_index_isSet){ isObjectUpdated = true; break;} - if(m_amplitude_bits_isSet){ isObjectUpdated = true; break;} - if(m_auto_corr_options_isSet){ isObjectUpdated = true; break;} - if(m_modulation_isSet){ isObjectUpdated = true; break;} - if(m_modulation_tone_isSet){ isObjectUpdated = true; break;} - if(m_am_modulation_isSet){ isObjectUpdated = true; break;} - if(m_fm_deviation_isSet){ isObjectUpdated = true; break;} - if(m_dc_factor_isSet){ isObjectUpdated = true; break;} - if(m_i_factor_isSet){ isObjectUpdated = true; break;} - if(m_q_factor_isSet){ isObjectUpdated = true; break;} - if(m_phase_imbalance_isSet){ isObjectUpdated = true; break;} if(file_record_name != nullptr && *file_record_name != QString("")){ isObjectUpdated = true; break;} if(m_use_reverse_api_isSet){ isObjectUpdated = true; break;} if(reverse_api_address != nullptr && *reverse_api_address != QString("")){ isObjectUpdated = true; break;} if(m_reverse_api_port_isSet){ isObjectUpdated = true; break;} if(m_reverse_api_device_index_isSet){ isObjectUpdated = true; break;} + if(streams->size() > 0){ isObjectUpdated = true; break;} }while(false); return isObjectUpdated; } diff --git a/swagger/sdrangel/code/qt5/client/SWGTestMISettings.h b/swagger/sdrangel/code/qt5/client/SWGTestMISettings.h index 43d67afa7..aad75639c 100644 --- a/swagger/sdrangel/code/qt5/client/SWGTestMISettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGTestMISettings.h @@ -13,7 +13,7 @@ /* * SWGTestMISettings.h * - * TestSourceMI + * TestMISettings */ #ifndef SWGTestMISettings_H_ @@ -22,6 +22,8 @@ #include +#include "SWGTestMiStreamSettings.h" +#include #include #include "SWGObject.h" @@ -42,54 +44,6 @@ public: virtual void fromJsonObject(QJsonObject &json) override; virtual SWGTestMISettings* fromJson(QString &jsonString) override; - qint32 getCenterFrequency(); - void setCenterFrequency(qint32 center_frequency); - - qint32 getFrequencyShift(); - void setFrequencyShift(qint32 frequency_shift); - - qint32 getSampleRate(); - void setSampleRate(qint32 sample_rate); - - qint32 getLog2Decim(); - void setLog2Decim(qint32 log2_decim); - - qint32 getFcPos(); - void setFcPos(qint32 fc_pos); - - qint32 getSampleSizeIndex(); - void setSampleSizeIndex(qint32 sample_size_index); - - qint32 getAmplitudeBits(); - void setAmplitudeBits(qint32 amplitude_bits); - - qint32 getAutoCorrOptions(); - void setAutoCorrOptions(qint32 auto_corr_options); - - qint32 getModulation(); - void setModulation(qint32 modulation); - - qint32 getModulationTone(); - void setModulationTone(qint32 modulation_tone); - - qint32 getAmModulation(); - void setAmModulation(qint32 am_modulation); - - qint32 getFmDeviation(); - void setFmDeviation(qint32 fm_deviation); - - float getDcFactor(); - void setDcFactor(float dc_factor); - - float getIFactor(); - void setIFactor(float i_factor); - - float getQFactor(); - void setQFactor(float q_factor); - - float getPhaseImbalance(); - void setPhaseImbalance(float phase_imbalance); - QString* getFileRecordName(); void setFileRecordName(QString* file_record_name); @@ -105,58 +59,13 @@ public: qint32 getReverseApiDeviceIndex(); void setReverseApiDeviceIndex(qint32 reverse_api_device_index); + QList* getStreams(); + void setStreams(QList* streams); + virtual bool isSet() override; private: - qint32 center_frequency; - bool m_center_frequency_isSet; - - qint32 frequency_shift; - bool m_frequency_shift_isSet; - - qint32 sample_rate; - bool m_sample_rate_isSet; - - qint32 log2_decim; - bool m_log2_decim_isSet; - - qint32 fc_pos; - bool m_fc_pos_isSet; - - qint32 sample_size_index; - bool m_sample_size_index_isSet; - - qint32 amplitude_bits; - bool m_amplitude_bits_isSet; - - qint32 auto_corr_options; - bool m_auto_corr_options_isSet; - - qint32 modulation; - bool m_modulation_isSet; - - qint32 modulation_tone; - bool m_modulation_tone_isSet; - - qint32 am_modulation; - bool m_am_modulation_isSet; - - qint32 fm_deviation; - bool m_fm_deviation_isSet; - - float dc_factor; - bool m_dc_factor_isSet; - - float i_factor; - bool m_i_factor_isSet; - - float q_factor; - bool m_q_factor_isSet; - - float phase_imbalance; - bool m_phase_imbalance_isSet; - QString* file_record_name; bool m_file_record_name_isSet; @@ -172,6 +81,9 @@ private: qint32 reverse_api_device_index; bool m_reverse_api_device_index_isSet; + QList* streams; + bool m_streams_isSet; + }; } diff --git a/swagger/sdrangel/code/qt5/client/SWGTestMiStreamSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGTestMiStreamSettings.cpp new file mode 100644 index 000000000..d341da560 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGTestMiStreamSettings.cpp @@ -0,0 +1,442 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 4.8.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + + +#include "SWGTestMiStreamSettings.h" + +#include "SWGHelpers.h" + +#include +#include +#include +#include + +namespace SWGSDRangel { + +SWGTestMiStreamSettings::SWGTestMiStreamSettings(QString* json) { + init(); + this->fromJson(*json); +} + +SWGTestMiStreamSettings::SWGTestMiStreamSettings() { + stream_index = 0; + m_stream_index_isSet = false; + center_frequency = 0; + m_center_frequency_isSet = false; + frequency_shift = 0; + m_frequency_shift_isSet = false; + sample_rate = 0; + m_sample_rate_isSet = false; + log2_decim = 0; + m_log2_decim_isSet = false; + fc_pos = 0; + m_fc_pos_isSet = false; + sample_size_index = 0; + m_sample_size_index_isSet = false; + amplitude_bits = 0; + m_amplitude_bits_isSet = false; + auto_corr_options = 0; + m_auto_corr_options_isSet = false; + modulation = 0; + m_modulation_isSet = false; + modulation_tone = 0; + m_modulation_tone_isSet = false; + am_modulation = 0; + m_am_modulation_isSet = false; + fm_deviation = 0; + m_fm_deviation_isSet = false; + dc_factor = 0.0f; + m_dc_factor_isSet = false; + i_factor = 0.0f; + m_i_factor_isSet = false; + q_factor = 0.0f; + m_q_factor_isSet = false; + phase_imbalance = 0.0f; + m_phase_imbalance_isSet = false; +} + +SWGTestMiStreamSettings::~SWGTestMiStreamSettings() { + this->cleanup(); +} + +void +SWGTestMiStreamSettings::init() { + stream_index = 0; + m_stream_index_isSet = false; + center_frequency = 0; + m_center_frequency_isSet = false; + frequency_shift = 0; + m_frequency_shift_isSet = false; + sample_rate = 0; + m_sample_rate_isSet = false; + log2_decim = 0; + m_log2_decim_isSet = false; + fc_pos = 0; + m_fc_pos_isSet = false; + sample_size_index = 0; + m_sample_size_index_isSet = false; + amplitude_bits = 0; + m_amplitude_bits_isSet = false; + auto_corr_options = 0; + m_auto_corr_options_isSet = false; + modulation = 0; + m_modulation_isSet = false; + modulation_tone = 0; + m_modulation_tone_isSet = false; + am_modulation = 0; + m_am_modulation_isSet = false; + fm_deviation = 0; + m_fm_deviation_isSet = false; + dc_factor = 0.0f; + m_dc_factor_isSet = false; + i_factor = 0.0f; + m_i_factor_isSet = false; + q_factor = 0.0f; + m_q_factor_isSet = false; + phase_imbalance = 0.0f; + m_phase_imbalance_isSet = false; +} + +void +SWGTestMiStreamSettings::cleanup() { + + + + + + + + + + + + + + + + + +} + +SWGTestMiStreamSettings* +SWGTestMiStreamSettings::fromJson(QString &json) { + QByteArray array (json.toStdString().c_str()); + QJsonDocument doc = QJsonDocument::fromJson(array); + QJsonObject jsonObject = doc.object(); + this->fromJsonObject(jsonObject); + return this; +} + +void +SWGTestMiStreamSettings::fromJsonObject(QJsonObject &pJson) { + ::SWGSDRangel::setValue(&stream_index, pJson["streamIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(¢er_frequency, pJson["centerFrequency"], "qint32", ""); + + ::SWGSDRangel::setValue(&frequency_shift, pJson["frequencyShift"], "qint32", ""); + + ::SWGSDRangel::setValue(&sample_rate, pJson["sampleRate"], "qint32", ""); + + ::SWGSDRangel::setValue(&log2_decim, pJson["log2Decim"], "qint32", ""); + + ::SWGSDRangel::setValue(&fc_pos, pJson["fcPos"], "qint32", ""); + + ::SWGSDRangel::setValue(&sample_size_index, pJson["sampleSizeIndex"], "qint32", ""); + + ::SWGSDRangel::setValue(&litude_bits, pJson["amplitudeBits"], "qint32", ""); + + ::SWGSDRangel::setValue(&auto_corr_options, pJson["autoCorrOptions"], "qint32", ""); + + ::SWGSDRangel::setValue(&modulation, pJson["modulation"], "qint32", ""); + + ::SWGSDRangel::setValue(&modulation_tone, pJson["modulationTone"], "qint32", ""); + + ::SWGSDRangel::setValue(&am_modulation, pJson["amModulation"], "qint32", ""); + + ::SWGSDRangel::setValue(&fm_deviation, pJson["fmDeviation"], "qint32", ""); + + ::SWGSDRangel::setValue(&dc_factor, pJson["dcFactor"], "float", ""); + + ::SWGSDRangel::setValue(&i_factor, pJson["iFactor"], "float", ""); + + ::SWGSDRangel::setValue(&q_factor, pJson["qFactor"], "float", ""); + + ::SWGSDRangel::setValue(&phase_imbalance, pJson["phaseImbalance"], "float", ""); + +} + +QString +SWGTestMiStreamSettings::asJson () +{ + QJsonObject* obj = this->asJsonObject(); + + QJsonDocument doc(*obj); + QByteArray bytes = doc.toJson(); + delete obj; + return QString(bytes); +} + +QJsonObject* +SWGTestMiStreamSettings::asJsonObject() { + QJsonObject* obj = new QJsonObject(); + if(m_stream_index_isSet){ + obj->insert("streamIndex", QJsonValue(stream_index)); + } + if(m_center_frequency_isSet){ + obj->insert("centerFrequency", QJsonValue(center_frequency)); + } + if(m_frequency_shift_isSet){ + obj->insert("frequencyShift", QJsonValue(frequency_shift)); + } + if(m_sample_rate_isSet){ + obj->insert("sampleRate", QJsonValue(sample_rate)); + } + if(m_log2_decim_isSet){ + obj->insert("log2Decim", QJsonValue(log2_decim)); + } + if(m_fc_pos_isSet){ + obj->insert("fcPos", QJsonValue(fc_pos)); + } + if(m_sample_size_index_isSet){ + obj->insert("sampleSizeIndex", QJsonValue(sample_size_index)); + } + if(m_amplitude_bits_isSet){ + obj->insert("amplitudeBits", QJsonValue(amplitude_bits)); + } + if(m_auto_corr_options_isSet){ + obj->insert("autoCorrOptions", QJsonValue(auto_corr_options)); + } + if(m_modulation_isSet){ + obj->insert("modulation", QJsonValue(modulation)); + } + if(m_modulation_tone_isSet){ + obj->insert("modulationTone", QJsonValue(modulation_tone)); + } + if(m_am_modulation_isSet){ + obj->insert("amModulation", QJsonValue(am_modulation)); + } + if(m_fm_deviation_isSet){ + obj->insert("fmDeviation", QJsonValue(fm_deviation)); + } + if(m_dc_factor_isSet){ + obj->insert("dcFactor", QJsonValue(dc_factor)); + } + if(m_i_factor_isSet){ + obj->insert("iFactor", QJsonValue(i_factor)); + } + if(m_q_factor_isSet){ + obj->insert("qFactor", QJsonValue(q_factor)); + } + if(m_phase_imbalance_isSet){ + obj->insert("phaseImbalance", QJsonValue(phase_imbalance)); + } + + return obj; +} + +qint32 +SWGTestMiStreamSettings::getStreamIndex() { + return stream_index; +} +void +SWGTestMiStreamSettings::setStreamIndex(qint32 stream_index) { + this->stream_index = stream_index; + this->m_stream_index_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getCenterFrequency() { + return center_frequency; +} +void +SWGTestMiStreamSettings::setCenterFrequency(qint32 center_frequency) { + this->center_frequency = center_frequency; + this->m_center_frequency_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getFrequencyShift() { + return frequency_shift; +} +void +SWGTestMiStreamSettings::setFrequencyShift(qint32 frequency_shift) { + this->frequency_shift = frequency_shift; + this->m_frequency_shift_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getSampleRate() { + return sample_rate; +} +void +SWGTestMiStreamSettings::setSampleRate(qint32 sample_rate) { + this->sample_rate = sample_rate; + this->m_sample_rate_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getLog2Decim() { + return log2_decim; +} +void +SWGTestMiStreamSettings::setLog2Decim(qint32 log2_decim) { + this->log2_decim = log2_decim; + this->m_log2_decim_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getFcPos() { + return fc_pos; +} +void +SWGTestMiStreamSettings::setFcPos(qint32 fc_pos) { + this->fc_pos = fc_pos; + this->m_fc_pos_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getSampleSizeIndex() { + return sample_size_index; +} +void +SWGTestMiStreamSettings::setSampleSizeIndex(qint32 sample_size_index) { + this->sample_size_index = sample_size_index; + this->m_sample_size_index_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getAmplitudeBits() { + return amplitude_bits; +} +void +SWGTestMiStreamSettings::setAmplitudeBits(qint32 amplitude_bits) { + this->amplitude_bits = amplitude_bits; + this->m_amplitude_bits_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getAutoCorrOptions() { + return auto_corr_options; +} +void +SWGTestMiStreamSettings::setAutoCorrOptions(qint32 auto_corr_options) { + this->auto_corr_options = auto_corr_options; + this->m_auto_corr_options_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getModulation() { + return modulation; +} +void +SWGTestMiStreamSettings::setModulation(qint32 modulation) { + this->modulation = modulation; + this->m_modulation_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getModulationTone() { + return modulation_tone; +} +void +SWGTestMiStreamSettings::setModulationTone(qint32 modulation_tone) { + this->modulation_tone = modulation_tone; + this->m_modulation_tone_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getAmModulation() { + return am_modulation; +} +void +SWGTestMiStreamSettings::setAmModulation(qint32 am_modulation) { + this->am_modulation = am_modulation; + this->m_am_modulation_isSet = true; +} + +qint32 +SWGTestMiStreamSettings::getFmDeviation() { + return fm_deviation; +} +void +SWGTestMiStreamSettings::setFmDeviation(qint32 fm_deviation) { + this->fm_deviation = fm_deviation; + this->m_fm_deviation_isSet = true; +} + +float +SWGTestMiStreamSettings::getDcFactor() { + return dc_factor; +} +void +SWGTestMiStreamSettings::setDcFactor(float dc_factor) { + this->dc_factor = dc_factor; + this->m_dc_factor_isSet = true; +} + +float +SWGTestMiStreamSettings::getIFactor() { + return i_factor; +} +void +SWGTestMiStreamSettings::setIFactor(float i_factor) { + this->i_factor = i_factor; + this->m_i_factor_isSet = true; +} + +float +SWGTestMiStreamSettings::getQFactor() { + return q_factor; +} +void +SWGTestMiStreamSettings::setQFactor(float q_factor) { + this->q_factor = q_factor; + this->m_q_factor_isSet = true; +} + +float +SWGTestMiStreamSettings::getPhaseImbalance() { + return phase_imbalance; +} +void +SWGTestMiStreamSettings::setPhaseImbalance(float phase_imbalance) { + this->phase_imbalance = phase_imbalance; + this->m_phase_imbalance_isSet = true; +} + + +bool +SWGTestMiStreamSettings::isSet(){ + bool isObjectUpdated = false; + do{ + if(m_stream_index_isSet){ isObjectUpdated = true; break;} + if(m_center_frequency_isSet){ isObjectUpdated = true; break;} + if(m_frequency_shift_isSet){ isObjectUpdated = true; break;} + if(m_sample_rate_isSet){ isObjectUpdated = true; break;} + if(m_log2_decim_isSet){ isObjectUpdated = true; break;} + if(m_fc_pos_isSet){ isObjectUpdated = true; break;} + if(m_sample_size_index_isSet){ isObjectUpdated = true; break;} + if(m_amplitude_bits_isSet){ isObjectUpdated = true; break;} + if(m_auto_corr_options_isSet){ isObjectUpdated = true; break;} + if(m_modulation_isSet){ isObjectUpdated = true; break;} + if(m_modulation_tone_isSet){ isObjectUpdated = true; break;} + if(m_am_modulation_isSet){ isObjectUpdated = true; break;} + if(m_fm_deviation_isSet){ isObjectUpdated = true; break;} + if(m_dc_factor_isSet){ isObjectUpdated = true; break;} + if(m_i_factor_isSet){ isObjectUpdated = true; break;} + if(m_q_factor_isSet){ isObjectUpdated = true; break;} + if(m_phase_imbalance_isSet){ isObjectUpdated = true; break;} + }while(false); + return isObjectUpdated; +} +} + diff --git a/swagger/sdrangel/code/qt5/client/SWGTestMiStreamSettings.h b/swagger/sdrangel/code/qt5/client/SWGTestMiStreamSettings.h new file mode 100644 index 000000000..13b38b836 --- /dev/null +++ b/swagger/sdrangel/code/qt5/client/SWGTestMiStreamSettings.h @@ -0,0 +1,154 @@ +/** + * SDRangel + * This is the web REST/JSON API of SDRangel SDR software. SDRangel is an Open Source Qt5/OpenGL 3.0+ (4.3+ in Windows) GUI and server Software Defined Radio and signal analyzer in software. It supports Airspy, BladeRF, HackRF, LimeSDR, PlutoSDR, RTL-SDR, SDRplay RSP1 and FunCube --- Limitations and specifcities: * In SDRangel GUI the first Rx device set cannot be deleted. Conversely the server starts with no device sets and its number of device sets can be reduced to zero by as many calls as necessary to /sdrangel/deviceset with DELETE method. * Preset import and export from/to file is a server only feature. * Device set focus is a GUI only feature. * The following channels are not implemented (status 501 is returned): ATV and DATV demodulators, Channel Analyzer NG, LoRa demodulator * The device settings and report structures contains only the sub-structure corresponding to the device type. The DeviceSettings and DeviceReport structures documented here shows all of them but only one will be or should be present at a time * The channel settings and report structures contains only the sub-structure corresponding to the channel type. The ChannelSettings and ChannelReport structures documented here shows all of them but only one will be or should be present at a time --- + * + * OpenAPI spec version: 4.8.0 + * Contact: f4exb06@gmail.com + * + * NOTE: This class is auto generated by the swagger code generator program. + * https://github.com/swagger-api/swagger-codegen.git + * Do not edit the class manually. + */ + +/* + * SWGTestMiStreamSettings.h + * + * TestMiStreamSettings + */ + +#ifndef SWGTestMiStreamSettings_H_ +#define SWGTestMiStreamSettings_H_ + +#include + + + +#include "SWGObject.h" +#include "export.h" + +namespace SWGSDRangel { + +class SWG_API SWGTestMiStreamSettings: public SWGObject { +public: + SWGTestMiStreamSettings(); + SWGTestMiStreamSettings(QString* json); + virtual ~SWGTestMiStreamSettings(); + void init(); + void cleanup(); + + virtual QString asJson () override; + virtual QJsonObject* asJsonObject() override; + virtual void fromJsonObject(QJsonObject &json) override; + virtual SWGTestMiStreamSettings* fromJson(QString &jsonString) override; + + qint32 getStreamIndex(); + void setStreamIndex(qint32 stream_index); + + qint32 getCenterFrequency(); + void setCenterFrequency(qint32 center_frequency); + + qint32 getFrequencyShift(); + void setFrequencyShift(qint32 frequency_shift); + + qint32 getSampleRate(); + void setSampleRate(qint32 sample_rate); + + qint32 getLog2Decim(); + void setLog2Decim(qint32 log2_decim); + + qint32 getFcPos(); + void setFcPos(qint32 fc_pos); + + qint32 getSampleSizeIndex(); + void setSampleSizeIndex(qint32 sample_size_index); + + qint32 getAmplitudeBits(); + void setAmplitudeBits(qint32 amplitude_bits); + + qint32 getAutoCorrOptions(); + void setAutoCorrOptions(qint32 auto_corr_options); + + qint32 getModulation(); + void setModulation(qint32 modulation); + + qint32 getModulationTone(); + void setModulationTone(qint32 modulation_tone); + + qint32 getAmModulation(); + void setAmModulation(qint32 am_modulation); + + qint32 getFmDeviation(); + void setFmDeviation(qint32 fm_deviation); + + float getDcFactor(); + void setDcFactor(float dc_factor); + + float getIFactor(); + void setIFactor(float i_factor); + + float getQFactor(); + void setQFactor(float q_factor); + + float getPhaseImbalance(); + void setPhaseImbalance(float phase_imbalance); + + + virtual bool isSet() override; + +private: + qint32 stream_index; + bool m_stream_index_isSet; + + qint32 center_frequency; + bool m_center_frequency_isSet; + + qint32 frequency_shift; + bool m_frequency_shift_isSet; + + qint32 sample_rate; + bool m_sample_rate_isSet; + + qint32 log2_decim; + bool m_log2_decim_isSet; + + qint32 fc_pos; + bool m_fc_pos_isSet; + + qint32 sample_size_index; + bool m_sample_size_index_isSet; + + qint32 amplitude_bits; + bool m_amplitude_bits_isSet; + + qint32 auto_corr_options; + bool m_auto_corr_options_isSet; + + qint32 modulation; + bool m_modulation_isSet; + + qint32 modulation_tone; + bool m_modulation_tone_isSet; + + qint32 am_modulation; + bool m_am_modulation_isSet; + + qint32 fm_deviation; + bool m_fm_deviation_isSet; + + float dc_factor; + bool m_dc_factor_isSet; + + float i_factor; + bool m_i_factor_isSet; + + float q_factor; + bool m_q_factor_isSet; + + float phase_imbalance; + bool m_phase_imbalance_isSet; + +}; + +} + +#endif /* SWGTestMiStreamSettings_H_ */