libcyberradio  22.01.24
VitaIqUdpPort.h
1 /* -*- c++ -*- */
2 /***************************************************************************
3  * \file VitaIqUdpPort.h
4  *
5  * \brief UDP port for handling incoming VITA 49 or I/Q data.
6  *
7  * \author DA
8  * \copyright 2016 CyberRadio Solutions, Inc.
9  */
10 
11 #ifndef INCLUDED_LIBCYBERRADIO_VITAIQUDPPORT_H_
12 #define INCLUDED_LIBCYBERRADIO_VITAIQUDPPORT_H_
13 
14 #include "LibCyberRadio/Common/Debuggable.h"
15 #include <boost/asio.hpp>
16 #include <boost/format.hpp>
17 #include <string>
18 
22 namespace LibCyberRadio
23 {
24  /*
25  * Class that grabs channel I/Q data from a UDP port.
26  */
27  class VitaIqUdpPort : public Debuggable
28  {
29  public:
30  VitaIqUdpPort(const std::string& host = "0.0.0.0",
31  int port = 40001,
32  int packet_size = 8192,
33  bool debug = false);
34  ~VitaIqUdpPort();
35  void read_data();
36  void clear_buffer();
37  bool is_packet_ready() const;
38 
39  public:
40  std::string host;
41  int port;
42  int packet_size;
43  bool connected; // are we connected?
44  boost::asio::ip::udp::socket *socket;
45  boost::asio::ip::udp::endpoint endpoint;
46  boost::asio::io_context io_service;
47  unsigned char* recv_buffer;
48  int bytes_recvd;
49  };
50 
51 } /* namespace LibCyberRadio */
52 
53 #endif /* INCLUDED_LIBCYBERRADIO_VITAIQUDPPORT_H_ */
Defines functionality for LibCyberRadio applications.
Definition: App.h:23