Compare commits

...

53 Commits
2.3.0 ... 2.3.4

Author SHA1 Message Date
26c829d766 Merge branch 'main-rc' into b2.3.4 2020-11-30 16:38:04 +01:00
3fde5c5b55 Merge branch 'main-rc' into b2.3.3 2020-11-30 16:36:24 +01:00
3e5f546ebe Merge branch 'main-rc' into b2.3.2 2020-11-30 16:26:44 +01:00
9833a7d330 Merge branch 'main-rc' into b2.3.1 2020-11-30 16:25:23 +01:00
56c504abbb Merge remote branch 'slsDetectorCalibration/2.3.4' into 2.3.4 2017-12-12 11:14:19 +01:00
4d6346e678 Merge remote branch 'slsDetectorCalibration/2.3.3' into 2.3.3 2017-12-12 11:14:15 +01:00
dc7e448759 Merge remote branch 'slsDetectorCalibration/2.3.2' into 2.3.2 2017-12-12 11:14:12 +01:00
e658cbacda Merge remote branch 'slsDetectorCalibration/2.3.1' into 2.3.1 2017-12-12 11:14:08 +01:00
befdcf7f36 Merge remote branch 'slsDetectorGui/2.3.4' into 2.3.4 2017-12-04 16:48:01 +01:00
02f5c472a8 Merge remote branch 'slsReceiverSoftware/2.3.4' into 2.3.4 2017-12-04 16:48:00 +01:00
75ed2cd2e4 Merge remote branch 'slsDetectorSoftware/2.3.4' into 2.3.4 2017-12-04 16:47:59 +01:00
3be045f9b6 Merge remote branch 'slsDetectorGui/2.3.3' into 2.3.3 2017-12-04 16:47:54 +01:00
8fae982802 Merge remote branch 'slsReceiverSoftware/2.3.3' into 2.3.3 2017-12-04 16:47:54 +01:00
128ec88b5f Merge remote branch 'slsDetectorSoftware/2.3.3' into 2.3.3 2017-12-04 16:47:52 +01:00
d5fc158330 Merge remote branch 'slsDetectorGui/2.3.2' into 2.3.2 2017-12-04 16:47:47 +01:00
864e6e4c81 Merge remote branch 'slsReceiverSoftware/2.3.2' into 2.3.2 2017-12-04 16:47:47 +01:00
343d96ff16 Merge remote branch 'slsDetectorSoftware/2.3.2' into 2.3.2 2017-12-04 16:47:46 +01:00
4142328437 Merge remote branch 'slsDetectorGui/2.3.1' into 2.3.1 2017-12-04 16:47:41 +01:00
6c797988c7 Merge remote branch 'slsReceiverSoftware/2.3.1' into 2.3.1 2017-12-04 16:47:41 +01:00
215c262981 Merge remote branch 'slsDetectorSoftware/2.3.1' into 2.3.1 2017-12-04 16:47:39 +01:00
6a80bc5b54 new feature, set threshold without uploading trimbits 2017-06-27 13:00:38 +02:00
b9275646ad crazy amount of changes, both necessary and unnecessary;need to narrow down the real change later 2017-04-27 14:05:04 +02:00
9e2f2697c7 crazy amount of changes, both necessary and unnecessary;need to narrow down the real change later 2017-04-27 13:58:25 +02:00
b6b0df62b6 updaterev 2017-04-20 08:26:29 +02:00
0ba537e479 removed headersize compile error 2017-04-20 08:26:16 +02:00
75ddf535dc updaterev 2017-04-19 17:59:53 +02:00
b1de501bef updaterev 2017-04-19 17:59:46 +02:00
0f3a63f101 changed zmq default port starting at 40001 to be able to view in wireshark and removed headersize for warning 2017-04-19 17:42:38 +02:00
3b4b2d707f changes without ostringstream done 2017-04-19 10:17:39 +02:00
f405aa1733 split zmq_msg_t so its not reused 2017-04-19 10:17:30 +02:00
df0fdb7ecb changes without ostringstream done 2017-04-19 10:16:45 +02:00
91b7a87557 just started changin frm ostringstream 2017-04-18 15:32:01 +02:00
9468b9ca1e updaterev 2017-04-11 13:39:59 +02:00
d7982e178e updaterev 2017-04-11 13:39:53 +02:00
9cf5714a5b removing warnings shown from esrf debian 2017-04-11 13:39:35 +02:00
0c9ac8911a removing warnings shown from esrf debian 2017-04-11 13:39:28 +02:00
4730c8c0a9 updaterev 2017-04-11 13:31:49 +02:00
43efb8acfd removing warnings shown from esrf debian 2017-04-11 13:31:32 +02:00
6ecca8fcb0 updaterev 2017-04-11 09:03:26 +02:00
17cb63a57f updaterev 2017-04-11 09:03:19 +02:00
4f83fcb001 updaterev 2017-04-11 09:02:10 +02:00
ab94af6d29 removed verbose etc 2017-04-07 15:08:40 +02:00
7c725cc69b .c_str() must not access global variables from thread 2017-04-07 14:57:19 +02:00
f0198d2d2e alejandro's changes from ESRF 2017-04-07 14:50:17 +02:00
5ddccbdee4 changed all -lpthread to -pthread 2017-04-07 14:28:00 +02:00
8fb39b8c7e changed all -lpthread to -pthread 2017-04-07 14:27:27 +02:00
bd5293f4b1 changed all -lpthread to -pthread 2017-04-07 14:26:09 +02:00
b91180f5b2 changed all -lpthread to -pthread 2017-04-07 14:26:03 +02:00
7c3b5065a5 changed all -lpthread to -pthread 2017-04-07 14:25:09 +02:00
9aef802bea changed all -lpthread to -pthread 2017-04-07 14:24:49 +02:00
f7d85231f2 solved warnings except sscanf for uint64_t 2017-04-07 14:12:21 +02:00
5b3a911e8d solved warnings except sscanf for uint64_t 2017-04-07 14:11:34 +02:00
65f5e1c1ab strtok is not thread safe..used to set receiver udp ip etc to detector, fixed 2017-04-06 15:04:33 +02:00
54 changed files with 2062 additions and 1992 deletions

0
Makefile Executable file → Normal file
View File

View File

@ -5,17 +5,17 @@
CC = g++ CC = g++
CXX = $(CC) CXX = $(CC)
ASM=$(shell echo "/lib/modules/`uname -r`/build/include") ASM=$(shell echo "/lib/modules/`uname -r`/build/include")
LDFLAGDET = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread LDFLAGDET = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread LDFLAGRXR = -L$(LIBDIR) -Wl,-rpath=$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
FLAGS= -Wall #-DEIGER_DEBUG2 -DEIGER_DEBUG -DEIGER_DEBUG3 #-DFIFO_DEBUG FLAGS= -Wall -pthread #-DEIGER_DEBUG2 -DEIGER_DEBUG -DEIGER_DEBUG3 #-DFIFO_DEBUG
# -DVERBOSE # -DVERBOSE
# Setting up the verbose flags # Setting up the verbose flags
ifeq ($(DEBUG),1) ifeq ($(DEBUG),1)
FLAGS = -Wall -DVERBOSE FLAGS = -Wall -pthread -DVERBOSE
endif endif
ifeq ($(DEBUG),2) ifeq ($(DEBUG),2)
FLAGS = -Wall -DVERYVERBOSE FLAGS = -Wall -pthread -DVERYVERBOSE
endif endif
############################################################## ##############################################################

View File

@ -2,8 +2,8 @@ INCLUDES = -I .
SRC_DET = mainClient.cpp SRC_DET = mainClient.cpp
SRC_REC = mainReceiver.cpp SRC_REC = mainReceiver.cpp
LIBDIR = ../../bin LIBDIR = ../../bin
LDFLAG_DET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread LDFLAG_DET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
LDFLAG_REC = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread LDFLAG_REC = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
DESTDIR ?= ../docs DESTDIR ?= ../docs

View File

@ -4,7 +4,7 @@
This file is an example of how to implement the slsDetectorUsers class This file is an example of how to implement the slsDetectorUsers class
You can compile it linking it to the slsDetector library You can compile it linking it to the slsDetector library
gcc mainClient.cpp -L lib -l SlsDetector -lm -lpthread gcc mainClient.cpp -L lib -l SlsDetector -lm -pthread
where lib is the location of libSlsDetector.so where lib is the location of libSlsDetector.so

View File

@ -9,7 +9,7 @@
This file is an example of how to implement the slsDetectorUsers class This file is an example of how to implement the slsDetectorUsers class
You can compile it linking it to the slsDetector library You can compile it linking it to the slsDetector library
gcc mainReceiver.cpp -L lib -l SlsDetector -lm -lpthread gcc mainReceiver.cpp -L lib -l SlsDetector -lm -pthread
where lib is the location of libSlsDetector.so where lib is the location of libSlsDetector.so

View File

@ -1,6 +1,6 @@
CC = g++ CC = g++
CLAGS += -DVERBOSE #VERYBOSE CLAGS += -DVERBOSE #VERYBOSE
LDLIBS += -lm -lstdc++ -lpthread LDLIBS += -lm -lstdc++ -pthread
LDIR = ../../slsDetectorSoftware LDIR = ../../slsDetectorSoftware
RDIR = ../../slsReceiverSoftware RDIR = ../../slsReceiverSoftware

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorGui Path: slsDetectorsPackage/slsDetectorGui
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_gui.git
Repsitory UUID: c43f58653a9b90aade45b9649810ff11225ca844 Repsitory UUID: bddd126e382c1b2e8082419ff393f6e1fb17526a
Revision: 379 Revision: 381
Branch: 2.3-rc Branch: 2.3.1
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 379 Last Changed Rev: 381
Last Changed Date: 2016-12-16 14:46:02 +0100 Last Changed Date: 2017-04-07 14:25:09 +0200

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_detector_gui.git"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "c43f58653a9b90aade45b9649810ff11225ca844" #define SVNREPUUID "bddd126e382c1b2e8082419ff393f6e1fb17526a"
//#define SVNREV 0x379 //#define SVNREV 0x381
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Dhanya_Maliakal" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x379 #define SVNREV 0x381
#define SVNDATE 0x20161216 #define SVNDATE 0x20170407
// //

View File

