USRP Hardware Driver and USRP Manual Version: 3.15.0.0-MacPorts-Release
UHD and USRP Manual
 
Loading...
Searching...
No Matches
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
15namespace uhd {
16
30{
31 typedef std::map<std::string, std::string> sensor_map_t;
32
40 sensor_value_t(const std::string& name,
41 bool value,
42 const std::string& utrue,
43 const std::string& ufalse);
44
52 sensor_value_t(const std::string& name,
53 signed value,
54 const std::string& unit,
55 const std::string& formatter = "%d");
56
64 sensor_value_t(const std::string& name,
65 double value,
66 const std::string& unit,
67 const std::string& formatter = "%f");
68
76 const std::string& name, const std::string& value, const std::string& unit);
77
86 sensor_value_t(const std::map<std::string, std::string>& sensor_dict);
87
93
95 bool to_bool(void) const;
96
98 signed to_int(void) const;
99
101 double to_real(void) const;
102
104 sensor_map_t to_map(void) const;
105
107 std::string name;
108
114 std::string value;
115
121 std::string unit;
122
124 enum data_type_t { BOOLEAN = 'b', INTEGER = 'i', REALNUM = 'r', STRING = 's' };
125
128
130 std::string to_pp_string(void) const;
131
134};
135
136} // namespace uhd
137
138#endif /* INCLUDED_UHD_TYPES_SENSORS_HPP */
#define UHD_API
Definition config.h:68
Definition build_info.hpp:13
Definition sensors.hpp:30
bool to_bool(void) const
convert the sensor value to a boolean
data_type_t
Enumeration of possible data types in a sensor.
Definition sensors.hpp:124
signed to_int(void) const
convert the sensor value to an integer
double to_real(void) const
convert the sensor value to real number
sensor_value_t(const std::string &name, signed value, const std::string &unit, const std::string &formatter="%d")
std::map< std::string, std::string > sensor_map_t
Definition sensors.hpp:31
sensor_value_t(const std::string &name, const std::string &value, const std::string &unit)
sensor_value_t(const std::string &name, bool value, const std::string &utrue, const std::string &ufalse)
std::string value
Definition sensors.hpp:114
sensor_value_t(const sensor_value_t &source)
sensor_map_t to_map(void) const
convert the sensor value to sensor_map_t
sensor_value_t(const std::string &name, double value, const std::string &unit, const std::string &formatter="%f")
sensor_value_t & operator=(const sensor_value_t &value)
Assignment operator for sensor value.
std::string name
The name of the sensor value.
Definition sensors.hpp:107
sensor_value_t(const std::map< std::string, std::string > &sensor_dict)
data_type_t type
The data type of the value.
Definition sensors.hpp:127
std::string to_pp_string(void) const
Convert this sensor value into a printable string.
std::string unit
Definition sensors.hpp:121