00001 #ifndef _ots_OtsUDPHardware_h_
00002 #define _ots_OtsUDPHardware_h_
00003
00004 #include "otsdaq-components/DAQHardware/FrontEndHardwareBase.h"
00005 #include "otsdaq-core/NetworkUtilities/TransceiverSocket.h"
00006
00007 namespace ots
00008 {
00009
00010 class OtsUDPHardware : public TransceiverSocket, public FrontEndHardwareBase
00011 {
00012
00013 public:
00014 OtsUDPHardware (std::string hostIPAddress, unsigned int hostPort, std::string boardIPAddress, unsigned int boardPort, unsigned int version = -1, bool verbose = false);
00015 virtual ~OtsUDPHardware(void);
00016
00017 virtual void write (const std::string& sendBuffer) throw(std::runtime_error);
00018 virtual void write (const std::vector<std::string>& sendBuffers) throw(std::runtime_error);
00019 virtual void writeAndAcknowledge(const std::string& sendBuffer, int timeoutSeconds = -1) throw(std::runtime_error);
00020 virtual void writeAndAcknowledge(const std::vector<std::string>& sendBuffers, int timeoutSeconds = -1) throw(std::runtime_error);
00021 virtual void read (const std::string& sendBuffer , std::string& receiveBuffer, int timeoutSeconds = -1) throw(std::runtime_error);
00022 virtual void read (const std::vector<std::string>& sendBuffers, std::vector<std::string>& receiveBuffers, int timeoutSeconds = -1) throw(std::runtime_error);
00023
00024 virtual int flushRead () throw(std::runtime_error) {return clearReadSocket();}
00025
00026 void read (const std::string& sendBuffer, uint64_t& receiveQuadWord, int timeoutSeconds = -1) throw(std::runtime_error);
00027 void read (const std::string& sendBuffer, std::vector<uint64_t>& receiveQuadWords, int timeoutSeconds = -1) throw(std::runtime_error);
00028 void read (const std::vector<std::string>& sendBuffers, std::vector<std::vector<uint64_t> >& receiveQuadWordsVector, int timeoutSeconds = -1) throw(std::runtime_error);
00029 int clearReadSocket ();
00030
00031
00032
00033
00034 protected:
00035 OtsUDPHardware (std::string boardIPAddress, unsigned int boardPort, unsigned int version = -1, bool verbose = false);
00036 Socket OtsUDPBoard_;
00037 std::string acknowledgment_;
00038 bool verbose_;
00039
00040 };
00041
00042
00043 }
00044
00045 #endif