USRP Hardware Driver and USRP Manual  Version: 003.009.007-0-g50839059
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 
95  bool to_bool(void) const;
96 
98  signed to_int(void) const;
99 
101  double to_real(void) const;
102 
104  const std::string name;
105 
111  const std::string value;
112 
118  const std::string unit;
119 
121  enum data_type_t {
122  BOOLEAN = 'b',
123  INTEGER = 'i',
124  REALNUM = 'r',
125  STRING = 's'
126  };
127 
130 
132  std::string to_pp_string(void) const;
133  };
134 
135 } //namespace uhd
136 
137 #endif /* INCLUDED_UHD_TYPES_SENSORS_HPP */
data_type_t
Enumeration of possible data types in a sensor.
Definition: sensors.hpp:121
Definition: convert.hpp:28
const std::string unit
Definition: sensors.hpp:118
Definition: sensors.hpp:38
#define UHD_API
Definition: config.h:66
const data_type_t type
The data type of the value.
Definition: sensors.hpp:129
const std::string name
The name of the sensor value.
Definition: sensors.hpp:104
const std::string value
Definition: sensors.hpp:111