41 fiRetryCnt(par->GetRetryCnt()),
42 fxEvent(nullptr), fxBuffer(nullptr), fxInfoHeader(nullptr),
43 fbIsOpen(kFALSE), fbDataCopyMode(kFALSE),
44 fuEventCounter(0), fbFirstEvent(kTRUE),
45 fuStartEvent(par->GetStartEvent()) ,
46 fuStopEvent(par->GetStopEvent()),
47 fuEventInterval(par->GetEventInterval()),
48 fiTimeout(par->GetTimeout()),
49 fbPollingMode(kFALSE),
50 fiPort(par->GetPort())
53 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource(const char*, Int_t)",__LINE__, __FILE__));
69 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource(const char*, Int_t)",__LINE__, __FILE__));
88 GO4TRACE((15,
"TGo4MbsSource::TGo4MbsSource()",__LINE__, __FILE__));
93 GO4TRACE((15,
"TGo4MbsSource::~TGo4MbsSource()",__LINE__, __FILE__));
114 return cl->InheritsFrom(TGo4MbsEvent::Class());
132 GO4TRACE((12,
"TGo4MbsSource::BuildMbsEvent(TGo4MbsEvent *)",__LINE__, __FILE__));
143 std::cout << std::endl;
147 Char_t *endofevent = (Char_t *) (
fxEvent) +
160 Char_t *subevtpointer;
164 Int_t totalsubdatalength = 0;
170 Int_t datalength = 0;
172 while((datalength = subevent->
l_dlen) > 0) {
173 totalsubdatalength+=datalength-2+
sizeof(
s_ves10_1)/
sizeof(Short_t);
180 Int_t *subeventid= (Int_t *) (subevent) + 2;
182 Short_t *data = (Short_t *) (subevent+1);
186 subevtpointer = (Char_t*) (subevent) +
189 if ((Char_t*) subevent >= endofevent) {
202 SetErrMess(
"!!! BuildMbsEvent: -- NO SUBEVENTS!!!");
217 Int_t subeventid = 4;
218 Short_t *data = (Short_t *) (eventfourone+1);
219 Int_t datalength = eventfourone->
l_dlen+2;
227 SetErrMess(
"!!! BuildMbsEvent: -- NO Data in event 4,1!!!");
261 GO4TRACE((12,
"TGo4MbsSource::NextEvent()",__LINE__, __FILE__));
287 while (eventstep > 0) {
297 if(status != 0)
break;
309 SetErrMess(TString::Format(
"%s name:%s", buffer, GetName()).Data());
325 gSystem->Sleep(1000);
332 printf(
"Retry %d successful\n", cnt);
338 printf(
"Retry %d failed\n", cnt);
349 GO4TRACE((12,
"TGo4MbsSource::Open()",__LINE__, __FILE__));
355 strncpy(name, GetName(),
sizeof(name) - 1);
358 char *separ = strrchr(name,
':');
360 if ((sscanf(separ+1,
"%d",&nport)==1) && (nport>0)) {
372 SetErrMess(TString::Format(
"%s name:%s port:%d", buffer, name, nport).Data());
390 SetErrMess(TString::Format(
"%s name:%s", buffer, GetName()).Data());
394 TGo4Log::Debug(
" Mbs Source -- opened input from type %d: %s . Timeout=%d s",
407 GO4TRACE((12,
"TGo4MbsSource::Close()",__LINE__, __FILE__));
void SetCount(Int_t count)
TGo4MbsSubEvent * AddSubEvent(Int_t fullID, Short_t *source, Int_t datalength, Bool_t copydata=kFALSE)
INTS4 f_evt_type(s_bufhe *ps_bufhe, s_evhe *ps_evhe, INTS4 l_subid, INTS4 l_long, INTS4 l_hex, INTS4 l_data)
const char * GetErrMess() const
s_evt_channel * fxInputChannel
Bool_t CheckEventClass(TClass *cl) override
INTS4 f_evt_get_close(s_evt_channel *ps_chan)
static Bool_t gbPollingMode
Int_t GetCreateStatus() const
INTS4 f_evt_get_open(INTS4 l_mode, CHARS *pc_server, s_evt_channel *ps_chan, CHARS **ps_info, INTS4 l_sample, INTS4 l_param)
INTS4 f_evt_timeout(s_evt_channel *ps_chan, INTS4 l_sec)
static void Info(const char *text,...) GO4_PRINTF_ARGS
void SetCreateStatus(Int_t status)
Bool_t BuildEvent(TGo4EventElement *dest) override
INTS4 f_evt_source_port(INTS4 l_port)
INTS4 f_evt_error(INTS4 l_error, CHARS *pc_dest, INTS4 l_out)
CHARS * f_evt_get_buffer_ptr(s_evt_channel *ps_chan)
virtual Int_t NextEvent()
s_evt_channel * f_evt_control(void)
void BuildMbsEvent(TGo4MbsEvent *target)
static void Debug(const char *text,...) GO4_PRINTF_ARGS
void SetErrMess(const char *txt)
void SetTimeout(Int_t time)
void SetSubtype(Short_t subtype)
void SetDummy(Short_t dummy)
static void SetPollingMode(Bool_t on=kTRUE)
static const UInt_t fguLONGBYCHAR
void SetType(Short_t type)
static const UInt_t fguSHORTBYCHAR
static const UInt_t fguEVHEBYCHAR
static const Int_t fgiTIMEOUTDEFAULT
void SetType(Short_t type)
void SetEventStatus(Int_t status)
void HandleAnlysisEvents()
Int_t GetMode() const
number of allowed reconnect retries
void SetPrintEvent(Int_t num=1, Int_t sid=-1, Int_t longw=1, Int_t hexw=1, Int_t dataw=0)
virtual s_bufhe * GetBufferHeader()
static TGo4Analysis * Instance()
INTS4 f_evt_get_event(s_evt_channel *ps_chan, INTS4 **ppl_buffer, INTS4 **ppl_goobuf)
TGo4MbsSubEvent * BuildMbsSubEvent(TGo4MbsEvent *target, Int_t fullID, Short_t *source, Int_t datalength)
Int_t GetEventStatus() const
void SetSubtype(Short_t subtype)
static void Warn(const char *text,...) GO4_PRINTF_ARGS
TGo4MbsSourcePrintPar fxPrEventPar
static const UInt_t fguLONGBYSHORT
void SetTrigger(Short_t trigger)
Int_t fiPort
if true, use short timeout to keep gSystem->ProcessEvents() running