GNU Radio C++ API Reference: attr_source.h Source File

| GNU Radio C++ API Reference 3.10.12.0 The Free & Open Software Radio Ecosystem |

Loading...
Searching...
No Matches
attr_source.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2018 Analog Devices Inc.
4 * Author: Travis Collins <travis.collins@analog.com>
5 *
6 * SPDX-License-Identifier: GPL-3.0-or-later
7 *
8 */
9
10
11#ifndef INCLUDED_IIO_ATTR_SOURCE_H
12#define INCLUDED_IIO_ATTR_SOURCE_H
13
14#include <gnuradio/iio/api.h>
15#include <gnuradio/iio/iio_types.h>
16#include <gnuradio/sync_block.h>
17
18namespace gr {
19namespace iio {
20
21/*!
22 * \brief Generic reader for attributes of IIO devices
23 * \ingroup iio
24 *
25 * \details
26 * This block allow for reading of any IIO attribute that is readable. This
27 * includes channel, device, device buffer, device debug, and direct register
28 * attributes.
29 */
30 class IIO_API attr_source : virtual public gr::sync_block
31{
32public:
33 typedef std::shared_ptr<attr_source> sptr;
34
35 /*!
36 * \brief Return a shared_ptr to a new instance of iio::attr_source.
37 *
38 * \param uri String of the context uri
39 * \param device String of device name
40 * \param channel String of device name
41 * \param attribute String of attribute name
42 * \param update_interval_ms Integer number of milliseconds between
43 * attribute reads
44 * \param samples_per_update Integer number of samples to collect before
45 * block returns
46 * \param data_type Enum which selects what data type to output for
47 * received data:
48 * 0: double
49 * 1: float
50 * 2: long long
51 * 3: int
52 * 4: uint8
53 * \param attr_type Enum determining attribute type:
54 * 0: Channel attribute
55 * 1: Device attribute
56 * 2: Device debug attribute
57 * \param output Boolean when True if channel attribute is an output
58 * \param address uint32 register address of register to be read
59 */
60 static sptr make(const std::string& uri,
61 const std::string& device,
62 const std::string& channel,
63 const std::string& attribute,
64 int update_interval_ms,
65 int samples_per_update,
66 data_type_t data_type,
67 attr_type_t attr_type,
68 bool output,
69 uint32_t address);
70};
71
72} // namespace iio
73} // namespace gr
74
75#endif /* INCLUDED_IIO_ATTR_SOURCE_H */
gr::iio::attr_source
Generic reader for attributes of IIO devices.
Definition attr_source.h:31
gr::iio::attr_source::make
static sptr make(const std::string &uri, const std::string &device, const std::string &channel, const std::string &attribute, int update_interval_ms, int samples_per_update, data_type_t data_type, attr_type_t attr_type, bool output, uint32_t address)
Return a shared_ptr to a new instance of iio::attr_source.
gr::iio::attr_source::sptr
std::shared_ptr< attr_source > sptr
Definition attr_source.h:33
gr::sync_block
synchronous 1:1 input to output with history
Definition sync_block.h:26
api.h
IIO_API
#define IIO_API
Definition gr-iio/include/gnuradio/iio/api.h:18
iio_types.h
gr::iio
Definition attr_sink.h:19
gr::iio::data_type_t
data_type_t
Definition iio_types.h:21
gr::iio::attr_type_t
attr_type_t
Definition iio_types.h:23
gr
GNU Radio logging wrapper.
Definition basic_block.h:29
sync_block.h