USRP Hardware Driver and USRP Manual: ranges.h Source File

| USRP Hardware Driver and USRP Manual Version: 4.8.0.makepkg-0-g308126a4 UHD and USRP Manual |

Loading...
Searching...
No Matches
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#pragma once
9
10#include <uhd/config.h>
11#include <uhd/error.h>
12
13#include <stdbool.h>
14#include <stdlib.h>
15
17 typedef struct
18{
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
31struct uhd_meta_range_t
32{
33 uhd::meta_range_t meta_range_cpp;
34 std::string last_error;
35};
36
37extern "C" {
38#else
39struct uhd_meta_range_t;
40#endif
41
43
46 typedef struct uhd_meta_range_t* uhd_meta_range_handle;
47
49 UHD_API uhd_error uhd_range_to_pp_string(
50 const uhd_range_t* range, char* pp_string_out, size_t strbuffer_len);
51
53
57 UHD_API uhd_error uhd_meta_range_make(uhd_meta_range_handle* h);
58
60
64 UHD_API uhd_error uhd_meta_range_free(uhd_meta_range_handle* h);
65
67 UHD_API uhd_error uhd_meta_range_start(uhd_meta_range_handle h, double* start_out);
68
70 UHD_API uhd_error uhd_meta_range_stop(uhd_meta_range_handle h, double* stop_out);
71
73 UHD_API uhd_error uhd_meta_range_step(uhd_meta_range_handle h, double* step_out);
74
76 UHD_API uhd_error uhd_meta_range_clip(
77 uhd_meta_range_handle h, double value, bool clip_step, double* result_out);
78
80 UHD_API uhd_error uhd_meta_range_size(uhd_meta_range_handle h, size_t* size_out);
81
83 UHD_API uhd_error uhd_meta_range_push_back(
84 uhd_meta_range_handle h, const uhd_range_t* range);
85
87 UHD_API uhd_error uhd_meta_range_at(
88 uhd_meta_range_handle h, size_t num, uhd_range_t* range_out);
89
91 UHD_API uhd_error uhd_meta_range_to_pp_string(
92 uhd_meta_range_handle h, char* pp_string_out, size_t strbuffer_len);
93
95 UHD_API uhd_error uhd_meta_range_last_error(
96 uhd_meta_range_handle h, char* error_out, size_t strbuffer_len);
97
98#ifdef __cplusplus
99}
100
101 UHD_API uhd::range_t uhd_range_c_to_cpp(const uhd_range_t* range_c);
102
103 UHD_API void uhd_range_cpp_to_c(const uhd::range_t& range_cpp, uhd_range_t* range_c);
104#endif
uhd::range_t
Definition ranges.hpp:22
config.h
UHD_API
#define UHD_API
Definition config.h:87
error.h
uhd_error
uhd_error
UHD error codes.
Definition error.h:20
uhd_meta_range_make
UHD_API uhd_error uhd_meta_range_make(uhd_meta_range_handle *h)
Create a meta range handle.
uhd_meta_range_to_pp_string
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_meta_range_free
UHD_API uhd_error uhd_meta_range_free(uhd_meta_range_handle *h)
Destroy a meta range handle.
uhd_meta_range_start
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.
uhd_meta_range_at
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_meta_range_clip
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_meta_range_stop
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.
uhd_meta_range_last_error
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_meta_range_push_back
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.
uhd_range_to_pp_string
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.
uhd_meta_range_handle
struct uhd_meta_range_t * uhd_meta_range_handle
C-level interface for dealing with a list of ranges.
Definition ranges.h:46
uhd_meta_range_size
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.
uhd_meta_range_step
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.
ranges.hpp
uhd::meta_range_t
Definition ranges.hpp:66
uhd_range_t
Range of floating-point values.
Definition ranges.h:18
uhd_range_t::stop
double stop
Last value.
Definition ranges.h:22
uhd_range_t::start
double start
First value.
Definition ranges.h:20
uhd_range_t::step
double step
Granularity.
Definition ranges.h:24