@ -69,14 +69,14 @@ gotthardVirtualServer: $(SRC_MYTHEN_SVC)
%.o : %.cpp %.h Makefile %.o : %.cpp %.h Makefile
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -lpthread -lrt $(LIBZMQ) #$(FLAGS) $(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) -pthread -lrt $(LIBZMQ) $(FLAGS)
package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a package: $(OBJS) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(DESTDIR)/libSlsDetector.so: $(OBJS) $(DESTDIR)/libSlsDetector.so: $(OBJS)
$(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -lpthread -lrt $(LIBZMQ) $(CXX) -shared -Wl,-soname,libSlsDetector.so -o libSlsDetector.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -pthread -lrt $(LIBZMQ)
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR)) $(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
mv libSlsDetector.so $(DESTDIR) mv libSlsDetector.so $(DESTDIR)

View File

@ -561,6 +561,15 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
myMod->chipregs=chipptr; myMod->chipregs=chipptr;
myMod->chanregs=chanptr; myMod->chanregs=chanptr;
#ifdef EIGERD
//feature to exclude sending of trimbtis, nchips=0,nchans=0 in that case
if(myMod->nchip == 0 && myMod->nchan == 0) {
receiveAll=0;
nchipold=0;
nchanold=0;
}
#endif
nChips=myMod->nchip; nChips=myMod->nchip;
nchipdiff=nChips-nchipold; nchipdiff=nChips-nchipold;
if (nchipold!=nChips) { if (nchipold!=nChips) {
@ -571,6 +580,7 @@ int receiveModuleGeneral(int file_des, sls_detector_module* myMod, int receiveA
printf("received %d chips\n",nChips); printf("received %d chips\n",nChips);
#endif #endif
nChans=myMod->nchan; nChans=myMod->nchan;
nchandiff=nChans-nchanold; nchandiff=nChans-nchanold;
if (nchanold!=nChans) { if (nchanold!=nChans) {

View File

@ -627,25 +627,30 @@ int setModule(sls_detector_module myMod, int delay){
for(i=0;i<myMod.ndac;i++) for(i=0;i<myMod.ndac;i++)
setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module,0,retval); setDAC((enum detDacIndex)i,myMod.dacs[i],myMod.module,0,retval);
//includ gap pixels if(myMod.nchan==0 && myMod.nchip == 0)
unsigned int tt[263680]; cprintf(BLUE,"Setting module without trimbits\n");
int iy,ichip,ix,ip=0,ich=0; else{
for(iy=0;iy<256;iy++) { cprintf(GREEN,"Setting module with trimbits\n");
for (ichip=0; ichip<4; ichip++) { //includ gap pixels
for(ix=0;ix<256;ix++) { unsigned int tt[263680];
tt[ip++]=myMod.chanregs[ich++]; int iy,ichip,ix,ip=0,ich=0;
} for(iy=0;iy<256;iy++) {
if (ichip<3) { for (ichip=0; ichip<4; ichip++) {
tt[ip++]=0; for(ix=0;ix<256;ix++) {
tt[ip++]=0; tt[ip++]=myMod.chanregs[ich++];
}
if (ichip<3) {
tt[ip++]=0;
tt[ip++]=0;
}
} }
} }
}
//set trimbits //set trimbits
if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){ if(!Feb_Control_SetTrimbits(Feb_Control_GetModuleNumber(),tt)){
cprintf(BG_RED,"Could not set trimbits\n"); cprintf(BG_RED,"Could not set trimbits\n");
return FAIL; return FAIL;
}
} }
return thisSettings; return thisSettings;
@ -1126,11 +1131,13 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
destMod->serialnumber=srcMod->serialnumber; destMod->serialnumber=srcMod->serialnumber;
} }
if ((srcMod->nchip)>(destMod->nchip)) { //no trimbit feature
if (destMod->nchip && ((srcMod->nchip)>(destMod->nchip))) {
printf("Number of chip of source is larger than number of chips of destination\n"); printf("Number of chip of source is larger than number of chips of destination\n");
return FAIL; return FAIL;
} }
if ((srcMod->nchan)>(destMod->nchan)) { //no trimbit feature
if (destMod->nchan && ((srcMod->nchan)>(destMod->nchan))) {
printf("Number of channels of source is larger than number of channels of destination\n"); printf("Number of channels of source is larger than number of channels of destination\n");
return FAIL; return FAIL;
} }
@ -1164,14 +1171,21 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod){
if (srcMod->offset>=0) if (srcMod->offset>=0)
destMod->offset=srcMod->offset; destMod->offset=srcMod->offset;
for (ichip=0; ichip<(srcMod->nchip); ichip++) { if((destMod->nchip!=0) || (destMod->nchan!=0)) {
if (*((srcMod->chipregs)+ichip)>=0) for (ichip=0; ichip<(srcMod->nchip); ichip++) {
*((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip); if (*((srcMod->chipregs)+ichip)>=0)
} *((destMod->chipregs)+ichip)=*((srcMod->chipregs)+ichip);
for (ichan=0; ichan<(srcMod->nchan); ichan++) { }
if (*((srcMod->chanregs)+ichan)>=0) for (ichan=0; ichan<(srcMod->nchan); ichan++) {
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan); if (*((srcMod->chanregs)+ichan)>=0)
*((destMod->chanregs)+ichan)=*((srcMod->chanregs)+ichan);
}
} }
#ifdef VERBOSE
printf("Not Copying trimbits\n");
#endif
for (idac=0; idac<(srcMod->ndac); idac++) { for (idac=0; idac<(srcMod->ndac); idac++) {
if (*((srcMod->dacs)+idac)>=0) if (*((srcMod->dacs)+idac)>=0)
*((destMod->dacs)+idac)=*((srcMod->dacs)+idac); *((destMod->dacs)+idac)=*((srcMod->dacs)+idac);

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsDetectorSoftware Path: slsDetectorsPackage/slsDetectorSoftware
URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git URL: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_detector_software.git
Repsitory UUID: 3618c87c5cd000fff7799ddd8cd07a4162d9fdec Repsitory UUID: 41acb4c1ab89fe85b049c329adb539c3ad5b107a
Revision: 1340 Revision: 1350
Branch: 2.3 Branch: 2.3.2
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 1340 Last Changed Rev: 1350
Last Changed Date: 2017-03-23 13:46:02 +0100 Last Changed Date: 2017-04-19 10:17:30 +0200

View File

@ -1139,7 +1139,7 @@ int multiSlsDetector::getThresholdEnergy(int pos) {
} }
int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings isettings) { int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings isettings, int tb) {
int posmin, posmax; int posmin, posmax;
int ret=-100; int ret=-100;
@ -1160,8 +1160,8 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
for(int idet=posmin; idet<posmax; idet++){ for(int idet=posmin; idet<posmax; idet++){
if(detectors[idet]){ if(detectors[idet]){
iret[idet]= new int(-1); iret[idet]= new int(-1);
Task* task = new Task(new func3_t<int,slsDetector,int,int,detectorSettings,int>(&slsDetector::setThresholdEnergy, Task* task = new Task(new func4_t<int,slsDetector,int,int,detectorSettings,int,int>(&slsDetector::setThresholdEnergy,
detectors[idet],e_eV,-1,isettings,iret[idet])); detectors[idet],e_eV,-1,isettings,tb, iret[idet]));
threadpool->add_task(task); threadpool->add_task(task);
} }
} }
@ -1173,11 +1173,11 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
if (ret==-100) if (ret==-100)
ret=*iret[idet]; ret=*iret[idet];
else if (ret<(*iret[idet]-200) || ret>(*iret[idet]+200)) else if (ret<(*iret[idet]-200) || ret>(*iret[idet]+200))
ret=-1; ret=-1;
delete iret[idet];
}else ret=-1; }else ret=-1;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -1191,7 +1191,7 @@ int multiSlsDetector::setThresholdEnergy(int e_eV, int pos, detectorSettings ise
slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) { slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) {
int i, posmin, posmax; int posmin, posmax;
int ret=-100; int ret=-100;
if (pos<0) { if (pos<0) {
@ -1225,10 +1225,10 @@ slsDetectorDefs::detectorSettings multiSlsDetector::getSettings(int pos) {
ret=*iret[idet]; ret=*iret[idet];
else if (ret!=*iret[idet]) else if (ret!=*iret[idet])
ret=GET_SETTINGS; ret=GET_SETTINGS;
delete iret[idet];
}else ret=GET_SETTINGS; }else ret=GET_SETTINGS;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -1273,10 +1273,10 @@ slsDetectorDefs::detectorSettings multiSlsDetector::setSettings(detectorSettings
ret=*iret[idet]; ret=*iret[idet];
else if (ret!=*iret[idet]) else if (ret!=*iret[idet])
ret=GET_SETTINGS; ret=GET_SETTINGS;
delete iret[idet];
}else ret=GET_SETTINGS; }else ret=GET_SETTINGS;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -1436,7 +1436,7 @@ int* multiSlsDetector::getDataFromDetector() {
int n = 0; int n = 0;
int* retval= NULL; int* retval= NULL;
int *retdet, *p=retval; int *retdet, *p=retval;
int nodata=1, nodatadet=-1; int nodatadet=-1;
int nodatadetectortype = false; int nodatadetectortype = false;
detectorType types = getDetectorsType(); detectorType types = getDetectorsType();
if(types == EIGER || types == JUNGFRAU){ if(types == EIGER || types == JUNGFRAU){
@ -1455,7 +1455,6 @@ int* multiSlsDetector::getDataFromDetector() {
if(!nodatadetectortype){ if(!nodatadetectortype){
n=detectors[id]->getDataBytes(); n=detectors[id]->getDataBytes();
if (retdet) { if (retdet) {
nodata=0;
#ifdef VERBOSE #ifdef VERBOSE
cout << "Detector " << id << " returned " << n << " bytes " << endl; cout << "Detector " << id << " returned " << n << " bytes " << endl;
#endif #endif
@ -1662,10 +1661,10 @@ int multiSlsDetector::startAndReadAllNoWait(){
if(iret[idet] != NULL){ if(iret[idet] != NULL){
if(*iret[idet] != OK) if(*iret[idet] != OK)
ret = FAIL; ret = FAIL;
delete iret[idet];
}else ret = FAIL; }else ret = FAIL;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -2105,7 +2104,6 @@ slsDetectorDefs::ROI* multiSlsDetector::getROI(int &n){
n = 0; n = 0;
int num = 0,i,j; int num = 0,i,j;
int ndet = thisMultiDetector->numberOfDetectors; int ndet = thisMultiDetector->numberOfDetectors;
int nroi[ndet];
int maxroi = ndet*MAX_ROIS; int maxroi = ndet*MAX_ROIS;
ROI temproi; ROI temproi;
ROI roiLimits[maxroi]; ROI roiLimits[maxroi];
@ -2120,7 +2118,6 @@ slsDetectorDefs::ROI* multiSlsDetector::getROI(int &n){
if(detectors[i]->getErrorMask()) if(detectors[i]->getErrorMask())
setErrorMask(getErrorMask()|(1<<i)); setErrorMask(getErrorMask()|(1<<i));
nroi[i] = index;
if(temp){ if(temp){
//#ifdef VERBOSE //#ifdef VERBOSE
if(index) if(index)
@ -2332,7 +2329,7 @@ int multiSlsDetector::setFlatFieldCorrection(string fname){
char ffffname[MAX_STR_LENGTH*2]; char ffffname[MAX_STR_LENGTH*2];
int nch;//nbad=0, int nch;//nbad=0,
//int badlist[MAX_BADCHANS]; //int badlist[MAX_BADCHANS];
int im=0; //int im=0;
if (fname=="default") { if (fname=="default") {
fname=string(thisMultiDetector->flatFieldFile); fname=string(thisMultiDetector->flatFieldFile);
@ -2604,7 +2601,7 @@ int multiSlsDetector::setRateCorrection(double t){
ret=detectors[idet]->setRateCorrection(t); ret=detectors[idet]->setRateCorrection(t);
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
if (ret1 != OK) if (ret != OK)
ret1=FAIL; ret1=FAIL;
} }
} }
@ -3334,8 +3331,6 @@ char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
if (s.find('+')==string::npos) { if (s.find('+')==string::npos) {
int posmin=0, posmax=thisMultiDetector->numberOfDetectors;
if(!threadpool){ if(!threadpool){
cout << "Error in creating threadpool. Exiting" << endl; cout << "Error in creating threadpool. Exiting" << endl;
return getNetworkParameter(p); return getNetworkParameter(p);
@ -3356,6 +3351,7 @@ char* multiSlsDetector::setNetworkParameter(networkParameter p, string s){
//doing nothing with the return values //doing nothing with the return values
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete sret[idet];
} }
} }
} }
@ -4000,10 +3996,10 @@ int multiSlsDetector::executeTrimming(trimMode mode, int par1, int par2, int imo
ret=*iret[idet]; ret=*iret[idet];
else if (ret!=*iret[idet]) else if (ret!=*iret[idet])
ret=-1; ret=-1;
delete iret[idet];
}else ret=-1; }else ret=-1;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -4098,10 +4094,10 @@ int multiSlsDetector::loadSettingsFile(string fname, int imod) {
if(iret[idet] != NULL){ if(iret[idet] != NULL){
if(*iret[idet] != OK) if(*iret[idet] != OK)
ret = FAIL; ret = FAIL;
delete iret[idet];
}else ret = FAIL; }else ret = FAIL;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -4175,10 +4171,10 @@ int multiSlsDetector::setAllTrimbits(int val, int imod){
ret=*iret[idet]; ret=*iret[idet];
else if (ret!=*iret[idet]) else if (ret!=*iret[idet])
ret=-1; ret=-1;
delete iret[idet];
}else ret=-1; }else ret=-1;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -4223,10 +4219,10 @@ int multiSlsDetector::loadCalibrationFile(string fname, int imod) {
if(iret[idet] != NULL){ if(iret[idet] != NULL){
if(*iret[idet] != OK) if(*iret[idet] != OK)
ret = FAIL; ret = FAIL;
delete iret[idet];
}else ret = FAIL; }else ret = FAIL;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -4511,9 +4507,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
ofstream outfile; ofstream outfile;
#ifdef VERBOSE int iline = 0;
int ret;
#endif
outfile.open(fname.c_str(),ios_base::out); outfile.open(fname.c_str(),ios_base::out);
if (outfile.is_open()) { if (outfile.is_open()) {
@ -4526,7 +4520,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
cout << iv << " " << names[iv] << endl; cout << iv << " " << names[iv] << endl;
strcpy(args[0],names[iv].c_str()); strcpy(args[0],names[iv].c_str());
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl; outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
iline++;
// single detector configuration // single detector configuration
for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) { for (int i=0; i<thisMultiDetector->numberOfDetectors; i++) {
// sprintf(ext,".det%d",i); // sprintf(ext,".det%d",i);
@ -4544,6 +4538,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
cout << iv << " " << names[iv] << endl; cout << iv << " " << names[iv] << endl;
strcpy(args[0],names[iv].c_str()); strcpy(args[0],names[iv].c_str());
outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl; outfile << names[iv] << " " << cmd->executeLine(1,args,GET_ACTION) << std::endl;
iline++;
} }
@ -4555,7 +4550,7 @@ int multiSlsDetector::writeConfigurationFile(string const fname){
return FAIL; return FAIL;
} }
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "wrote " <<ret << " lines to configuration file " << std::endl; std::cout<< "wrote " << iline << " lines to configuration file " << std::endl;
#endif #endif
return OK; return OK;
@ -4882,10 +4877,10 @@ int multiSlsDetector::startReceiver(){
if(iret[idet] != NULL){ if(iret[idet] != NULL){
if(*iret[idet] != OK) if(*iret[idet] != OK)
ret = FAIL; ret = FAIL;
delete iret[idet];
}else ret = FAIL; }else ret = FAIL;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -4944,10 +4939,10 @@ int multiSlsDetector::stopReceiver(){
if(iret[idet] != NULL){ if(iret[idet] != NULL){
if(*iret[idet] != OK) if(*iret[idet] != OK)
ret = FAIL; ret = FAIL;
delete iret[idet];
}else ret = FAIL; }else ret = FAIL;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -5164,41 +5159,43 @@ int multiSlsDetector::createReceivingDataSockets(const bool destroy){
int multiSlsDetector::getData(const int isocket, const bool masking, int* image, const int size, uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename){ int multiSlsDetector::getData(const int isocket, const bool masking, int* image, const int size, uint64_t &acqIndex, uint64_t &frameIndex, uint32_t &subframeIndex, string &filename){
zmq_msg_t message; zmq_msg_t header_message;
//scan header------------------------------------------------------------------- //scan header-------------------------------------------------------------------
zmq_msg_init (&message); zmq_msg_init (&header_message);
//cprintf(BLUE,"%d going to receive message\n", isocket); //cprintf(BLUE,"%d going to receive message\n", isocket);
int len = zmq_msg_recv(&message, zmqsocket[isocket], 0); int len = zmq_msg_recv(&header_message, zmqsocket[isocket], 0);
if (len == -1) { if (len == -1) {
cprintf(BG_RED,"Could not read header for socket %d\n",isocket); cprintf(BG_RED,"Could not read header for socket %d\n",isocket);
zmq_msg_close(&message); zmq_msg_close(&header_message);
cprintf(RED, "%d message null\n",isocket); cprintf(RED, "%d message null\n",isocket);
return FAIL; return FAIL;
} }
// error if you print it // error if you print it
// cprintf(BLUE,"%d header len:%d value:%s\n",isocket, len, (char*)zmq_msg_data(&message)); //cprintf(BLUE,"%d header len:%d value:%s\n",isocket, len, (char*)zmq_msg_data(&header_message));
//cprintf(BLUE,"%d header %d\n",isocket,len);
rapidjson::Document d; rapidjson::Document d;
d.Parse( (char*)zmq_msg_data(&message), zmq_msg_size(&message)); rapidjson::ParseResult result = d.Parse( (char*)zmq_msg_data(&header_message), len);
if (!result) {
cprintf(RED,"%d Could not parse. len:%d: Message:%s \n", isocket, len, (char*)zmq_msg_data(&header_message) );
}
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
// htype is an array of strings // htype is an array of strings
rapidjson::Value::Array htype = d["htype"].GetArray(); rapidjson::Value::Array htype = d["htype"].GetArray();
for(int i=0; i< htype.Size(); i++) for(int i=0; i< (signed int)htype.Size(); i++)
std::cout << isocket << "htype: " << htype[i].GetString() << std::endl; std::cout << isocket << "htype: " << htype[i].GetString() << std::endl;
// shape is an array of ints // shape is an array of ints
rapidjson::Value::Array shape = d["shape"].GetArray(); rapidjson::Value::Array shape = d["shape"].GetArray();
cout << isocket << "shape: "; cout << isocket << "shape: ";
for(int i=0; i< shape.Size(); i++) for(int i=0; i< (signed int) shape.Size(); i++)
cout << isocket << shape[i].GetInt() << " "; cout << isocket << shape[i].GetInt() << " ";
cout << endl; cout << endl;
cout << isocket << "type: " << d["type"].GetString() << endl; cout << isocket << "type: " << d["type"].GetString() << endl;
#endif #endif
if(d["acqIndex"].GetUint64()!=-1){ //!isocket && if(d["acqIndex"].GetUint64()!= (uint64_t)-1){ //!isocket &&
acqIndex = d["acqIndex"].GetUint64(); acqIndex = d["acqIndex"].GetUint64();
frameIndex = d["fIndex"].GetUint64(); frameIndex = d["fIndex"].GetUint64();
subframeIndex = -1; subframeIndex = -1;
@ -5212,20 +5209,22 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
cout << "Subframe index: " << subframeIndex << endl; cout << "Subframe index: " << subframeIndex << endl;
cout << "File name: " << filename << endl; cout << "File name: " << filename << endl;
#endif #endif
if(frameIndex ==-1) cprintf(RED,"multi frame index -1!!\n"); if(frameIndex == (long long unsigned int)-1) cprintf(RED,"multi frame index -1!!\n");
} }
// close the message // close the message
zmq_msg_close(&message); zmq_msg_close(&header_message);
//scan data------------------------------------------------------------------- //scan data-------------------------------------------------------------------
zmq_msg_init (&message); zmq_msg_t data_message;
len = zmq_msg_recv(&message, zmqsocket[isocket], 0); zmq_msg_init (&data_message);
//cprintf(BLUE,"%d data %d\n",isocket,len); len = zmq_msg_recv(&data_message, zmqsocket[isocket], 0);
//cprintf(GREEN,"%d data %d\n",isocket,len);
//end of socket ("end") //end of socket ("end\0")
if(len == 3){ if(len == 4){
//cprintf(RED,"%d Received end of acquisition\n", isocket); zmq_msg_close(&data_message); // close the message
//cprintf(RED,"%d Received end of acquisition len:%d\n", isocket, len);
return FAIL; return FAIL;
} }
@ -5237,19 +5236,19 @@ int multiSlsDetector::getData(const int isocket, const bool masking, int* image,
//actual image //actual image
else{ else{
//actual data //actual data
//cprintf(BLUE,"%d actual dataaa\n",isocket); // cprintf(GREEN,"%d actual dataaa\n",isocket);
memcpy((char*)image,(char*)zmq_msg_data(&message),size); memcpy((char*)image,(char*)zmq_msg_data(&data_message),size);
//jungfrau masking adcval //jungfrau masking adcval
if(masking){ if(masking){
int snel = size/sizeof(int); int snel = size/sizeof(int);
for(unsigned int i=0;i<snel;++i){ for(unsigned int i=0;i<(unsigned int) snel;++i){
image[i] = (image[i] & 0x3FFF3FFF); image[i] = (image[i] & 0x3FFF3FFF);
} }
} }
} }
zmq_msg_close(&message); // close the message zmq_msg_close(&data_message); // close the message
return OK; return OK;
} }
@ -5571,7 +5570,7 @@ string multiSlsDetector::getErrorMessage(int &critical){
slsMask=detectors[idet]->getErrorMask(); slsMask=detectors[idet]->getErrorMask();
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
//append sls det error mask //append sls det error mask
sprintf(sNumber,"0x%x",slsMask); sprintf(sNumber,"0x%lx",slsMask);
retval.append("Error Mask " + string(sNumber)+string("\n")); retval.append("Error Mask " + string(sNumber)+string("\n"));
#endif #endif
//get the error critical level //get the error critical level
@ -5804,10 +5803,10 @@ uint64_t multiSlsDetector::setCTBWord(int addr,uint64_t word) {
ret1=detectors[idet]->setCTBWord(addr, word); ret1=detectors[idet]->setCTBWord(addr, word);
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
if(ret==-100) if(ret== (long long unsigned int)-100)
ret=ret1; ret=ret1;
else if (ret!=ret1) else if (ret!=ret1)
ret=-1; ret=(long long unsigned int)-1;
} }
return ret; return ret;
} }
@ -5918,10 +5917,10 @@ int multiSlsDetector::pulsePixel(int n,int x,int y) {
ret=*iret[idet]; ret=*iret[idet];
else if (ret!=*iret[idet]) else if (ret!=*iret[idet])
ret=-1; ret=-1;
delete iret[idet];
}else ret=-1; }else ret=-1;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -5955,10 +5954,10 @@ int multiSlsDetector::pulsePixelNMove(int n,int x,int y) {
ret=*iret[idet]; ret=*iret[idet];
else if (ret!=*iret[idet]) else if (ret!=*iret[idet])
ret=-1; ret=-1;
delete iret[idet];
}else ret=-1; }else ret=-1;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }
@ -5992,10 +5991,10 @@ int multiSlsDetector::pulseChip(int n) {
ret=*iret[idet]; ret=*iret[idet];
else if (ret!=*iret[idet]) else if (ret!=*iret[idet])
ret=-1; ret=-1;
delete iret[idet];
}else ret=-1; }else ret=-1;
if(detectors[idet]->getErrorMask()) if(detectors[idet]->getErrorMask())
setErrorMask(getErrorMask()|(1<<idet)); setErrorMask(getErrorMask()|(1<<idet));
delete iret[idet];
} }
} }
} }

View File

@ -198,7 +198,7 @@ class multiSlsDetector : public slsDetectorUtils {
/** flag for acquiring */ /** flag for acquiring */
bool acquiringFlag; bool acquiringFlag;
}; }sharedMultiSlsDetector;
@ -453,9 +453,10 @@ class multiSlsDetector : public slsDetectorUtils {
\param e_eV threshold in eV \param e_eV threshold in eV
\param imod module number (-1 all) \param imod module number (-1 all)
\param isettings ev. change settings \param isettings ev. change settings
\param tb 1 to include trimbits, 0 to exclude
\returns current threshold value for imod in ev (-1 failed) \returns current threshold value for imod in ev (-1 failed)
*/ */
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS); int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS, int tb=1);
/** /**
get detector settings get detector settings

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git" #define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUIDLIB "3618c87c5cd000fff7799ddd8cd07a4162d9fdec" #define SVNREPUUIDLIB "41acb4c1ab89fe85b049c329adb539c3ad5b107a"
//#define SVNREV 0x1340 //#define SVNREV 0x1350
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTHLIB "Dhanya_Maliakal" #define SVNAUTHLIB "Dhanya_Maliakal"
#define SVNREVLIB 0x1340 #define SVNREVLIB 0x1350
#define SVNDATELIB 0x20170323 #define SVNDATELIB 0x20170419
// //

File diff suppressed because it is too large Load Diff

View File

@ -511,7 +511,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
\sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int) \sa ::sls_detector_module sharedSlsDetector mythenDetector::writeSettingsFile(string, int)
*/ */
using energyConversion::writeSettingsFile; using energyConversion::writeSettingsFile;
int writeSettingsFile(string fname, int imod, int& iodelay, int& tau); int writeSettingsFile(string fname, int imod, int iodelay, int tau);
/** /**
@ -953,10 +953,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
\param e_eV threashold in eV (detector specific) \param e_eV threashold in eV (detector specific)
\param gainval pointer to extra gain values \param gainval pointer to extra gain values
\param offsetval pointer to extra offset values \param offsetval pointer to extra offset values
\param tb 1 to include trimbits, 0 to exclude (used for eiger)
\returns current register value \returns current register value
\sa ::sls_detector_module \sa ::sls_detector_module
*/ */
int setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval=0, int* offsetval=0); int setModule(sls_detector_module module, int iodelay, int tau, int e_eV, int* gainval=0, int* offsetval=0, int tb=1);
//virtual int setModule(sls_detector_module module); //virtual int setModule(sls_detector_module module);
/** /**
@ -987,17 +988,19 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
\param e_eV threshold in eV \param e_eV threshold in eV
\param imod module number (-1 all) \param imod module number (-1 all)
\param isettings ev. change settings \param isettings ev. change settings
\param tb 1 to include trimbits, 0 to exclude
\returns current threshold value for imod in ev (-1 failed) \returns current threshold value for imod in ev (-1 failed)
*/ */
int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS); int setThresholdEnergy(int e_eV, int imod=-1, detectorSettings isettings=GET_SETTINGS, int tb=1);
/** /**
set threshold energy set threshold energy
\param e_eV threshold in eV \param e_eV threshold in eV
\param isettings ev. change settings \param isettings ev. change settings
\param tb 1 to include trimbits, 0 to exclude
\returns OK if successful, else FAIL \returns OK if successful, else FAIL
*/ */
int setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings); int setThresholdEnergyAndSettings(int e_eV, detectorSettings isettings, int tb=1);
/** /**
get detector settings get detector settings

View File

@ -75,10 +75,10 @@ int slsDetectorActions::setActionScript(int iaction, string fname) {
int slsDetectorActions::setActionParameter(int iaction, string par) { int slsDetectorActions::setActionParameter(int iaction, string par) {
int am; // int am;
if (iaction>=0 && iaction<MAX_ACTIONS) { if (iaction>=0 && iaction<MAX_ACTIONS) {
am= 1& ( (*actionMask) << iaction); //am= 1& ( (*actionMask) << iaction);
if (par!="") { if (par!="") {
strcpy(actionParameter[iaction],par.c_str()); strcpy(actionParameter[iaction],par.c_str());

View File

@ -210,7 +210,7 @@ class slsDetectorActions : public virtual slsDetectorBase
/* *\/ */ /* *\/ */
/* virtual detectorType getDetectorsType(int pos=-1)=0; */ /* virtual detectorType getDetectorsType(int pos=-1)=0; */
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0; virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0; virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;

View File

@ -429,7 +429,7 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
virtual externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE)=0; virtual externalCommunicationMode setExternalCommunicationMode(externalCommunicationMode pol=GET_EXTERNAL_COMMUNICATION_MODE)=0;
int setTimingMode(int i=-1){return slsDetectorUsers::getTimingMode( externalCommunicationType( setExternalCommunicationMode(externalCommunicationType( slsDetectorUsers::getTimingMode(i) ) ) ) );}; int setTimingMode(int i=-1){return slsDetectorUsers::getTimingMode( externalCommunicationType( setExternalCommunicationMode(externalCommunicationType( slsDetectorUsers::getTimingMode(i) ) ) ) );};
virtual int setThresholdEnergy(int e_eV, int imod, detectorSettings isettings=GET_SETTINGS)=0; virtual int setThresholdEnergy(int e_eV, int imod, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
int setThresholdEnergy(int e_eV){return setThresholdEnergy(e_eV,-1);}; int setThresholdEnergy(int e_eV){return setThresholdEnergy(e_eV,-1);};

View File

@ -7,6 +7,7 @@
#include <iomanip> #include <iomanip>
slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) { slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
myDet=det; myDet=det;
@ -551,6 +552,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
i++; i++;
descrToFuncMap[i].m_pFuncName="thresholdnotb"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
i++;
descrToFuncMap[i].m_pFuncName="trimbits"; // descrToFuncMap[i].m_pFuncName="trimbits"; //
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettings;
i++; i++;
@ -3288,10 +3293,10 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
return myDet->getDetectorSettings(myDet->getSettings()); return myDet->getDetectorSettings(myDet->getSettings());
} else if (cmd=="threshold") { } else if (cmd=="threshold") {
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
detectorType type = myDet->getDetectorsType();
if (!sscanf(args[1],"%d",&val)) { if (!sscanf(args[1],"%d",&val)) {
return string("invalid threshold value"); return string("invalid threshold value");
} }
detectorType type = myDet->getDetectorsType();
if (type != EIGER || (type == EIGER && narg<=2)) { if (type != EIGER || (type == EIGER && narg<=2)) {
myDet->setThresholdEnergy(val); myDet->setThresholdEnergy(val);
} else { } else {
@ -3303,6 +3308,25 @@ string slsDetectorCommand::cmdSettings(int narg, char *args[], int action) {
} }
sprintf(ans,"%d",myDet->getThresholdEnergy()); sprintf(ans,"%d",myDet->getThresholdEnergy());
return string(ans); return string(ans);
} else if (cmd=="thresholdnotb") {
if (action==PUT_ACTION) {
if (!sscanf(args[1],"%d",&val)) {
return string("invalid threshold value");
}
detectorType type = myDet->getDetectorsType();
if (type != EIGER)
return string("not implemented for this detector");
if (narg<=2) {
myDet->setThresholdEnergy(val, -1, GET_SETTINGS, 0);
} else {
detectorSettings sett= myDet->getDetectorSettings(string(args[2]));
if(sett == -1)
return string("invalid settings value");
myDet->setThresholdEnergy(val, -1, sett, 0);
}
}
sprintf(ans,"%d",myDet->getThresholdEnergy());
return string(ans);
} else if (cmd=="trimbits") { } else if (cmd=="trimbits") {
if (narg>=2) { if (narg>=2) {
string sval=string(args[1]); string sval=string(args[1]);
@ -3385,7 +3409,8 @@ string slsDetectorCommand::helpSettings(int narg, char *args[], int action) {
if (action==PUT_ACTION || action==HELP_ACTION) { if (action==PUT_ACTION || action==HELP_ACTION) {
os << "settings s \n sets the settings of the detector - can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain" os << "settings s \n sets the settings of the detector - can be standard, fast, highgain, dynamicgain, lowgain, mediumgain, veryhighgain"
"lownoise, dynamichg0,fixgain1,fixgain2,forceswitchg1, forceswitchg2"<< std::endl; "lownoise, dynamichg0,fixgain1,fixgain2,forceswitchg1, forceswitchg2"<< std::endl;
os << "threshold eV\n sets the detector threshold in eV"<< std::endl; os << "threshold eV [sett]\n sets the detector threshold in eV. If sett is provided for eiger, uses settings sett"<< std::endl;
os << "thresholdnotb eV [sett]\n sets the detector threshold in eV without loading trimbits. If sett is provided for eiger, uses settings sett"<< std::endl;
os << "trimbits fname\n loads the trimfile fname to the detector. If no extension is specified, the serial number of each module will be attached."<< std::endl; os << "trimbits fname\n loads the trimfile fname to the detector. If no extension is specified, the serial number of each module will be attached."<< std::endl;
os << "trim:mode fname\n trims the detector according to mode (can be noise, beam, improve, fix) and saves the resulting trimbits to file fname."<< std::endl; os << "trim:mode fname\n trims the detector according to mode (can be noise, beam, improve, fix) and saves the resulting trimbits to file fname."<< std::endl;
os << "trimval i \n sets all the trimbits to i" << std::endl; os << "trimval i \n sets all the trimbits to i" << std::endl;
@ -3426,7 +3451,11 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (cmd=="thisversion"){ if (cmd=="thisversion"){
sprintf(answer,"%llx",myDet->getId(THIS_SOFTWARE_VERSION)); int64_t retval = myDet->getId(THIS_SOFTWARE_VERSION);
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
return string(answer); return string(answer);
} }
@ -3436,37 +3465,61 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
if (cmd=="moduleversion") { if (cmd=="moduleversion") {
int ival=-1; int ival=-1;
if (sscanf(args[0],"moduleversion:%d",&ival)) { if (sscanf(args[0],"moduleversion:%d",&ival)) {
sprintf(answer,"%llx",myDet->getId(MODULE_FIRMWARE_VERSION,ival)); int64_t retval = myDet->getId(MODULE_FIRMWARE_VERSION, ival);
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
return string(answer); return string(answer);
} else } else
return string("undefined module number"); return string("undefined module number");
} }
if (cmd=="detectornumber") { if (cmd=="detectornumber") {
sprintf(answer,"%llx",myDet->getId(DETECTOR_SERIAL_NUMBER)); int64_t retval = myDet->getId(DETECTOR_SERIAL_NUMBER);
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
return string(answer); return string(answer);
} }
if (cmd.find("modulenumber")!=string::npos) { if (cmd.find("modulenumber")!=string::npos) {
int ival=-1; int ival=-1;
if (sscanf(args[0],"modulenumber:%d",&ival)) { if (sscanf(args[0],"modulenumber:%d",&ival)) {
sprintf(answer,"%llx",myDet->getId(MODULE_SERIAL_NUMBER,ival)); int64_t retval = myDet->getId(MODULE_SERIAL_NUMBER, ival);
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
return string(answer); return string(answer);
} else } else
return string("undefined module number"); return string("undefined module number");
} }
if (cmd=="detectorversion") { if (cmd=="detectorversion") {
sprintf(answer,"%llx",myDet->getId(DETECTOR_FIRMWARE_VERSION)); int64_t retval = myDet->getId(DETECTOR_FIRMWARE_VERSION);
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
return string(answer); return string(answer);
} }
if (cmd=="softwareversion") { if (cmd=="softwareversion") {
sprintf(answer,"%llx",myDet->getId(DETECTOR_SOFTWARE_VERSION)); int64_t retval = myDet->getId(DETECTOR_SOFTWARE_VERSION);
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
return string(answer); return string(answer);
} }
if (cmd=="receiverversion") { if (cmd=="receiverversion") {
myDet->setReceiverOnline(ONLINE_FLAG); myDet->setReceiverOnline(ONLINE_FLAG);
sprintf(answer,"%llx",myDet->getId(RECEIVER_VERSION)); int64_t retval = myDet->getId(RECEIVER_VERSION);
if (retval < 0)
sprintf(answer, "%d", -1);
else
sprintf(answer,"%lx", retval);
return string(answer); return string(answer);
} }
return string("unknown id mode ")+cmd; return string("unknown id mode ")+cmd;
@ -4491,7 +4544,7 @@ string slsDetectorCommand::cmdAdvanced(int narg, char *args[], int action) {
if (action==GET_ACTION) if (action==GET_ACTION)
return string("cannot get"); return string("cannot get");
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< " resetting fpga " << sval << std::endl; std::cout<< " resetting fpga " << std::endl;
#endif #endif
myDet->setOnline(ONLINE_FLAG); myDet->setOnline(ONLINE_FLAG);
if(myDet->resetFPGA() == OK) if(myDet->resetFPGA() == OK)
@ -4870,7 +4923,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
else else
return string("Could not scan address (hexadecimal fomat) ")+string(args[1]); return string("Could not scan address (hexadecimal fomat) ")+string(args[1]);
if (sscanf(args[2],"%llx",&word)) if (sscanf(args[2],"%lx",&word))
; ;
else else
return string("Could not scan value (hexadecimal fomat) ")+string(args[2]); return string("Could not scan value (hexadecimal fomat) ")+string(args[2]);
@ -4886,7 +4939,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
if (sscanf(args[1],"%llx",&word)) if (sscanf(args[1],"%lx",&word))
; ;
else else
return string("Could not scan value (hexadecimal fomat) ")+string(args[1]); return string("Could not scan value (hexadecimal fomat) ")+string(args[1]);
@ -4903,7 +4956,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
if (sscanf(args[1],"%llx",&word)) if (sscanf(args[1],"%lx",&word))
; ;
else else
return string("Could not scan value (hexadecimal fomat) ")+string(args[1]); return string("Could not scan value (hexadecimal fomat) ")+string(args[1]);
@ -5174,7 +5227,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
if (sscanf(args[1],"%lld",&t)) if (sscanf(args[1],"%ld",&t))
; ;
else else
return string("Could not scan wait time")+string(args[1]); return string("Could not scan wait time")+string(args[1]);
@ -5197,7 +5250,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
if (sscanf(args[1],"%lld",&t)) if (sscanf(args[1],"%ld",&t))
; ;
else else
return string("Could not scan wait time ")+string(args[1]); return string("Could not scan wait time ")+string(args[1]);
@ -5215,7 +5268,7 @@ string slsDetectorCommand::cmdPattern(int narg, char *args[], int action) {
} else if (cmd=="patwaittime2") { } else if (cmd=="patwaittime2") {
if (action==PUT_ACTION) { if (action==PUT_ACTION) {
if (sscanf(args[1],"%lld",&t)) if (sscanf(args[1],"%ld",&t))
; ;
else else
return string("Could not scan wait time ")+string(args[1]); return string("Could not scan wait time ")+string(args[1]);
@ -5334,13 +5387,11 @@ string slsDetectorCommand::cmdPulse(int narg, char *args[], int action) {
} }
return string("");
/*
if(retval == OK) if(retval == OK)
return string(" successful"); return string(" successful");
else else
return string(" failed"); return string(" failed");
*/
} }

View File

@ -798,7 +798,6 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
slsDetectorCommand *cmd; slsDetectorCommand *cmd;
string names[100]; string names[100];
int nvar=0; int nvar=0;
int nvar1=0;
names[nvar++]="fname"; names[nvar++]="fname";
names[nvar++]="index"; names[nvar++]="index";
@ -878,6 +877,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
names[nvar++]="patnloop2"; names[nvar++]="patnloop2";
names[nvar++]="patwait2"; names[nvar++]="patwait2";
names[nvar++]="patwaittime2"; names[nvar++]="patwaittime2";
default:
break;
} }
@ -908,6 +909,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
names[nvar++]="flatfield"; names[nvar++]="flatfield";
names[nvar++]="badchannels"; names[nvar++]="badchannels";
break; break;
default:
break;
} }
@ -916,7 +919,8 @@ int slsDetectorUtils::dumpDetectorSetup(string const fname, int level){
case MYTHEN: case MYTHEN:
names[nvar++]="trimbits"; names[nvar++]="trimbits";
break; break;
default:
break;
} }
// char ext[100]; // char ext[100];

View File

@ -421,7 +421,7 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
// double* convertAngles(){return convertAngles(currentPosition);}; // double* convertAngles(){return convertAngles(currentPosition);};
// virtual double* convertAngles(double pos)=0; // virtual double* convertAngles(double pos)=0;
virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS)=0; virtual int setThresholdEnergy(int, int im=-1, detectorSettings isettings=GET_SETTINGS, int tb=1)=0;
virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0; virtual int setChannel(int64_t, int ich=-1, int ichip=-1, int imod=-1)=0;
virtual double getRateCorrectionTau()=0; virtual double getRateCorrectionTau()=0;

View File

@ -255,8 +255,8 @@ int angularConversionStatic::readAngularConversion( ifstream& infile, int nmod,
angOff[nm].etilt=epitch; angOff[nm].etilt=epitch;
} }
// cout << angOff[nm].center << " " << \ // cout << angOff[nm].center << " " <<
// angOff[nm].r_conversion << " " << \ // angOff[nm].r_conversion << " " <<
// angOff[nm].offset << endl; // angOff[nm].offset << endl;
} else } else

