GNU Radio's CYBERRADIO Package
vita_udp_rx.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 /*
3  * Copyright 2017 <+YOU OR YOUR COMPANY+>.
4  *
5  * This is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3, or (at your option)
8  * any later version.
9  *
10  * This software is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this software; see the file COPYING. If not, write to
17  * the Free Software Foundation, Inc., 51 Franklin Street,
18  * Boston, MA 02110-1301, USA.
19  */
20 
21 
22 #ifndef INCLUDED_CYBERRADIO_VITA_UDP_RX_H
23 #define INCLUDED_CYBERRADIO_VITA_UDP_RX_H
24 
25 #include <gnuradio/block.h>
26 #include <CyberRadio/api.h>
27 
28 namespace gr {
29 namespace CyberRadio {
30 
31 /*!
32  * \brief <+description of block+>
33  * \ingroup CyberRadio
34  *
35  */
36 
37 // Note: the recommendation from GNU Radio developers is the sources and sinks should
38 // always inherit from gr::block, not one of the more derived types
39 class CYBERRADIO_API vita_udp_rx : public gr::block
40 {
41 public:
42  using BaseBlock = gr::block;
43  using sptr = boost::shared_ptr<vita_udp_rx>;
44 
45  // Because this class takes a number of optional configuration items, and because the
46  // signature changed in a way that could lead to undiagnosed errors, collapse all the
47  // configuration items to a structure and pass that
48  struct Cfg {
49  std::string src_ip; ///< source IP address to bind to
50  short port; ///< source port to bind to
51  unsigned header_byte_offset; ///< number of bytes in the V49 header
52  int samples_per_packet; ///< number of samples in a packet
53  int bytes_per_packet; ///< total size of the V49 packet
54  bool swap_bytes; ///< if the packet should be byteswapped
55  bool swap_iq; ///< change from IQ to QI (or from QI to IQ)
56  bool tag_packets; ///< add GR tags to the stream
57  bool uses_v49_1 = true; ///< VITA 49.1 (VRLP and VEND headers)
58  bool narrowband = false; ///< if using a narrowband DDC
59  bool debug = false; ///< output extra debug info
60  };
61 
62  /*!
63  * \brief Return a shared_ptr to a new instance of vita_udp_rx::vita_udp_rx.
64  *
65  * To avoid accidental use of raw pointers, vita_udp_rx::vita_udp_rx's
66  * constructor is in a private implementation class. vita_udp_rx::vita_udp_rx::make
67  * is the public interface for creating new instances.
68  */
69  static auto make(Cfg const& cfg) -> sptr;
70  static auto make(const std::string &src_ip,
71  unsigned short port,
72  unsigned int header_byte_offset,
73  int samples_per_packet,
74  int bytes_per_packet,
75  bool swap_bytes,
76  bool swap_iq, bool
77  tag_packets, bool
78  vector_output,
79  bool uses_v491,
80  bool narrowband,
81  bool debug) -> sptr;
82 
83  // these are already virtual ... do we need the pure virtual?
84  bool start() override = 0;
85  bool stop() override = 0;
86 
87 protected:
88  using BaseBlock::block;
89 };
90 
91 } // namespace CyberRadio
92 } // namespace gr
93 
94 #endif // INCLUDED_CYBERRADIO_VITA_UDP_RX_H
gr::block BaseBlock
Definition: vita_udp_rx.h:42
<+description of block+>
Definition: vita_udp_rx.h:39
#define CYBERRADIO_API
Definition: api.h:30
bool swap_bytes
if the packet should be byteswapped
Definition: vita_udp_rx.h:54
Definition: vita_udp_rx.h:48
boost::shared_ptr< vita_udp_rx > sptr
Definition: vita_udp_rx.h:43
bool swap_iq
change from IQ to QI (or from QI to IQ)
Definition: vita_udp_rx.h:55
Provides GNU Radio blocks.
Definition: NDR651_duc_sink_mk2.h:21
bool tag_packets
add GR tags to the stream
Definition: vita_udp_rx.h:56
short port
source port to bind to
Definition: vita_udp_rx.h:50
std::string src_ip
source IP address to bind to
Definition: vita_udp_rx.h:49
unsigned header_byte_offset
number of bytes in the V49 header
Definition: vita_udp_rx.h:51
int bytes_per_packet
total size of the V49 packet
Definition: vita_udp_rx.h:53
int samples_per_packet
number of samples in a packet
Definition: vita_udp_rx.h:52