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