otsdaq_components  v2_05_02_indev
OtsUDPHardware.h
1 #ifndef _ots_OtsUDPHardware_h_
2 #define _ots_OtsUDPHardware_h_
3 
4 #include "otsdaq-components/DAQHardware/FrontEndHardwareBase.h"
5 #include "otsdaq/NetworkUtilities/TransceiverSocket.h"
6 
7 namespace ots
8 {
9 class OtsUDPHardware : public TransceiverSocket, public FrontEndHardwareBase
10 {
11  public:
12  OtsUDPHardware(std::string hostIPAddress,
13  unsigned int hostPort,
14  std::string boardIPAddress,
15  unsigned int boardPort,
16  unsigned int version = -1,
17  bool verbose = false);
18  virtual ~OtsUDPHardware(void);
19 
20  virtual void write(const std::string& sendBuffer);
21  virtual void write(const std::vector<std::string>& sendBuffers);
22  virtual void writeAndAcknowledge(const std::string& sendBuffer,
23  int timeoutSeconds = -1);
24  virtual void writeAndAcknowledge(const std::vector<std::string>& sendBuffers,
25  int timeoutSeconds = -1);
26  virtual void read(const std::string& sendBuffer,
27  std::string& receiveBuffer,
28  int timeoutSeconds = -1);
29  virtual void read(const std::vector<std::string>& sendBuffers,
30  std::vector<std::string>& receiveBuffers,
31  int timeoutSeconds = -1);
32 
33  virtual int flushRead() { return clearReadSocket(); }
34 
35  void read(const std::string& sendBuffer,
36  uint64_t& receiveQuadWord,
37  int timeoutSeconds = -1);
38  void read(const std::string& sendBuffer,
39  std::vector<uint64_t>& receiveQuadWords,
40  int timeoutSeconds = -1);
41  void read(const std::vector<std::string>& sendBuffers,
42  std::vector<std::vector<uint64_t> >& receiveQuadWordsVector,
43  int timeoutSeconds = -1);
44  int clearReadSocket();
45  //
46  // virtual int write(uint64_t address, const std::string& value){return 0;}
47  // virtual int read (uint64_t address, std::string& value){return 0;}
48 
49  protected:
50  OtsUDPHardware(std::string boardIPAddress,
51  unsigned int boardPort,
52  unsigned int version = -1,
53  bool verbose = false);
54  Socket OtsUDPBoard_;
55  std::string acknowledgment_;
56  bool verbose_;
57 };
58 }
59 
60 #endif