USRP Hardware Driver and USRP Manual  Version: 003.010.002.HEAD-0-gbd6e21dc
UHD and USRP Manual
sensors.h
Go to the documentation of this file.
1 //
2 // Copyright 2015 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_H
19 #define INCLUDED_UHD_TYPES_SENSORS_H
20 
21 #include <uhd/config.h>
22 #include <uhd/error.h>
23 
24 #ifdef __cplusplus
25 #include <uhd/types/sensors.hpp>
26 #include <string>
27 
28 struct uhd_sensor_value_t {
29  // No default constructor, so we need a pointer
30  uhd::sensor_value_t* sensor_value_cpp;
31  std::string last_error;
32 };
33 extern "C" {
34 #else
35 struct uhd_sensor_value_t;
36 #endif
37 
39 
44 typedef struct uhd_sensor_value_t* uhd_sensor_value_handle;
45 
47 typedef enum {
53 
55 
64  uhd_sensor_value_handle* h,
65  const char* name,
66  bool value,
67  const char* utrue,
68  const char* ufalse
69 );
70 
72 
81  uhd_sensor_value_handle* h,
82  const char* name,
83  int value,
84  const char* unit,
85  const char* formatter
86 );
87 
89 
98  uhd_sensor_value_handle* h,
99  const char* name,
100  double value,
101  const char* unit,
102  const char* formatter
103 );
104 
106 
114  uhd_sensor_value_handle* h,
115  const char* name,
116  const char* value,
117  const char* unit
118 );
119 
121 
126  uhd_sensor_value_handle* h
127 );
128 
131  uhd_sensor_value_handle h,
132  bool *value_out
133 );
134 
137  uhd_sensor_value_handle h,
138  int *value_out
139 );
140 
143  uhd_sensor_value_handle h,
144  double *value_out
145 );
146 
148 
157  uhd_sensor_value_handle h,
158  char* name_out,
159  size_t strbuffer_len
160 );
161 
163 
172  uhd_sensor_value_handle h,
173  char* value_out,
174  size_t strbuffer_len
175 );
176 
178 
187  uhd_sensor_value_handle h,
188  char* unit_out,
189  size_t strbuffer_len
190 );
191 
193  uhd_sensor_value_handle h,
194  uhd_sensor_value_data_type_t *data_type_out
195 );
196 
198 
207  uhd_sensor_value_handle h,
208  char* pp_string_out,
209  size_t strbuffer_len
210 );
211 
213 
222  uhd_sensor_value_handle h,
223  char* error_out,
224  size_t strbuffer_len
225 );
226 
227 #ifdef __cplusplus
228 }
229 #endif
230 
231 #endif /* INCLUDED_UHD_TYPES_SENSORS_H */
UHD_API uhd_error uhd_sensor_value_to_realnum(uhd_sensor_value_handle h, double *value_out)
Get the sensor&#39;s value as a real number.
UHD_API uhd_error uhd_sensor_value_make_from_int(uhd_sensor_value_handle *h, const char *name, int value, const char *unit, const char *formatter)
Make a UHD sensor from an integer.
UHD_API uhd_error uhd_sensor_value_last_error(uhd_sensor_value_handle h, char *error_out, size_t strbuffer_len)
Get the last error logged by the sensor handle.
Definition: sensors.h:51
UHD_API uhd_error uhd_sensor_value_unit(uhd_sensor_value_handle h, char *unit_out, size_t strbuffer_len)
Get the sensor&#39;s unit.
UHD_API uhd_error uhd_sensor_value_value(uhd_sensor_value_handle h, char *value_out, size_t strbuffer_len)
Get the sensor&#39;s value.
UHD_API uhd_error uhd_sensor_value_make_from_string(uhd_sensor_value_handle *h, const char *name, const char *value, const char *unit)
Make a UHD sensor from a string.
Definition: sensors.h:50
UHD_API uhd_error uhd_sensor_value_free(uhd_sensor_value_handle *h)
Free the given sensor handle.
UHD_API uhd_error uhd_sensor_value_make_from_bool(uhd_sensor_value_handle *h, const char *name, bool value, const char *utrue, const char *ufalse)
Make a UHD sensor from a boolean.
uhd_sensor_value_data_type_t
Sensor value types.
Definition: sensors.h:47
UHD_API uhd_error uhd_sensor_value_data_type(uhd_sensor_value_handle h, uhd_sensor_value_data_type_t *data_type_out)
uhd_error
UHD error codes.
Definition: error.h:31
Definition: sensors.hpp:38
Definition: sensors.h:48
UHD_API uhd_error uhd_sensor_value_to_pp_string(uhd_sensor_value_handle h, char *pp_string_out, size_t strbuffer_len)
Get a pretty-print representation of the given sensor.
#define UHD_API
Definition: config.h:73
UHD_API uhd_error uhd_sensor_value_make_from_realnum(uhd_sensor_value_handle *h, const char *name, double value, const char *unit, const char *formatter)
Make a UHD sensor from a real number.
struct uhd_sensor_value_t * uhd_sensor_value_handle
C-level interface for a UHD sensor.
Definition: sensors.h:44
Definition: sensors.h:49
UHD_API uhd_error uhd_sensor_value_name(uhd_sensor_value_handle h, char *name_out, size_t strbuffer_len)
Get the sensor&#39;s name.
UHD_API uhd_error uhd_sensor_value_to_int(uhd_sensor_value_handle h, int *value_out)
Get the sensor&#39;s value as an integer.
UHD_API uhd_error uhd_sensor_value_to_bool(uhd_sensor_value_handle h, bool *value_out)
Get the sensor&#39;s value as a boolean.