28 dabc::ModuleAsync(name, cmd),
51 for (
unsigned ix = 0; ix <
fAddrs.size(); ++ix) {
81 std::string tmpfile =
"output.log";
92 auto res = std::system(cmd.c_str());
95 std::ifstream t(tmpfile);
96 std::string str((std::istreambuf_iterator<char>(t)),
97 std::istreambuf_iterator<char>());
100 std::remove(tmpfile.c_str());
102 unsigned value1 = 0, value2 = 0;
104 std::sscanf(str.c_str(),
"0x%x 0x%x", &value1, &value2);
114 if (buf.
null())
return false;
119 int block_size = (fAddrs0.size() == 0) ? 2 : 3;
123 if (!iter.
NewSubevent(fAddrs.size() * 4 * block_size, fEventId))
return false;
128 iter.
evnt()->
SetId((
id & 0xfffffff0) | (fTriggerType & 0xf));
136 uint32_t *rawdata = (uint32_t *) iter.
rawdata();
137 for (
unsigned n=0; n < fAddrs.size(); ++n) {
140 if (block_size == 3) {
141 addr0 = (fAddrs0.size() >= fAddrs.size()) ? fAddrs0[n] : fAddrs0[0];
165 if (TimerName(timer) !=
"TrbNetRead")
170 if (ReadAllVariables(buf))
171 SendToAllOutputs(buf);
176 if (fInterval > 0)
return;
180 if (ReadAllVariables(buf))
181 SendToAllOutputs(buf);
Reference on memory from memory pool.
void SetTypeId(unsigned tid)
Represents command with its arguments.
Represents objects hierarchy of remote (or local) DABC process.
Hierarchy CreateHChild(const std::string &name, bool allowslahes=false, bool sortorder=false)
Create child item in hierarchy with specified name If allowslahes enabled, instead of subfolders item...
void Create(const std::string &name, bool withmutex=false)
Create top-level object with specified name.
void EnableHistory(unsigned length=100, bool withchilds=false)
Activate history production for selected element and its childs.
virtual void OnThreadAssigned()
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.
std::vector< uint64_t > AsUIntVect() const
uint64_t AsUInt(uint64_t dflt=0) const
std::string AsStr(const std::string &dflt="") const
double AsDouble(double dflt=0.) const
bool SetField(const std::string &name, const RecordField &v)
bool null() const
Returns true if reference contains nullptr.
Hierarchy fWorkerHierarchy
place for publishing of worker parameters
RecordField Cfg(const std::string &name, Command cmd=nullptr) const
Returns configuration field of specified name Configuration value of specified name searched in follo...
virtual bool Publish(const Hierarchy &h, const std::string &path)
double fInterval
Time interval for reading in seconds.
std::string GetItemName(unsigned addr)
unsigned fTriggerType
trigger type
std::string fTopFolder
name of top folder, which should exists also in every variable
std::string fShellCmd
shell command with formats pattern
std::vector< uint64_t > fAddrs
array of monitored address
bool ReadAllVariables(dabc::Buffer &buf)
void ProcessTimerEvent(unsigned timer) override
Method called by framework when timer event is produced.
std::vector< uint64_t > fAddrs0
array of monitored address
uint32_t DoRead(uint32_t addr0, uint32_t addr)
MonitorModule(const std::string &name, dabc::Command cmd=nullptr)
void BeforeModuleStart() override
void OnThreadAssigned() override
unsigned fSubevId
subevent id
Write iterator for HADAQ events/subevents.
hadaq::RawEvent * evnt() const
bool NewEvent(uint32_t evtSeqNr=0, uint32_t runNr=0, uint32_t minsubeventsize=0)
bool FinishSubEvent(uint32_t rawdatasz)
bool NewSubevent(uint32_t minrawsize=0, uint32_t trigger=0)
hadaq::RawSubevent * subevnt() const
std::string format(const char *fmt,...)
void SetValue(uint32_t *member, uint32_t val)
swapsave method to set value stolen from hadtu.h
void SetDecodingDirect(uint32_t dec)
Hadaq subevent structure.
void SetTrigNr(uint32_t trigger)
void SetTrigTypeTrb3(uint8_t typ)