View File

@ -17,20 +17,20 @@ int energyConversion::readCalibrationFile(string fname, double &gain, double &of
string str; string str;
ifstream infile; ifstream infile;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Opening file "<< fname << std::endl; printf( "Opening file %s \n", fname.c_str() );
#endif #endif
infile.open(fname.c_str(), ios_base::in); infile.open(fname.c_str(), ios_base::in);
if (infile.is_open()) { if (infile.is_open()) {
getline(infile,str); getline(infile,str);
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< str << std::endl; printf( "%s \n", str.c_str() );
#endif #endif
istringstream ssstr(str); istringstream ssstr(str);
ssstr >> offset >> gain; ssstr >> offset >> gain;
infile.close(); infile.close();
cout << "Calibration file loaded: " << fname << endl; printf( "Calibration file loaded: %s \n", fname.c_str() );
} else { } else {
std::cout<< "Could not open calibration file "<< fname << std::endl; printf( "Could not open calibration file %s \n", fname.c_str() );
gain=0.; gain=0.;
offset=0.; offset=0.;
#ifndef MYROOT #ifndef MYROOT
@ -45,7 +45,7 @@ int energyConversion::readCalibrationFile(string fname, double &gain, double &of
}; };
int energyConversion::writeCalibrationFile(string fname, double gain, double offset){ int energyConversion::writeCalibrationFile(string fname, double gain, double offset){
//std::cout<< "Function not yet implemented " << std::endl; //printf( "Function not yet implemented \n" );
ofstream outfile; ofstream outfile;
outfile.open (fname.c_str()); outfile.open (fname.c_str());
@ -53,7 +53,7 @@ int energyConversion::writeCalibrationFile(string fname, double gain, double off
if (outfile.is_open()) { if (outfile.is_open()) {
outfile << offset << " " << gain << std::endl; outfile << offset << " " << gain << std::endl;
} else { } else {
std::cout<< "Could not open calibration file "<< fname << " for writing" << std::endl; printf( "Could not open calibration file %s for writing \n", fname.c_str() );
#ifndef MYROOT #ifndef MYROOT
return FAIL; return FAIL;
#endif #endif
@ -76,7 +76,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
double o,g; double o,g;
int ig=0; int ig=0;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "Opening file "<< fname << std::endl; printf( "Opening file %s \n", fname.c_str() );
#endif #endif
infile.open(fname.c_str(), ios_base::in); infile.open(fname.c_str(), ios_base::in);
if (infile.is_open()) { if (infile.is_open()) {
@ -85,7 +85,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
//while ( (getline(infile,str)) > -1) { //while ( (getline(infile,str)) > -1) {
getline(infile,str); getline(infile,str);
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< str << std::endl; printf( "%s \n", str.c_str() );
#endif #endif
istringstream ssstr(str); istringstream ssstr(str);
ssstr >> o >> g; ssstr >> o >> g;
@ -96,9 +96,9 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
break; break;
} }
infile.close(); infile.close();
cout << "Calibration file loaded: " << fname << endl; printf( "Calibration file loaded: %s \n", fname.c_str() );
} else { } else {
cout << "Could not open calibration file: "<< fname << std::endl; printf( "Could not open calibration file: %s \n", fname.c_str() );
gain[0]=0; gain[0]=0;
offset[0]=0; offset[0]=0;
#ifndef MYROOT #ifndef MYROOT
@ -114,7 +114,7 @@ int energyConversion::readCalibrationFile(string fname, int *gain, int *offset){
}; };
int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset){ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset){
//std::cout<< "Function not yet implemented " << std::endl; //printf( "Function not yet implemented \n" );
ofstream outfile; ofstream outfile;
outfile.open (fname.c_str()); outfile.open (fname.c_str());
// >> i/o operations here << // >> i/o operations here <<
@ -122,7 +122,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset)
for (int ig=0; ig<4; ig++) for (int ig=0; ig<4; ig++)
outfile << ((double)offset[ig]/1000) << " " << ((double)gain[ig]/1000) << std::endl; outfile << ((double)offset[ig]/1000) << " " << ((double)gain[ig]/1000) << std::endl;
} else { } else {
std::cout<< "Could not open calibration file "<< fname << " for writing" << std::endl; printf( "Could not open calibration file %s for writing \n", fname.c_str() );
#ifndef MYROOT #ifndef MYROOT
return FAIL; return FAIL;
#endif #endif
@ -138,7 +138,7 @@ int energyConversion::writeCalibrationFile(string fname, int *gain, int *offset)
slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2){ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2, int tb){
// only implemented for eiger currently (in terms of which dacs) // only implemented for eiger currently (in terms of which dacs)
if(myDetectorType != EIGER) { if(myDetectorType != EIGER) {
printf("Interpolation of Trim values not implemented for this detector!\n"); printf("Interpolation of Trim values not implemented for this detector!\n");
@ -168,8 +168,10 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
} }
//Interpolate all trimbits //Interpolate all trimbits
for (int i = 0; i<myMod->nchan; i++) if(tb) {
myMod->chanregs[i] = linearInterpolation(energy, e1, e2, a->chanregs[i], b->chanregs[i]); for (int i = 0; i<myMod->nchan; i++)
myMod->chanregs[i] = linearInterpolation(energy, e1, e2, a->chanregs[i], b->chanregs[i]);
}
return myMod; return myMod;
} }
@ -180,7 +182,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::interpolateTrim(detector
/* I/O */ /* I/O */
slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod){ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod, int tb){
@ -251,16 +253,16 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
names[id++]="VDAC15"; names[id++]="VDAC15";
break; break;
default: default:
cout << "Unknown detector type - unknown format for settings file" << endl; printf( "Unknown detector type - unknown format for settings file \n" );
return NULL; return NULL;
} }
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "reading settings file for module number "<< myMod->module << std::endl; printf( " reading settings file for module number %d \n", myMod->module );
#endif #endif
myfname=fname; myfname=fname;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "file name is "<< myfname << std::endl; printf( "file name is %s \n", myfname.c_str() );
#endif #endif
switch (myDetectorType) { switch (myDetectorType) {
@ -274,7 +276,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
istringstream ssstr(str); istringstream ssstr(str);
ssstr >> sargname >> ival; ssstr >> sargname >> ival;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " dac nr. " << idac << " is " << ival << std::endl; printf( "%s dac nr. %d is %d \n", sargname.c_str(), idac, ival );
#endif #endif
myMod->dacs[idac]=ival; myMod->dacs[idac]=ival;
idac++; idac++;
@ -283,24 +285,24 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
getline(infile,str); getline(infile,str);
iline++; iline++;
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
std::cout<< str << std::endl; printf( "%s \n", str.c_str() );
#endif #endif
istringstream ssstr(str); istringstream ssstr(str);
ssstr >> sargname >> ival; ssstr >> sargname >> ival;
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
std::cout<< "chip " << ichip << " " << sargname << " is " << ival << std::endl; printf( "chip %d %s is %d \n", ichip, sargname.c_str(), ival );
#endif #endif
myMod->chipregs[ichip]=ival; myMod->chipregs[ichip]=ival;
for (ichan=0; ichan<nch; ichan++) { for (ichan=0; ichan<nch; ichan++) {
getline(infile,str); getline(infile,str);
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
std::cout<< str << std::endl; printf( " %s \n", str.c_str() );
#endif #endif
istringstream ssstr(str); istringstream ssstr(str);
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
std::cout<< "channel " << ichan+ichip*thisDetector->nChans <<" iline " << iline<< std::endl; printf( "channel %d iline %d \n", ichan+ichip*myMod->nchan, iline );
#endif #endif
iline++; iline++;
myMod->chanregs[ichip*nch+ichan]=0; myMod->chanregs[ichip*nch+ichan]=0;
@ -310,42 +312,42 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
switch (iarg) { switch (iarg) {
case 0: case 0:
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
std::cout<< "trimbits " << ival ; printf( "trimbits %d", ival );
#endif #endif
myMod->chanregs[ichip*nch+ichan]|=ival&TRIMBITMASK; myMod->chanregs[ichip*nch+ichan]|=ival&TRIMBITMASK;
break; break;
case 1: case 1:
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
std::cout<< " compen " << ival ; printf( " compen %d", ival );
#endif #endif
myMod->chanregs[ichip*nch+ichan]|=ival<<9; myMod->chanregs[ichip*nch+ichan]|=ival<<9;
break; break;
case 2: case 2:
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
std::cout<< " anen " << ival ; printf( " anen %d", ival );
#endif #endif
myMod->chanregs[ichip*nch+ichan]|=ival<<8; myMod->chanregs[ichip*nch+ichan]|=ival<<8;
break; break;
case 3: case 3:
#ifdef VERYVERBOSE #ifdef VERYVERBOSE
std::cout<< " calen " << ival ; printf( " calen %d", ival ) ;
#endif #endif
myMod->chanregs[ichip*nch+ichan]|=ival<<7; myMod->chanregs[ichip*nch+ichan]|=ival<<7;
break; break;
case 4: case 4:
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< " outcomp " << ival ; printf( " outcomp %d", ival ) ;
#endif #endif
myMod->chanregs[ichip*nch+ichan]|=ival<<10; myMod->chanregs[ichip*nch+ichan]|=ival<<10;
break; break;
case 5: case 5:
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< " counts " << ival << std::endl; printf( " counts %d \n", ival );
#endif #endif
myMod->chanregs[ichip*nch+ichan]|=ival<<11; myMod->chanregs[ichip*nch+ichan]|=ival<<11;
break; break;
default: default:
std::cout<< " too many columns" << std::endl; printf( " too many columns \n" );
break; break;
} }
} }
@ -353,7 +355,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
// } // }
} }
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< "read " << ichan*ichip << " channels" <<std::endl; printf( "read %d channels \n", ichan*ichip );
#endif #endif
infile.close(); infile.close();
@ -372,19 +374,21 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
infile.read((char*) myMod->dacs,sizeof(dacs_t)*(myMod->ndac)); infile.read((char*) myMod->dacs,sizeof(dacs_t)*(myMod->ndac));
infile.read((char*)&iodelay,sizeof(iodelay)); infile.read((char*)&iodelay,sizeof(iodelay));
infile.read((char*)&tau,sizeof(tau)); infile.read((char*)&tau,sizeof(tau));
infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
#ifdef VERBOSE #ifdef VERBOSE
for(int i=0;i<myMod->ndac;i++) for(int i=0;i<myMod->ndac;i++)
std::cout << "dac " << i << ":" << myMod->dacs[i] << std::endl; printf( "dac %d:%d \n", i, myMod->dacs[i] );
std::cout << "iodelay:" << iodelay << std::endl; printf( "iodelay:%d \n", iodelay );
std::cout << "tau:" << tau << std::endl; printf( "tau:%d \n", tau );
#endif #endif
if(infile.eof()){ if(tb) {
cout<<endl<<"Error, could not load trimbits end of file, "<<myfname<<", reached."<<endl<<endl; infile.read((char*) myMod->chanregs,sizeof(int)*(myMod->nchan));
if (nflag) if(infile.eof()){
deleteModule(myMod); printf( "Error, could not load trimbits end of file reached: %s \n\n", myfname.c_str() );
if (nflag)
deleteModule(myMod);
return NULL; return NULL;
}
} }
infile.close(); infile.close();
strcpy(settingsFile,fname.c_str()); strcpy(settingsFile,fname.c_str());
@ -406,7 +410,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
getline(infile,str); getline(infile,str);
iline++; iline++;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< str << std::endl; printf( "str: %s \n", str.c_str() );
#endif #endif
istringstream ssstr(str); istringstream ssstr(str);
ssstr >> sargname >> ival; ssstr >> sargname >> ival;
@ -415,7 +419,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
myMod->dacs[i]=ival; myMod->dacs[i]=ival;
idac++; idac++;
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " dac nr. " << idac << " is " << ival << std::endl; printf( " %s dac nr. %d is %d \n", sargname.c_str(), idac, ival );
#endif #endif
break; break;
} }
@ -423,10 +427,10 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
} }
if (i < id) { if (i < id) {
#ifdef VERBOSE #ifdef VERBOSE
std::cout<< sargname << " dac nr. " << idac << " is " << ival << std::endl; printf( " %s dac nr. %d is %d \n", sargname.c_str(), idac, ival );
#endif #endif
}else }else
std::cout<< "Unknown dac " << sargname << std::endl; printf( "Unknown dac %s \n", sargname.c_str() );
infile.close(); infile.close();
strcpy(settingsFile,fname.c_str()); strcpy(settingsFile,fname.c_str());
@ -439,7 +443,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
break; break;
default: default:
std::cout<< "Unknown detector type - don't know how to read file" << myfname << std::endl; printf( "Unknown detector type - don't know how to read file %s\n", myfname.c_str());
infile.close(); infile.close();
deleteModule(myMod); deleteModule(myMod);
return NULL; return NULL;
@ -457,7 +461,7 @@ slsDetectorDefs::sls_detector_module* energyConversion::readSettingsFile(string
}; };
int energyConversion::writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int& iodelay, int& tau){ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int iodelay, int tau){
ofstream outfile; ofstream outfile;
@ -517,7 +521,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
names[id++]="VDAC15"; names[id++]="VDAC15";
break; break;
default: default:
cout << "Unknown detector type - unknown format for settings file" << endl; printf( "Unknown detector type - unknown format for settings file \n" );
return FAIL; return FAIL;
} }
@ -532,13 +536,13 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
iv = 1150; iv = 1150;
#ifdef VERBOSE #ifdef VERBOSE
for(int i=0;i<mod.ndac;i++) for(int i=0;i<mod.ndac;i++)
std::cout << "dac " << i << ":" << mod.dacs[i] << std::endl; printf( "dac %d:%d \n", i, mod.dacs[i] );
std::cout << "iodelay: " << iodelay << std::endl; printf( "iodelay: %d \n", iodelay );
std::cout << "tau: " << tau << std::endl; printf( "tau: %d", tau);
#endif #endif
outfile.write((char*)mod.dacs, sizeof(dacs_t)*(mod.ndac)); outfile.write((char*)mod.dacs, sizeof(dacs_t)*(mod.ndac));
outfile.write((char*)iodelay, sizeof(iodelay)); outfile.write(reinterpret_cast<char*>(&iodelay), sizeof(iodelay));
outfile.write((char*)tau, sizeof(tau)); outfile.write(reinterpret_cast<char*>(&tau), sizeof(tau));
outfile.write((char*)mod.chanregs, sizeof(int)*(mod.nchan)); outfile.write((char*)mod.chanregs, sizeof(int)*(mod.nchan));
outfile.close(); outfile.close();
@ -587,7 +591,7 @@ int energyConversion::writeSettingsFile(string fname, detectorType myDetectorTyp
outfile.close(); outfile.close();
return OK; return OK;
} }
std::cout<< "could not open SETTINGS file " << fname << std::endl; printf( "could not open SETTINGS file %s \n", fname.c_str() );
return FAIL; return FAIL;
} }

