GNU Radio's CYBERRADIO Package
vita_iq_source_mk3.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /***************************************************************************
3  * \file vita_iq_source_mk3.h
4  *
5  * \brief Generic VITA 49-compatible I/Q data source block (Mk3).
6  *
7  * \author DA
8  * \copyright 2015 CyberRadio Solutions, Inc.
9  */
10 
11 
12 #ifndef INCLUDED_CYBERRADIO_VITA_IQ_SOURCE_MK3_H
13 #define INCLUDED_CYBERRADIO_VITA_IQ_SOURCE_MK3_H
14 
15 #include <CyberRadio/api.h>
16 #include <gnuradio/sync_interpolator.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 CyberRadioBase
31  *
32  * \brief A generic VITA 49-compatible I/Q data source block (Mk3).
33  *
34  * \details
35  * The vita_iq_source block outputs VITA 49 or raw I/Q data coming
36  * from an NDR-class radio. The source block listens for incoming
37  * I/Q data using UDP and dispatches it to its output port(s)
38  * as needed. This block uses multiple output ports, one per tuner,
39  * if the incoming data is in DDC-coherent mode.
40  *
41  * \note When using this block in DDC-coherent mode, all output ports
42  * MUST be connected.
43  *
44  * This class is designed to be as flexible as possible in dealing
45  * with data streams, since each NDR-class radio varies in how it
46  * packages data streams.
47  *
48  * The vita_iq_source block can also produce stream tags at the
49  * beginning of each received VITA 49 frame. The block generates
50  * the following stream tags, as appropriate for the radio:
51  * \li absolute_sample_num -- The absolute sample number
52  * \li frame_counter -- The VITA frame counter
53  * \li frame_size -- The VITA frame size
54  * \li packet_type -- The VITA packet type
55  * \li packet_counter -- The VITA packet counter
56  * \li packet_size -- The VITA packet size
57  * \li stream_id -- The VITA stream ID
58  * \li timestamp_int_type -- The VITA timestamp integer (TSI) field type
59  * \li timestamp_int -- The VITA timestamp integer (TSI) field
60  * \li timestamp_frac_type -- The VITA timestamp fractional (TSF) field type
61  * \li timestamp_frac -- The VITA timestamp fractional (TSF) field
62  * \li organizationally_unique_id -- The organizationally unique ID (OUI)
63  * \li information_class_code -- The information class code (ICC)
64  * \li packet_class_code -- The packet class code (PCC)
65  * If the radio is sending raw I/Q data instead of VITA 49 frames, this
66  * block will not produce stream tags regardless of the tagged setting.
67  */
68  // Internal note -- although this class uses the sync_interpolator
69  // block as a base, the processing performs no actual interpolation
70  // to pruduce its output. The sync_interpolator block simply produces
71  // N output items per input item. So using it is a quick-and-dirty method
72  // of bounding the work() function so that calls to it request a number of
73  // samples.
74  class CYBERRADIO_API vita_iq_source_mk3 : virtual public gr::sync_interpolator
75  {
76  public:
77  typedef boost::shared_ptr<vita_iq_source_mk3> sptr;
78 
79  /*!
80  * \brief Creates a vita_iq_source_mk3 block.
81  *
82  * \param vita_type The VITA 49 enable option value. The range of valid
83  * values depends on the radio, but 0 always disables VITA 49
84  * formatting. In that case, the data format is raw I/Q.
85  * \param payload_size The VITA 49 or I/Q payload size for the radio, in
86  * bytes. If VITA 49 output is disabled, then this parameter provides
87  * the total size of all raw I/Q data transmitted in a single packet.
88  * \param vita_header_size The VITA 49 header size for the radio, in bytes.
89  * If VITA 49 output is disabled, then this parameter is ignored.
90  * \param vita_tail_size The VITA 49 tail size for the radio, in bytes.
91  * If VITA 49 output is disabled, then this parameter is ignored.
92  * \param byte_swapped Whether the bytes in the packet are swapped (with
93  * respect to the endianness employed by the host operating system).
94  * \param iq_swapped Whether I and Q data in the payload are swapped.
95  * \param iq_scale_factor Scale factor for converting I/Q data from
96  * native sample format to complex output.
97  * \param host The IP address or host name to bind listening UDP ports
98  * on. Specify this as "0.0.0.0" to listen on all network interfaces.
99  * \param port The UDP port number to listen on.
100  * \param ddc_coherent Whether the incoming data is in DDC-coherent mode.
101  * \param num_outputs Number of outputs for coherent-mode data. If the
102  * data is not DDC-coherent, then this parameter is ignored, and the number
103  * of outputs is automatically set to 1.
104  * \param tagged Whether the block should produce stream tags. Defaults to
105  * False.
106  * \param debug Whether the block should produce debug output. Defaults to
107  * False.
108  *
109  * \return A boost::shared_ptr<vita_iq_source_mk3> representing the new source
110  * block.
111  */
112  static sptr make(int vita_type = 0,
113  size_t payload_size = 8192,
114  size_t vita_header_size = 0,
115  size_t vita_tail_size = 0,
116  bool byte_swapped = false,
117  bool iq_swapped = false,
118  float iq_scale_factor = 1.0,
119  const std::string& host = "0.0.0.0",
120  unsigned short port = 0,
121  bool ddc_coherent = false,
122  int num_outputs = 1,
123  bool tagged = false,
124  bool debug = false);
125 
126  /*!
127  * \brief Gets the real-time calculated sample rate for a specific
128  * output.
129  * \param output Which output to get the sample rate for.
130  * \return The sample rate (in samples per second).
131  */
132  virtual float get_realtime_sample_rate(int output = 0) = 0;
133 
134  };
135 
136  } // namespace CyberRadio
137 
138 } // namespace gr
139 
140 #endif /* INCLUDED_CYBERRADIO_VITA_IQ_SOURCE_MK3_H */
141 
#define CYBERRADIO_API
Definition: api.h:30
A generic VITA 49-compatible I/Q data source block (Mk3).
Definition: vita_iq_source_mk3.h:74
Provides GNU Radio blocks.
Definition: NDR651_duc_sink_mk2.h:21
boost::shared_ptr< vita_iq_source_mk3 > sptr
Definition: vita_iq_source_mk3.h:77