GNU Radio's CYBERRADIO Package
snapshot_vector_source_impl.h
Go to the documentation of this file.
1/* -*- c++ -*- */
2/*
3 * Copyright 2022 G3.
4 *
5 * SPDX-License-Identifier: GPL-3.0-or-later
6 */
7
8#ifndef INCLUDED_CYBERRADIO_SNAPSHOT_VECTOR_SOURCE_IMPL_H
9#define INCLUDED_CYBERRADIO_SNAPSHOT_VECTOR_SOURCE_IMPL_H
10
12
13#include <arpa/inet.h>
14#include <errno.h>
15#include <fcntl.h>
16#include <inttypes.h>
17#include <linux/if_ether.h>
18#include <linux/if_packet.h>
19#include <netinet/ip.h>
20#include <netinet/udp.h>
21#include <net/ethernet.h>
22#include <net/if.h>
23#include <netinet/in.h>
24#include <netdb.h>
25#include <poll.h>
26#include <signal.h>
27#include <stdio.h>
28#include <stdlib.h>
29#include <string.h>
30#include <sys/mman.h>
31#include <sys/socket.h>
32#include <sys/stat.h>
33#include <sys/types.h>
34#include <sys/un.h>
35#include <unistd.h>
36#include <boost/bind/bind.hpp>
37#include <iostream>
38#include <vector>
39#include <volk/volk.h>
40#include <poll.h>
41#include <sys/uio.h>
42
43#include "packet_types.h"
44
45
46namespace gr {
47 namespace CyberRadio {
48
50 {
51 private:
52
53 std::string d_radio_type;
54 std::string d_ip;
55 unsigned int d_port;
56 unsigned int d_block_rate;
57 unsigned int d_block_size;
58 bool d_tag_frame;
59
60 std::string ip;
61 unsigned int port;
62 unsigned int block_rate;
63 unsigned int block_size;
64 unsigned int packets_per_block;
65
66 bool d_byteSwap, d_iqSwap;
67 bool d_bswap32, d_bswap16;
68 int d_samples_per_frame;
69 bool initializing, running;
70
71
72 int stream_counter, sample_counter;
73 bool program_starting;
74 int sock_fd;
75 std::vector<gr_complex> sampleVector;
76 struct iovec rxVec[3];
77 int expectedRxSize;
78 struct pollfd pfd;
79
80 int32_t thisCount,lastCount,countDiff;
81 bool d_iq_swap, d_byte_swap;
82
83 void (*_parseHeader)(char *, int);
84
85 void set_bswap_flags(void);
86 void set_byteSwap(bool byteSwap);
87 void set_iqSwap(bool iqSwap);
88
89 static void _parseHeaderNull(char * hdr, int hdr_len) {std::cout << "_parseHeaderNull" << std::endl;};
90 static void _parseHeaderNdr308(char * hdr, int hdr_len) {std::cout << "_parseHeaderNdr308" << std::endl;};
91 static void _parseHeaderNdr551(char * hdr, int hdr_len) {std::cout << "_parseHeaderNdr551" << std::endl;};
92
93 void rxControlMsg(pmt::pmt_t msg);
94 void txStatusMsg(void);
95
96 void determine_radio_type( void );
97
98 public:
99 snapshot_vector_source_impl(const std::string radio_type, const std::string &ip, unsigned int port, unsigned int block_size, unsigned int block_rate);
101 int initSocket(const std::string ip, unsigned short port);
102 void pause();
103
104 bool start(void);
105 bool stop(void);
106
107 int work(
108 int noutput_items,
109 gr_vector_const_void_star &input_items,
110 gr_vector_void_star &output_items
111 );
112 };
113
114 } // namespace CyberRadio
115} // namespace gr
116
117#endif /* INCLUDED_CYBERRADIO_SNAPSHOT_VECTOR_SOURCE_IMPL_H */
int initSocket(const std::string ip, unsigned short port)
snapshot_vector_source_impl(const std::string radio_type, const std::string &ip, unsigned int port, unsigned int block_size, unsigned int block_rate)
int work(int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items)
<+description of block+>
Definition snapshot_vector_source.h:23
Provides programming elements for controlling the CyberRadio Solutions NDR651 radio.
Definition single_pole_iir.h:31
Provides programming elements for controlling CyberRadio Solutions products.
Definition single_pole_iir.h:30