18 std::ostream&
operator<<(std::ostream& os, std::shared_ptr<daqif::DaqStatus>
const& s) {
19 os << std::setprecision(std::numeric_limits<long double>::digits10 + 1);
21 <<
" id: " << s->getId() <<
"\n"
22 <<
" file_id: " << s->getFileId() <<
"\n"
23 <<
" state: \"" <<
ToString(s->getState()) <<
"\"\n"
24 <<
" substate: \"" <<
ToString(s->getSubState()) <<
"\"\n"
25 <<
" error: \"" << (s->getError() ?
"true" :
"false") <<
"\n"
26 <<
" message: " << s->getMessage() <<
"\n"
27 <<
" result: " << s->getResult() <<
"\n"
28 <<
" timestamp: " << s->getTimestamp();
34 std::ostream&
operator<<(std::ostream& os, std::shared_ptr<daqif::DaqReply>
const& s) {
36 <<
" id: " << s->getId() <<
"\n"
37 <<
" error: " << (s->getError() ?
"true" :
"false") <<
"\n";
41 std::ostream&
operator<<(std::ostream& os, std::shared_ptr<daqif::AwaitDaqReply>
const& s) {
42 os <<
"AwaitDaqReply:\n"
43 <<
" timeout: " << (s->getTimeout() ?
"true" :
"false") <<
"\n"
44 <<
" status: " << s->getStatus() <<
"\n";
49 operator<<(std::ostream& os, std::vector<std::shared_ptr<daqif::DaqStatus>>
const& vec) {
50 for (
auto const& s : vec) {
58 os << std::setprecision(std::numeric_limits<long double>::digits10 + 1);
73 << (s.t->getError() ?
"true" :
"false")
79 << s.t->getTimestamp() <<
"\n"
85 operator<<(std::ostream& os,
JsonPrint<std::vector<std::shared_ptr<daqif::DaqStatus>>>
const& vec) {
88 for (
auto const& s : vec.t) {
91 if (num < vec.t.size()) {
105 << (s.t->getError() ?
"true" :
"false") <<
"\n";
115 << (s.t->getTimeout() ?
"true" :
"false")
125 os <<
"\"" << s.
t <<
"\"";
136 sub->add_option(
"logger", m_logger,
"Logger name");
137 sub->add_option(
"level", m_level,
"Log level");
141 ::daqif::OcmDaqControlSync& daq_cmds,
143 auto log_info =
m_args.
mal->createDataEntity<stdif::LogInfo>();
144 log_info->setLogger(m_logger);
145 log_info->setLevel(m_level);
146 auto reply = std_cmds.SetLogLevel(log_info);
150 std::cout <<
"Reply: " << reply << std::endl;
155 sub->add_option(
"--id",
m_id,
"DAQ ID");
156 sub->add_option(
"--prefix",
m_prefix,
"File prefix");
157 sub->add_option(
"--properties",
m_properties,
"JSON properties");
163 ::daqif::OcmDaqControlSync& daq_cmds,
170 std::cout <<
"Reply: " << reply << std::endl;
175 sub->add_option(
"id", m_id,
"DAQ ID");
176 sub->add_option(
"keywords", m_keywords,
"JSON encoded list of keywords");
180 ::daqif::OcmDaqControlSync& daq_cmds,
182 auto reply = daq_cmds.UpdateKeywords(m_id, m_keywords);
186 std::cout <<
"Reply: " << reply << std::endl;
191 sub->add_option(
"id", m_id,
"DAQ ID");
192 sub->add_option(
"state", m_state,
"State to await");
193 sub->add_option(
"substate", m_substate,
"Substate to await");
194 sub->add_option(
"timeout", m_timeout,
"timeout in [fractional] seconds");
196 auto min_timeout = m_timeout + 2;
198 std::cerr <<
"Note: Setting request timeout to " << min_timeout
199 <<
"s due to await timeout exceeding request timeout\n";
200 m_args.timeout = min_timeout;
206 ::daqif::OcmDaqControlSync& daq_cmds,
208 auto state = daqif::FromString<daqif::DaqState>(m_state);
209 auto substate = daqif::FromString<daqif::DaqSubState>(m_substate);
210 auto reply = daq_cmds.AwaitDaqState(m_id, state, substate, m_timeout);
214 std::cout <<
"Reply: " << reply << std::endl;