22 dabc::ModuleAsync(name, cmd),
34 double period =
Cfg(prefix +
"Period", cmd).
AsDouble(1);
39 CreateTimer(
"update", (period>0.01) ? period : 0.01);
48 if (fDoRec && (TimerName(timer) ==
"update"))
60 unsigned nextsize = GetRecRawSize();
62 if (fIter.IsAnyEvent() && !fIter.IsPlaceForEvent(nextsize,
true)) {
65 if (!CanSendToAllOutputs())
return;
68 SendToAllOutputs(buf);
70 fLastSendTime.GetNow();
73 if (!fIter.IsBuffer()) {
76 if (buf.
null()) {
EOUT(
"Cannot take buffer for FESA data");
return; }
80 if (!fIter.IsPlaceForEvent(nextsize,
true)) {
81 EOUT(
"EZCA event %u too large for current buffer size", nextsize);
85 unsigned evid = GetNextEventNumber();
87 fRec.SetEventId(evid);
88 fRec.SetEventTime(GetNextEventTime());
91 fIter.NewSubevent2(fSubeventId);
93 unsigned size = WriteRecRawData(fIter.rawdata(), fIter.maxrawdatasize());
96 EOUT(
"Fail to write data into MBS subevent");
99 fIter.FinishSubEvent(size);
102 if (fLastSendTime.Expired(fFlushTime) && CanSendToAllOutputs()) {
104 SendToAllOutputs(buf);
105 fLastSendTime.GetNow();
Reference on memory from memory pool.
Represents command with its arguments.
unsigned NumOutputs() const
unsigned CreateTimer(const std::string &name, double period_sec=-1., bool synchron=false)
void EnsurePorts(unsigned numinp=0, unsigned numout=0, const std::string &poolname="")
Method ensure that at least specified number of input and output ports will be created.
uint64_t AsUInt(uint64_t dflt=0) const
double AsDouble(double dflt=0.) const
bool null() const
Returns true if reference contains nullptr.
RecordField Cfg(const std::string &name, Command cmd=nullptr) const
Returns configuration field of specified name Configuration value of specified name searched in follo...
unsigned fSubeventId
full id number for subevent
virtual ~MonitorSlowControl()
virtual unsigned GetNextEventTime()
MonitorSlowControl(const std::string &name, const std::string &prefix, dabc::Command cmd=nullptr)
bool fDoRec
when true, record should be filled
double fFlushTime
time to flush event
virtual void ProcessTimerEvent(unsigned timer)
Method called by framework when timer event is produced.
const char * xmlFlushTimeout