artdaq_mfextensions  v1_05_00
EHReplyReceiver.cc
1 #include <time.h>
2 #include <string>
3 #include <sstream>
4 
5 #include <rms/provider/DDSConnection.h>
6 #include <rms/base/RmsDestination.h>
7 #include <rms/RmsReceiver.h>
8 #include <rms/RmsSender.h>
9 
10 #include <NovaTimingUtilities/TimingUtilities.h>
11 #include <DAQMessages/ccpp_ErrorHandlerMessages.h>
12 #include <ErrorHandler/EHListener.h>
13 #include <boost/shared_ptr.hpp>
14 
15 
16 using namespace gov::fnal::cd::rms;
17 using namespace novadaq::timeutils;
18 
19 
20 
21 int main() {
22 
23  // create the connection to RMS
24  boost::shared_ptr<provider::DDSConnection>
25  rmsConnection(new provider::DDSConnection("EHTestApplication",0));
26 
27 
28  // create the destination that represents where we will receive
29  // messages from
30  base::RmsDestination receiveDest("EHServerMailbox",
31  base::RmsDestination::EH_CHANNEL);
32 
33 
34  // create a receiver with the connection object and destination
35  RmsReceiver<provider::DDSConnection,
36  errorhandlermessages::ErrorHandlerReply, EHListener>
37  requestReceiver(rmsConnection, receiveDest);
38 
39  boost::shared_ptr<EHListener>
40  listener(new EHListener(rmsConnection));
41 
42  requestReceiver.setListener(listener);
43 
44 
45  // waiting for a message to arrive
46  std::cout << "Listening for messages..." << std::endl;
47 
48 
49 
50  // cleanup and exit
51  requestReceiver.close();
52  rmsConnection->close();
53 
54  return 0;
55 }