USRP Hardware Driver and USRP Manual Version: 3.15.0.0-MacPorts-Release
UHD and USRP Manual
 
Loading...
Searching...
No Matches
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#ifndef INCLUDED_UHD_TYPES_SENSORS_H
9#define INCLUDED_UHD_TYPES_SENSORS_H
10
11#include <uhd/config.h>
12#include <uhd/error.h>
13
14#ifdef __cplusplus
15#include <uhd/types/sensors.hpp>
16#include <string>
17
18struct uhd_sensor_value_t {
19 // No default constructor, so we need a pointer
20 uhd::sensor_value_t* sensor_value_cpp;
21 std::string last_error;
22};
23extern "C" {
24#else
25struct uhd_sensor_value_t;
26#endif
27
29
34typedef struct uhd_sensor_value_t* uhd_sensor_value_handle;
35
43
45
56);
57
59
69 const char* name,
70 bool value,
71 const char* utrue,
72 const char* ufalse
73);
74
76
86 const char* name,
87 int value,
88 const char* unit,
89 const char* formatter
90);
91
93
103 const char* name,
104 double value,
105 const char* unit,
106 const char* formatter
107);
108
110
119 const char* name,
120 const char* value,
121 const char* unit
122);
123
125
131);
132
136 bool *value_out
137);
138
142 int *value_out
143);
144
148 double *value_out
149);
150
152
162 char* name_out,
163 size_t strbuffer_len
164);
165
167
177 char* value_out,
178 size_t strbuffer_len
179);
180
182
192 char* unit_out,
193 size_t strbuffer_len
194);
195
198 uhd_sensor_value_data_type_t *data_type_out
199);
200
202
212 char* pp_string_out,
213 size_t strbuffer_len
214);
215
217
227 char* error_out,
228 size_t strbuffer_len
229);
230
231#ifdef __cplusplus
232}
233#endif
234
235#endif /* INCLUDED_UHD_TYPES_SENSORS_H */
#define UHD_API
Definition config.h:68
uhd_error
UHD error codes.
Definition error.h:21
UHD_API uhd_error uhd_sensor_value_data_type(uhd_sensor_value_handle h, uhd_sensor_value_data_type_t *data_type_out)
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.
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.
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.
UHD_API uhd_error uhd_sensor_value_value(uhd_sensor_value_handle h, char *value_out, size_t strbuffer_len)
Get the sensor's value.
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_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_make_from_string(uhd_sensor_value_handle *h, const char *name, const char *value, const char *unit)
Make a UHD sensor from a string.
UHD_API uhd_error uhd_sensor_value_to_int(uhd_sensor_value_handle h, int *value_out)
Get the sensor's value as an integer.
UHD_API uhd_error uhd_sensor_value_to_realnum(uhd_sensor_value_handle h, double *value_out)
Get the sensor's value as a real number.
uhd_sensor_value_data_type_t
Sensor value types.
Definition sensors.h:37
@ UHD_SENSOR_VALUE_BOOLEAN
Definition sensors.h:38
@ UHD_SENSOR_VALUE_STRING
Definition sensors.h:41
@ UHD_SENSOR_VALUE_REALNUM
Definition sensors.h:40
@ UHD_SENSOR_VALUE_INTEGER
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(uhd_sensor_value_handle *h)
Make an empty UHD sensor value.
UHD_API uhd_error uhd_sensor_value_name(uhd_sensor_value_handle h, char *name_out, size_t strbuffer_len)
Get the sensor's name.
UHD_API uhd_error uhd_sensor_value_to_bool(uhd_sensor_value_handle h, bool *value_out)
Get the sensor's value as a boolean.
struct uhd_sensor_value_t * uhd_sensor_value_handle
C-level interface for a UHD sensor.
Definition sensors.h:34
UHD_API uhd_error uhd_sensor_value_unit(uhd_sensor_value_handle h, char *unit_out, size_t strbuffer_len)
Get the sensor's unit.
Definition sensors.hpp:30