otsdaq_mu2e  v2_04_02
DemoInterfaceTestMain.cc
1 #include <fstream>
2 #include <iostream>
3 
4 #include "otsdaq-components/FEInterfaces/FEOtsUDPTemplateInterface.h"
5 #include "otsdaq/ConfigurationInterface/ConfigurationInterface.h"
6 #include "otsdaq/ConfigurationInterface/ConfigurationManager.h"
7 #include "otsdaq/TableCore/TableGroupKey.h"
8 /*
9 
10 #include "otsdaq-components/FEInterfaces/FEWOtsUDPFSSRInterface.h"
11 #include "otsdaq-components/FEInterfaces/FEWOtsUDPHCALInterface.h"
12 #include "otsdaq/ConfigurationDataFormats/FEWOtsUDPHardwareTable.h"
13 */
14 using namespace ots;
15 
16 int main(int argc, char** argv)
17 {
18  // Variables
19  const int supervisorInstance_ = 1;
20  const unsigned int configurationKeyValue_ = 1;
21 
22  ConfigurationManager* theConfigurationManager_ = new ConfigurationManager();
23 
24  std::string XDAQContextConfigurationName_ = "XDAQContextTable";
25  std::string supervisorContextUID_ = "mainContext";
26  std::string supervisorApplicationUID_ = "FESupervisor";
27  std::string interfaceUID_ = "ExampleInterface0";
28  std::string supervisorConfigurationPath_ =
29  "/" + supervisorContextUID_ + "/LinkToApplicationConfiguration/" +
30  supervisorApplicationUID_ + "/LinkToSupervisorConfiguration";
31  const ConfigurationTree theXDAQContextConfigTree_ =
32  theConfigurationManager_->getNode(XDAQContextConfigurationName_);
33 
34  std::string configurationGroupName = "defaultConfig";
35  std::pair<std::string, TableGroupKey> theGroup(configurationGroupName,
36  TableGroupKey(configurationKeyValue_));
37 
38  theConfigurationManager_->loadTableGroup(theGroup.first, theGroup.second, true);
39 
40  FEOtsUDPTemplateInterface* theInterface_ = new FEOtsUDPTemplateInterface(
41  interfaceUID_,
42  theXDAQContextConfigTree_,
43  supervisorConfigurationPath_ + "/LinkToFEInterfaceTable/" + interfaceUID_ +
44  "/LinkToFETypeConfiguration");
45  std::cout << "Done with new" << std::endl;
46  // Test interface class methods here //
47  theInterface_->configure();
48  theInterface_->start(std::string(argv[1]));
49  unsigned int second = 1000; // x1ms
50  unsigned int time = 60 * 60 * second;
51  unsigned int counter = 0;
52  while(counter++ < time)
53  {
54  theInterface_->running(); // There is a 1ms sleep inside the running
55  // std::cout << counter << std::endl;
56  }
57  theInterface_->stop();
58 
59  return 0;
60 }