GNU Radio's CYBERRADIO Package
vita_iq_source.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /***************************************************************************
3  * \file vita_iq_source.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_H
13 #define INCLUDED_CYBERRADIO_VITA_IQ_SOURCE_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 CyberRadioBase
31  *
32  * \brief A generic VITA 49-compatible I/Q data source block.
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. Dispatching is governed by which UDP port the data
39  * comes in on, so each data stream needs to be assigned its own
40  * UDP port on the radio side.
41  *
42  * This class is designed to be as flexible as possible in dealing
43  * with data streams, since each NDR-class radio varies in how it
44  * packages data streams.
45  *
46  * The vita_iq_source block can also produce stream tags at the
47  * beginning of each received VITA 49 frame. The block generates
48  * the following stream tags, as appropriate for the radio:
49  * \li absolute_sample_num -- The absolute sample number
50  * \li frame_counter -- The VITA frame counter
51  * \li frame_size -- The VITA frame size
52  * \li packet_type -- The VITA packet type
53  * \li packet_counter -- The VITA packet counter
54  * \li packet_size -- The VITA packet size
55  * \li stream_id -- The VITA stream ID
56  * \li timestamp_int_type -- The VITA timestamp integer (TSI) field type
57  * \li timestamp_int -- The VITA timestamp integer (TSI) field
58  * \li timestamp_frac_type -- The VITA timestamp fractional (TSF) field type
59  * \li timestamp_frac -- The VITA timestamp fractional (TSF) field
60  * \li organizationally_unique_id -- The organizationally unique ID (OUI)
61  * \li information_class_code -- The information class code (ICC)
62  * \li packet_class_code -- The packet class code (PCC)
63  * If the radio is sending raw I/Q data instead of VITA 49 frames, this
64  * block will not produce stream tags regardless of the tagged setting.
65  */
66  class CYBERRADIO_API vita_iq_source : virtual public gr::sync_block
67  {
68  public:
69  typedef boost::shared_ptr<vita_iq_source> sptr;
70 
71  /*!
72  * \brief Creates a vita_iq_source block.
73  *
74  * \param vita_type The VITA 49 enable option value. The range of valid
75  * values depends on the radio, but 0 always disables VITA 49
76  * formatting. In that case, the data format is raw I/Q.
77  * \param payload_size The VITA 49 or I/Q payload size for the radio, in
78  * bytes. If VITA 49 output is disabled, then this parameter provides
79  * the total size of all raw I/Q data transmitted in a single packet.
80  * \param vita_header_size The VITA 49 header size for the radio, in bytes.
81  * If VITA 49 output is disabled, then this parameter is ignored.
82  * \param vita_tail_size The VITA 49 tail size for the radio, in bytes.
83  * If VITA 49 output is disabled, then this parameter is ignored.
84  * \param byte_swapped Whether the bytes in the packet are swapped (with
85  * respect to the endianness employed by the host operating system).
86  * \param iq_swapped Whether I and Q data in the payload are swapped.
87  * \param iq_scale_factor Scale factor for coverting I/Q data from
88  * native sample format to complex output.
89  * \param host The IP address or host name to bind listening UDP ports
90  * on. Specify this as "0.0.0.0" to listen on all network interfaces.
91  * \param port_list The list of UDP port numbers to listen on. This block
92  * creates one output for each entry in this list, with each output
93  * corresponding to its associated port. This block will have one output
94  * for each port number in this list.
95  * \param debug Whether the block should produce debug output. Defaults to
96  * False.
97  * \param tagged Whether the block should produce stream tags. Defaults to
98  * False.
99  *
100  * \return A boost::shared_ptr<vita_iq_source> representing the new source
101  * block.
102  */
103  static sptr make(int vita_type = 0,
104  size_t payload_size = 8192,
105  size_t vita_header_size = 0,
106  size_t vita_tail_size = 0,
107  bool byte_swapped = false,
108  bool iq_swapped = false,
109  float iq_scale_factor = 1.0,
110  const std::string& host = "0.0.0.0",
111  const std::vector<unsigned short>& port_list = std::vector<unsigned short>(),
112  bool debug = false,
113  bool tagged = false);
114 
115  /*!
116  * \brief Gets the real-time calculated sample rate for a specific
117  * output.
118  * \param output Which output to get the sample rate for.
119  * \return The sample rate (in samples per second).
120  */
121  virtual float get_realtime_sample_rate(int output = 0) = 0;
122 
123  };
124 
125  } // namespace CyberRadio
126 } // namespace gr
127 
128 #endif /* INCLUDED_CYBERRADIO_VITA_IQ_SOURCE_H */
129 
#define CYBERRADIO_API
Definition: api.h:30
Provides GNU Radio blocks.
Definition: NDR651_duc_sink_mk2.h:21
A generic VITA 49-compatible I/Q data source block.
Definition: vita_iq_source.h:66
boost::shared_ptr< vita_iq_source > sptr
Definition: vita_iq_source.h:69