GNU Radio's CYBERRADIO Package
vita_udp_rx_impl.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 #ifndef INCLUDED_CYBERRADIO_VITA_UDP_RX_IMPL_H
22 #define INCLUDED_CYBERRADIO_VITA_UDP_RX_IMPL_H
23 
24 #include "CyberRadio/vita_udp_rx.h"
25 #include <vector>
26 
27 namespace gr {
28 namespace CyberRadio {
29 
31 {
32  using Base = vita_udp_rx;
33 
34 private:
35  // Variables
36  std::string const d_src_ip;
37  unsigned short const d_port;
38  int d_sock;
39 
40  int const d_samples_per_packet;
41  size_t const d_header_byte_offset;
42  size_t const d_bytes_per_packet;
43  bool const d_swap_bytes;
44  bool const d_swap_iq;
45  bool const d_uses_v49_1;
46  bool const d_is_narrowband;
47  bool const d_tag_packets;
48  bool d_debug;
49  bool d_first_packet;
50  unsigned d_packetCounter : 4;
51 
52  std::vector<uint8_t> d_buffer;
53 
54 protected:
55  // Methods
56  auto receive_packet() -> bool;
57  auto process_packet(gr_complex*& outP, int samples_needed) -> int;
58  auto process_v491_packet(gr_complex*& outP) -> int;
59  auto handle_dropped_packet(unsigned packet_counter,
60  gr_complex*& outP,
61  int samples_needed) -> int;
62  auto process_IQ(gr_complex*& outP) -> int;
63 
64 
65  auto tag_packet(int stream, int offset) -> void;
66  auto tag_v491_packet(int stream, int offset) -> void;
67 
68 public:
69  vita_udp_rx_impl(Cfg const& cfg);
70 
71  void rxControlMsg(pmt::pmt_t msg);
72  void txStatusMsg();
73 
74  bool start() override;
75  bool stop() override;
76 
77  // Where all the action really happens
78  int general_work(int noutput_items,
79  gr_vector_int& ninput_items,
80  gr_vector_const_void_star& input_items,
81  gr_vector_void_star& output_items) override;
82 };
83 
84 } // namespace CyberRadio
85 } // namespace gr
86 
87 #endif // INCLUDED_CYBERRADIO_VITA_UDP_RX_IMPL_H
void rxControlMsg(pmt::pmt_t msg)
auto process_IQ(gr_complex *&outP) -> int
<+description of block+>
Definition: vita_udp_rx.h:39
auto tag_packet(int stream, int offset) -> void
Definition: vita_udp_rx.h:48
auto tag_v491_packet(int stream, int offset) -> void
auto handle_dropped_packet(unsigned packet_counter, gr_complex *&outP, int samples_needed) -> int
auto process_packet(gr_complex *&outP, int samples_needed) -> int
Provides GNU Radio blocks.
Definition: NDR651_duc_sink_mk2.h:21
int general_work(int noutput_items, gr_vector_int &ninput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items) override
auto process_v491_packet(gr_complex *&outP) -> int
Definition: vita_udp_rx_impl.h:30