1 #include "artdaq/Application/BoardReaderApp.hh"
14 external_request_status_ =
true;
20 fragment_receiver_ptr_.reset(
nullptr);
22 external_request_status_ = fragment_receiver_ptr_->initialize(pset, timeout, timestamp);
23 if (! external_request_status_)
25 report_string_ =
"Error initializing ";
26 report_string_.append(name_ +
" ");
27 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
30 return external_request_status_;
36 external_request_status_ = fragment_receiver_ptr_->start(
id, timeout, timestamp);
37 if (! external_request_status_)
39 report_string_ =
"Error starting ";
40 report_string_.append(name_ +
" ");
41 report_string_.append(
"for run number ");
42 report_string_.append(boost::lexical_cast<std::string>(
id.run()));
43 report_string_.append(
", timeout ");
44 report_string_.append(boost::lexical_cast<std::string>(timeout));
45 report_string_.append(
", timestamp ");
46 report_string_.append(boost::lexical_cast<std::string>(timestamp));
47 report_string_.append(
".");
50 fragment_processing_future_ =
52 fragment_receiver_ptr_.get());
54 return external_request_status_;
60 external_request_status_ = fragment_receiver_ptr_->stop(timeout, timestamp);
61 if (! external_request_status_)
63 report_string_ =
"Error stopping ";
64 report_string_.append(name_ +
".");
68 if (fragment_processing_future_.valid())
70 int number_of_fragments_sent = fragment_processing_future_.get();
71 TLOG_DEBUG(name_ +
"App") <<
"do_stop(uint64_t, uint64_t): "
72 <<
"Number of fragments sent = " << number_of_fragments_sent
76 return external_request_status_;
82 external_request_status_ = fragment_receiver_ptr_->pause(timeout, timestamp);
83 if (! external_request_status_)
85 report_string_ =
"Error pausing ";
86 report_string_.append(name_ +
".");
89 if (fragment_processing_future_.valid())
91 int number_of_fragments_sent = fragment_processing_future_.get();
92 TLOG_DEBUG(name_ +
"App") <<
"do_pause(uint64_t, uint64_t): "
93 <<
"Number of fragments sent = " << number_of_fragments_sent
97 return external_request_status_;
103 external_request_status_ = fragment_receiver_ptr_->resume(timeout, timestamp);
104 if (! external_request_status_)
106 report_string_ =
"Error resuming ";
107 report_string_.append(name_ +
".");
110 fragment_processing_future_ =
112 fragment_receiver_ptr_.get());
114 return external_request_status_;
120 external_request_status_ = fragment_receiver_ptr_->shutdown(timeout);
121 if (! external_request_status_)
123 report_string_ =
"Error shutting down ";
124 report_string_.append(name_ +
".");
126 return external_request_status_;
132 external_request_status_ = fragment_receiver_ptr_->soft_initialize(pset, timeout, timestamp);
133 if (! external_request_status_)
135 report_string_ =
"Error soft-initializing ";
136 report_string_.append(name_ +
" ");
137 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
139 return external_request_status_;
144 external_request_status_ = fragment_receiver_ptr_->reinitialize(pset, timeout, timestamp);
145 if (! external_request_status_)
147 report_string_ =
"Error reinitializing ";
148 report_string_.append(name_ +
" ");
149 report_string_.append(
"with ParameterSet = \"" + pset.to_string() +
"\".");
151 return external_request_status_;
156 TLOG_DEBUG(name_ +
"App") <<
"Booted state entry action called." << TLOG_ENDL;
162 fragment_receiver_ptr_.reset(
nullptr);
167 std::string resultString;
170 if (which ==
"transition_status")
172 if (report_string_.length() > 0) {
return report_string_; }
173 else {
return "Success"; }
185 if (fragment_receiver_ptr_.get() != 0)
187 resultString.append(fragment_receiver_ptr_->report(which));
191 resultString.append(
"This BoardReader has not yet been initialized and ");
192 resultString.append(
"therefore can not provide reporting.");
bool do_soft_initialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp) override
Soft-Initialize the BoardReaderCore.
bool do_resume(uint64_t timeout, uint64_t timestamp) override
Resume the BoardReaderCore.
bool do_stop(uint64_t timeout, uint64_t timestamp) override
Stop the BoardReaderCore.
BoardReaderCore implements the state machine for the BoardReader artdaq application. It contains a CommandableFragmentGenerator, which generates Fragments which are then sent to a DataSenderManager by BoardReaderCore.
bool do_shutdown(uint64_t timeout) override
Shutdown the BoardReaderCore.
bool do_reinitialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp) override
Reinitialize the BoardReaderCore.
std::string report(std::string const &which) const override
If which is "transition_status", report the status of the last transition. Otherwise pass through to ...
void BootedEnter() override
Action taken upon entering the "Booted" state.
bool do_start(art::RunID id, uint64_t timeout, uint64_t timestamp) override
Start the BoardReaderCore.
BoardReaderApp(int rank, std::string name)
BoardReaderApp Constructor.
size_t process_fragments()
Main working loop of the BoardReaderCore.
bool do_initialize(fhicl::ParameterSet const &pset, uint64_t timeout, uint64_t timestamp) override
Initialize the BoardReaderCore.
bool do_pause(uint64_t timeout, uint64_t timestamp) override
Pause the BoardReaderCore.