View File

@ -88,9 +88,10 @@ class energyConversion
\param energy energy to trim at \param energy energy to trim at
\param e1 reference trim value \param e1 reference trim value
\param e2 reference trim value \param e2 reference trim value
\param tb 1 to include trimbits, 0 to exclude (used for eiger)
\returns the pointer to the module structure with interpolated values or NULL if error \returns the pointer to the module structure with interpolated values or NULL if error
*/ */
sls_detector_module* interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2); sls_detector_module* interpolateTrim(detectorType myDetectorType, sls_detector_module* a, sls_detector_module* b, const int energy, const int e1, const int e2, int tb=1);
@ -103,10 +104,11 @@ class energyConversion
\param iodelay io delay (detector specific) \param iodelay io delay (detector specific)
\param tau tau (detector specific) \param tau tau (detector specific)
\param myMod pointer to the module structure which has to be set. <BR> If it is NULL a new module structure will be created \param myMod pointer to the module structure which has to be set. <BR> If it is NULL a new module structure will be created
\param tb 1 to include trimbits, 0 to exclude (used for eiger)
\returns the pointer to myMod or NULL if reading the file failed \returns the pointer to myMod or NULL if reading the file failed
*/ */
sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL); sls_detector_module* readSettingsFile(string fname, detectorType myDetectorType, int& iodelay, int& tau, sls_detector_module* myMod=NULL, int tb=1);
/** /**
writes a trim/settings file writes a trim/settings file
@ -119,7 +121,7 @@ class energyConversion
\sa ::sls_detector_module mythenDetector::writeSettingsFile(string, sls_detector_module) \sa ::sls_detector_module mythenDetector::writeSettingsFile(string, sls_detector_module)
*/ */
int writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int& iodelay, int& tau); int writeSettingsFile(string fname, detectorType myDetectorType, sls_detector_module mod, int iodelay, int tau);
/** allocates the momery for a detector module structure /** allocates the momery for a detector module structure
\param myDetectorType detector type (needed for number of channels, chips, dacs etc.) \param myDetectorType detector type (needed for number of channels, chips, dacs etc.)

View File

@ -534,9 +534,7 @@ class fileIOStatic {
static int readDataFile(int nch, string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \ static int readDataFile(int nch, string fname, double *data, double *err=NULL, double *ang=NULL, char dataformat='f') { \
ifstream infile; \ ifstream infile; \
int iline=0; \ int iline=0; \
int maxchans; \
string str; \ string str; \
maxchans=nch; \
infile.open(fname.c_str(), ios_base::in); \ infile.open(fname.c_str(), ios_base::in); \
if (infile.is_open()) { \ if (infile.is_open()) { \
iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \ iline=readDataFile(nch, infile, data, err, ang, dataformat, 0); \

View File

@ -38,7 +38,7 @@ int postProcessing::kbhit(){
} }
postProcessing::postProcessing(): expTime(NULL), ang(NULL), val(NULL), err(NULL), numberOfChannels(0), badChannelMask(NULL){ postProcessing::postProcessing(): expTime(NULL), badChannelMask(NULL), ang(NULL), val(NULL), err(NULL), numberOfChannels(0) {
pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t mp1 = PTHREAD_MUTEX_INITIALIZER;
mp=mp1; mp=mp1;
pthread_mutex_init(&mp, NULL); pthread_mutex_init(&mp, NULL);
@ -422,10 +422,9 @@ void* postProcessing::processData(int delflag) {
int *myData; int *myData;
char *p;
int dum=1; int dum=1;
int nf=1, ii, nch; // int nf=1, ii, nch;
int jctb=0; // int jctb=0;
// if (getDetectorsType()==JUNGFRAUCTB) { // if (getDetectorsType()==JUNGFRAUCTB) {
@ -456,7 +455,7 @@ void* postProcessing::processData(int delflag) {
// if (jctb) { // if (jctb) {
// p=(char*)myData; // char* p=(char*)myData;
// for (ii=0; ii<nf; ii++) { // for (ii=0; ii<nf; ii++) {
// processFrame((int*)p,delflag, 1); // processFrame((int*)p,delflag, 1);
// p+=2*nch; // p+=2*nch;
@ -880,10 +879,14 @@ void postProcessing::startThread(int delflag) {
else else
ret = pthread_create(&dataProcessingThread, &tattr,startProcessDataNoDelete, (void*)this); ret = pthread_create(&dataProcessingThread, &tattr,startProcessDataNoDelete, (void*)this);
if (ret)
printf("ret %d\n", ret);
pthread_attr_destroy(&tattr); pthread_attr_destroy(&tattr);
// scheduling parameters of target thread // scheduling parameters of target thread
ret = pthread_setschedparam(dataProcessingThread, policy, &param); ret = pthread_setschedparam(dataProcessingThread, policy, &param);
} }

View File

@ -13,7 +13,7 @@ INCLUDES?= -I../commonFiles -I../slsDetector -I ../MySocketTCP -I../usersFuncti
LIBDIR?=../ LIBDIR?=../
LIBS?= -L$(LIBDIR) -lSlsDetector LIBS?= -L$(LIBDIR) -lSlsDetector
LDFLAG= -L/usr/lib64/ -lpthread LDFLAG= -L/usr/lib64/ -pthread
DESTDIR ?= bin DESTDIR ?= bin

View File

@ -2,7 +2,7 @@ CFLAGS= -DC_ONLY
FLAGS=-DVERBOSE FLAGS=-DVERBOSE
INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/usersFunctions -I../slsDetectorSoftware/multiSlsDetector -I../slsDetectorSoftware/slsDetectorAnalysis INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/usersFunctions -I../slsDetectorSoftware/multiSlsDetector -I../slsDetectorSoftware/slsDetectorAnalysis
LIBS= -L../slsDetectorSoftware/ LIBS= -L../slsDetectorSoftware/
LDFLAG= -lSlsDetector -lpthread LDFLAG= -lSlsDetector -pthread
EPICSFLAGS=-DEPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom EPICSFLAGS=-DEPICS -I/usr/local/epics/base/include/ -I /usr/local/epics/base/include/os/Linux/ -L /usr/local/epics/base/lib/SL5-x86/ -Wl,-R/usr/local/epics/base/lib/SL5-x86 -lca -lCom

View File

@ -2,20 +2,20 @@ OBJPATH=bin/obj
EXAMPLEPATH=bin/example EXAMPLEPATH=bin/example
all: all:
g++ CondVar.cpp -lpthread -c -g -o $(OBJPATH)/CondVar.o g++ CondVar.cpp -pthread -c -g -o $(OBJPATH)/CondVar.o
g++ Mutex.cpp -lpthread -c -g -o $(OBJPATH)/Mutex.o g++ Mutex.cpp -pthread -c -g -o $(OBJPATH)/Mutex.o
#g++ Task.cpp -lpthread -c -g -o $(OBJPATH)/Task.o #g++ Task.cpp -pthread -c -g -o $(OBJPATH)/Task.o
g++ ThreadPool.cpp -lpthread -c -g -o $(OBJPATH)/ThreadPool.o g++ ThreadPool.cpp -pthread -c -g -o $(OBJPATH)/ThreadPool.o
g++ Multi.cpp -lpthread -c -g -o $(OBJPATH)/Multi.o g++ Multi.cpp -pthread -c -g -o $(OBJPATH)/Multi.o
#g++ $(OBJPATH)/CondVar.o $(OBJPATH)/Mutex.o $(OBJPATH)/Task.o $(OBJPATH)/ThreadPool.o threadpool_test.cpp Single.cpp Multi.cpp -lpthread -I . -g -o $(EXAMPLEPATH)threadpool_test #g++ $(OBJPATH)/CondVar.o $(OBJPATH)/Mutex.o $(OBJPATH)/Task.o $(OBJPATH)/ThreadPool.o threadpool_test.cpp Single.cpp Multi.cpp -pthread -I . -g -o $(EXAMPLEPATH)threadpool_test
g++ $(OBJPATH)/CondVar.o $(OBJPATH)/Mutex.o $(OBJPATH)/ThreadPool.o threadpool_test.cpp Single.cpp Multi.cpp -lpthread -I . -g -o $(EXAMPLEPATH)threadpool_test g++ $(OBJPATH)/CondVar.o $(OBJPATH)/Mutex.o $(OBJPATH)/ThreadPool.o threadpool_test.cpp Single.cpp Multi.cpp -pthread -I . -g -o $(EXAMPLEPATH)threadpool_test
#all: #all:
# g++ threadpool.cpp -lpthread -fpic -c -o bin/obj/threadpool.o # g++ threadpool.cpp -pthread -fpic -c -o bin/obj/threadpool.o
# g++ -L./bin bin/obj/threadpool.o -lpthread threadpool_test.cpp -o bin/example/threadpool_test # g++ -L./bin bin/obj/threadpool.o -pthread threadpool_test.cpp -o bin/example/threadpool_test
#threadpool: #threadpool:
# g++ threadpool.cpp -lpthread -fpic -c -o bin/obj/threadpool.o # g++ threadpool.cpp -pthread -fpic -c -o bin/obj/threadpool.o
# g++ -shared -fPIC bin/obj/threadpool.o -o bin/lib/libthreadpool.so # g++ -shared -fPIC bin/obj/threadpool.o -o bin/lib/libthreadpool.so
#example: #example:
# g++ -L./bin/lib -lthreadpool threadpool_test.cpp -o threadpool_test # g++ -L./bin/lib -lthreadpool threadpool_test.cpp -o threadpool_test

View File

@ -24,8 +24,8 @@ public:
~func00_t() {} ~func00_t() {}
void operator()() const {((m_ptr->*m_fn)());} void operator()() const {((m_ptr->*m_fn)());}
private: private:
_Class* m_ptr;
_Ret (_Class::*m_fn)(); _Ret (_Class::*m_fn)();
_Class* m_ptr;
}; };
template<typename _Ret, typename _Class, typename _Store> template<typename _Ret, typename _Class, typename _Store>
@ -36,8 +36,8 @@ public:
~func0_t() {} ~func0_t() {}
void operator()() const {*m_store = ((m_ptr->*m_fn)());} void operator()() const {*m_store = ((m_ptr->*m_fn)());}
private: private:
_Class* m_ptr;
_Ret (_Class::*m_fn)(); _Ret (_Class::*m_fn)();
_Class* m_ptr;
_Store* m_store; _Store* m_store;
}; };
@ -49,8 +49,8 @@ public:
~func1_t() {} ~func1_t() {}
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1));} void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1));}
private: private:
_Class* m_ptr;
_Ret (_Class::*m_fn)(_Arg1); _Ret (_Class::*m_fn)(_Arg1);
_Class* m_ptr;
_Arg1 m_arg1; _Arg1 m_arg1;
_Store* m_store; _Store* m_store;
}; };
@ -63,8 +63,8 @@ public:
~func2_t() {} ~func2_t() {}
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2));} void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2));}
private: private:
_Class* m_ptr;
_Ret (_Class::*m_fn)(_Arg1,_Arg2); _Ret (_Class::*m_fn)(_Arg1,_Arg2);
_Class* m_ptr;
_Arg1 m_arg1; _Arg1 m_arg1;
_Arg2 m_arg2; _Arg2 m_arg2;
_Store* m_store; _Store* m_store;
@ -78,8 +78,8 @@ public:
~func3_t() {} ~func3_t() {}
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3));} void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3));}
private: private:
_Class* m_ptr;
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3); _Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3);
_Class* m_ptr;
_Arg1 m_arg1; _Arg1 m_arg1;
_Arg2 m_arg2; _Arg2 m_arg2;
_Arg3 m_arg3; _Arg3 m_arg3;
@ -94,8 +94,8 @@ public:
~func4_t() {} ~func4_t() {}
void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3,m_arg4));} void operator()() const {*m_store = ((m_ptr->*m_fn)(m_arg1,m_arg2,m_arg3,m_arg4));}
private: private:
_Class* m_ptr;
_Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3,_Arg4); _Ret (_Class::*m_fn)(_Arg1,_Arg2,_Arg3,_Arg4);
_Class* m_ptr;
_Arg1 m_arg1; _Arg1 m_arg1;
_Arg2 m_arg2; _Arg2 m_arg2;
_Arg3 m_arg3; _Arg3 m_arg3;
@ -129,8 +129,8 @@ public:
Task(func2_t <char*,slsDetector,networkParameter,string,string>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(t),m12(0),m13(0){}; Task(func2_t <char*,slsDetector,networkParameter,string,string>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(t),m12(0),m13(0){};
/* Return: void, Param: none */ /* Return: void, Param: none */
Task(func00_t <void,slsDetector>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(t),m13(0){}; Task(func00_t <void,slsDetector>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(t),m13(0){};
/* Return: int, Param: int,int,detectorSettings */ /* Return: int, Param: int,int,detectorSettings,int */
Task(func3_t <int,slsDetector,int,int,detectorSettings,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t){}; Task(func4_t <int,slsDetector,int,int,detectorSettings,int,int>* t): m1(0),m2(0),m3(0),m4(0),m5(0),m6(0),m7(0),m8(0),m9(0),m10(0),m11(0),m12(0),m13(t){};
@ -178,7 +178,7 @@ private:
/* Return: void, Param: none */ /* Return: void, Param: none */
func00_t <void,slsDetector>* m12; func00_t <void,slsDetector>* m12;
/* Return: int, Param: int,int,detectorSettings */ /* Return: int, Param: int,int,detectorSettings */
func3_t <int,slsDetector,int,int,detectorSettings,int>* m13; func4_t <int,slsDetector,int,int,detectorSettings,int,int>* m13;
}; };

