USRP Hardware Driver and USRP Manual  Version: 4.6.0.0
UHD and USRP Manual
sensors.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2011 Ettus Research LLC
3 // Copyright 2018 Ettus Research, a National Instruments Company
4 //
5 // SPDX-License-Identifier: GPL-3.0-or-later
6 //
7 
8 #pragma once
9 
10 #include <uhd/config.hpp>
11 #include <map>
12 #include <string>
13 
14 namespace uhd {
15 
29 {
30  typedef std::map<std::string, std::string> sensor_map_t;
31 
39  sensor_value_t(const std::string& name,
40  bool value,
41  const std::string& utrue,
42  const std::string& ufalse);
43 
51  sensor_value_t(const std::string& name,
52  signed value,
53  const std::string& unit,
54  const std::string& formatter = "%d");
55 
63  sensor_value_t(const std::string& name,
64  double value,
65  const std::string& unit,
66  const std::string& formatter = "%f");
67 
75  const std::string& name, const std::string& value, const std::string& unit);
76 
85  sensor_value_t(const std::map<std::string, std::string>& sensor_dict);
86 
92 
94  bool to_bool(void) const;
95 
97  signed to_int(void) const;
98 
100  double to_real(void) const;
101 
103  sensor_map_t to_map(void) const;
104 
106  std::string name;
107 
113  std::string value;
114 
120  std::string unit;
121 
123  enum data_type_t { BOOLEAN = 'b', INTEGER = 'i', REALNUM = 'r', STRING = 's' };
124 
127 
129  std::string to_pp_string(void) const;
130 
132  sensor_value_t& operator=(const sensor_value_t& value);
133 };
134 
135 } // namespace uhd
std::string value
Definition: sensors.hpp:113
data_type_t
Enumeration of possible data types in a sensor.
Definition: sensors.hpp:123
std::string name
The name of the sensor value.
Definition: sensors.hpp:106
Definition: build_info.hpp:12
Definition: sensors.hpp:28
source
Identify the source of calibration data, i.e., where was it stored.
Definition: database.hpp:23
#define UHD_API
Definition: config.h:87
std::map< std::string, std::string > sensor_map_t
Definition: sensors.hpp:30
std::string unit
Definition: sensors.hpp:120
data_type_t type
The data type of the value.
Definition: sensors.hpp:126