USRP Hardware Driver and Device Manual Version: 4.11.0.0-0-unknown
UHD and USRP Manual
Loading...
Searching...
No Matches
pwr_cal.hpp
Go to the documentation of this file.
1//
2// Copyright 2020 Ettus Research, a National Instruments Brand
3//
4// SPDX-License-Identifier: GPL-3.0-or-later
5//
6
7#pragma once
8
10#include <uhd/config.hpp>
11#include <uhd/types/ranges.hpp>
12#include <boost/none.hpp>
13#include <boost/optional.hpp>
14#include <cstdint>
15#include <map>
16#include <memory>
17#include <optional>
18#include <string>
19
20namespace uhd { namespace usrp { namespace cal {
21
50{
51public:
52 using sptr = std::shared_ptr<pwr_cal>;
53
69 virtual void add_power_table(const std::map<double, double>& gain_power_map,
70 const double min_power,
71 const double max_power,
72 const double freq,
73 const std::optional<int> temperature = {}) = 0;
74
75 // Helper to resolve between the two optional methods
76 void add_power_table(const std::map<double, double>& gain_power_map,
77 const double min_power,
78 const double max_power,
79 const double freq,
80 const int temperature)
81 {
82 add_power_table(gain_power_map,
83 min_power,
84 max_power,
85 freq,
86 std::make_optional<int>(temperature));
87 }
88
89 [[deprecated("Prefer std::optional over boost::optional.")]] void add_power_table(
90 const std::map<double, double>& gain_power_map,
91 const double min_power,
92 const double max_power,
93 const double freq,
94 const boost::optional<int> temperature)
95 {
96 add_power_table(gain_power_map,
97 min_power,
98 max_power,
99 freq,
100 bool(temperature) ? std::make_optional<int>(*temperature) : std::nullopt);
101 }
102
103
109 virtual void clear() = 0;
110
119 virtual void set_temperature(const int temperature) = 0;
120
122 virtual int get_temperature() const = 0;
123
129 virtual void set_ref_gain(const double gain) = 0;
130
135 virtual double get_ref_gain() const = 0;
136
140 const double freq, const std::optional<int> temperature = {}) const = 0;
141
142 // Helper to resolve between the two optional methods
143 uhd::meta_range_t get_power_limits(const double freq, const int temperature) const
144 {
145 return get_power_limits(freq, std::make_optional<int>(temperature));
146 }
147
148 [[deprecated("Prefer std::optional over boost::optional.")]] uhd::meta_range_t
149 get_power_limits(const double freq, const boost::optional<int> temperature) const
150 {
151 return get_power_limits(freq,
152 bool(temperature) ? std::make_optional<int>(*temperature) : std::nullopt);
153 }
154
166 virtual double get_power(const double gain,
167 const double freq,
168 const std::optional<int> temperature = {}) const = 0;
169
170 double get_power(const double gain, const double freq, const int temperature) const
171 {
172 return get_power(gain, freq, std::make_optional<int>(temperature));
173 }
174
175 [[deprecated("Prefer std::optional over boost::optional.")]] double get_power(
176 const double gain,
177 const double freq,
178 const boost::optional<int> temperature) const
179 {
180 return get_power(gain,
181 freq,
182 bool(temperature) ? std::make_optional<int>(*temperature) : std::nullopt);
183 }
184
200 virtual double get_gain(const double power_dbm,
201 const double freq,
202 const std::optional<int> temperature = {}) const = 0;
203
204 double get_gain(
205 const double power_dbm, const double freq, const int temperature) const
206 {
207 return get_gain(power_dbm, freq, std::make_optional<int>(temperature));
208 }
209
210 [[deprecated("Prefer std::optional over boost::optional.")]] double get_gain(
211 const double power_dbm,
212 const double freq,
213 const boost::optional<int> temperature) const
214 {
215 return get_gain(power_dbm,
216 freq,
217 bool(temperature) ? std::make_optional<int>(*temperature) : std::nullopt);
218 }
219
221 static sptr make(
222 const std::string& name, const std::string& serial, const uint64_t timestamp);
223
225 static sptr make();
226};
227
228}}} // namespace uhd::usrp::cal
Definition container.hpp:23
Definition pwr_cal.hpp:50
static sptr make(const std::string &name, const std::string &serial, const uint64_t timestamp)
Factory for new cal data sets.
static sptr make()
Default factory.
virtual void set_ref_gain(const double gain)=0
virtual void set_temperature(const int temperature)=0
double get_power(const double gain, const double freq, const boost::optional< int > temperature) const
Definition pwr_cal.hpp:175
virtual int get_temperature() const =0
Return the current default temperature.
virtual double get_ref_gain() const =0
double get_gain(const double power_dbm, const double freq, const int temperature) const
Definition pwr_cal.hpp:204
virtual double get_power(const double gain, const double freq, const std::optional< int > temperature={}) const =0
virtual void clear()=0
virtual void add_power_table(const std::map< double, double > &gain_power_map, const double min_power, const double max_power, const double freq, const std::optional< int > temperature={})=0
uhd::meta_range_t get_power_limits(const double freq, const boost::optional< int > temperature) const
Definition pwr_cal.hpp:149
double get_gain(const double power_dbm, const double freq, const boost::optional< int > temperature) const
Definition pwr_cal.hpp:210
std::shared_ptr< pwr_cal > sptr
Definition pwr_cal.hpp:52
void add_power_table(const std::map< double, double > &gain_power_map, const double min_power, const double max_power, const double freq, const int temperature)
Definition pwr_cal.hpp:76
virtual uhd::meta_range_t get_power_limits(const double freq, const std::optional< int > temperature={}) const =0
uhd::meta_range_t get_power_limits(const double freq, const int temperature) const
Definition pwr_cal.hpp:143
void add_power_table(const std::map< double, double > &gain_power_map, const double min_power, const double max_power, const double freq, const boost::optional< int > temperature)
Definition pwr_cal.hpp:89
double get_power(const double gain, const double freq, const int temperature) const
Definition pwr_cal.hpp:170
virtual double get_gain(const double power_dbm, const double freq, const std::optional< int > temperature={}) const =0
#define UHD_API
Definition config.h:87
Definition cal_utils.hpp:11
Definition cal_utils.hpp:11
Definition build_info.hpp:12
Definition ranges.hpp:67