70 fLongValues.resize(fLongRecords.size(), 0);
71 fLongRes.resize(fLongRecords.size(),
false);
74 fDoubleValues.resize(fDoubleRecords.size(), 0.);
75 fDoubleRes.resize(fDoubleRecords.size(),
false);
82 DOUT1(
"EpicsInput %s - Timeout = %e s, subevtid:%d, update flag:%s id:%s ",
83 fName.c_str(), fTimeout,fSubeventId, fUpdateFlagRecord.c_str(),fIDNumberRecord.c_str());
92 DOUT1(
"EpicsInput::Close");
100 if (fEzcaTimeout>0) ezcaSetTimeout(fEzcaTimeout);
102 if (fEzcaRetryCnt>0) ezcaSetRetryCount(fEzcaRetryCnt);
104 if (fEzcaDebug) ezcaDebugOn();
107 if (fEzcaAutoError) ezcaAutoErrorMessageOn();
108 else ezcaAutoErrorMessageOff();
110 if (!fUpdateFlagRecord.empty()) {
114 if (CA_GetLong(fUpdateFlagRecord, flag) != 0) {
115 EOUT(
"Cannot get update record %s", fUpdateFlagRecord.c_str());
119 if (flag == fLastFlagValue) {
121 DOUT3(
"EpicsInput::Read_Size same flag value, repeat after timeout %3.1f", fTimeout);
125 fLastFlagValue = flag;
127 if (!fUpdateCommandReceiver.empty()) {
147 if (!fIDNumberRecord.empty()) {
150 DOUT1(
"Event number record reading %s retr %d tmout %5.3f", fIDNumberRecord.c_str(), ezcaGetRetryCount(), ezcaGetTimeout());
151 if (CA_GetLong(fIDNumberRecord, fEventNumber) != 0) {
152 EOUT(
"Cannot read event number from record %s", fIDNumberRecord.c_str());
155 DOUT1(
"Event number record reading %s = %ld ", fIDNumberRecord.c_str(), fEventNumber);
157 fEventNumber = fCounter;
172 if ((NumLongRecords() + NumDoubleRecords()) > 0) {
177 for (
unsigned ix = 0; ix < NumLongRecords(); ix++) {
180 int ret = CA_GetLong(GetLongRecord(ix), fLongValues[ix]);
181 if (ret!=EZCA_OK)
EOUT(
"Request long %s Ret = %s", GetLongRecord(ix).c_str(), CA_RetCode(ret));
184 for (
unsigned ix = 0; ix < NumDoubleRecords(); ix++) {
185 fDoubleValues[ix] = 0;
186 fDoubleRes[ix] =
true;
187 int ret = CA_GetDouble(GetDoubleRecord(ix), fDoubleValues[ix]);
188 if (ret!=EZCA_OK)
EOUT(
"Request double %s Ret = %s", GetDoubleRecord(ix).c_str(), CA_RetCode(ret));
191 int *rcs(0), nrcs(0);
193 if (ezcaEndGroupWithReport(&rcs, &nrcs) != EZCA_OK) {
194 EOUT(
"EZCA error %s", CA_ErrorString().c_str());
195 for (
unsigned i=0; i< (unsigned) nrcs; i++)
196 if (i<fLongRecords.size()) {
198 fLongRes[ix] = (rcs[i]==EZCA_OK);
200 EOUT(
"Problem getting long %s ret %s", fLongRecords[ix].c_str(), CA_RetCode(rcs[i]));
202 unsigned ix = i - fLongRecords.size();
203 fDoubleRes[ix] = (rcs[i]==EZCA_OK);
205 EOUT(
"Problem getting double %s ret %s", fDoubleRecords[ix].c_str(), CA_RetCode(rcs[i]));
216 for (
unsigned ix = 0; ix < fLongRecords.size(); ++ix)
217 if (fLongRes[ix]) rec.
AddLong(fLongRecords[ix], fLongValues[ix]);
219 for (
unsigned ix = 0; ix < fDoubleRecords.size(); ++ix)
220 if (fDoubleRes[ix]) rec.
AddDouble(fDoubleRecords[ix], fDoubleValues[ix]);
234 EOUT(
"Fail to write data into MBS subevent");
250 int rev = ezcaGet((
char*) name.c_str(), ezcaLong, 1, &val);
252 EOUT(
"%s", CA_ErrorString().c_str());
254 DOUT3(
"EpicsInput::CA_GetLong(%s) = %d",name.c_str(),val);
260 int rev=ezcaGet((
char*) name.c_str(), ezcaDouble, 1, &val);
262 EOUT(
"%s", CA_ErrorString().c_str());
264 DOUT3(
"EpicsInput::CA_GetDouble(%s) = %f",name.c_str(),val);
272 char *error_msg_buff(0);
273 ezcaGetErrorString(NULL, &error_msg_buff);
274 if (error_msg_buff!=0) res = error_msg_buff;
275 ezcaFree(error_msg_buff);
283 case EZCA_OK:
return "EZCA_OK";
284 case EZCA_INVALIDARG:
return "EZCA_INVALIDARG";
285 case EZCA_FAILEDMALLOC:
return "EZCA_FAILEDMALLOC";
286 case EZCA_CAFAILURE:
return "EZCA_CAFAILURE";
287 case EZCA_UDFREQ:
return "EZCA_UDFREQ";
288 case EZCA_NOTCONNECTED:
return "EZCA_NOTCONNECTED";
289 case EZCA_NOTIMELYRESPONSE:
return "EZCA_NOTIMELYRESPONSE";
290 case EZCA_INGROUP:
return "EZCA_INGROUP";
291 case EZCA_NOTINGROUP:
return "EZCA_NOTINGROUP";
292 case EZCA_ABORTED:
return "EZCA_ABORTED";
Reference on memory from memory pool.
Represents command with its arguments.
bool SetInt(const std::string &name, int v)
Command & SetReceiver(const std::string &itemname)
These methods prepare command so, that one can submit command to the manager like: dabc::mgr....
std::vector< std::string > AsStrVect() const
bool AsBool(bool dflt=false) const
std::string AsStr(const std::string &dflt="") const
int64_t AsInt(int64_t dflt=0) const
double AsDouble(double dflt=0.) const
Reference on dabc::Worker
RecordField Cfg(const std::string &name, Command cmd=nullptr) const
Returns configuration record of specified name.
Record for manipulation with slow control data.
void SetEventId(uint32_t id)
void SetEventTime(uint32_t tm)
unsigned Write(void *buf, unsigned buflen)
void AddDouble(const std::string &name, double value, bool checkduplicate=false)
Method add double record.
void AddLong(const std::string &name, int64_t value, bool checkduplicate=false)
Method add long record.
Write iterator for MBS events/subevents.
bool FinishSubEvent(uint32_t rawdatasz=0)
bool NewSubevent2(uint32_t fullid)
uint32_t maxrawdatasize() const
bool NewEvent(EventNumType event_number=0, uint32_t subeventsize=0)
const char * xmlUpdateFlagRecord
const char * nameUpdateCommand
const char * xmlEzcaAutoError
indicates if error should be automatically printed
const char * xmlNameLongRecords
const char * xmlCommandReceiver
const char * xmlEventIDRecord
const char * xmlEpicsSubeventId
const char * xmlEpicsName
const char * xmlEzcaDebug
retry counter for ezca operation
const char * xmlEzcaTimeout
timeout for ezca operation
const char * xmlEzcaRetryCount
retry counter for ezca operation
const char * xmlNameDoubleRecords
Class for acquiring and holding timestamps.
double SpentTillNow() const
Method return time in second, spent from the time kept in TimeStamp instance If time was not set befo...