View File

@ -67,12 +67,13 @@ int ThreadPool::destroy_threadpool(){
/*cout << "Broadcasting STOP signal to all threads..." << endl;*/ /*cout << "Broadcasting STOP signal to all threads..." << endl;*/
m_task_cond_var.broadcast(); // notify all threads we are shttung down m_task_cond_var.broadcast(); // notify all threads we are shttung down
int ret = -1; //int ret = -1;
for (int i = 0; i < m_pool_size; i++) { for (int i = 0; i < m_pool_size; i++) {
void* result; void* result;
sem_post(&semStart); sem_post(&semStart);
sem_post(&semDone); sem_post(&semDone);
ret = pthread_join(m_threads[i], &result); //ret =
pthread_join(m_threads[i], &result);
/*cout << "pthread_join() returned " << ret << ": " << strerror(errno) << endl;*/ /*cout << "pthread_join() returned " << ret << ": " << strerror(errno) << endl;*/
m_task_cond_var.broadcast(); // try waking up a bunch of threads that are still waiting m_task_cond_var.broadcast(); // try waking up a bunch of threads that are still waiting
} }
@ -85,7 +86,8 @@ int ThreadPool::destroy_threadpool(){
} }
void* ThreadPool::execute_thread(){ void* ThreadPool::execute_thread(){
int ithread = current_thread_number; //for debugging seting ithread value
// int ithread = current_thread_number;
thread_started = true; thread_started = true;
Task* task = NULL; Task* task = NULL;
m_tasks_loaded = false; m_tasks_loaded = false;

View File

@ -54,7 +54,7 @@ $(BUILDDIR)/%.o : $(SRCDIR)/%.cpp Makefile
ifeq ($(ROOTSLS),yes) ifeq ($(ROOTSLS),yes)
$(CXX) -DROOTSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(ROOTFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -L/usr/lib64/ $(FLAGS) $(CXX) -DROOTSLS -o $@ -c $< $(INCLUDES) $(DFLAGS) $(ROOTFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -L/usr/lib64/ $(FLAGS)
else else
$(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -lpthread $(FLAGS) $(LIBZMQ) -lrt $(CXX) -o $@ -c $< $(INCLUDES) $(DFLAGS) -fPIC $(EPICSFLAGS) $(LDFLAGRXR) -pthread $(FLAGS) $(LIBZMQ) -lrt
endif endif
lib: $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a lib: $(OBJS) $(DESTDIR)/libSlsReceiver.so $(DESTDIR)/libSlsReceiver.a
@ -63,7 +63,7 @@ receiver: $(DESTDIR)/slsReceiver
$(DESTDIR)/libSlsReceiver.so: $(OBJS) $(DESTDIR)/libSlsReceiver.so: $(OBJS)
$(CXX) -shared -Wl,-soname,libSlsReceiver.so -o libSlsReceiver.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -lpthread $(LIBZMQ) -lrt $(CXX) -shared -Wl,-soname,libSlsReceiver.so -o libSlsReceiver.so $(OBJS) -lc $(INCLUDES) $(DFLAGS) $(FLAGS) $(EPICSFLAGS) -L/usr/lib64 -pthread $(LIBZMQ) -lrt
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR)) $(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
mv libSlsReceiver.so $(DESTDIR) mv libSlsReceiver.so $(DESTDIR)

View File

@ -1,9 +1,9 @@
Path: slsDetectorsPackage/slsReceiverSoftware Path: slsDetectorsPackage/slsReceiverSoftware
URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git URL: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git Repository Root: origin git@git.psi.ch:sls_detectors_software/sls_receiver_software.git
Repsitory UUID: a453c1d55d73fecc18af9df6ada21621a989ee4b Repsitory UUID: 239415ea0db2b9cdccd9bce80f0c78216115ffea
Revision: 514 Revision: 527
Branch: 2.3 Branch: 2.3.2
Last Changed Author: Dhanya_Maliakal Last Changed Author: Dhanya_Maliakal
Last Changed Rev: 514 Last Changed Rev: 527
Last Changed Date: 2017-03-24 13:41:56 +0100 Last Changed Date: 2017-04-20 08:26:16 +0200

View File

@ -21,7 +21,7 @@
#include "logger.h" #include "logger.h"
class UDPInterface { class UDPInterface: public Logger {
/* abstract class that defines the UDP interface of an sls detector data receiver. /* abstract class that defines the UDP interface of an sls detector data receiver.

View File

@ -739,7 +739,7 @@ private:
//***data call back thread parameters*** //***data call back thread parameters***
/** Ensures if zmq threads created successfully */ /** Ensures if zmq threads created successfully */
bool zmqThreadStarted; volatile bool zmqThreadStarted;
/** Number of data callback Threads */ /** Number of data callback Threads */
int numberofDataCallbackThreads; int numberofDataCallbackThreads;
@ -760,7 +760,7 @@ private:
//***general and listening thread parameters*** //***general and listening thread parameters***
/** Ensures if threads created successfully */ /** Ensures if threads created successfully */
bool threadStarted; volatile bool threadStarted;
/** Current Thread Index*/ /** Current Thread Index*/
int currentThreadIndex; int currentThreadIndex;
@ -832,6 +832,7 @@ private:
pthread_mutex_t progressMutex; pthread_mutex_t progressMutex;
}; };

View File

@ -134,7 +134,7 @@ bool CircularFifo<Element>::isEmpty() const
template<typename Element> template<typename Element>
bool CircularFifo<Element>::isFull() const bool CircularFifo<Element>::isFull() const
{ {
int tailCheck = (tail+1) % Capacity; int tailCheck = increment(tail);
return (tailCheck == head); return (tailCheck == head);
} }

View File

@ -81,7 +81,7 @@ using namespace std;
#define DEFAULT_BACKLOG 5 #define DEFAULT_BACKLOG 5
#define DEFAULT_UDP_PORTNO 50001 #define DEFAULT_UDP_PORTNO 50001
#define DEFAULT_GUI_PORTNO 65000 #define DEFAULT_GUI_PORTNO 65000
#define DEFAULT_ZMQ_PORTNO 70001 #define DEFAULT_ZMQ_PORTNO 40001
@ -111,8 +111,8 @@ enum communicationProtocol{
total_sent(0),// sender (client): where to? ip total_sent(0),// sender (client): where to? ip
header_packet_size(0) header_packet_size(0)
{ {
memset(&serverAddress, 0, sizeof(serverAddress)); memset(&serverAddress, 0,sizeof(serverAddress));
memset(&clientAddress, 0, sizeof(clientAddress)); memset(&clientAddress,0,sizeof(clientAddress));
// strcpy(hostname,host_ip_or_name); // strcpy(hostname,host_ip_or_name);
strcpy(lastClientIP,"none"); strcpy(lastClientIP,"none");

View File

@ -1,11 +1,11 @@
//#define SVNPATH "" //#define SVNPATH ""
#define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git" #define SVNURL "git@git.psi.ch:sls_detectors_software/sls_receiver_software.git"
//#define SVNREPPATH "" //#define SVNREPPATH ""
#define SVNREPUUID "a453c1d55d73fecc18af9df6ada21621a989ee4b" #define SVNREPUUID "239415ea0db2b9cdccd9bce80f0c78216115ffea"
//#define SVNREV 0x514 //#define SVNREV 0x527
//#define SVNKIND "" //#define SVNKIND ""
//#define SVNSCHED "" //#define SVNSCHED ""
#define SVNAUTH "Dhanya_Maliakal" #define SVNAUTH "Dhanya_Maliakal"
#define SVNREV 0x514 #define SVNREV 0x527
#define SVNDATE 0x20170324 #define SVNDATE 0x20170420
// //

View File

@ -1,5 +1,6 @@
//#ifndef __LOG_H__ #ifndef __LOG_H__
//#define __LOG_H__ #define __LOG_H__
#include <sstream> #include <sstream>
#include <string> #include <string>
@ -7,240 +8,82 @@
#include <unistd.h> #include <unistd.h>
#include <ansi.h> #include <ansi.h>
#ifdef VERBOSE
#define FILELOG_MAX_LEVEL logDEBUG
#endif
#ifdef VERYVERBOSE
#define FILELOG_MAX_LEVEL logDEBUG4
#endif
#ifdef FIFODEBUG #ifdef FIFODEBUG
#define FILELOG_MAX_LEVEL logDEBUG5 #define FILELOG_MAX_LEVEL logDEBUG5
#elif VERYVERBOSE
#define FILELOG_MAX_LEVEL logDEBUG4
#elif VERBOSE
#define FILELOG_MAX_LEVEL logDEBUG1
#endif #endif
#ifndef FILELOG_MAX_LEVEL #ifndef FILELOG_MAX_LEVEL
#define FILELOG_MAX_LEVEL logINFO #define FILELOG_MAX_LEVEL logINFO
#endif #endif
#define REPORT_LEVEL logDEBUG5
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
#define MYCONCAT(x,y)
#define __AT__ string(__FILE__) + string("::") + string(__func__) + string("(): ")
#define __SHORT_FORM_OF_FILE__ \
(strrchr(__FILE__,'/') \
? strrchr(__FILE__,'/')+1 \
: __FILE__ \
)
#define __SHORT_AT__ string(__SHORT_FORM_OF_FILE__) + string("::") + string(__func__) + string("(): ")
//":" TOSTRING(__LINE__)
/*
void error(const char *location, const char *msg){
printf("Error at %s: %s\n", location, msg);
}
*/
inline std::string NowTime();
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
template <typename T> class Log{
public:
Log();
virtual ~Log();
std::ostringstream& Get(TLogLevel level = logINFO);
static TLogLevel& ReportingLevel();
static std::string ToString(TLogLevel level);
static TLogLevel FromString(const std::string& level);
protected:
std::ostringstream os;
TLogLevel lev;
private:
Log(const Log&);
Log& operator =(const Log&);
};
class Output2FILE {
public:
static FILE*& Stream();
static void Output(const std::string& msg);
static void Output(const std::string& msg, TLogLevel level);
};
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# if defined (BUILDING_FILELOG_DLL)
# define FILELOG_DECLSPEC __declspec (dllexport)
# elif defined (USING_FILELOG_DLL)
# define FILELOG_DECLSPEC __declspec (dllimport)
# else
# define FILELOG_DECLSPEC
# endif // BUILDING_DBSIMPLE_DLL
#else
# define FILELOG_DECLSPEC
#endif // _WIN32
class FILELOG_DECLSPEC FILELog : public Log<Output2FILE> {};
//typedef Log<Output2FILE> FILELog;
#ifdef REST
#define FILE_LOG(level) \
if (level > FILELOG_MAX_LEVEL) ; \
else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \
else FILELog().Get(level)
#else
#define FILE_LOG(level) \
if (level > FILELOG_MAX_LEVEL) ; \
else if (level > FILELog::ReportingLevel() || !Output2FILE::Stream()) ; \
else FILELog().Get(level)
#endif
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
#include <windows.h>
inline std::string NowTime()
{
const int MAX_LEN = 200;
char buffer[MAX_LEN];
if (GetTimeFormatA(LOCALE_USER_DEFAULT, 0, 0,
"HH':'mm':'ss", buffer, MAX_LEN) == 0)
return "Error in NowTime()";
char result[100] = {0};
static DWORD first = GetTickCount();
sprintf(result, "%s.%03ld", buffer, (long)(GetTickCount() - first) % 1000);
return result;
}
#else
#include <sys/time.h> #include <sys/time.h>
inline std::string NowTime()
{
char buffer[11];
time_t t;
time(&t);
tm r = {0};
strftime(buffer, sizeof(buffer), "%X", localtime_r(&t, &r));
struct timeval tv;
gettimeofday(&tv, 0);
char result[100] = {0};
sprintf(result, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
return result;
}
#endif //WIN32 class Logger {
public:
Logger(){};
enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5};
template <typename T> Log<T>::Log():lev(logDEBUG){} static void FILE_LOG(TLogLevel level, char const* msg)
{
template <typename T> std::ostringstream& Log<T>::Get(TLogLevel level) if(level > FILELOG_MAX_LEVEL) return;
{
lev = level;
os << "- " << NowTime();
os << " " << ToString(level) << ": ";
os << std::string(level > logDEBUG ? level - logDEBUG : 0, '\t');
return os;
}
template <typename T> Log<T>::~Log() char buffer[11];
{ const int buffer_len = sizeof(buffer);
os << std::endl; time_t t;
#ifdef REST time(&t);
T::Output( os.str()); tm r = {0};
#else strftime(buffer, buffer_len, "%X", localtime_r(&t, &r));
T::Output( os.str(),lev); buffer[buffer_len - 1] = 0;
#endif struct timeval tv;
} gettimeofday(&tv, 0);
char result[100];
template <typename T> TLogLevel& Log<T>::ReportingLevel() const int result_len = sizeof(result);
{ snprintf(result, result_len, "%s.%03ld", buffer, (long)tv.tv_usec / 1000);
static TLogLevel reportingLevel = logDEBUG5; result[result_len - 1] = 0;
return reportingLevel;
}
template <typename T> std::string Log<T>::ToString(TLogLevel level)
{
static const char* const buffer[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4","DEBUG5"};
return buffer[level];
}
template <typename T>
TLogLevel Log<T>::FromString(const std::string& level)
{
if (level == "DEBUG5")
return logDEBUG5;
if (level == "DEBUG4")
return logDEBUG4;
if (level == "DEBUG3")
return logDEBUG3;
if (level == "DEBUG2")
return logDEBUG2;
if (level == "DEBUG1")
return logDEBUG1;
if (level == "DEBUG")
return logDEBUG;
if (level == "INFO")
return logINFO;
if (level == "WARNING")
return logWARNING;
if (level == "ERROR")
return logERROR;
Log<T>().Get(logWARNING) << "Unknown logging level '" << level << "'. Using INFO level as default.";
return logINFO;
}
inline FILE*& Output2FILE::Stream() /*
{ const char* const slevel[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4","DEBUG5"};
static FILE* pStream = stderr; ostringstream os;
return pStream; os << "- " << string(result);
} os << " " << string(slevel[level]) << ": ";
// if (level > logDEBUG)
// os << std::string(level - logDEBUG, '\t');
os << msg;
string smessage = os.str();
inline void Output2FILE::Output(const std::string& msg) switch(level){
{ case logERROR: cprintf(RED BOLD, "%s\n", smessage.c_str()); break;
FILE* pStream = Stream(); case logWARNING: cprintf(YELLOW BOLD, "%s\n", smessage.c_str()); break;
if (!pStream) case logINFO: cprintf(GRAY, "%s\n", smessage.c_str()); break;
return; default: break;
fprintf(pStream, "%s", msg.c_str()); }
fflush(pStream); */
}
inline void Output2FILE::Output(const std::string& msg, TLogLevel level) switch(level){
{ case logERROR: cprintf(RED BOLD, "- %s ERROR: %s \n", result, msg); break;
FILE* pStream = Stream(); case logWARNING: cprintf(YELLOW BOLD,"- %s WARNING: %s \n", result, msg); break;
if (!pStream) case logINFO: cprintf(GRAY, "- %s INFO: %s \n", result, msg); break;
return; default: cprintf(GRAY, "- %s DEBUG: %s \n", result, msg); break;
switch(level){ }
case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break;
case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break;
case logINFO: cprintf(GRAY,"%s",msg.c_str());break;
// case logINFO: cprintf(DARKGRAY BOLD,"%s",msg.c_str());break;
default: fprintf(pStream,"%s",msg.c_str()); break;
}
fflush(pStream);
}
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# if defined (BUILDING_FILELOG_DLL)
# define FILELOG_DECLSPEC __declspec (dllexport)
# elif defined (USING_FILELOG_DLL)
# define FILELOG_DECLSPEC __declspec (dllimport)
# else
# define FILELOG_DECLSPEC
# endif // BUILDING_DBSIMPLE_DLL
#else
# define FILELOG_DECLSPEC
#endif // _WIN32
fflush(stdout);
}
//#endif //__LOG_H__ };
#endif //__LOG_H__

View File

@ -18,7 +18,7 @@
*@short creates the UDP and TCP class objects *@short creates the UDP and TCP class objects
*/ */
class slsReceiver : private virtual slsReceiverDefs { class slsReceiver : public Logger, private virtual slsReceiverDefs {
public: public:
/** /**

View File

@ -17,7 +17,7 @@
*@short interface between receiver and client *@short interface between receiver and client
*/ */
class slsReceiverTCPIPInterface : private virtual slsReceiverDefs { class slsReceiverTCPIPInterface : public Logger, private virtual slsReceiverDefs {
public: public:
/** /**

View File

@ -19,7 +19,6 @@ using namespace std;
* They access local cache of configuration or detector parameters ******* * They access local cache of configuration or detector parameters *******
*************************************************************************/ *************************************************************************/
UDPBaseImplementation::UDPBaseImplementation(){ UDPBaseImplementation::UDPBaseImplementation(){
FILE_LOG(logDEBUG) << __AT__ << " starting";
initializeMembers(); initializeMembers();
@ -33,9 +32,7 @@ UDPBaseImplementation::UDPBaseImplementation(){
} }
void UDPBaseImplementation::initializeMembers(){ void UDPBaseImplementation::initializeMembers(){
FILE_LOG(logDEBUG) << __AT__ << " starting";
FILE_LOG(logDEBUG) << "Info: Initializing base members";
//**detector parameters*** //**detector parameters***
myDetectorType = GENERIC; myDetectorType = GENERIC;
strcpy(detHostname,""); strcpy(detHostname,"");
@ -93,7 +90,6 @@ UDPBaseImplementation::~UDPBaseImplementation(){}
/**initial parameters***/ /**initial parameters***/
char *UDPBaseImplementation::getDetectorHostname() const{ char *UDPBaseImplementation::getDetectorHostname() const{
FILE_LOG(logDEBUG) << __AT__ << " starting";
//not initialized //not initialized
if(!strlen(detHostname)) if(!strlen(detHostname))
@ -106,7 +102,6 @@ char *UDPBaseImplementation::getDetectorHostname() const{
} }
int UDPBaseImplementation::getFlippedData(int axis) const{ int UDPBaseImplementation::getFlippedData(int axis) const{
FILE_LOG(logDEBUG) << __AT__ << " starting";
if(axis<0 || axis > 1) return -1; if(axis<0 || axis > 1) return -1;
return flippedData[axis]; return flippedData[axis];
} }
@ -114,7 +109,6 @@ int UDPBaseImplementation::getFlippedData(int axis) const{
/***file parameters***/ /***file parameters***/
char *UDPBaseImplementation::getFileName() const{ char *UDPBaseImplementation::getFileName() const{
FILE_LOG(logDEBUG) << __AT__ << " starting";
//not initialized //not initialized
if(!strlen(fileName)) if(!strlen(fileName))
@ -127,7 +121,6 @@ char *UDPBaseImplementation::getFileName() const{
} }
char *UDPBaseImplementation::getFilePath() const{ char *UDPBaseImplementation::getFilePath() const{
FILE_LOG(logDEBUG) << __AT__ << " starting";
//not initialized //not initialized
if(!strlen(filePath)) if(!strlen(filePath))
@ -139,25 +132,24 @@ char *UDPBaseImplementation::getFilePath() const{
return output; return output;
} }
uint64_t UDPBaseImplementation::getFileIndex() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fileIndex;} uint64_t UDPBaseImplementation::getFileIndex() const{ return fileIndex;}
int UDPBaseImplementation::getScanTag() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return scanTag;} int UDPBaseImplementation::getScanTag() const{ return scanTag;}
bool UDPBaseImplementation::getFrameIndexEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameIndexEnable;} bool UDPBaseImplementation::getFrameIndexEnable() const{ return frameIndexEnable;}
bool UDPBaseImplementation::getFileWriteEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fileWriteEnable;} bool UDPBaseImplementation::getFileWriteEnable() const{ return fileWriteEnable;}
bool UDPBaseImplementation::getOverwriteEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return overwriteEnable;} bool UDPBaseImplementation::getOverwriteEnable() const{ return overwriteEnable;}
bool UDPBaseImplementation::getDataCompressionEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dataCompressionEnable;} bool UDPBaseImplementation::getDataCompressionEnable() const{ return dataCompressionEnable;}
/***acquisition count parameters***/ /***acquisition count parameters***/
uint64_t UDPBaseImplementation::getTotalFramesCaught() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return (totalPacketsCaught/packetsPerFrame);} uint64_t UDPBaseImplementation::getTotalFramesCaught() const{ return (totalPacketsCaught/packetsPerFrame);}
uint64_t UDPBaseImplementation::getFramesCaught() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return (packetsCaught/packetsPerFrame);} uint64_t UDPBaseImplementation::getFramesCaught() const{ return (packetsCaught/packetsPerFrame);}
int64_t UDPBaseImplementation::getAcquisitionIndex() const{ int64_t UDPBaseImplementation::getAcquisitionIndex() const{
FILE_LOG(logDEBUG) << __AT__ << " starting";
if(!totalPacketsCaught) if(!totalPacketsCaught)
return -1; return -1;
@ -166,12 +158,12 @@ int64_t UDPBaseImplementation::getAcquisitionIndex() const{
/***connection parameters***/ /***connection parameters***/
uint32_t UDPBaseImplementation::getUDPPortNumber() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return udpPortNum[0];} uint32_t UDPBaseImplementation::getUDPPortNumber() const{ return udpPortNum[0];}
uint32_t UDPBaseImplementation::getUDPPortNumber2() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return udpPortNum[1];} uint32_t UDPBaseImplementation::getUDPPortNumber2() const{ return udpPortNum[1];}
char *UDPBaseImplementation::getEthernetInterface() const{ char *UDPBaseImplementation::getEthernetInterface() const{
FILE_LOG(logDEBUG) << __AT__ << " starting";
char* output = new char[MAX_STR_LENGTH](); char* output = new char[MAX_STR_LENGTH]();
strcpy(output,eth); strcpy(output,eth);
@ -181,30 +173,30 @@ char *UDPBaseImplementation::getEthernetInterface() const{
/***acquisition parameters***/ /***acquisition parameters***/
int UDPBaseImplementation::getShortFrameEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return shortFrameEnable;} int UDPBaseImplementation::getShortFrameEnable() const{ return shortFrameEnable;}
uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameToGuiFrequency;} uint32_t UDPBaseImplementation::getFrameToGuiFrequency() const{ return frameToGuiFrequency;}
uint32_t UDPBaseImplementation::getFrameToGuiTimer() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return frameToGuiTimerinMS;} uint32_t UDPBaseImplementation::getFrameToGuiTimer() const{ return frameToGuiTimerinMS;}
uint32_t UDPBaseImplementation::getDataStreamEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dataStreamEnable;} uint32_t UDPBaseImplementation::getDataStreamEnable() const{ return dataStreamEnable;}
uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionPeriod;} uint64_t UDPBaseImplementation::getAcquisitionPeriod() const{ return acquisitionPeriod;}
uint64_t UDPBaseImplementation::getAcquisitionTime() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return acquisitionTime;} uint64_t UDPBaseImplementation::getAcquisitionTime() const{ return acquisitionTime;}
uint64_t UDPBaseImplementation::getNumberOfFrames() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return numberOfFrames;} uint64_t UDPBaseImplementation::getNumberOfFrames() const{ return numberOfFrames;}
uint32_t UDPBaseImplementation::getDynamicRange() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return dynamicRange;} uint32_t UDPBaseImplementation::getDynamicRange() const{ return dynamicRange;}
bool UDPBaseImplementation::getTenGigaEnable() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return tengigaEnable;} bool UDPBaseImplementation::getTenGigaEnable() const{ return tengigaEnable;}
uint32_t UDPBaseImplementation::getFifoDepth() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return fifoDepth;} uint32_t UDPBaseImplementation::getFifoDepth() const{ return fifoDepth;}
/***receiver status***/ /***receiver status***/
slsReceiverDefs::runStatus UDPBaseImplementation::getStatus() const{ FILE_LOG(logDEBUG) << __AT__ << " starting"; return status;} slsReceiverDefs::runStatus UDPBaseImplementation::getStatus() const{ return status;}
int UDPBaseImplementation::getActivate() const{FILE_LOG(logDEBUG) << __AT__ << " starting"; return activated;} int UDPBaseImplementation::getActivate() const{ return activated;}
/************************************************************************* /*************************************************************************
@ -214,29 +206,32 @@ int UDPBaseImplementation::getActivate() const{FILE_LOG(logDEBUG) << __AT__ << "
/**initial parameters***/ /**initial parameters***/
void UDPBaseImplementation::configure(map<string, string> config_map){ void UDPBaseImplementation::configure(map<string, string> config_map){
FILE_LOG(logWARNING) << __AT__ << " doing nothing..."; FILE_LOG(logERROR, " must be overridden by child classes");
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes";
} }
void UDPBaseImplementation::setFlippedData(int axis, int enable){ void UDPBaseImplementation::setFlippedData(int axis, int enable){
FILE_LOG(logDEBUG) << __AT__ << " starting";
if(axis<0 || axis>1) return; if(axis<0 || axis>1) return;
flippedData[axis] = enable==0?0:1; flippedData[axis] = enable==0?0:1;
FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1];
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Flipped Data: %d , %d ", flippedData[0], flippedData[1]);
FILE_LOG(logINFO, cstreambuf);
} }
/***file parameters***/ /***file parameters***/
void UDPBaseImplementation::setFileName(const char c[]){ void UDPBaseImplementation::setFileName(const char c[]){
FILE_LOG(logDEBUG) << __AT__ << " starting";
if(strlen(c)) if(strlen(c))
strcpy(fileName, c); strcpy(fileName, c);
FILE_LOG(logINFO) << "File name:" << fileName;
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "File name: %s ", fileName);
FILE_LOG(logINFO, cstreambuf);
} }
void UDPBaseImplementation::setFilePath(const char c[]){ void UDPBaseImplementation::setFilePath(const char c[]){
FILE_LOG(logDEBUG) << __AT__ << " starting";
if(strlen(c)){ if(strlen(c)){
//check if filepath exists //check if filepath exists
@ -245,55 +240,67 @@ void UDPBaseImplementation::setFilePath(const char c[]){
strcpy(filePath,c); strcpy(filePath,c);
else{ else{
strcpy(filePath,""); strcpy(filePath,"");
FILE_LOG(logWARNING) << "FilePath does not exist:" << filePath;
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "FilePath does not exist: %s ", filePath);
FILE_LOG(logWARNING, cstreambuf);
} }
strcpy(filePath, c); strcpy(filePath, c);
} }
FILE_LOG(logDEBUG) << "Info: File path:" << filePath; /*{
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "File path:: %s ", filePath);
FILE_LOG(logDEBUG, cstreambuf);
}*/
} }
void UDPBaseImplementation::setFileIndex(const uint64_t i){ void UDPBaseImplementation::setFileIndex(const uint64_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
fileIndex = i; fileIndex = i;
FILE_LOG(logINFO) << "File Index:" << fileIndex; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "File Index: %lu ", fileIndex);
FILE_LOG(logINFO, cstreambuf);
} }
//FIXME: needed? //FIXME: needed?
void UDPBaseImplementation::setScanTag(const int i){ void UDPBaseImplementation::setScanTag(const int i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
scanTag = i; scanTag = i;
FILE_LOG(logINFO) << "Scan Tag:" << scanTag; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Scan Tag: %d ", scanTag);
FILE_LOG(logINFO, cstreambuf);
} }
void UDPBaseImplementation::setFrameIndexEnable(const bool b){ void UDPBaseImplementation::setFrameIndexEnable(const bool b){
FILE_LOG(logDEBUG) << __AT__ << " starting";
frameIndexEnable = b; frameIndexEnable = b;
FILE_LOG(logINFO) << "Frame Index Enable: " << stringEnable(frameIndexEnable); char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Frame Index Enable: %s ", stringEnable(frameIndexEnable).c_str());
FILE_LOG(logINFO, cstreambuf);
} }
void UDPBaseImplementation::setFileWriteEnable(const bool b){ void UDPBaseImplementation::setFileWriteEnable(const bool b){
FILE_LOG(logDEBUG) << __AT__ << " starting";
fileWriteEnable = b; fileWriteEnable = b;
FILE_LOG(logINFO) << "File Write Enable: " << stringEnable(fileWriteEnable); char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "File Write Enable: %s ", stringEnable(fileWriteEnable).c_str());
FILE_LOG(logINFO, cstreambuf);
} }
void UDPBaseImplementation::setOverwriteEnable(const bool b){ void UDPBaseImplementation::setOverwriteEnable(const bool b){
FILE_LOG(logDEBUG) << __AT__ << " starting";
overwriteEnable = b; overwriteEnable = b;
FILE_LOG(logINFO) << "Overwrite Enable: " << stringEnable(overwriteEnable); char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Overwrite Enable: %s ", stringEnable(overwriteEnable).c_str());
FILE_LOG(logINFO, cstreambuf);
} }
int UDPBaseImplementation::setDataCompressionEnable(const bool b){ int UDPBaseImplementation::setDataCompressionEnable(const bool b){
FILE_LOG(logDEBUG) << __AT__ << " starting";
dataCompressionEnable = b; dataCompressionEnable = b;
FILE_LOG(logINFO) << "Data Compression : " << stringEnable(dataCompressionEnable); char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Data Compression: %s ", stringEnable(dataCompressionEnable).c_str());
FILE_LOG(logINFO, cstreambuf);
//overridden methods might return FAIL //overridden methods might return FAIL
return OK; return OK;
@ -302,58 +309,65 @@ int UDPBaseImplementation::setDataCompressionEnable(const bool b){
/***connection parameters***/ /***connection parameters***/
void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){ void UDPBaseImplementation::setUDPPortNumber(const uint32_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
udpPortNum[0] = i; udpPortNum[0] = i;
FILE_LOG(logINFO) << "UDP Port Number[0]:" << udpPortNum[0]; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "UDP Port Number[0]: %u ", udpPortNum[0]);
FILE_LOG(logINFO, cstreambuf);
} }
void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){ void UDPBaseImplementation::setUDPPortNumber2(const uint32_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
udpPortNum[1] = i; udpPortNum[1] = i;
FILE_LOG(logINFO) << "UDP Port Number[1]:" << udpPortNum[1]; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "UDP Port Number[1]: %u ", udpPortNum[1]);
FILE_LOG(logINFO, cstreambuf);
} }
void UDPBaseImplementation::setEthernetInterface(const char* c){ void UDPBaseImplementation::setEthernetInterface(const char* c){
FILE_LOG(logDEBUG) << __AT__ << " starting";
strcpy(eth, c); strcpy(eth, c);
FILE_LOG(logINFO) << "Ethernet Interface: " << eth; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Ethernet Interface: %s ", eth);
FILE_LOG(logINFO, cstreambuf);
} }
/***acquisition parameters***/ /***acquisition parameters***/
void UDPBaseImplementation::setShortFrameEnable(const int i){ void UDPBaseImplementation::setShortFrameEnable(const int i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
shortFrameEnable = i; shortFrameEnable = i;
FILE_LOG(logINFO) << "Short Frame Enable: " << stringEnable(shortFrameEnable); char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Short Frame Enable: %d ", shortFrameEnable);
FILE_LOG(logINFO, cstreambuf);
} }
int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){ int UDPBaseImplementation::setFrameToGuiFrequency(const uint32_t freq){
FILE_LOG(logDEBUG) << __AT__ << " starting";
frameToGuiFrequency = freq; frameToGuiFrequency = freq;
FILE_LOG(logINFO) << "Frame To Gui Frequency:" << frameToGuiFrequency; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Frame To Gui Frequency: %u ", frameToGuiFrequency);
FILE_LOG(logINFO, cstreambuf);
//overrridden child classes might return FAIL //overrridden child classes might return FAIL
return OK; return OK;
} }
void UDPBaseImplementation::setFrameToGuiTimer(const uint32_t time_in_ms){ void UDPBaseImplementation::setFrameToGuiTimer(const uint32_t time_in_ms){
FILE_LOG(logDEBUG) << __AT__ << " starting";
frameToGuiTimerinMS = time_in_ms; frameToGuiTimerinMS = time_in_ms;
FILE_LOG(logINFO) << "Frame To Gui Timer:" << frameToGuiTimerinMS; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Frame To Gui Timer: %u ", frameToGuiTimerinMS);
FILE_LOG(logINFO, cstreambuf);
} }
uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){ uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
FILE_LOG(logDEBUG) << __AT__ << " starting";
dataStreamEnable = enable; dataStreamEnable = enable;
FILE_LOG(logINFO) << "Streaming Data from Receiver:" << dataStreamEnable; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Streaming Data from Receiver: %d ", dataStreamEnable);
FILE_LOG(logINFO, cstreambuf);
//overrridden child classes might return FAIL //overrridden child classes might return FAIL
return OK; return OK;
@ -361,60 +375,66 @@ uint32_t UDPBaseImplementation::setDataStreamEnable(const uint32_t enable){
int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){ int UDPBaseImplementation::setAcquisitionPeriod(const uint64_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
acquisitionPeriod = i; acquisitionPeriod = i;
FILE_LOG(logINFO) << "Acquisition Period:" << (double)acquisitionPeriod/(1E9) << "s"; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Acquisition Period: %f s ", (double)acquisitionPeriod/(1E9));
FILE_LOG(logINFO, cstreambuf);
//overrridden child classes might return FAIL //overrridden child classes might return FAIL
return OK; return OK;
} }
int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){ int UDPBaseImplementation::setAcquisitionTime(const uint64_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
acquisitionTime = i; acquisitionTime = i;
FILE_LOG(logINFO) << "Acquisition Time:" << (double)acquisitionTime/(1E9) << "s"; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Acquisition Time: %f s ", (double)acquisitionTime/(1E9));
FILE_LOG(logINFO, cstreambuf);
//overrridden child classes might return FAIL //overrridden child classes might return FAIL
return OK; return OK;
} }
int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){ int UDPBaseImplementation::setNumberOfFrames(const uint64_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
numberOfFrames = i; numberOfFrames = i;
FILE_LOG(logINFO) << "Number of Frames:" << numberOfFrames; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Number of Frames: %lu ", numberOfFrames);
FILE_LOG(logINFO, cstreambuf);
//overrridden child classes might return FAIL //overrridden child classes might return FAIL
return OK; return OK;
} }
int UDPBaseImplementation::setDynamicRange(const uint32_t i){ int UDPBaseImplementation::setDynamicRange(const uint32_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
dynamicRange = i; dynamicRange = i;
FILE_LOG(logINFO) << "Dynamic Range:" << dynamicRange; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Dynamic Range: %u ", dynamicRange);
FILE_LOG(logINFO, cstreambuf);
//overrridden child classes might return FAIL //overrridden child classes might return FAIL
return OK; return OK;
} }
int UDPBaseImplementation::setTenGigaEnable(const bool b){ int UDPBaseImplementation::setTenGigaEnable(const bool b){
FILE_LOG(logDEBUG) << __AT__ << " starting";
tengigaEnable = b; tengigaEnable = b;
FILE_LOG(logINFO) << "Ten Giga Enable: " << stringEnable(tengigaEnable); char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Ten Giga Enable: %s ", stringEnable(tengigaEnable).c_str());
FILE_LOG(logINFO, cstreambuf);
//overridden functions might return FAIL //overridden functions might return FAIL
return OK; return OK;
} }
int UDPBaseImplementation::setFifoDepth(const uint32_t i){ int UDPBaseImplementation::setFifoDepth(const uint32_t i){
FILE_LOG(logDEBUG) << __AT__ << " starting";
fifoDepth = i; fifoDepth = i;
FILE_LOG(logINFO) << "Fifo Depth: " << i; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Fifo Depth: %u ", i);
FILE_LOG(logINFO, cstreambuf);
//overridden functions might return FAIL //overridden functions might return FAIL
return OK; return OK;
@ -428,79 +448,88 @@ int UDPBaseImplementation::setFifoDepth(const uint32_t i){
/***initial functions***/ /***initial functions***/
int UDPBaseImplementation::setDetectorType(const detectorType d){ int UDPBaseImplementation::setDetectorType(const detectorType d){
FILE_LOG(logDEBUG) << __AT__ << " starting";
myDetectorType = d; myDetectorType = d;
//if eiger, set numberofListeningThreads = 2; //if eiger, set numberofListeningThreads = 2;
FILE_LOG(logINFO) << "Detector Type:" << getDetectorType(d); char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Detector Type: %s ", getDetectorType(d).c_str());
FILE_LOG(logINFO, cstreambuf);
return OK; return OK;
} }
void UDPBaseImplementation::initialize(const char *c){ void UDPBaseImplementation::initialize(const char *c){
FILE_LOG(logDEBUG) << __AT__ << " starting";
if(strlen(c)) if(strlen(c))
strcpy(detHostname, c); strcpy(detHostname, c);
FILE_LOG(logINFO) << "Detector Hostname:" << detHostname; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Detector Hostname: %s ", detHostname);
FILE_LOG(logINFO, cstreambuf);
} }
/***acquisition functions***/ /***acquisition functions***/
void UDPBaseImplementation::resetAcquisitionCount(){ void UDPBaseImplementation::resetAcquisitionCount(){
FILE_LOG(logDEBUG) << __AT__ << " starting";
totalPacketsCaught = 0; totalPacketsCaught = 0;
FILE_LOG(logINFO) << "totalPacketsCaught:" << totalPacketsCaught; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Total Packets Caught: %lu ", totalPacketsCaught);
FILE_LOG(logINFO, cstreambuf);
} }
int UDPBaseImplementation::startReceiver(char *c){ int UDPBaseImplementation::startReceiver(char *c){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes"; FILE_LOG(logERROR, " must be overridden by child classes");
return OK; return OK;
} }
void UDPBaseImplementation::stopReceiver(){ void UDPBaseImplementation::stopReceiver(){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes"; FILE_LOG(logERROR, " must be overridden by child classes");
} }
void UDPBaseImplementation::startReadout(){ void UDPBaseImplementation::startReadout(){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes"; FILE_LOG(logERROR, " must be overridden by child classes");
} }
int UDPBaseImplementation::shutDownUDPSockets(){ int UDPBaseImplementation::shutDownUDPSockets(){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes"; FILE_LOG(logERROR, " must be overridden by child classes");
//overridden functions might return FAIL //overridden functions might return FAIL
return OK; return OK;
} }
void UDPBaseImplementation::readFrame(int ithread, char* c,char** raw, int64_t &startAcquisitionIndex, int64_t &startFrameIndex){ void UDPBaseImplementation::readFrame(int ithread, char* c,char** raw, int64_t &startAcquisitionIndex, int64_t &startFrameIndex){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes"; FILE_LOG(logERROR, " must be overridden by child classes");
} }
//FIXME: needed, isnt stopReceiver enough? //FIXME: needed, isnt stopReceiver enough?
void UDPBaseImplementation::abort(){ void UDPBaseImplementation::abort(){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes"; FILE_LOG(logERROR, " must be overridden by child classes");
} }
void UDPBaseImplementation::closeFile(int ithread){ void UDPBaseImplementation::closeFile(int ithread){
FILE_LOG(logWARNING) << __AT__ << " doing nothing...";
FILE_LOG(logERROR) << __AT__ << " must be overridden by child classes"; FILE_LOG(logERROR, " must be overridden by child classes");
} }
int UDPBaseImplementation::setActivate(int enable){ int UDPBaseImplementation::setActivate(int enable){
FILE_LOG(logDEBUG) << __AT__ << " starting";
if(enable != -1){ if(enable != -1){
activated = enable; activated = enable;
FILE_LOG(logINFO) << "Activation: " << stringEnable(activated);
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Activation: %s ", stringEnable(activated).c_str());
FILE_LOG(logINFO, cstreambuf);
} }
return activated; return activated;

View File

@ -22,18 +22,21 @@ using namespace std;
UDPInterface * UDPInterface::create(string receiver_type){ UDPInterface * UDPInterface::create(string receiver_type){
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Starting %s ", receiver_type.c_str());
if (receiver_type == "standard"){ if (receiver_type == "standard"){
FILE_LOG(logINFO) << "Starting " << receiver_type; FILE_LOG(logINFO, cstreambuf);
return new UDPStandardImplementation(); return new UDPStandardImplementation();
} }
#ifdef REST #ifdef REST
else if (receiver_type == "REST"){ else if (receiver_type == "REST"){
FILE_LOG(logINFO) << "Starting " << receiver_type; FILE_LOG(logINFO, cstreambuf);
return new UDPRESTImplementation(); return new UDPRESTImplementation();
} }
#endif #endif
else{ else{
FILE_LOG(logWARNING) << "[ERROR] UDP interface not supported, using standard implementation"; FILE_LOG(logWARNING, "[ERROR] UDP interface not supported, using standard implementation");
return new UDPBaseImplementation(); return new UDPBaseImplementation();
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -104,7 +104,6 @@ int main(int argc, char *argv[]) {
//start tcp server thread //start tcp server thread
if(receiver->start() == slsReceiverDefs::OK){ if(receiver->start() == slsReceiverDefs::OK){
FILE_LOG(logDEBUG1) << "DONE!" << endl;
string str; string str;
cin>>str; cin>>str;
//wait and look for an exit keyword //wait and look for an exit keyword

View File

@ -106,23 +106,32 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){
if( !fname.empty() ){ if( !fname.empty() ){
try{ try{
FILE_LOG(logINFO) << "config file name " << fname; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "config file name : %s ",fname.c_str());
FILE_LOG(logDEBUG1, cstreambuf);
success = read_config_file(fname, &tcpip_port_no, &configuration_map); success = read_config_file(fname, &tcpip_port_no, &configuration_map);
//VERBOSE_PRINT("Read configuration file of " + iline + " lines"); //VERBOSE_PRINT("Read configuration file of " + iline + " lines");
} }
catch(...){ catch(...){
FILE_LOG(logERROR) << "Error opening configuration file " << fname ; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
success = FAIL; sprintf(cstreambuf, "Error opening configuration file : %s ",fname.c_str());
FILE_LOG(logERROR, cstreambuf);
success = FAIL;
} }
} }
if(success != OK){ if(success != OK){
FILE_LOG(logERROR) << "Failed: see output above for more information " ; FILE_LOG(logERROR, "Failed: see output above for more information ");
} }
if (success==OK){ if (success==OK){
FILE_LOG(logINFO) << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << endl;
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "SLS Receiver starting %s on port %d ",udp_interface_type.c_str(), tcpip_port_no);
FILE_LOG(logDEBUG1, cstreambuf);
#ifdef REST #ifdef REST
udp_interface = UDPInterface::create(udp_interface_type); udp_interface = UDPInterface::create(udp_interface_type);
udp_interface->configure(configuration_map); udp_interface->configure(configuration_map);

View File

@ -28,17 +28,17 @@ slsReceiverTCPIPInterface::~slsReceiverTCPIPInterface() {
} }
slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int &success, UDPInterface* rbase, int pn): slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int &success, UDPInterface* rbase, int pn):
myDetectorType(GOTTHARD), myDetectorType(GOTTHARD),
receiverBase(rbase), receiverBase(rbase),
ret(OK), ret(OK),
lockStatus(0), lockStatus(0),
shortFrame(-1), shortFrame(-1),
packetsPerFrame(GOTTHARD_PACKETS_PER_FRAME), packetsPerFrame(GOTTHARD_PACKETS_PER_FRAME),
dynamicrange(16), dynamicrange(16),
killTCPServerThread(0), killTCPServerThread(0),
tenGigaEnable(0), tenGigaEnable(0),
portNumber(DEFAULT_PORTNO+2), portNumber(DEFAULT_PORTNO+2),
mySock(NULL){ mySock(NULL){
strcpy(SET_RECEIVER_ERR_MESSAGE,"Receiver not set up. Please use rx_hostname first.\n"); strcpy(SET_RECEIVER_ERR_MESSAGE,"Receiver not set up. Please use rx_hostname first.\n");
@ -126,14 +126,17 @@ int slsReceiverTCPIPInterface::setPortNumber(int pn){
int slsReceiverTCPIPInterface::start(){ int slsReceiverTCPIPInterface::start(){
FILE_LOG(logDEBUG) << "Creating TCP Server Thread" << endl;
FILE_LOG(logDEBUG1, "Creating TCP Server Thread");
killTCPServerThread = 0; killTCPServerThread = 0;
if(pthread_create(&TCPServer_thread, NULL,startTCPServerThread, (void*) this)){ if(pthread_create(&TCPServer_thread, NULL,startTCPServerThread, (void*) this)){
cout << "Could not create TCP Server thread" << endl; cout << "Could not create TCP Server thread" << endl;
return FAIL; return FAIL;
} }
//#ifdef VERYVERBOSE //#ifdef VERYVERBOSE
FILE_LOG(logDEBUG) << "TCP Server thread created successfully." << endl; FILE_LOG(logDEBUG1, "TCP Server thread created successfully.");
//#endif //#endif
return OK; return OK;
} }
@ -387,23 +390,27 @@ int slsReceiverTCPIPInterface::set_detector_type(){
receiverBase->registerCallBackRawDataReady(rawDataReadyCallBack,pRawDataReady); receiverBase->registerCallBackRawDataReady(rawDataReadyCallBack,pRawDataReady);
} }
#endif #endif
myDetectorType = dr; myDetectorType = dr;
ret=receiverBase->setDetectorType(myDetectorType); ret=receiverBase->setDetectorType(myDetectorType);
retval = myDetectorType; retval = myDetectorType;
} }
} }
} }
//#ifdef VERYVERBOSE //#ifdef VERYVERBOSE
if(ret!=FAIL) if(ret!=FAIL)
FILE_LOG(logDEBUG) << "detector type " << dr; {
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Detector Type %d ", (int)dr);
FILE_LOG(logDEBUG1, cstreambuf);
}
else else
cprintf(RED, "%s\n", mess); cprintf(RED, "%s\n", mess);
//#endif //#endif
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -470,7 +477,7 @@ int slsReceiverTCPIPInterface::set_file_name() {
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -545,7 +552,7 @@ int slsReceiverTCPIPInterface::set_file_dir() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -617,7 +624,7 @@ int slsReceiverTCPIPInterface::set_file_index() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -695,7 +702,7 @@ int slsReceiverTCPIPInterface::set_frame_index() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -759,12 +766,16 @@ int slsReceiverTCPIPInterface::setup_udp(){
receiverBase->setUDPPortNumber2(udpport2); receiverBase->setUDPPortNumber2(udpport2);
//setup udpip //setup udpip
//get ethernet interface or IP to listen to //get ethernet interface or IP to listen to
FILE_LOG(logINFO) << "Receiver UDP IP: " << args[0]; {
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Receiver UDP IP: %s ",args[0]);
FILE_LOG(logINFO, cstreambuf);
}
temp = genericSocket::ipToName(args[0]); temp = genericSocket::ipToName(args[0]);
if(temp=="none"){ if(temp=="none"){
ret = FAIL; ret = FAIL;
strcpy(mess, "Failed to get ethernet interface or IP\n"); strcpy(mess, "Failed to get ethernet interface or IP\n");
FILE_LOG(logERROR) << mess; FILE_LOG(logERROR, "Failed to get ethernet interface or IP ");
} }
else{ else{
strcpy(eth,temp.c_str()); strcpy(eth,temp.c_str());
@ -785,7 +796,10 @@ int slsReceiverTCPIPInterface::setup_udp(){
} }
else{ else{
strcpy(retval,temp.c_str()); strcpy(retval,temp.c_str());
FILE_LOG(logINFO) << "Reciever MAC Address: " << retval;
char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "Reciever MAC Address: %s ",retval);
FILE_LOG(logINFO, cstreambuf);
} }
} }
} }
@ -793,14 +807,16 @@ int slsReceiverTCPIPInterface::setup_udp(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
// send answer // send answer
mySock->SendDataOnly(&ret,sizeof(ret)); mySock->SendDataOnly(&ret,sizeof(ret));
if(ret==FAIL){ if(ret==FAIL){
FILE_LOG(logERROR) << mess; char cstreambuf[MAX_STR_LENGTH]; memset(cstreambuf, 0, MAX_STR_LENGTH);
sprintf(cstreambuf, "%s ", mess);
FILE_LOG(logERROR, cstreambuf);
mySock->SendDataOnly(mess,sizeof(mess)); mySock->SendDataOnly(mess,sizeof(mess));
} }
mySock->SendDataOnly(retval,MAX_STR_LENGTH); mySock->SendDataOnly(retval,MAX_STR_LENGTH);
@ -849,7 +865,7 @@ int slsReceiverTCPIPInterface::start_receiver(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -897,7 +913,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -928,7 +944,7 @@ int slsReceiverTCPIPInterface::get_status(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -959,7 +975,7 @@ int slsReceiverTCPIPInterface::get_frames_caught(){
}else retval=receiverBase->getTotalFramesCaught(); }else retval=receiverBase->getTotalFramesCaught();
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -991,7 +1007,7 @@ int slsReceiverTCPIPInterface::get_frame_index(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1036,7 +1052,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1105,7 +1121,7 @@ int slsReceiverTCPIPInterface::set_short_frame() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1287,7 +1303,7 @@ int slsReceiverTCPIPInterface::moench_read_frame(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1468,7 +1484,7 @@ int slsReceiverTCPIPInterface::gotthard_read_frame(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1622,7 +1638,7 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1657,7 +1673,7 @@ int slsReceiverTCPIPInterface::propix_read_frame(){
int slsReceiverTCPIPInterface::eiger_read_frame(){ int slsReceiverTCPIPInterface::eiger_read_frame(){
ret=OK; ret=OK;
/* /*
char fName[MAX_STR_LENGTH]=""; char fName[MAX_STR_LENGTH]="";
int acquisitionIndex = -1; int acquisitionIndex = -1;
int frameIndex= -1; int frameIndex= -1;
@ -1889,7 +1905,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -1910,7 +1926,7 @@ int slsReceiverTCPIPInterface::eiger_read_frame(){
delete [] retval; delete [] retval;
delete [] origVal; delete [] origVal;
delete [] raw; delete [] raw;
*/ */
return ret; return ret;
} }
@ -2052,7 +2068,7 @@ int slsReceiverTCPIPInterface::jungfrau_read_frame(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2130,7 +2146,7 @@ int slsReceiverTCPIPInterface::set_read_frequency(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2196,7 +2212,7 @@ int slsReceiverTCPIPInterface::set_read_receiver_timer(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2259,7 +2275,7 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2319,7 +2335,7 @@ int slsReceiverTCPIPInterface::enable_file_write(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2347,7 +2363,7 @@ int slsReceiverTCPIPInterface::get_id(){
#endif #endif
if(mySock->differentClients){ if(mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2371,43 +2387,43 @@ int64_t slsReceiverTCPIPInterface::getReceiverVersion(){
int slsReceiverTCPIPInterface::start_readout(){cprintf(BLUE,"In start readout!\n"); int slsReceiverTCPIPInterface::start_readout(){cprintf(BLUE,"In start readout!\n");
ret=OK; ret=OK;
enum runStatus retval; enum runStatus retval;
// execute action if the arguments correctly arrived // execute action if the arguments correctly arrived
#ifdef SLS_RECEIVER_UDP_FUNCTIONS #ifdef SLS_RECEIVER_UDP_FUNCTIONS
if (receiverBase == NULL){ if (receiverBase == NULL){
strcpy(mess,SET_RECEIVER_ERR_MESSAGE); strcpy(mess,SET_RECEIVER_ERR_MESSAGE);
ret=FAIL; ret=FAIL;
} }
/*else if(receiverBase->getStatus()!= IDLE){ /*else if(receiverBase->getStatus()!= IDLE){
strcpy(mess,"Can not start receiver readout while receiver not idle\n"); strcpy(mess,"Can not start receiver readout while receiver not idle\n");
ret = FAIL; ret = FAIL;
}*/ }*/
else{ else{
receiverBase->startReadout(); receiverBase->startReadout();
retval = receiverBase->getStatus(); retval = receiverBase->getStatus();
if((retval == TRANSMITTING) || (retval == RUN_FINISHED) || (retval == IDLE)) if((retval == TRANSMITTING) || (retval == RUN_FINISHED) || (retval == IDLE))
ret = OK; ret = OK;
else else
ret = FAIL; ret = FAIL;
} }
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
// send answer // send answer
mySock->SendDataOnly(&ret,sizeof(ret)); mySock->SendDataOnly(&ret,sizeof(ret));
if(ret==FAIL){ if(ret==FAIL){
cprintf(RED,"%s\n",mess); cprintf(RED,"%s\n",mess);
mySock->SendDataOnly(mess,sizeof(mess)); mySock->SendDataOnly(mess,sizeof(mess));
} }
mySock->SendDataOnly(&retval,sizeof(retval)); mySock->SendDataOnly(&retval,sizeof(retval));
//return ok/fail //return ok/fail
return ret; return ret;
} }
@ -2483,7 +2499,7 @@ int slsReceiverTCPIPInterface::set_timer() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2555,7 +2571,7 @@ int slsReceiverTCPIPInterface::enable_compression() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2621,7 +2637,7 @@ int slsReceiverTCPIPInterface::set_detector_hostname() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2722,7 +2738,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2790,7 +2806,7 @@ int slsReceiverTCPIPInterface::enable_overwrite() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2860,7 +2876,7 @@ int slsReceiverTCPIPInterface::enable_tengiga() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -2932,7 +2948,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() {
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -3006,7 +3022,7 @@ int slsReceiverTCPIPInterface::set_activate() {
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }
@ -3070,7 +3086,7 @@ int slsReceiverTCPIPInterface::set_flipped_data(){
#endif #endif
if(ret==OK && mySock->differentClients){ if(ret==OK && mySock->differentClients){
FILE_LOG(logDEBUG) << "Force update"; FILE_LOG(logDEBUG1,"Force update" );
ret=FORCE_UPDATE; ret=FORCE_UPDATE;
} }

View File

@ -2,8 +2,8 @@ WD = $(shell pwd)
LIBDIR = $(WD)/../bin LIBDIR = $(WD)/../bin
LIBRARYRXRDIR = $(WD)/../slsReceiverSoftware LIBRARYRXRDIR = $(WD)/../slsReceiverSoftware
LIBRARYDETDIR = $(WD)/../slsDetectorSoftware LIBRARYDETDIR = $(WD)/../slsDetectorSoftware
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
LDFLAGDET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread LDFLAGDET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
INCLUDESRXR = -I $(LIBRARYRXRDIR)/include INCLUDESRXR = -I $(LIBRARYRXRDIR)/include
INCLUDESDET = -I $(LIBRARYRXRDIR)/include -I $(LIBRARYDETDIR)/slsDetector -I $(LIBRARYDETDIR)/slsDetectorAnalysis INCLUDESDET = -I $(LIBRARYRXRDIR)/include -I $(LIBRARYDETDIR)/slsDetector -I $(LIBRARYDETDIR)/slsDetectorAnalysis

View File

@ -2,8 +2,8 @@ WD = $(shell pwd)
LIBDIR = $(WD)/../bin LIBDIR = $(WD)/../bin
LIBRARYRXRDIR = $(WD)/../slsReceiverSoftware LIBRARYRXRDIR = $(WD)/../slsReceiverSoftware
LIBRARYDETDIR = $(WD)/../slsDetectorSoftware LIBRARYDETDIR = $(WD)/../slsDetectorSoftware
LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -lpthread LDFLAGRXR = -L$(LIBDIR) -lSlsReceiver -L/usr/lib64/ -pthread
LDFLAGDET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -lpthread LDFLAGDET = -L$(LIBDIR) -lSlsDetector -L/usr/lib64/ -pthread
INCLUDESRXR = -I $(LIBRARYRXRDIR)/include INCLUDESRXR = -I $(LIBRARYRXRDIR)/include
INCLUDESDET = -I $(LIBRARYDETDIR)/slsDetector -I $(LIBRARYDETDIR)/slsDetectorAnalysis INCLUDESDET = -I $(LIBRARYDETDIR)/slsDetector -I $(LIBRARYDETDIR)/slsDetectorAnalysis

View File

@ -4,10 +4,10 @@
This file is an example of how to implement the slsDetectorUsers class This file is an example of how to implement the slsDetectorUsers class
You can compile it linking it to the slsDetector library You can compile it linking it to the slsDetector library
gcc mainClient.cpp -L lib -l SlsDetector -lm -lpthread gcc mainClient.cpp -L lib -l SlsDetector -lm -pthread
where lib is the location of libSlsDetector.so where lib is the location of libSlsDetector.so
gcc mainClient.cpp -L . -l SlsDetector -lm -lpthread -o users gcc mainClient.cpp -L . -l SlsDetector -lm -pthread -o users
*/ */

View File

@ -5,10 +5,10 @@
This file is an example of how to implement the slsDetectorUsers class This file is an example of how to implement the slsDetectorUsers class
You can compile it linking it to the slsDetector library You can compile it linking it to the slsDetector library
gcc mainClient.cpp -L lib -l SlsDetector -lm -lpthread gcc mainClient.cpp -L lib -l SlsDetector -lm -pthread
where lib is the location of libSlsDetector.so where lib is the location of libSlsDetector.so
gcc mainClient.cpp -L . -l SlsDetector -lm -lpthread -o users gcc mainClient.cpp -L . -l SlsDetector -lm -pthread -o users
*/ */