1 #define TRACE_NAME "commander_test"
3 #include "artdaq/ExternalComms/CommanderInterface.hh"
5 #include "artdaq/ExternalComms/MakeCommanderPlugin.hh"
6 #include "artdaq/Application/LoadParameterSet.hh"
8 #include "artdaq/DAQdata/Globals.hh"
9 #include <boost/thread.hpp>
11 int main(
int argc,
char** argv)
15 fhicl::TableFragment<artdaq::CommanderInterface::Config> commanderPluginConfig;
17 fhicl::Atom<std::string> partition_number{ fhicl::Name{
"partition_number" }, fhicl::Comment{
"Partition to run in" },
"" };
19 artdaq::configureMessageFacility(
"transfer_driver");
20 fhicl::ParameterSet config_ps = LoadParameterSet<Config>(argc, argv,
"commander_test",
"A test driver for CommanderInterface plugins");
30 boost::thread commanderThread([&] { commander->run_server(); });
31 while (!commander->GetStatus()) usleep(10000);
35 fhicl::ParameterSet pset;
37 TLOG(TLVL_DEBUG) <<
"Sending init";
38 std::string sts = commander->send_init(pset, arg, arg);
39 TLOG(TLVL_DEBUG) <<
"init res=" << sts <<
", sending soft_init";
40 sts = commander->send_soft_init(pset,arg,arg);
41 TLOG(TLVL_DEBUG) <<
"soft_init res=" << sts <<
", sending legal_commands";
43 sts = commander->send_legal_commands();
44 TLOG(TLVL_DEBUG) <<
"legal_commands res=" << sts <<
", sending meta_command";
45 sts = commander->send_meta_command(
"test",
"test");
46 TLOG(TLVL_DEBUG) <<
"meta_command res=" << sts <<
", sending report";
47 sts = commander->send_report(
"test");
48 TLOG(TLVL_DEBUG) <<
"report res=" << sts <<
", sending start";
50 sts = commander->send_start(art::RunID(0x7357),arg,arg);
51 TLOG(TLVL_DEBUG) <<
"start res=" << sts <<
", sending status";
52 sts = commander->send_status();
53 TLOG(TLVL_DEBUG) <<
"status res=" << sts <<
", sending pause";
54 sts = commander->send_pause(arg,arg);
55 TLOG(TLVL_DEBUG) <<
"pause res=" << sts <<
", sending resume";
56 sts = commander->send_resume(arg,arg);
57 TLOG(TLVL_DEBUG) <<
"resume res=" << sts <<
", sending rollover_subrun";
58 sts = commander->send_rollover_subrun(arg, arg);
59 TLOG(TLVL_DEBUG) <<
"rollover_subrun res=" << sts <<
", sending stop";
60 sts = commander->send_stop(arg,arg);
61 TLOG(TLVL_DEBUG) <<
"stop res=" << sts <<
", sending reinit";
62 sts = commander->send_reinit(pset, arg, arg);
63 TLOG(TLVL_DEBUG) <<
"reinit res=" << sts <<
", sending trace_set";
65 sts = commander->send_trace_set(
"TRACE",
"M", 0x7357);
66 TLOG(TLVL_DEBUG) <<
"trace_set res=" << sts <<
", sending trace_get";
67 sts = commander->send_trace_get(
"TRACE");
68 TLOG(TLVL_DEBUG) <<
"trace_get res=" << sts <<
", sending register_monitor";
70 sts = commander->send_register_monitor(
"test");
71 TLOG(TLVL_DEBUG) <<
"register_monitor res=" << sts <<
", sending unregister_monitor";
72 sts = commander->send_unregister_monitor(
"test");
73 TLOG(TLVL_DEBUG) <<
"unregister_monitor res=" << sts <<
", sending shutdown";
75 sts = commander->send_shutdown(arg);
76 TLOG(TLVL_DEBUG) <<
"shutdown res=" << sts <<
", DONE";
78 if(commanderThread.joinable()) commanderThread.join();
Commandable is the base class for all artdaq components which implement the artdaq state machine...
std::unique_ptr< artdaq::CommanderInterface > MakeCommanderPlugin(const fhicl::ParameterSet &commander_pset, artdaq::Commandable &commandable)
Load a CommanderInterface plugin.
static int partition_number_
The partition number of the current application.