GNU Radio's IIO Package
multi_source.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_MULTI_SOURCE_H
24 #define INCLUDED_IIO_MULTI_SOURCE_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 multi_source : virtual public gr::sync_block
44  {
45  public:
46  typedef std::shared_ptr<multi_source> 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_phy1,
59  const std::vector<std::string> &params1,
60  const std::string &device_phy2,
61  const std::vector<std::string> &params2,
62  unsigned int buffer_size = DEFAULT_BUFFER_SIZE,
63  unsigned int decimation = 0);
64 
65  static sptr make_from(struct iio_context *ctx, const std::string &device,
66  const std::vector<std::string> &channels,
67  const std::string &device_phy1,
68  const std::vector<std::string> &params1,
69  const std::string &device_phy2,
70  const std::vector<std::string> &params2,
71  unsigned int buffer_size = DEFAULT_BUFFER_SIZE,
72  unsigned int decimation = 0);
73 
74  virtual void set_buffer_size(unsigned int buffer_size) = 0;
75  virtual void set_timeout_ms(unsigned long timeout) = 0;
76  };
77 
78  } // namespace iio
79 } // namespace gr
80 
81 #endif /* INCLUDED_IIO_MULTI_SOURCE_H */
82 
#define IIO_API
Definition: api.h:19
#define DEFAULT_BUFFER_SIZE
Definition: multi_source.h:29
Definition: attr_sink.h:29
std::shared_ptr< multi_source > sptr
Definition: multi_source.h:46
<+description of block+>
Definition: multi_source.h:43