USRP Hardware Driver and USRP Manual  Version: 4.1.0.0-264-g3e5e4eb06
UHD and USRP Manual
sensors.h
Go to the documentation of this file.
1 //
2 // Copyright 2015 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 #pragma once
9 
10 #include <uhd/config.h>
11 #include <uhd/error.h>
12 
13 #ifdef __cplusplus
14 #include <uhd/types/sensors.hpp>
15 #include <string>
16 
17 struct uhd_sensor_value_t {
18  // No default constructor, so we need a pointer
19  uhd::sensor_value_t* sensor_value_cpp;
20  std::string last_error;
21 };
22 extern "C" {
23 #else
24 struct uhd_sensor_value_t;
25 #endif
26 
28 
33 typedef struct uhd_sensor_value_t* uhd_sensor_value_handle;
34 
36 typedef enum {
42 
44 
54  uhd_sensor_value_handle* h
55 );
56 
58 
67  uhd_sensor_value_handle* h,
68  const char* name,
69  bool value,
70  const char* utrue,
71  const char* ufalse
72 );
73 
75 
84  uhd_sensor_value_handle* h,
85  const char* name,
86  int value,
87  const char* unit,
88  const char* formatter
89 );
90 
92 
101  uhd_sensor_value_handle* h,
102  const char* name,
103  double value,
104  const char* unit,
105  const char* formatter
106 );
107 
109 
117  uhd_sensor_value_handle* h,
118  const char* name,
119  const char* value,
120  const char* unit
121 );
122 
124 
129  uhd_sensor_value_handle* h
130 );
131 
134  uhd_sensor_value_handle h,
135  bool *value_out
136 );
137 
140  uhd_sensor_value_handle h,
141  int *value_out
142 );
143 
146  uhd_sensor_value_handle h,
147  double *value_out
148 );
149 
151 
160  uhd_sensor_value_handle h,
161  char* name_out,
162  size_t strbuffer_len
163 );
164 
166 
175  uhd_sensor_value_handle h,
176  char* value_out,
177  size_t strbuffer_len
178 );
179 
181 
190  uhd_sensor_value_handle h,
191  char* unit_out,
192  size_t strbuffer_len
193 );
194 
196  uhd_sensor_value_handle h,
197  uhd_sensor_value_data_type_t *data_type_out
198 );
199 
201 
210  uhd_sensor_value_handle h,
211  char* pp_string_out,
212  size_t strbuffer_len
213 );
214 
216 
225  uhd_sensor_value_handle h,
226  char* error_out,
227  size_t strbuffer_len
228 );
229 
230 #ifdef __cplusplus
231 }
232 #endif
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:40
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:39
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:36
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:20
Definition: sensors.hpp:28
Definition: sensors.h:37
UHD_API uhd_error uhd_sensor_value_make(uhd_sensor_value_handle *h)
Make an empty UHD sensor value.
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:70
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:33
Definition: sensors.h:38
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.