USRP Hardware Driver and USRP Manual  Version: 3.13.0.HEAD-0-gf114cfa0
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 #ifndef INCLUDED_UHD_TYPES_SENSORS_HPP
9 #define INCLUDED_UHD_TYPES_SENSORS_HPP
10 
11 #include <uhd/config.hpp>
12 #include <map>
13 #include <string>
14 
15 namespace uhd{
16 
30  typedef std::map<std::string, std::string> sensor_map_t;
31 
40  const std::string &name,
41  bool value,
42  const std::string &utrue,
43  const std::string &ufalse
44  );
45 
54  const std::string &name,
55  signed value,
56  const std::string &unit,
57  const std::string &formatter = "%d"
58  );
59 
68  const std::string &name,
69  double value,
70  const std::string &unit,
71  const std::string &formatter = "%f"
72  );
73 
81  const std::string &name,
82  const std::string &value,
83  const std::string &unit
84  );
85 
95  const std::map<std::string, std::string> &sensor_dict
96  );
97 
102  sensor_value_t(const sensor_value_t& source);
103 
105  bool to_bool(void) const;
106 
108  signed to_int(void) const;
109 
111  double to_real(void) const;
112 
114  sensor_map_t to_map(void) const;
115 
117  std::string name;
118 
124  std::string value;
125 
131  std::string unit;
132 
134  enum data_type_t {
135  BOOLEAN = 'b',
136  INTEGER = 'i',
137  REALNUM = 'r',
138  STRING = 's'
139  };
140 
143 
145  std::string to_pp_string(void) const;
146 
148  sensor_value_t& operator=(const sensor_value_t& value);
149  };
150 
151 } //namespace uhd
152 
153 #endif /* INCLUDED_UHD_TYPES_SENSORS_HPP */
std::string value
Definition: sensors.hpp:124
data_type_t
Enumeration of possible data types in a sensor.
Definition: sensors.hpp:134
std::string name
The name of the sensor value.
Definition: sensors.hpp:117
Definition: build_info.hpp:14
Definition: sensors.hpp:29
#define UHD_API
Definition: config.h:63
std::map< std::string, std::string > sensor_map_t
Definition: sensors.hpp:30
std::string unit
Definition: sensors.hpp:131
data_type_t type
The data type of the value.
Definition: sensors.hpp:142