USRP Hardware Driver and USRP Manual  Version: 3.13.0.HEAD-0-gf114cfa0
UHD and USRP Manual
ranges.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_RANGES_H
9 #define INCLUDED_UHD_TYPES_RANGES_H
10 
11 #include <uhd/config.h>
12 #include <uhd/error.h>
13 
14 #include <stdbool.h>
15 #include <stdlib.h>
16 
18 typedef struct {
20  double start;
22  double stop;
24  double step;
25 } uhd_range_t;
26 
27 #ifdef __cplusplus
28 #include <uhd/types/ranges.hpp>
29 #include <string>
30 
31 struct uhd_meta_range_t {
32  uhd::meta_range_t meta_range_cpp;
33  std::string last_error;
34 };
35 
36 extern "C" {
37 #else
38 struct uhd_meta_range_t;
39 #endif
40 
42 
45 typedef struct uhd_meta_range_t* uhd_meta_range_handle;
46 
49  const uhd_range_t *range,
50  char* pp_string_out,
51  size_t strbuffer_len
52 );
53 
55 
60  uhd_meta_range_handle* h
61 );
62 
64 
69  uhd_meta_range_handle* h
70 );
71 
74  uhd_meta_range_handle h,
75  double *start_out
76 );
77 
80  uhd_meta_range_handle h,
81  double *stop_out
82 );
83 
86  uhd_meta_range_handle h,
87  double *step_out
88 );
89 
92  uhd_meta_range_handle h,
93  double value,
94  bool clip_step,
95  double *result_out
96 );
97 
100  uhd_meta_range_handle h,
101  size_t *size_out
102 );
103 
106  uhd_meta_range_handle h,
107  const uhd_range_t *range
108 );
109 
112  uhd_meta_range_handle h,
113  size_t num,
114  uhd_range_t *range_out
115 );
116 
119  uhd_meta_range_handle h,
120  char* pp_string_out,
121  size_t strbuffer_len
122 );
123 
126  uhd_meta_range_handle h,
127  char* error_out,
128  size_t strbuffer_len
129 );
130 
131 #ifdef __cplusplus
132 }
133 
134 UHD_API uhd::range_t uhd_range_c_to_cpp(
135  const uhd_range_t *range_c
136 );
137 
138 UHD_API void uhd_range_cpp_to_c(
139  const uhd::range_t &range_cpp,
140  uhd_range_t *range_c
141 );
142 #endif
143 
144 #endif /* INCLUDED_UHD_TYPES_RANGES_H */
UHD_API uhd_error uhd_meta_range_stop(uhd_meta_range_handle h, double *stop_out)
Get the overall stop value for the given meta range.
double stop
Last value.
Definition: ranges.h:22
UHD_API uhd_error uhd_meta_range_at(uhd_meta_range_handle h, size_t num, uhd_range_t *range_out)
Get the range at the given index.
UHD_API uhd_error uhd_meta_range_last_error(uhd_meta_range_handle h, char *error_out, size_t strbuffer_len)
Get the last error recorded by the underlying meta range.
UHD_API uhd_error uhd_meta_range_size(uhd_meta_range_handle h, size_t *size_out)
Get the number of ranges in the given meta range.
Range of floating-point values.
Definition: ranges.h:18
struct uhd_meta_range_t * uhd_meta_range_handle
C-level interface for dealing with a list of ranges.
Definition: ranges.h:45
UHD_API uhd_error uhd_meta_range_clip(uhd_meta_range_handle h, double value, bool clip_step, double *result_out)
Clip the given value to a possible value in the given range.
UHD_API uhd_error uhd_meta_range_make(uhd_meta_range_handle *h)
Create a meta range handle.
UHD_API uhd_error uhd_meta_range_to_pp_string(uhd_meta_range_handle h, char *pp_string_out, size_t strbuffer_len)
Get a string representation of the given meta range.
uhd_error
UHD error codes.
Definition: error.h:21
UHD_API uhd_error uhd_meta_range_start(uhd_meta_range_handle h, double *start_out)
Get the overall start value for the given meta range.
Definition: ranges.hpp:21
UHD_API uhd_error uhd_range_to_pp_string(const uhd_range_t *range, char *pp_string_out, size_t strbuffer_len)
Get a string representation of the given range.
#define UHD_API
Definition: config.h:63
double step
Granularity.
Definition: ranges.h:24
UHD_API uhd_error uhd_meta_range_push_back(uhd_meta_range_handle h, const uhd_range_t *range)
Add a range to the given meta range.
Definition: ranges.hpp:64
UHD_API uhd_error uhd_meta_range_free(uhd_meta_range_handle *h)
Destroy a meta range handle.
double start
First value.
Definition: ranges.h:20
UHD_API uhd_error uhd_meta_range_step(uhd_meta_range_handle h, double *step_out)
Get the overall step value for the given meta range.