GNU Radio's CYBERRADIO Package
snapshot_source_c_impl.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2016 <+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_SNAPSHOT_SOURCE_C_IMPL_H
22 #define INCLUDED_CYBERRADIO_SNAPSHOT_SOURCE_C_IMPL_H
23 
25 #include <arpa/inet.h>
26 #include <errno.h>
27 #include <fcntl.h>
28 #include <inttypes.h>
29 #include <linux/if_ether.h>
30 #include <linux/if_packet.h>
31 #include <net/ethernet.h>
32 #include <net/if.h>
33 #include <netdb.h>
34 #include <netinet/in.h>
35 #include <netinet/ip.h>
36 #include <netinet/udp.h>
37 #include <poll.h>
38 #include <signal.h>
39 #include <stdio.h>
40 #include <stdlib.h>
41 #include <string.h>
42 #include <sys/mman.h>
43 #include <sys/socket.h>
44 #include <sys/stat.h>
45 #include <sys/types.h>
46 #include <sys/un.h>
47 #include <unistd.h>
48 
49 #include <iostream>
50 
51 #include "packet_types.h"
52 
53 namespace gr {
54 namespace CyberRadio {
55 
57 private:
58  std::string ip;
59  unsigned int port;
60  unsigned int block_rate;
61  unsigned int block_size;
62  unsigned int packets_per_block;
63 
64  int stream_counter;
65  bool program_starting;
66  int sock_fd;
67  //~ uint8_t * rxbuff;
68  struct Ndr308Frame *rxbuff;
69  int32_t thisCount, lastCount, countDiff;
70  bool d_iq_swap, d_byte_swap;
71  //~ struct Ndr308Frame * frame;
72 
73 public:
74  snapshot_source_c_impl(const std::string &ip, unsigned int port,
75  unsigned int block_size, unsigned int block_rate);
77  int initSocket(const std::string ip, unsigned short port);
78  void pause();
79 
80  // Where all the action really happens
81  int work(int noutput_items, gr_vector_const_void_star &input_items,
82  gr_vector_void_star &output_items);
83 };
84 
85 } // namespace CyberRadio
86 } // namespace gr
87 
88 #endif /* INCLUDED_CYBERRADIO_SNAPSHOT_SOURCE_C_IMPL_H */
snapshot_source_c_impl(const std::string &ip, unsigned int port, unsigned int block_size, unsigned int block_rate)
VITA 49 transmit-over-UDP frame information.
Definition: packet_types.h:104
int initSocket(const std::string ip, unsigned short port)
Provides GNU Radio blocks.
Definition: NDR651_duc_sink_mk2.h:21
<+description of block+>
Definition: snapshot_source_c.h:36
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
Definition: snapshot_source_c_impl.h:56