GNU Radio Manual and C++ API Reference 3.10.3.0
The Free & Open Software Radio Ecosystem
 
Loading...
Searching...
No Matches
attr_source_impl.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#ifndef INCLUDED_IIO_ATTR_SOURCE_IMPL_H
11#define INCLUDED_IIO_ATTR_SOURCE_IMPL_H
12
13#include "device_source_impl.h"
15
16#include <string>
17
18namespace gr {
19namespace iio {
20
22{
23private:
24 std::string device;
25 std::string channel;
26 std::string uri;
27 std::string attribute;
28 int update_interval_ms;
29 int samples_per_update;
30 attr_type_t attr_type;
31 data_type_t data_type;
32 int ret;
33 uint32_t address;
34
35protected:
36 iio_context* ctx;
37 iio_device* dev;
38 iio_channel* chan;
39
40public:
41 attr_source_impl(const std::string& uri,
42 const std::string& device,
43 const std::string& channel,
44 const std::string& attribute,
45 int update_interval_ms,
46 int samples_per_update,
47 data_type_t data_type,
48 attr_type_t attr_type,
49 bool output,
50 uint32_t address);
52
53 // Where all the action really happens
54 int work(int noutput_items,
55 gr_vector_const_void_star& input_items,
56 gr_vector_void_star& output_items);
57
58 size_t type_sizeof(data_type_t data_type, attr_type_t attr_type);
59 void get_attribute_data(const std::string& attribute, double* value);
60 void get_attribute_data(const std::string& attribute, float* value);
61 void get_attribute_data(const std::string& attribute, long long* value);
62 void get_attribute_data(const std::string& attribute, int* value);
63 void get_attribute_data(const std::string& attribute, uint8_t* value);
64 void get_register_data(uint32_t address, int* value);
65 void check(int ret);
66};
67
68} // namespace iio
69} // namespace gr
70
71#endif /* INCLUDED_IIO_ATTR_SOURCE_IMPL_H */
Definition: attr_source_impl.h:22
iio_channel * chan
Definition: attr_source_impl.h:38
void get_attribute_data(const std::string &attribute, uint8_t *value)
size_t type_sizeof(data_type_t data_type, attr_type_t attr_type)
attr_source_impl(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)
iio_context * ctx
Definition: attr_source_impl.h:36
void get_register_data(uint32_t address, int *value)
void get_attribute_data(const std::string &attribute, long long *value)
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
just like gr::block::general_work, only this arranges to call consume_each for you
void get_attribute_data(const std::string &attribute, int *value)
void get_attribute_data(const std::string &attribute, float *value)
iio_device * dev
Definition: attr_source_impl.h:37
void get_attribute_data(const std::string &attribute, double *value)
Generic reader for attributes of IIO devices.
Definition: attr_source.h:31
data_type_t
Definition: iio_types.h:21
attr_type_t
Definition: iio_types.h:23
GNU Radio logging wrapper.
Definition: basic_block.h:29
std::vector< const void * > gr_vector_const_void_star
Definition: types.h:28
std::vector< void * > gr_vector_void_star
Definition: types.h:27