00001 #ifndef MFVIEWER_RECEIVERS_UDP_RECEIVER_HH
00002 #define MFVIEWER_RECEIVERS_UDP_RECEIVER_HH
00003
00004 #include "mfextensions/Receivers/MVReceiver.hh"
00005
00006 #include "messagefacility/MessageLogger/MessageLogger.h"
00007 #include "messagefacility/Utilities/MessageFacilityMsg.h"
00008
00009 #include <boost/asio.hpp>
00010 using boost::asio::ip::udp;
00011
00012 namespace mfviewer
00013 {
00017 class UDPReceiver : public MVReceiver
00018 {
00019 Q_OBJECT
00020 public:
00021 explicit UDPReceiver(fhicl::ParameterSet pset);
00022
00023 virtual ~UDPReceiver();
00024
00025
00026 void run() override;
00027
00028
00029 mf::MessageFacilityMsg read_msg(std::string input);
00030
00031 static bool validate_packet(std::string input);
00032
00033 private:
00034 int port_;
00035 boost::asio::io_service io_service_;
00036 udp::socket socket_;
00037 char buffer_[0x10000];
00038 bool debug_;
00039 };
00040 }
00041
00042 #endif