diff --git a/plugins/feature/satellitetracker/satellitedevicesettingsgui.cpp b/plugins/feature/satellitetracker/satellitedevicesettingsgui.cpp index 0358116ba..0eac51e7f 100644 --- a/plugins/feature/satellitetracker/satellitedevicesettingsgui.cpp +++ b/plugins/feature/satellitetracker/satellitedevicesettingsgui.cpp @@ -41,15 +41,12 @@ SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings: m_deviceSetWidget->setEditable(true); m_deviceSetWidget->setToolTip("Device set to control"); formLayout->addRow("Device set", m_deviceSetWidget); + addDeviceSets(); - int devSetIdx = m_deviceSetWidget->findText(devSettings->m_deviceSet); - if (devSetIdx != -1) - { - m_deviceSetWidget->setCurrentIndex(devSetIdx); - } - else - { - m_deviceSetWidget->addItem(devSettings->m_deviceSet); + + if (devSettings->m_deviceSetIndex < m_deviceSetWidget->count()) { + m_deviceSetWidget->setCurrentIndex(devSettings->m_deviceSetIndex); + } else { m_deviceSetWidget->setCurrentIndex(m_deviceSetWidget->count() - 1); } @@ -59,19 +56,31 @@ SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings: m_presetWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); m_presetWidget->setToolTip("Preset to load on AOS"); formLayout->addRow("Preset", m_presetWidget); - addPresets(devSettings->m_deviceSet); - const MainSettings& mainSettings = MainCore::instance()->getSettings(); - if (!devSettings->m_deviceSet.isEmpty()) + MainCore *mainCore = MainCore::instance(); + const std::vector& deviceSets = mainCore->getDeviceSets(); + + if (devSettings->m_deviceSetIndex < (int) deviceSets.size()) { + DeviceSet *deviceSet = deviceSets[devSettings->m_deviceSetIndex]; + + if (deviceSet->m_deviceSourceEngine) { + addPresets("R"); + } else if (deviceSet->m_deviceSinkEngine) { + addPresets("T"); + } else if (deviceSet->m_deviceMIMOEngine) { + addPresets("M"); + } + + const MainSettings& mainSettings = MainCore::instance()->getSettings(); int count = mainSettings.getPresetCount(); int idx = 0; for (int i = 0; i < count; i++) { const Preset *preset = mainSettings.getPreset(i); - if ( ((preset->isSourcePreset() && (devSettings->m_deviceSet[0] == "R"))) - || ((preset->isSinkPreset() && (devSettings->m_deviceSet[0] == "T"))) - || ((preset->isMIMOPreset() && (devSettings->m_deviceSet[0] == "M")))) + if (((preset->isSourcePreset() && (deviceSet->m_deviceSourceEngine))) + || ((preset->isSinkPreset() && (deviceSet->m_deviceSinkEngine))) + || ((preset->isMIMOPreset() && (deviceSet->m_deviceMIMOEngine)))) { if ( (devSettings->m_presetGroup == preset->getGroup()) && (devSettings->m_presetFrequency == preset->getCenterFrequency()) @@ -96,6 +105,7 @@ SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings: for (int i = 0; i < devSettings->m_doppler.size(); i++) { int idx = devSettings->m_doppler[i]; + if (idx < m_dopplerItems.size()) { m_dopplerItems[idx]->setData(Qt::Checked, Qt::CheckStateRole); } else { @@ -158,28 +168,32 @@ void SatelliteDeviceSettingsGUI::addDeviceSets() { DSPDeviceSourceEngine *deviceSourceEngine = (*it)->m_deviceSourceEngine; DSPDeviceSinkEngine *deviceSinkEngine = (*it)->m_deviceSinkEngine; + DSPDeviceMIMOEngine *deviceMIMOEngine = (*it)->m_deviceMIMOEngine; if (deviceSourceEngine) { m_deviceSetWidget->addItem(QString("R%1").arg(deviceIndex), deviceIndex); } else if (deviceSinkEngine) { m_deviceSetWidget->addItem(QString("T%1").arg(deviceIndex), deviceIndex); + } else if (deviceMIMOEngine) { + m_deviceSetWidget->addItem(QString("M%1").arg(deviceIndex), deviceIndex); } } } // Add all available presets for a deviceset to the combobox -void SatelliteDeviceSettingsGUI::addPresets(const QString& deviceSet) +void SatelliteDeviceSettingsGUI::addPresets(const QString& deviceSetType) { m_presetWidget->clear(); const MainSettings& mainSettings = MainCore::instance()->getSettings(); int count = mainSettings.getPresetCount(); - m_currentPresets = deviceSet[0]; + m_currentPresetType = deviceSetType[0]; + for (int i = 0; i < count; i++) { const Preset *preset = mainSettings.getPreset(i); - if ( ((preset->isSourcePreset() && (m_currentPresets == "R"))) - || ((preset->isSinkPreset() && (m_currentPresets == "T"))) - || ((preset->isMIMOPreset() && (m_currentPresets == "M")))) + if (((preset->isSourcePreset() && (m_currentPresetType == "R"))) + || ((preset->isSinkPreset() && (m_currentPresetType == "T"))) + || ((preset->isMIMOPreset() && (m_currentPresetType == "M")))) { m_presetWidget->addItem(QString("%1: %2 - %3") .arg(preset->getGroup()) @@ -198,9 +212,9 @@ const Preset* SatelliteDeviceSettingsGUI::getSelectedPreset() for (int i = 0; i < count; i++) { const Preset *preset = mainSettings.getPreset(i); - if ( ((preset->isSourcePreset() && (m_currentPresets == "R"))) - || ((preset->isSinkPreset() && (m_currentPresets == "T"))) - || ((preset->isMIMOPreset() && (m_currentPresets == "M")))) + if ( ((preset->isSourcePreset() && (m_currentPresetType == "R"))) + || ((preset->isSinkPreset() && (m_currentPresetType == "T"))) + || ((preset->isMIMOPreset() && (m_currentPresetType == "M")))) { if (listIdx == presetIdx) { return preset; @@ -218,13 +232,14 @@ void SatelliteDeviceSettingsGUI::addChannels() m_dopplerItems.clear(); const PluginManager *pluginManager = MainCore::instance()->getPluginManager(); const Preset* preset = getSelectedPreset(); + if (preset != nullptr) { int channels = preset->getChannelCount(); + for (int i = 0; i < channels; i++) { const Preset::ChannelConfig& channelConfig = preset->getChannelConfig(i); - QStandardItem *item = new QStandardItem(); item->setText(pluginManager->uriToId(channelConfig.m_channelIdURI)); item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled); @@ -240,9 +255,10 @@ void SatelliteDeviceSettingsGUI::on_m_deviceSetWidget_currentTextChanged(const Q { if (!text.isEmpty()) { - if (text[0] != m_currentPresets) { + if (text[0] != m_currentPresetType) { addPresets(text[0]); } + // Set name of tab to match int currentTabIndex = m_tab->currentIndex(); m_tab->setTabText(currentTabIndex, text); @@ -259,8 +275,9 @@ void SatelliteDeviceSettingsGUI::on_m_presetWidget_currentIndexChanged(int index // Update devSettings with current GUI values void SatelliteDeviceSettingsGUI::accept() { - m_devSettings->m_deviceSet = m_deviceSetWidget->currentText(); + m_devSettings->m_deviceSetIndex = m_deviceSetWidget->currentIndex(); const Preset* preset = getSelectedPreset(); + if (preset != nullptr) { m_devSettings->m_presetGroup = preset->getGroup(); @@ -273,13 +290,16 @@ void SatelliteDeviceSettingsGUI::accept() m_devSettings->m_presetFrequency = 0; m_devSettings->m_presetDescription = ""; } + m_devSettings->m_doppler.clear(); + for (int i = 0; i < m_dopplerItems.size(); i++) { if (m_dopplerItems[i]->checkState() == Qt::Checked) { m_devSettings->m_doppler.append(i); } } + m_devSettings->m_startOnAOS = m_startOnAOSWidget->isChecked(); m_devSettings->m_stopOnLOS = m_stopOnLOSWidget->isChecked(); m_devSettings->m_startStopFileSink = m_startStopFileSinkWidget->isChecked(); diff --git a/plugins/feature/satellitetracker/satellitedevicesettingsgui.h b/plugins/feature/satellitetracker/satellitedevicesettingsgui.h index 149f90178..e37867b5f 100644 --- a/plugins/feature/satellitetracker/satellitedevicesettingsgui.h +++ b/plugins/feature/satellitetracker/satellitedevicesettingsgui.h @@ -68,7 +68,7 @@ protected: QLineEdit *m_frequencyWidget; QLineEdit *m_aosCommandWidget; QLineEdit *m_losCommandWidget; - QChar m_currentPresets; + QChar m_currentPresetType; QStandardItemModel m_dopplerModel; QList m_dopplerItems; diff --git a/plugins/feature/satellitetracker/satelliteradiocontroldialog.cpp b/plugins/feature/satellitetracker/satelliteradiocontroldialog.cpp index 018f2bcde..ca53750c1 100644 --- a/plugins/feature/satellitetracker/satelliteradiocontroldialog.cpp +++ b/plugins/feature/satellitetracker/satelliteradiocontroldialog.cpp @@ -111,7 +111,25 @@ void SatelliteRadioControlDialog::on_satelliteSelect_currentIndexChanged(int ind for (int i = 0; i < devSettingsList->size(); i++) { SatelliteDeviceSettingsGUI *devSettingsGUI = new SatelliteDeviceSettingsGUI(devSettingsList->at(i), ui->tabWidget, ui->tabWidget); - ui->tabWidget->addTab(devSettingsGUI, devSettingsList->at(i)->m_deviceSet); + QString deviceSetString; + MainCore *mainCore = MainCore::instance(); + const std::vector& deviceSets = mainCore->getDeviceSets(); + + if (devSettingsList->at(i)->m_deviceSetIndex < (int) deviceSets.size()) + { + const DeviceSet *deviceSet = deviceSets[devSettingsList->at(i)->m_deviceSetIndex]; + + if (deviceSet->m_deviceSourceEngine != nullptr) { + deviceSetString = tr("R%1").arg(devSettingsList->at(i)->m_deviceSetIndex); + } else if (deviceSet->m_deviceSinkEngine != nullptr) { + deviceSetString = tr("T%1").arg(devSettingsList->at(i)->m_deviceSetIndex); + } else if (deviceSet->m_deviceMIMOEngine != nullptr) { + deviceSetString = tr("M%1").arg(devSettingsList->at(i)->m_deviceSetIndex); + } + + ui->tabWidget->addTab(devSettingsGUI, deviceSetString); + } + m_devSettingsGUIs.append(devSettingsGUI); } diff --git a/plugins/feature/satellitetracker/satellitetracker.cpp b/plugins/feature/satellitetracker/satellitetracker.cpp index 5036672dc..e5825eaf1 100644 --- a/plugins/feature/satellitetracker/satellitetracker.cpp +++ b/plugins/feature/satellitetracker/satellitetracker.cpp @@ -407,15 +407,14 @@ QList* SatelliteTracker::getSWGSat for (int j = 0; j < l->size(); j++) { SWGSDRangel::SWGSatelliteDeviceSettings* deviceSettings = new SWGSDRangel::SWGSatelliteDeviceSettings(); - deviceSettings->setDeviceSet(new QString(l->at(j)->m_deviceSet)); + deviceSettings->setDeviceSetIndex(l->at(j)->m_deviceSetIndex); deviceSettings->setPresetGroup(new QString(l->at(j)->m_presetGroup)); deviceSettings->setPresetDescription(new QString(l->at(j)->m_presetDescription)); deviceSettings->setPresetFrequency(l->at(j)->m_presetFrequency); - QList* doppler = new QList(); + deviceSettings->setDoppler(new QList()); for (int k = 0; k < l->at(j)->m_doppler.size(); k++) { - doppler->append(l->at(j)->m_doppler[k]); + deviceSettings->getDoppler()->append(new QString(QString::number(l->at(j)->m_doppler[k]))); } - deviceSettings->setDoppler(doppler); deviceSettings->setStartOnAos((int)l->at(j)->m_startOnAOS ? 1 : 0); deviceSettings->setStopOnLos((int)l->at(j)->m_stopOnLOS ? 1 : 0); deviceSettings->setStartStopFileSinks((int)l->at(j)->m_startStopFileSink ? 1 : 0); @@ -459,12 +458,16 @@ QHash *> Sat for (int j = 0; j < swgDeviceSettingsList->size(); j++) { SatelliteTrackerSettings::SatelliteDeviceSettings *deviceSettings = new SatelliteTrackerSettings::SatelliteDeviceSettings(); - deviceSettings->m_deviceSet = getString(swgDeviceSettingsList->at(j)->getDeviceSet()); + deviceSettings->m_deviceSetIndex = swgDeviceSettingsList->at(j)->getDeviceSetIndex(); deviceSettings->m_presetGroup = getString(swgDeviceSettingsList->at(j)->getPresetGroup()); deviceSettings->m_presetFrequency = swgDeviceSettingsList->at(j)->getPresetFrequency(); deviceSettings->m_presetDescription = getString(swgDeviceSettingsList->at(j)->getPresetDescription()); - if (swgDeviceSettingsList->at(j)->getDoppler()) { - deviceSettings->m_doppler = *swgDeviceSettingsList->at(j)->getDoppler(); + deviceSettings->m_doppler.clear(); + if (swgDeviceSettingsList->at(j)->getDoppler()) + { + for (auto dopplerStr : *swgDeviceSettingsList->at(j)->getDoppler()) { + deviceSettings->m_doppler.append(dopplerStr->toInt()); + } } deviceSettings->m_startOnAOS = swgDeviceSettingsList->at(j)->getStartOnAos(); deviceSettings->m_stopOnLOS = swgDeviceSettingsList->at(j)->getStopOnLos(); diff --git a/plugins/feature/satellitetracker/satellitetrackersettings.cpp b/plugins/feature/satellitetracker/satellitetrackersettings.cpp index 571126787..61f2e51bc 100644 --- a/plugins/feature/satellitetracker/satellitetrackersettings.cpp +++ b/plugins/feature/satellitetracker/satellitetrackersettings.cpp @@ -243,7 +243,7 @@ QDataStream& operator>>(QDataStream& in, QListm_deviceSet; + out << settings->m_deviceSetIndex; out << settings->m_presetGroup; out << settings->m_presetFrequency; out << settings->m_presetDescription; @@ -260,7 +260,7 @@ QDataStream& operator<<(QDataStream& out, const SatelliteTrackerSettings::Satell QDataStream& operator>>(QDataStream& in, SatelliteTrackerSettings::SatelliteDeviceSettings*& settings) { settings = new SatelliteTrackerSettings::SatelliteDeviceSettings(); - in >> settings->m_deviceSet; + in >> settings->m_deviceSetIndex; in >> settings->m_presetGroup; in >> settings->m_presetFrequency; in >> settings->m_presetDescription; @@ -292,7 +292,7 @@ void SatelliteTrackerSettings::deserializeDeviceSettings(const QByteArray& data, SatelliteTrackerSettings::SatelliteDeviceSettings::SatelliteDeviceSettings() { - m_deviceSet = "R0"; + m_deviceSetIndex = 0; m_presetFrequency = 0; m_startOnAOS = true; m_stopOnLOS = true; diff --git a/plugins/feature/satellitetracker/satellitetrackersettings.h b/plugins/feature/satellitetracker/satellitetrackersettings.h index 643f331b0..490f4aac8 100644 --- a/plugins/feature/satellitetracker/satellitetrackersettings.h +++ b/plugins/feature/satellitetracker/satellitetrackersettings.h @@ -33,7 +33,7 @@ struct SatelliteTrackerSettings { struct SatelliteDeviceSettings { - QString m_deviceSet; //!< R0, T1... + int m_deviceSetIndex; //!< Device set index in the list of device sets of the SDRangel instance QString m_presetGroup; //!< Preset to load to device set quint64 m_presetFrequency; QString m_presetDescription; diff --git a/plugins/feature/satellitetracker/satellitetrackerworker.cpp b/plugins/feature/satellitetracker/satellitetrackerworker.cpp index 16695cb75..829382998 100644 --- a/plugins/feature/satellitetracker/satellitetrackerworker.cpp +++ b/plugins/feature/satellitetracker/satellitetrackerworker.cpp @@ -544,27 +544,40 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name) for (int i = 0; i < m_deviceSettingsList->size(); i++) { SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings = m_deviceSettingsList->at(i); - if (!devSettings->m_presetGroup.isEmpty() && !devSettings->m_deviceSet.isEmpty()) + if (!devSettings->m_presetGroup.isEmpty()) { const MainSettings& mainSettings = mainCore->getSettings(); + const std::vector& deviceSets = mainCore->getDeviceSets(); - QString presetType = QString(devSettings->m_deviceSet[0]); - const Preset* preset = mainSettings.getPreset(devSettings->m_presetGroup, devSettings->m_presetFrequency, devSettings->m_presetDescription, presetType); - if (preset != nullptr) + if (devSettings->m_deviceSetIndex < deviceSets.size()) { - qDebug() << "SatelliteTrackerWorker::aos: Loading preset " << preset->getDescription() << " to " << devSettings->m_deviceSet[0]; - unsigned int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt(); - std::vector& deviceSets = mainCore->getDeviceSets(); - if (deviceSetIndex < deviceSets.size()) + const DeviceSet *deviceSet = deviceSets[devSettings->m_deviceSetIndex]; + QString presetType; + if (deviceSet->m_deviceSourceEngine != nullptr) { + presetType = "R"; + } else if (deviceSet->m_deviceSinkEngine != nullptr) { + presetType = "T"; + } else if (deviceSet->m_deviceMIMOEngine != nullptr) { + presetType = "M"; + } + + const Preset* preset = mainSettings.getPreset(devSettings->m_presetGroup, devSettings->m_presetFrequency, devSettings->m_presetDescription, presetType); + + if (preset != nullptr) { - MainCore::MsgLoadPreset *msg = MainCore::MsgLoadPreset::create(preset, deviceSetIndex); + qDebug() << "SatelliteTrackerWorker::aos: Loading preset " << preset->getDescription() << " to device set at " << devSettings->m_deviceSetIndex; + MainCore::MsgLoadPreset *msg = MainCore::MsgLoadPreset::create(preset, devSettings->m_deviceSetIndex); mainCore->getMainMessageQueue()->push(msg); } else - qWarning() << "SatelliteTrackerWorker::aos: device set " << devSettings->m_deviceSet << " does not exist"; + { + qWarning() << "SatelliteTrackerWorker::aos: Unable to get preset: " << devSettings->m_presetGroup << " " << devSettings->m_presetFrequency << " " << devSettings->m_presetDescription; + } } else - qWarning() << "SatelliteTrackerWorker::aos: Unable to get preset: " << devSettings->m_presetGroup << " " << devSettings->m_presetFrequency << " " << devSettings->m_presetDescription; + { + qWarning() << "SatelliteTrackerWorker::aos: device set at " << devSettings->m_deviceSetIndex << " does not exist"; + } } } @@ -580,8 +593,7 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name) if (devSettings->m_frequency != 0) { qDebug() << "SatelliteTrackerWorker::aos: setting frequency to: " << devSettings->m_frequency; - int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt(); - ChannelWebAPIUtils::setCenterFrequency(deviceSetIndex, devSettings->m_frequency); + ChannelWebAPIUtils::setCenterFrequency(devSettings->m_deviceSetIndex, devSettings->m_frequency); } // Execute per satellite program/script @@ -600,8 +612,7 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name) if (devSettings->m_startOnAOS) { qDebug() << "SatelliteTrackerWorker::aos: starting acqusition"; - int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt(); - ChannelWebAPIUtils::run(deviceSetIndex); + ChannelWebAPIUtils::run(devSettings->m_deviceSetIndex); } } @@ -622,8 +633,8 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name) for (int j = 0; j < devSettings->m_doppler.size(); j++) { int offset; - int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt(); - if (ChannelWebAPIUtils::getFrequencyOffset(deviceSetIndex, devSettings->m_doppler[j], offset)) + + if (ChannelWebAPIUtils::getFrequencyOffset(devSettings->m_deviceSetIndex, devSettings->m_doppler[j], offset)) { satWorkerState->m_initFrequencyOffset.append(offset); qDebug() << "SatelliteTrackerWorker::applyDeviceAOSSettings: Initial frequency offset: " << offset; @@ -655,8 +666,7 @@ void SatelliteTrackerWorker::applyDeviceAOSSettings(const QString& name) if (devSettings->m_startStopFileSink) { qDebug() << "SatelliteTrackerWorker::aos: starting file sinks"; - int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt(); - ChannelWebAPIUtils::startStopFileSinks(deviceSetIndex, true); + ChannelWebAPIUtils::startStopFileSinks(devSettings->m_deviceSetIndex, true); } } }); @@ -686,9 +696,9 @@ void SatelliteTrackerWorker::doppler(SatWorkerState *satWorkerState) if (devSettings->m_doppler.size() > 0) { // Get center frequency for this device - int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt(); double centerFrequency; - if (ChannelWebAPIUtils::getCenterFrequency(deviceSetIndex, centerFrequency)) + + if (ChannelWebAPIUtils::getCenterFrequency(devSettings->m_deviceSetIndex, centerFrequency)) { // Calculate frequency delta due to Doppler double c = 299792458.0; @@ -697,18 +707,14 @@ void SatelliteTrackerWorker::doppler(SatWorkerState *satWorkerState) for (int j = 0; j < devSettings->m_doppler.size(); j++) { // For receive, we subtract, transmit we add - int offset; - if (devSettings->m_deviceSet[0] == "R") - offset = satWorkerState->m_initFrequencyOffset[i] - (int)round(deltaF); - else - offset = satWorkerState->m_initFrequencyOffset[i] + (int)round(deltaF); + int offset = satWorkerState->m_initFrequencyOffset[i] - (int)round(deltaF); - if (!ChannelWebAPIUtils::setFrequencyOffset(deviceSetIndex, devSettings->m_doppler[j], offset)) + if (!ChannelWebAPIUtils::setFrequencyOffset(devSettings->m_deviceSetIndex, devSettings->m_doppler[j], offset)) qDebug() << "SatelliteTrackerWorker::doppler: Failed to set frequency offset"; } } else - qDebug() << "SatelliteTrackerWorker::doppler: couldn't get centre frequency for " << devSettings->m_deviceSet; + qDebug() << "SatelliteTrackerWorker::doppler: couldn't get centre frequency for device at " << devSettings->m_deviceSetIndex; } } } @@ -746,8 +752,7 @@ void SatelliteTrackerWorker::los(SatWorkerState *satWorkerState) if (devSettings->m_startStopFileSink) { qDebug() << "SatelliteTrackerWorker::los: stopping file sinks"; - int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt(); - ChannelWebAPIUtils::startStopFileSinks(deviceSetIndex, false); + ChannelWebAPIUtils::startStopFileSinks(devSettings->m_deviceSetIndex, false); } } @@ -759,10 +764,9 @@ void SatelliteTrackerWorker::los(SatWorkerState *satWorkerState) for (int i = 0; i < m_deviceSettingsList->size(); i++) { SatelliteTrackerSettings::SatelliteDeviceSettings *devSettings = m_deviceSettingsList->at(i); - if (devSettings->m_stopOnLOS) - { - int deviceSetIndex = devSettings->m_deviceSet.mid(1).toInt(); - ChannelWebAPIUtils::stop(deviceSetIndex); + + if (devSettings->m_stopOnLOS) { + ChannelWebAPIUtils::stop(devSettings->m_deviceSetIndex); } } diff --git a/sdrbase/resources/webapi/doc/html2/index.html b/sdrbase/resources/webapi/doc/html2/index.html index ac7c67a66..37257ba7f 100644 --- a/sdrbase/resources/webapi/doc/html2/index.html +++ b/sdrbase/resources/webapi/doc/html2/index.html @@ -9976,9 +9976,9 @@ margin-bottom: 20px; }; defs.SatelliteDeviceSettings = { "properties" : { - "deviceSet" : { - "type" : "string", - "description" : "Name of the device set (E.g. R0)" + "deviceSetIndex" : { + "type" : "integer", + "description" : "Index of the device set (E.g. 0)" }, "presetGroup" : { "type" : "string", @@ -9995,9 +9995,9 @@ margin-bottom: 20px; }, "doppler" : { "type" : "array", - "description" : "Whether to apply doppler correction to each channel (1 for yes, 0 for no)", + "description" : "Channel which to apply doppler correction (index as string)", "items" : { - "type" : "integer" + "type" : "string" } }, "startOnAOS" : { @@ -50580,7 +50580,7 @@ except ApiException as e:
- Generated 2021-09-17T00:27:04.059+02:00 + Generated 2021-10-03T09:59:26.222+02:00
diff --git a/sdrbase/resources/webapi/doc/swagger/include/SatelliteTracker.yaml b/sdrbase/resources/webapi/doc/swagger/include/SatelliteTracker.yaml index 5da7b2bc2..ffcb4951a 100644 --- a/sdrbase/resources/webapi/doc/swagger/include/SatelliteTracker.yaml +++ b/sdrbase/resources/webapi/doc/swagger/include/SatelliteTracker.yaml @@ -128,9 +128,9 @@ SatelliteDeviceSettingsList: SatelliteDeviceSettings: description: "Device set settings" properties: - deviceSet: - description: "Name of the device set (E.g. R0)" - type: string + deviceSetIndex: + description: "Index of the device set (E.g. 0)" + type: integer presetGroup: description: "Group for preset to load on AOS" type: string @@ -142,10 +142,10 @@ SatelliteDeviceSettings: description: "Description of preset to load on AOS" type: string doppler: - description: "Whether to apply doppler correction to each channel (1 for yes, 0 for no)" + description: "Channel which to apply doppler correction (index as string)" type: array items: - type: integer + type: string startOnAOS: description: "Start acquisition on AOS (1 for yes, 0 for no)" type: integer diff --git a/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml b/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml index 68f6b95f5..5b6a20376 100644 --- a/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml +++ b/swagger/sdrangel/api/swagger/include/SatelliteTracker.yaml @@ -128,9 +128,9 @@ SatelliteDeviceSettingsList: SatelliteDeviceSettings: description: "Device set settings" properties: - deviceSet: - description: "Name of the device set (E.g. R0)" - type: string + deviceSetIndex: + description: "Index of the device set (E.g. 0)" + type: integer presetGroup: description: "Group for preset to load on AOS" type: string @@ -142,10 +142,10 @@ SatelliteDeviceSettings: description: "Description of preset to load on AOS" type: string doppler: - description: "Whether to apply doppler correction to each channel (1 for yes, 0 for no)" + description: "Channel which to apply doppler correction (index as string)" type: array items: - type: integer + type: string startOnAOS: description: "Start acquisition on AOS (1 for yes, 0 for no)" type: integer diff --git a/swagger/sdrangel/code/html2/index.html b/swagger/sdrangel/code/html2/index.html index ac7c67a66..37257ba7f 100644 --- a/swagger/sdrangel/code/html2/index.html +++ b/swagger/sdrangel/code/html2/index.html @@ -9976,9 +9976,9 @@ margin-bottom: 20px; }; defs.SatelliteDeviceSettings = { "properties" : { - "deviceSet" : { - "type" : "string", - "description" : "Name of the device set (E.g. R0)" + "deviceSetIndex" : { + "type" : "integer", + "description" : "Index of the device set (E.g. 0)" }, "presetGroup" : { "type" : "string", @@ -9995,9 +9995,9 @@ margin-bottom: 20px; }, "doppler" : { "type" : "array", - "description" : "Whether to apply doppler correction to each channel (1 for yes, 0 for no)", + "description" : "Channel which to apply doppler correction (index as string)", "items" : { - "type" : "integer" + "type" : "string" } }, "startOnAOS" : { @@ -50580,7 +50580,7 @@ except ApiException as e:
- Generated 2021-09-17T00:27:04.059+02:00 + Generated 2021-10-03T09:59:26.222+02:00
diff --git a/swagger/sdrangel/code/qt5/client/SWGSatelliteDeviceSettings.cpp b/swagger/sdrangel/code/qt5/client/SWGSatelliteDeviceSettings.cpp index d19492fe5..0f1431f93 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSatelliteDeviceSettings.cpp +++ b/swagger/sdrangel/code/qt5/client/SWGSatelliteDeviceSettings.cpp @@ -28,15 +28,15 @@ SWGSatelliteDeviceSettings::SWGSatelliteDeviceSettings(QString* json) { } SWGSatelliteDeviceSettings::SWGSatelliteDeviceSettings() { - device_set = nullptr; - m_device_set_isSet = false; + device_set_index = 0; + m_device_set_index_isSet = false; preset_group = nullptr; m_preset_group_isSet = false; preset_frequency = 0L; m_preset_frequency_isSet = false; preset_description = nullptr; m_preset_description_isSet = false; - doppler = new QList(); + doppler = nullptr; m_doppler_isSet = false; start_on_aos = 0; m_start_on_aos_isSet = false; @@ -58,15 +58,15 @@ SWGSatelliteDeviceSettings::~SWGSatelliteDeviceSettings() { void SWGSatelliteDeviceSettings::init() { - device_set = new QString(""); - m_device_set_isSet = false; + device_set_index = 0; + m_device_set_index_isSet = false; preset_group = new QString(""); m_preset_group_isSet = false; preset_frequency = 0L; m_preset_frequency_isSet = false; preset_description = new QString(""); m_preset_description_isSet = false; - doppler = new QList(); + doppler = new QList(); m_doppler_isSet = false; start_on_aos = 0; m_start_on_aos_isSet = false; @@ -84,9 +84,7 @@ SWGSatelliteDeviceSettings::init() { void SWGSatelliteDeviceSettings::cleanup() { - if(device_set != nullptr) { - delete device_set; - } + if(preset_group != nullptr) { delete preset_group; } @@ -94,7 +92,13 @@ SWGSatelliteDeviceSettings::cleanup() { if(preset_description != nullptr) { delete preset_description; } - + if(doppler != nullptr) { + auto arr = doppler; + for(auto o: *arr) { + delete o; + } + delete doppler; + } @@ -118,7 +122,7 @@ SWGSatelliteDeviceSettings::fromJson(QString &json) { void SWGSatelliteDeviceSettings::fromJsonObject(QJsonObject &pJson) { - ::SWGSDRangel::setValue(&device_set, pJson["deviceSet"], "QString", "QString"); + ::SWGSDRangel::setValue(&device_set_index, pJson["deviceSetIndex"], "qint32", ""); ::SWGSDRangel::setValue(&preset_group, pJson["presetGroup"], "QString", "QString"); @@ -127,7 +131,7 @@ SWGSatelliteDeviceSettings::fromJsonObject(QJsonObject &pJson) { ::SWGSDRangel::setValue(&preset_description, pJson["presetDescription"], "QString", "QString"); - ::SWGSDRangel::setValue(&doppler, pJson["doppler"], "QList", "qint32"); + ::SWGSDRangel::setValue(&doppler, pJson["doppler"], "QList", "QString"); ::SWGSDRangel::setValue(&start_on_aos, pJson["startOnAOS"], "qint32", ""); ::SWGSDRangel::setValue(&stop_on_los, pJson["stopOnLOS"], "qint32", ""); @@ -156,8 +160,8 @@ SWGSatelliteDeviceSettings::asJson () QJsonObject* SWGSatelliteDeviceSettings::asJsonObject() { QJsonObject* obj = new QJsonObject(); - if(device_set != nullptr && *device_set != QString("")){ - toJsonValue(QString("deviceSet"), device_set, obj, QString("QString")); + if(m_device_set_index_isSet){ + obj->insert("deviceSetIndex", QJsonValue(device_set_index)); } if(preset_group != nullptr && *preset_group != QString("")){ toJsonValue(QString("presetGroup"), preset_group, obj, QString("QString")); @@ -169,7 +173,7 @@ SWGSatelliteDeviceSettings::asJsonObject() { toJsonValue(QString("presetDescription"), preset_description, obj, QString("QString")); } if(doppler && doppler->size() > 0){ - toJsonArray((QList*)doppler, obj, "doppler", ""); + toJsonArray((QList*)doppler, obj, "doppler", "QString"); } if(m_start_on_aos_isSet){ obj->insert("startOnAOS", QJsonValue(start_on_aos)); @@ -193,14 +197,14 @@ SWGSatelliteDeviceSettings::asJsonObject() { return obj; } -QString* -SWGSatelliteDeviceSettings::getDeviceSet() { - return device_set; +qint32 +SWGSatelliteDeviceSettings::getDeviceSetIndex() { + return device_set_index; } void -SWGSatelliteDeviceSettings::setDeviceSet(QString* device_set) { - this->device_set = device_set; - this->m_device_set_isSet = true; +SWGSatelliteDeviceSettings::setDeviceSetIndex(qint32 device_set_index) { + this->device_set_index = device_set_index; + this->m_device_set_index_isSet = true; } QString* @@ -233,12 +237,12 @@ SWGSatelliteDeviceSettings::setPresetDescription(QString* preset_description) { this->m_preset_description_isSet = true; } -QList* +QList* SWGSatelliteDeviceSettings::getDoppler() { return doppler; } void -SWGSatelliteDeviceSettings::setDoppler(QList* doppler) { +SWGSatelliteDeviceSettings::setDoppler(QList* doppler) { this->doppler = doppler; this->m_doppler_isSet = true; } @@ -308,7 +312,7 @@ bool SWGSatelliteDeviceSettings::isSet(){ bool isObjectUpdated = false; do{ - if(device_set && *device_set != QString("")){ + if(m_device_set_index_isSet){ isObjectUpdated = true; break; } if(preset_group && *preset_group != QString("")){ @@ -320,9 +324,6 @@ SWGSatelliteDeviceSettings::isSet(){ if(preset_description && *preset_description != QString("")){ isObjectUpdated = true; break; } - if(m_doppler_isSet){ - isObjectUpdated = true; break; - } if(doppler && (doppler->size() > 0)){ isObjectUpdated = true; break; } diff --git a/swagger/sdrangel/code/qt5/client/SWGSatelliteDeviceSettings.h b/swagger/sdrangel/code/qt5/client/SWGSatelliteDeviceSettings.h index cb287ef44..96c0475a5 100644 --- a/swagger/sdrangel/code/qt5/client/SWGSatelliteDeviceSettings.h +++ b/swagger/sdrangel/code/qt5/client/SWGSatelliteDeviceSettings.h @@ -43,8 +43,8 @@ public: virtual void fromJsonObject(QJsonObject &json) override; virtual SWGSatelliteDeviceSettings* fromJson(QString &jsonString) override; - QString* getDeviceSet(); - void setDeviceSet(QString* device_set); + qint32 getDeviceSetIndex(); + void setDeviceSetIndex(qint32 device_set_index); QString* getPresetGroup(); void setPresetGroup(QString* preset_group); @@ -55,8 +55,8 @@ public: QString* getPresetDescription(); void setPresetDescription(QString* preset_description); - QList* getDoppler(); - void setDoppler(QList* doppler); + QList* getDoppler(); + void setDoppler(QList* doppler); qint32 getStartOnAos(); void setStartOnAos(qint32 start_on_aos); @@ -80,8 +80,8 @@ public: virtual bool isSet() override; private: - QString* device_set; - bool m_device_set_isSet; + qint32 device_set_index; + bool m_device_set_index_isSet; QString* preset_group; bool m_preset_group_isSet; @@ -92,7 +92,7 @@ private: QString* preset_description; bool m_preset_description_isSet; - QList* doppler; + QList* doppler; bool m_doppler_isSet; qint32 start_on_aos;