GNU Radio's CYBERRADIO Package
vita_iq_source_2.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /***************************************************************************
3  * \file vita_iq_source_2.h
4  *
5  * \brief Generic VITA 49-compatible I/Q data source block.
6  *
7  * \author DA
8  * \copyright 2015 CyberRadio Solutions, Inc.
9  */
10 
11 
12 #ifndef INCLUDED_CYBERRADIO_VITA_IQ_SOURCE_2_H
13 #define INCLUDED_CYBERRADIO_VITA_IQ_SOURCE_2_H
14 
15 #include <CyberRadio/api.h>
16 #include <gnuradio/sync_block.h>
17 
18 /*!
19  * \brief Provides GNU Radio blocks.
20  */
21 namespace gr
22 {
23  /*!
24  * \brief Provides GNU Radio blocks for CyberRadio Solutions products.
25  */
26  namespace CyberRadio
27  {
28 
29  /*!
30  * @ingroup vita
31  *
32  * @brief Creates a VITA 49 and/or I/Q radio data source block for GNU Radio.
33  *
34  * @details
35  * The vita_iq_source block is used to collect VITA 49 or raw I/Q data
36  * coming from an NDR-class radio. The vita_iq_source block establishes
37  * a UDP listening port (details specified by the @c host and @c port
38  * arguments) and waits for the radio to send packetized data to that
39  * address.
40  *
41  * The source block then makes raw data available on its output 0
42  * stream without translating it in any way.
43  * If coherent mode is off,
44  * output 1 data has the VITA information stripped off, with byte swapping,
45  * I/Q swapping and tagging optionally available.
46  * If coherent mode is on, outputs 1-6 will contain data from each of the six
47  * receiver inputs, with byte swapping and I/Q swapping optionally available.
48  * Tagging is optionally available on output 1 only.
49  *
50  * This class is designed to be as flexible as possible in dealing
51  * with data streams, since each NDR-class radio varies in how it
52  * packages data streams.
53  *
54  */
55  class CYBERRADIO_API vita_iq_source_2 : virtual public gr::sync_block
56  {
57  public:
58  typedef boost::shared_ptr<vita_iq_source_2> sptr;
59 
60  /*!
61  * @brief Return a shared_ptr to a new instance of G3Tech::vita_iq_source.
62  *
63  * To avoid accidental use of raw pointers, G3Tech::vita_iq_source
64  * constructor is in a private implementation class.
65  * G3Tech::vita_iq_source::make is the public interface for
66  * creating new instances.
67  *
68  * @param vitaType The VITA 49 enable option value. The range of valid values
69  * depends on the radio, but 0 always disables VITA 49 formatting. In that
70  * case, the data format is raw I/Q.
71  * @param payloadSize The VITA 49 or I/Q payload size for the radio, in bytes.
72  * If VITA 49 output is disabled, then this parameter provides the total
73  * size of all raw I/Q data transmitted in a single packet.
74  * @param vitaHeaderSize The VITA 49 header size for the radio, in bytes.
75  * If VITA 49 output is disabled, then this parameter is ignored.
76  * @param vitaTailSize The VITA 49 tail size for the radio, in bytes.
77  * If VITA 49 output is disabled, then this parameter is ignored.
78  * @param byteSwapped Whether the bytes in the packet are swapped (with respect
79  * to the endianness employed by the host operating system).
80  * @param iqSwapped Whether I and Q data in the payload should be swapped.
81  * @param host The IP address or host name for the UDP port to listen on.
82  * @param port The port number for the UDP port to listen on.
83  * @param debug Whether the block should produce debug output. Defaults to False.
84  * @param tagOutput Whether the second output should contain tags
85  * from the VITA header. Defaults to False.
86  * @param coherent If true, six channels of coherent data are deinterleaved
87  * from one UDP stream into six outputs. Default is False. This requires
88  * the receiver to be configured in coherent mode. (cmd: 'COH 3').
89  *
90  * @return A boost::shared_ptr<vita_iq_source> representing the new source block.
91  *
92  */
93  static sptr make(int vitaType, size_t payloadSize, size_t vitaHeaderSize,
94  size_t vitaTailSize, bool byteSwapped, bool iqSwapped,
95  const std::string& host, int port, bool debug=false,
96  bool tagOutput=false, bool coherent=false);
97 
98  /*! \brief Change the connection to a new destination
99  *
100  * \param host The name or IP address of the receiving host; use
101  * NULL or None to break the connection without closing
102  * \param port Destination port to connect to on receiving host
103  *
104  * Calls disconnect() to terminate any current connection first.
105  */
106  virtual void connect(const std::string &host, int port) = 0;
107 
108  /*! \brief Cut the connection if we have one set up.
109  */
110  virtual void disconnect() = 0;
111 
112  /*! \brief Change the size of the UDP receive buffer.
113  *
114  * \param size The size in bytes of the UDP receive buffer.
115  */
116  virtual void set_receive_buffer_size(int size) = 0;
117 
118  /*! \brief Get the size of the UDP receive buffer.
119  *
120  * \return size The size in bytes of the UDP receive buffer.
121  */
122  virtual int get_receive_buffer_size() = 0;
123 
124  /*! \brief Set the scale factor used when converting from short to float.
125  * Default is 32767.
126  *
127  * \param scale The scale factor Default is 32767.
128  */
129  virtual void set_scale_factor(int scale) = 0;
130 
131  /*! \brief Get the scale factor used when converting from short to float.
132  *
133  * \return scale The scale factor.
134  */
135  virtual int get_scale_factor() = 0;
136 
137  };
138 
139 
140  } // namespace CyberRadio
141 } // namespace gr
142 
143 #endif /* INCLUDED_CYBERRADIO_VITA_IQ_SOURCE_2_H */
144 
#define CYBERRADIO_API
Definition: api.h:30
boost::shared_ptr< vita_iq_source_2 > sptr
Definition: vita_iq_source_2.h:58
Creates a VITA 49 and/or I/Q radio data source block for GNU Radio.
Definition: vita_iq_source_2.h:55
Provides GNU Radio blocks.
Definition: NDR651_duc_sink_mk2.h:21