USRP Hardware Driver and USRP Manual  Version: 003.010.002.HEAD-0-gbd6e21dc
UHD and USRP Manual
sensors.hpp
Go to the documentation of this file.
1 //
2 // Copyright 2011 Ettus Research LLC
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, either 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 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/>.
16 //
17 
18 #ifndef INCLUDED_UHD_TYPES_SENSORS_HPP
19 #define INCLUDED_UHD_TYPES_SENSORS_HPP
20 
21 #include <uhd/config.hpp>
22 #include <string>
23 
24 namespace uhd{
25 
39 
48  const std::string &name,
49  bool value,
50  const std::string &utrue,
51  const std::string &ufalse
52  );
53 
61  sensor_value_t(
62  const std::string &name,
63  signed value,
64  const std::string &unit,
65  const std::string &formatter = "%d"
66  );
67 
75  sensor_value_t(
76  const std::string &name,
77  double value,
78  const std::string &unit,
79  const std::string &formatter = "%f"
80  );
81 
88  sensor_value_t(
89  const std::string &name,
90  const std::string &value,
91  const std::string &unit
92  );
93 
98  sensor_value_t(const sensor_value_t& source);
99 
101  bool to_bool(void) const;
102 
104  signed to_int(void) const;
105 
107  double to_real(void) const;
108 
110  std::string name;
111 
117  std::string value;
118 
124  std::string unit;
125 
127  enum data_type_t {
128  BOOLEAN = 'b',
129  INTEGER = 'i',
130  REALNUM = 'r',
131  STRING = 's'
132  };
133 
136 
138  std::string to_pp_string(void) const;
139 
141  sensor_value_t& operator=(const sensor_value_t& value);
142  };
143 
144 } //namespace uhd
145 
146 #endif /* INCLUDED_UHD_TYPES_SENSORS_HPP */
std::string value
Definition: sensors.hpp:117
data_type_t
Enumeration of possible data types in a sensor.
Definition: sensors.hpp:127
std::string name
The name of the sensor value.
Definition: sensors.hpp:110
Definition: build_info.hpp:25
Definition: sensors.hpp:38
#define UHD_API
Definition: config.h:73
std::string unit
Definition: sensors.hpp:124
data_type_t type
The data type of the value.
Definition: sensors.hpp:135