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);
34 fhicl::ParameterSet pset;
36 TLOG(TLVL_DEBUG) <<
"Sending init";
37 std::string sts = commander->send_init(pset, arg, arg);
38 TLOG(TLVL_DEBUG) <<
"init res=" << sts <<
", sending soft_init";
39 sts = commander->send_soft_init(pset,arg,arg);
40 TLOG(TLVL_DEBUG) <<
"soft_init res=" << sts <<
", sending legal_commands";
42 sts = commander->send_legal_commands();
43 TLOG(TLVL_DEBUG) <<
"legal_commands res=" << sts <<
", sending meta_command";
44 sts = commander->send_meta_command(
"test",
"test");
45 TLOG(TLVL_DEBUG) <<
"meta_command res=" << sts <<
", sending report";
46 sts = commander->send_report(
"test");
47 TLOG(TLVL_DEBUG) <<
"report res=" << sts <<
", sending start";
49 sts = commander->send_start(art::RunID(0x7357),arg,arg);
50 TLOG(TLVL_DEBUG) <<
"start res=" << sts <<
", sending status";
51 sts = commander->send_status();
52 TLOG(TLVL_DEBUG) <<
"status res=" << sts <<
", sending pause";
53 sts = commander->send_pause(arg,arg);
54 TLOG(TLVL_DEBUG) <<
"pause res=" << sts <<
", sending resume";
55 sts = commander->send_resume(arg,arg);
56 TLOG(TLVL_DEBUG) <<
"resume res=" << sts <<
", sending rollover_subrun";
57 sts = commander->send_rollover_subrun(arg);
58 TLOG(TLVL_DEBUG) <<
"rollover_subrun res=" << sts <<
", sending stop";
59 sts = commander->send_stop(arg,arg);
60 TLOG(TLVL_DEBUG) <<
"stop res=" << sts <<
", sending reinit";
61 sts = commander->send_reinit(pset, arg, arg);
62 TLOG(TLVL_DEBUG) <<
"reinit res=" << sts <<
", sending trace_set";
64 sts = commander->send_trace_set(
"TRACE",
"M", 0x7357);
65 TLOG(TLVL_DEBUG) <<
"trace_set res=" << sts <<
", sending trace_get";
66 sts = commander->send_trace_get(
"TRACE");
67 TLOG(TLVL_DEBUG) <<
"trace_get res=" << sts <<
", sending register_monitor";
69 sts = commander->send_register_monitor(
"test");
70 TLOG(TLVL_DEBUG) <<
"register_monitor res=" << sts <<
", sending unregister_monitor";
71 sts = commander->send_unregister_monitor(
"test");
72 TLOG(TLVL_DEBUG) <<
"unregister_monitor res=" << sts <<
", sending shutdown";
74 sts = commander->send_shutdown(arg);
75 TLOG(TLVL_DEBUG) <<
"shutdown res=" << sts <<
", DONE";
77 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.