1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2026-06-02 06:04:39 -04:00

REST API: config: GET (2) presets channels and devices loop

This commit is contained in:
f4exb
2019-08-01 08:49:35 +02:00
parent 233a84c2b3
commit b95fa98e5a
13 changed files with 92 additions and 147 deletions
+21 -3
View File
@@ -46,9 +46,27 @@ void WebAPIAdapterBase::webapiFormatPreset(
apiPreset->setGroup(new QString(preset.m_group));
apiPreset->setDescription(new QString(preset.m_description));
apiPreset->setCenterFrequency(preset.m_centerFrequency);
apiPreset->getMSpectrumConfig()->init(); // TODO when spectrum config is extracted to sdrbase
apiPreset->getSpectrumConfig()->init(); // TODO when spectrum config is extracted to sdrbase
apiPreset->setDcOffsetCorrection(preset.m_dcOffsetCorrection ? 1 : 0);
apiPreset->setIqImbalanceCorrection(preset.m_iqImbalanceCorrection ? 1 : 0);
// TODO: channel configs
// TODO: device configs
int nbChannels = preset.getChannelCount();
for (int i = 0; i < nbChannels; i++)
{
const Preset::ChannelConfig& channelConfig = preset.getChannelConfig(i);
QList<SWGSDRangel::SWGChannelConfig *> *swgChannelConfigs = apiPreset->getChannelConfigs();
swgChannelConfigs->append(new SWGSDRangel::SWGChannelConfig);
swgChannelConfigs->back()->setChannelIdUri(new QString(channelConfig.m_channelIdURI));
}
int nbDevices = preset.getDeviceCount();
for (int i = 0; i < nbDevices; i++)
{
const Preset::DeviceConfig& deviceConfig = preset.getDeviceConfig(i);
QList<SWGSDRangel::SWGDeviceConfig *> *swgdeviceConfigs = apiPreset->getDeviceConfigs();
swgdeviceConfigs->append(new SWGSDRangel::SWGDeviceConfig);
swgdeviceConfigs->back()->setDeviceId(new QString(deviceConfig.m_deviceId));
swgdeviceConfigs->back()->setDeviceSerial(new QString(deviceConfig.m_deviceSerial));
swgdeviceConfigs->back()->setDeviceSequence(deviceConfig.m_deviceSequence);
}
}