SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
devicesoapysdrparams.h
Go to the documentation of this file.
1 // Copyright (C) 2018 Edouard Griffiths, F4EXB //
3 // //
4 // This program is free software; you can redistribute it and/or modify //
5 // it under the terms of the GNU General Public License as published by //
6 // the Free Software Foundation as version 3 of the License, or //
7 // (at your option) any later version. //
8 // //
9 // This program is distributed in the hope that it will be useful, //
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
12 // GNU General Public License V3 for more details. //
13 // //
14 // You should have received a copy of the GNU General Public License //
15 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
17 
18 #ifndef DEVICES_SOAPYSDR_DEVICESOAPYSDRPARAMS_H_
19 #define DEVICES_SOAPYSDR_DEVICESOAPYSDRPARAMS_H_
20 
21 #include <stdint.h>
22 #include <string>
23 #include <vector>
24 
25 #include <SoapySDR/Device.hpp>
26 
27 #include "export.h"
28 
38 {
39 public:
40  struct GainSetting
41  {
42  std::string m_name;
43  SoapySDR::Range m_range;
44  };
45 
47  {
48  std::string m_name;
49  SoapySDR::RangeList m_ranges;
50  };
51 
53  {
54  SoapySDR::ArgInfoList m_streamSettingsArgs;
59  std::vector<std::string> m_antennas;
60  bool m_hasAGC;
61  SoapySDR::Range m_gainRange;
62  std::vector<GainSetting> m_gainSettings;
63  std::vector<FrequencySetting> m_frequencySettings;
64  SoapySDR::ArgInfoList m_frequencySettingsArgs;
65  SoapySDR::RangeList m_ratesRanges;
66  SoapySDR::RangeList m_bandwidthsRanges;
67  };
68 
69  DeviceSoapySDRParams(SoapySDR::Device *device);
71 
72  const SoapySDR::ArgInfoList& getDeviceArgs() const { return m_deviceSettingsArgs; }
73 
75  {
76  if (index < m_nbRx) {
77  return &m_RxChannelsSettings[index];
78  } else {
79  return 0;
80  }
81  }
82 
84  {
85  if (index < m_nbTx) {
86  return &m_TxChannelsSettings[index];
87  } else {
88  return 0;
89  }
90  }
91 
92  std::string getRxChannelMainTunableElementName(uint32_t index);
93  std::string getTxChannelMainTunableElementName(uint32_t index);
94 
95 private:
96  void fillParams();
97  void fillChannelParams(std::vector<ChannelSettings>& channelSettings, int direction, unsigned int ichan);
98  void printParams();
99  void printChannelParams(const ChannelSettings& channelSetting);
100 
101  // Printing functions copied from SoapySDR's SoapySDRProbe.cpp
102  std::string argInfoToString(const SoapySDR::ArgInfo &argInfo, const std::string indent = " ");
103  std::string argInfoListToString(const SoapySDR::ArgInfoList &argInfos);
104  std::string rangeToString(const SoapySDR::Range &range);
105  std::string rangeListToString(const SoapySDR::RangeList &range, const double scale);
106 
107  template <typename Type>
108  std::string vectorToString(const std::vector<Type> &options)
109  {
110  std::stringstream ss;
111 
112  if (options.empty()) {
113  return "";
114  }
115 
116  for (std::size_t i = 0; i < options.size(); i++)
117  {
118  if (not ss.str().empty()) {
119  ss << ", ";
120  }
121 
122  ss << options[i];
123  }
124 
125  return ss.str();
126  }
127 
128  SoapySDR::Device *m_device;
129  SoapySDR::ArgInfoList m_deviceSettingsArgs;
132  std::vector<ChannelSettings> m_RxChannelsSettings;
133  std::vector<ChannelSettings> m_TxChannelsSettings;
134 };
135 
136 
137 #endif /* DEVICES_SOAPYSDR_DEVICESOAPYSDRPARAMS_H_ */
SoapySDR::Device * m_device
std::vector< ChannelSettings > m_RxChannelsSettings
uint32_t m_nbRx
number of Rx channels
SoapySDR::ArgInfoList m_deviceSettingsArgs
list (vector) of device settings arguments
SoapySDR::ArgInfoList m_frequencySettingsArgs
common tuning parameters
bool m_hasFrequencyCorrectionValue
Frequency correction value flag.
bool m_hasDCOffsetValue
DC offset value flag.
uint32_t m_nbTx
number of Tx channels
bool m_hasDCAutoCorrection
DC offset auto correction flag.
std::vector< ChannelSettings > m_TxChannelsSettings
std::vector< FrequencySetting > m_frequencySettings
tunable elements settings
std::string m_name
Name of the gain element.
#define DEVICES_API
Definition: export.h:76
std::string m_name
Name of the tunable element.
unsigned int uint32_t
Definition: rtptypes_win.h:46
const ChannelSettings * getRxChannelSettings(uint32_t index)
SoapySDR::RangeList m_ranges
List of ranges of the tunable element.
std::vector< std::string > m_antennas
Antenna ports names.
SoapySDR::RangeList m_ratesRanges
list of ranges of sample rates
int32_t i
Definition: decimators.h:244
const SoapySDR::ArgInfoList & getDeviceArgs() const
SoapySDR::Range m_range
Gain range.
SoapySDR::RangeList m_bandwidthsRanges
list of ranges of bandwidths
const ChannelSettings * getTxChannelSettings(uint32_t index)
std::string vectorToString(const std::vector< Type > &options)
std::vector< GainSetting > m_gainSettings
gain elements settings
SoapySDR::ArgInfoList m_streamSettingsArgs
common stream parameters
bool m_hasIQBalanceValue
IQ correction value flag.
SoapySDR::Range m_gainRange
Global gain range.