diff --git a/devices/soapysdr/CMakeLists.txt b/devices/soapysdr/CMakeLists.txt
index c410e6ee2..55ef5369b 100644
--- a/devices/soapysdr/CMakeLists.txt
+++ b/devices/soapysdr/CMakeLists.txt
@@ -6,12 +6,14 @@ set(soapysdrdevice_SOURCES
devicesoapysdr.cpp
devicesoapysdrscan.cpp
devicesoapysdrshared.cpp
+ devicesoapysdrparams.cpp
)
set(soapysdrdevice_HEADERS
devicesoapysdr.h
devicesoapysdrscan.h
devicesoapysdrshared.h
+ devicesoapysdrparams.h
)
if (BUILD_DEBIAN)
diff --git a/devices/soapysdr/devicesoapysdrparams.cpp b/devices/soapysdr/devicesoapysdrparams.cpp
new file mode 100644
index 000000000..482567b30
--- /dev/null
+++ b/devices/soapysdr/devicesoapysdrparams.cpp
@@ -0,0 +1,87 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2018 Edouard Griffiths, F4EXB //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#include "devicesoapysdrparams.h"
+
+DeviceSoapySDRParams::DeviceSoapySDRParams(SoapySDR::Device *device) :
+ m_device(device)
+{
+ fillParams();
+}
+
+DeviceSoapySDRParams::~DeviceSoapySDRParams()
+{}
+
+void DeviceSoapySDRParams::fillParams()
+{
+ m_deviceSettingsArgs = m_device->getSettingInfo();
+ m_nbRx = m_device->getNumChannels(SOAPY_SDR_RX);
+ m_nbTx = m_device->getNumChannels(SOAPY_SDR_TX);
+
+ for (unsigned int ichan = 0; ichan < m_nbRx; ichan++) {
+ fillChannelParams(m_RxChannelsSettings, SOAPY_SDR_RX, ichan);
+ }
+
+ for (unsigned int ichan = 0; ichan < m_nbTx; ichan++) {
+ fillChannelParams(m_TxChannelsSettings, SOAPY_SDR_TX, ichan);
+ }
+}
+
+void DeviceSoapySDRParams::fillChannelParams(std::vector& channelSettings, int direction, unsigned int ichan)
+{
+ channelSettings.push_back(ChannelSetting());
+
+ channelSettings.back().m_streamSettingsArgs = m_device->getStreamArgsInfo(direction, ichan);
+ channelSettings.back().m_antennas = m_device->listAntennas(direction, ichan);
+ channelSettings.back().m_hasDCAutoCorrection = m_device->hasDCOffsetMode(direction, ichan);
+ channelSettings.back().m_hasDCOffsetValue = m_device->hasDCOffset(direction, ichan);
+ channelSettings.back().m_hasIQBalanceValue = m_device->hasIQBalance(direction, ichan);
+ channelSettings.back().m_hasFrequencyCorrectionValue = m_device->hasFrequencyCorrection(direction, ichan);
+
+ // gains
+
+ channelSettings.back().m_hasAGC = m_device->hasGainMode(direction, ichan);
+ channelSettings.back().m_gainRange = m_device->getGainRange(direction, ichan);
+ std::vector gainsList = m_device->listGains(direction, ichan);
+
+ for (const auto &it : gainsList)
+ {
+ channelSettings.back().m_gainSettings.push_back(GainSetting());
+ channelSettings.back().m_gainSettings.back().m_name = it;
+ channelSettings.back().m_gainSettings.back().m_range = m_device->getGainRange(direction, ichan, it);
+ }
+
+ // frequencies
+
+ std::vector freqsList = m_device->listFrequencies(direction, ichan);
+
+ for (const auto &it : freqsList)
+ {
+ channelSettings.back().m_frequencySettings.push_back(FrequencySetting());
+ channelSettings.back().m_frequencySettings.back().m_name = it;
+ channelSettings.back().m_frequencySettings.back().m_ranges = m_device->getFrequencyRange(direction, ichan, it);
+ }
+
+ channelSettings.back().m_frequencySettingsArgs = m_device->getFrequencyArgsInfo(direction, ichan);
+
+ // sample rates
+
+ channelSettings.back().m_ratesRanges = m_device->getSampleRateRange(direction, ichan);
+
+ // bandwidths
+
+ channelSettings.back().m_bandwidthsRanges = m_device->getBandwidthRange(direction, ichan);
+}
diff --git a/devices/soapysdr/devicesoapysdrparams.h b/devices/soapysdr/devicesoapysdrparams.h
new file mode 100644
index 000000000..447736ac8
--- /dev/null
+++ b/devices/soapysdr/devicesoapysdrparams.h
@@ -0,0 +1,80 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2018 Edouard Griffiths, F4EXB //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef DEVICES_SOAPYSDR_DEVICESOAPYSDRPARAMS_H_
+#define DEVICES_SOAPYSDR_DEVICESOAPYSDRPARAMS_H_
+
+#include
+#include
+
+#include "export.h"
+
+/**
+ * This structure refers to one physical device shared among parties (logical devices represented by
+ * the DeviceSinkAPI or DeviceSourceAPI).
+ * It allows storing information on the common resources in one place and is shared among participants.
+ * There is only one copy that is constructed by the first participant and destroyed by the last.
+ * A participant knows it is the first or last by checking the lists of buddies (Rx + Tx).
+ */
+
+class DEVICES_API DeviceSoapySDRParams
+{
+public:
+ struct GainSetting
+ {
+ std::string m_name; //!< Name of the gain element
+ SoapySDR::Range m_range; //!< Gain range
+ };
+
+ struct FrequencySetting
+ {
+ std::string m_name; //!< Name of the tunable element
+ SoapySDR::RangeList m_ranges; //!< List of ranges of the tunable element
+ };
+
+ struct ChannelSetting
+ {
+ SoapySDR::ArgInfoList m_streamSettingsArgs; //!< common stream parameters
+ bool m_hasDCAutoCorrection; //!< DC offset auto correction flag
+ bool m_hasDCOffsetValue; //!< DC offset value flag
+ bool m_hasIQBalanceValue; //!< IQ correction value flag
+ bool m_hasFrequencyCorrectionValue; //!< Frequency correction value flag
+ std::vector m_antennas; //!< Antenna ports names
+ bool m_hasAGC; //!< AGC flag
+ SoapySDR::Range m_gainRange; //!< Global gain range
+ std::vector m_gainSettings; //!< gain elements settings
+ std::vector m_frequencySettings; //!< tunable elements settings
+ SoapySDR::ArgInfoList m_frequencySettingsArgs; //!< common tuning parameters
+ SoapySDR::RangeList m_ratesRanges; //!< list of ranges of sample rates
+ SoapySDR::RangeList m_bandwidthsRanges; //!< list of ranges of bandwidths
+ };
+
+ DeviceSoapySDRParams(SoapySDR::Device *device);
+ ~DeviceSoapySDRParams();
+
+private:
+ void fillParams();
+ void fillChannelParams(std::vector& channelSettings, int direction, unsigned int ichan);
+ SoapySDR::Device *m_device;
+ SoapySDR::ArgInfoList m_deviceSettingsArgs; //!< list (vector) of device settings arguments
+ uint32_t m_nbRx; //!< number of Rx channels
+ uint32_t m_nbTx; //!< number of Tx channels
+ std::vector m_RxChannelsSettings;
+ std::vector m_TxChannelsSettings;
+};
+
+
+#endif /* DEVICES_SOAPYSDR_DEVICESOAPYSDRPARAMS_H_ */