aboutsummaryrefslogtreecommitdiffstats
path: root/gr-iio/lib/attr_sink_impl.h
blob: 8fa2da7cdde56affd7694734a750acdd14ed0373 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
/* -*- c++ -*- */
/*
 * Copyright 2018 Analog Devices Inc.
 * Author: Travis Collins <travis.collins@analog.com>
 *
 * SPDX-License-Identifier: GPL-3.0-or-later
 *
 */

#ifndef INCLUDED_IIO_ATTR_SINK_IMPL_H
#define INCLUDED_IIO_ATTR_SINK_IMPL_H

#include "device_source_impl.h"
#include <gnuradio/iio/attr_sink.h>
#include <iio.h>
#include <pmt/pmt.h>

#include <string>

namespace gr {
namespace iio {

class attr_sink_impl : public attr_sink
{
private:
    std::string device;
    std::string channel;
    std::string uri;
    attr_type_t type;
    bool output;

protected:
    iio_context* ctx;
    iio_device* dev;
    iio_channel* chan;

public:
    attr_sink_impl(const std::string& uri,
                   const std::string& device,
                   const std::string& channel,
                   attr_type_t type,
                   bool output);
    ~attr_sink_impl();

    void write_attribute(pmt::pmt_t pdu);
};

} // namespace iio
} // namespace gr

#endif /* INCLUDED_IIO_ATTR_SINK_IMPL_H */