mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-22 08:04:49 -05:00
Merge pull request #959 from srcejon/fix_953
Fix handling of Satellite Tracker device settings
This commit is contained in:
commit
6089f0aa42
@ -210,4 +210,4 @@ And how to set the target:
|
||||
|
||||
Or, to set the device settings:
|
||||
|
||||
curl -X PATCH "http://127.0.0.1:8091/sdrangel/featureset/0/feature/0/settings" -d '{"featureType": "SatelliteTracker", "SatelliteTrackerSettings": { "deviceSettings": [ { "satellite": "ISS", "deviceSettings": [ { "deviceSet": "R0", "doppler": [1], "frequency": 0, "presetDescription": Sat", "presetFrequency": 145.825, "presetGroup": "ISS Digi", "startOnAOS": 1, "startStopFileSinks": 1, "stopOnLOS": 1}] } ] }}'
|
||||
curl -X PATCH "http://127.0.0.1:8091/sdrangel/featureset/0/feature/0/settings" -d '{"featureType": "SatelliteTracker", "SatelliteTrackerSettings": { "deviceSettings": [ { "satellite": "ISS", "deviceSettings": [ { "deviceSet": "R0", "doppler": [0], "frequency": 0, "presetDescription": Sat", "presetFrequency": 145.825, "presetGroup": "ISS Digi", "startOnAOS": 1, "startStopFileSinks": 1, "stopOnLOS": 1}] } ] }}'
|
||||
|
@ -94,7 +94,14 @@ SatelliteDeviceSettingsGUI::SatelliteDeviceSettingsGUI(SatelliteTrackerSettings:
|
||||
addChannels();
|
||||
|
||||
for (int i = 0; i < devSettings->m_doppler.size(); i++)
|
||||
m_dopplerItems[devSettings->m_doppler[i]]->setData(Qt::Checked, Qt::CheckStateRole);
|
||||
{
|
||||
int idx = devSettings->m_doppler[i];
|
||||
if (idx < m_dopplerItems.size()) {
|
||||
m_dopplerItems[idx]->setData(Qt::Checked, Qt::CheckStateRole);
|
||||
} else {
|
||||
qDebug() << "SatelliteDeviceSettingsGUI - Doppler index " << idx << " out of range: " << m_dopplerItems.size();
|
||||
}
|
||||
}
|
||||
|
||||
// Start on AOS
|
||||
m_startOnAOSWidget = new QCheckBox();
|
||||
|
@ -431,6 +431,16 @@ QList<SWGSDRangel::SWGSatelliteDeviceSettingsList*>* SatelliteTracker::getSWGSat
|
||||
return deviceSettingsList;
|
||||
}
|
||||
|
||||
// Dereference a potentionally null string
|
||||
static QString getString(QString *sp)
|
||||
{
|
||||
QString s;
|
||||
if (sp != nullptr) {
|
||||
s = *sp;
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
// Convert Swagger device settings to struct SatelliteDeviceSettings
|
||||
QHash<QString, QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *> SatelliteTracker::getSatelliteDeviceSettings(QList<SWGSDRangel::SWGSatelliteDeviceSettingsList*>* list)
|
||||
{
|
||||
@ -449,17 +459,19 @@ QHash<QString, QList<SatelliteTrackerSettings::SatelliteDeviceSettings *> *> Sat
|
||||
for (int j = 0; j < swgDeviceSettingsList->size(); j++)
|
||||
{
|
||||
SatelliteTrackerSettings::SatelliteDeviceSettings *deviceSettings = new SatelliteTrackerSettings::SatelliteDeviceSettings();
|
||||
deviceSettings->m_deviceSet = *swgDeviceSettingsList->at(j)->getDeviceSet();
|
||||
deviceSettings->m_presetGroup = *swgDeviceSettingsList->at(j)->getPresetGroup();
|
||||
deviceSettings->m_deviceSet = getString(swgDeviceSettingsList->at(j)->getDeviceSet());
|
||||
deviceSettings->m_presetGroup = getString(swgDeviceSettingsList->at(j)->getPresetGroup());
|
||||
deviceSettings->m_presetFrequency = swgDeviceSettingsList->at(j)->getPresetFrequency();
|
||||
deviceSettings->m_presetDescription = *swgDeviceSettingsList->at(j)->getPresetDescription();
|
||||
deviceSettings->m_doppler = *swgDeviceSettingsList->at(j)->getDoppler();
|
||||
deviceSettings->m_presetDescription = getString(swgDeviceSettingsList->at(j)->getPresetDescription());
|
||||
if (swgDeviceSettingsList->at(j)->getDoppler()) {
|
||||
deviceSettings->m_doppler = *swgDeviceSettingsList->at(j)->getDoppler();
|
||||
}
|
||||
deviceSettings->m_startOnAOS = swgDeviceSettingsList->at(j)->getStartOnAos();
|
||||
deviceSettings->m_stopOnLOS = swgDeviceSettingsList->at(j)->getStopOnLos();
|
||||
deviceSettings->m_startStopFileSink = swgDeviceSettingsList->at(j)->getStartStopFileSinks();
|
||||
deviceSettings->m_frequency = swgDeviceSettingsList->at(j)->getFrequency();
|
||||
deviceSettings->m_aosCommand = *swgDeviceSettingsList->at(j)->getAosCommand();
|
||||
deviceSettings->m_losCommand = *swgDeviceSettingsList->at(j)->getLosCommand();
|
||||
deviceSettings->m_aosCommand = getString(swgDeviceSettingsList->at(j)->getAosCommand());
|
||||
deviceSettings->m_losCommand = getString(swgDeviceSettingsList->at(j)->getLosCommand());
|
||||
deviceSettingsList->append(deviceSettings);
|
||||
}
|
||||
hash.insert(satellite, deviceSettingsList);
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user