USRP Hardware Driver and USRP Manual  Version: 003.010.003.HEAD-0-gef157678
UHD and USRP Manual
ranges.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_RANGES_H
19 #define INCLUDED_UHD_TYPES_RANGES_H
20 
21 #include <uhd/config.h>
22 #include <uhd/error.h>
23 
24 #include <stdbool.h>
25 #include <stdlib.h>
26 
28 typedef struct {
30  double start;
32  double stop;
34  double step;
35 } uhd_range_t;
36 
37 #ifdef __cplusplus
38 #include <uhd/types/ranges.hpp>
39 #include <string>
40 
41 struct uhd_meta_range_t {
42  uhd::meta_range_t meta_range_cpp;
43  std::string last_error;
44 };
45 
46 extern "C" {
47 #else
48 struct uhd_meta_range_t;
49 #endif
50 
52 
55 typedef struct uhd_meta_range_t* uhd_meta_range_handle;
56 
59  const uhd_range_t *range,
60  char* pp_string_out,
61  size_t strbuffer_len
62 );
63 
65 
70  uhd_meta_range_handle* h
71 );
72 
74 
79  uhd_meta_range_handle* h
80 );
81 
84  uhd_meta_range_handle h,
85  double *start_out
86 );
87 
90  uhd_meta_range_handle h,
91  double *stop_out
92 );
93 
96  uhd_meta_range_handle h,
97  double *step_out
98 );
99 
102  uhd_meta_range_handle h,
103  double value,
104  bool clip_step,
105  double *result_out
106 );
107 
110  uhd_meta_range_handle h,
111  size_t *size_out
112 );
113 
116  uhd_meta_range_handle h,
117  const uhd_range_t *range
118 );
119 
122  uhd_meta_range_handle h,
123  size_t num,
124  uhd_range_t *range_out
125 );
126 
129  uhd_meta_range_handle h,
130  char* pp_string_out,
131  size_t strbuffer_len
132 );
133 
136  uhd_meta_range_handle h,
137  char* error_out,
138  size_t strbuffer_len
139 );
140 
141 #ifdef __cplusplus
142 }
143 
144 UHD_API uhd::range_t uhd_range_c_to_cpp(
145  const uhd_range_t *range_c
146 );
147 
148 UHD_API void uhd_range_cpp_to_c(
149  const uhd::range_t &range_cpp,
150  uhd_range_t *range_c
151 );
152 #endif
153 
154 #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:32
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:28
struct uhd_meta_range_t * uhd_meta_range_handle
C-level interface for dealing with a list of ranges.
Definition: ranges.h:55
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:31
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:31
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:73
double step
Granularity.
Definition: ranges.h:34
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:68
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:30
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.