1 #include "otsdaq-core/GatewaySupervisor/ARTDAQCommandable.h"
2 #include "artdaq/ExternalComms/MakeCommanderPlugin.hh"
3 #include "otsdaq-core/GatewaySupervisor/GatewaySupervisor.h"
5 ots::ARTDAQCommandable::ARTDAQCommandable(GatewaySupervisor* super)
6 : artdaq::Commandable(), theSupervisor_(super), theCommander_(nullptr)
10 ots::ARTDAQCommandable::~ARTDAQCommandable()
12 if(theCommander_ !=
nullptr)
14 theCommander_->send_shutdown(0);
15 if(commanderThread_.joinable())
16 commanderThread_.join();
20 void ots::ARTDAQCommandable::init(
int commanderId, std::string commanderType)
22 fhicl::ParameterSet ps;
23 ps.put<
int>(
"id", commanderId);
24 ps.put<std::string>(
"commanderPluginType", commanderType);
26 theCommander_ = artdaq::MakeCommanderPlugin(ps, *
this);
27 boost::thread::attributes attrs;
28 attrs.set_stack_size(4096 * 2000);
29 commanderThread_ = boost::thread(
30 attrs, boost::bind(&artdaq::CommanderInterface::run_server, theCommander_.get()));
37 std::vector<std::string> parameters;
38 parameters.push_back(ps.get<std::string>(
"config_name"));
40 auto ret = theSupervisor_->attemptStateMachineTransition(
44 theSupervisor_->activeStateMachineName_,
45 theSupervisor_->activeStateMachineWindowName_,
49 ret = theSupervisor_->attemptStateMachineTransition(
53 theSupervisor_->activeStateMachineName_,
54 theSupervisor_->activeStateMachineWindowName_,
63 std::vector<std::string> parameters;
64 auto ret = theSupervisor_->attemptStateMachineTransition(
68 theSupervisor_->activeStateMachineName_,
69 theSupervisor_->activeStateMachineWindowName_,
78 std::vector<std::string> parameters;
79 auto ret = theSupervisor_->attemptStateMachineTransition(
83 theSupervisor_->activeStateMachineName_,
84 theSupervisor_->activeStateMachineWindowName_,
93 std::vector<std::string> parameters;
94 auto ret = theSupervisor_->attemptStateMachineTransition(
98 theSupervisor_->activeStateMachineName_,
99 theSupervisor_->activeStateMachineWindowName_,
102 report_string_ = ret;
108 std::vector<std::string> parameters;
109 auto ret = theSupervisor_->attemptStateMachineTransition(
113 theSupervisor_->activeStateMachineName_,
114 theSupervisor_->activeStateMachineWindowName_,
117 report_string_ = ret;
123 std::vector<std::string> parameters;
124 auto ret = theSupervisor_->attemptStateMachineTransition(
128 theSupervisor_->activeStateMachineName_,
129 theSupervisor_->activeStateMachineWindowName_,
133 ret = theSupervisor_->attemptStateMachineTransition(
137 theSupervisor_->activeStateMachineName_,
138 theSupervisor_->activeStateMachineWindowName_,
141 report_string_ = ret;
146 std::string
const& args)
148 std::vector<std::string> parameters;
149 parameters.push_back(args);
150 auto ret = theSupervisor_->attemptStateMachineTransition(
154 theSupervisor_->activeStateMachineName_,
155 theSupervisor_->activeStateMachineWindowName_,
158 report_string_ = ret;
bool do_shutdown(uint64_t) override
Perform the shutdown transition.
bool do_meta_command(std::string const &, std::string const &) override
Run a module-defined command with the given parameter string.
bool do_stop(uint64_t, uint64_t) override
Perform the stop transition.
bool do_start(art::RunID, uint64_t, uint64_t) override
Perform the start transition.
bool do_resume(uint64_t, uint64_t) override
Perform the resume transition.
bool do_initialize(fhicl::ParameterSet const &, uint64_t, uint64_t) override
Perform the initialize transition.
bool do_pause(uint64_t, uint64_t) override
Perform the pause transition.