GNU Radio's IIO Package
device_sink.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 Analog Devices Inc.
4  * Author: Paul Cercueil <paul.cercueil@analog.com>
5  *
6  * This is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3, or (at your option)
9  * any later version.
10  *
11  * This software is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this software; see the file COPYING. If not, write to
18  * the Free Software Foundation, Inc., 51 Franklin Street,
19  * Boston, MA 02110-1301, USA.
20  */
21 
22 
23 #ifndef INCLUDED_IIO_DEVICE_SINK_H
24 #define INCLUDED_IIO_DEVICE_SINK_H
25 
26 #include <iio/api.h>
27 #include <gnuradio/sync_block.h>
28 
29 #define DEFAULT_BUFFER_SIZE 0x8000
30 
31 extern "C" {
32  struct iio_context;
33 };
34 
35 namespace gr {
36  namespace iio {
37 
38  /*!
39  * \brief <+description of block+>
40  * \ingroup iio
41  *
42  */
43  class IIO_API device_sink : virtual public gr::sync_block
44  {
45  public:
46  typedef std::shared_ptr<device_sink> sptr;
47 
48  /*!
49  * \brief Return a shared_ptr to a new instance of iio::device.
50  *
51  * To avoid accidental use of raw pointers, iio::device's
52  * constructor is in a private implementation
53  * class. iio::device::make is the public interface for
54  * creating new instances.
55  */
56  static sptr make(const std::string &uri, const std::string &device,
57  const std::vector<std::string> &channels,
58  const std::string &device_phy,
59  const std::vector<std::string> &params,
60  unsigned int buffer_size = DEFAULT_BUFFER_SIZE,
61  unsigned int interpolation = 0, bool cyclic = false);
62 
63  static sptr make_from(struct iio_context *ctx, const std::string &device,
64  const std::vector<std::string> &channels,
65  const std::string &device_phy,
66  const std::vector<std::string> &params,
67  unsigned int buffer_size = DEFAULT_BUFFER_SIZE,
68  unsigned int interpolation = 0, bool cyclic = false);
69  };
70 
71  } // namespace iio
72 } // namespace gr
73 
74 #endif /* INCLUDED_IIO_DEVICE_SINK_H */
75 
#define IIO_API
Definition: api.h:19
<+description of block+>
Definition: device_sink.h:43
std::shared_ptr< device_sink > sptr
Definition: device_sink.h:46
#define DEFAULT_BUFFER_SIZE
Definition: device_sink.h:29
Definition: attr_sink.h:29