From dfa8cf73814addc668f9771ff4954a2f37042f2a Mon Sep 17 00:00:00 2001 From: Dhanya Thattil Date: Tue, 30 Oct 2018 13:35:20 +0100 Subject: [PATCH] runs, prints right in reciever --- CMakeLists.txt | 2 +- manual/manual-api/mainReceiver.cpp | 10 +- slsDetectorServers/eigerDetectorServer/Beb.c | 42 +- .../eigerDetectorServer/FebControl.c | 46 +- .../eigerDetectorServer/FebInterface.c | 2 +- .../eigerDetectorServer/LocalLinkInterface.c | 20 +- .../eigerDetectorServer/gitInfo.txt | 8 +- .../eigerDetectorServer/gitInfoEiger.h | 6 +- .../slsDetectorFunctionList.c | 74 +-- .../slsDetectorServer/communication_funcs.c | 18 +- .../slsDetectorServer/slsDetectorServer.c | 2 +- .../slsDetectorServer_funcs.c | 253 ++++---- .../sharedMemory/SharedMemory.cpp | 41 +- .../slsDetector/slsDetector.cpp | 556 +++++++++--------- .../slsDetector/slsDetectorCommand.cpp | 2 +- .../include/BinaryFileStatic.h | 10 +- slsReceiverSoftware/include/File.h | 30 +- slsReceiverSoftware/include/GeneralData.h | 62 +- slsReceiverSoftware/include/HDF5File.h | 2 +- slsReceiverSoftware/include/HDF5FileStatic.h | 84 +-- slsReceiverSoftware/src/BinaryFile.cpp | 3 +- slsReceiverSoftware/src/DataProcessor.cpp | 51 +- slsReceiverSoftware/src/DataStreamer.cpp | 68 +-- slsReceiverSoftware/src/Fifo.cpp | 9 +- slsReceiverSoftware/src/File.cpp | 4 +- slsReceiverSoftware/src/HDF5File.cpp | 19 +- slsReceiverSoftware/src/Listener.cpp | 56 +- slsReceiverSoftware/src/ThreadObject.cpp | 6 +- slsReceiverSoftware/src/main.cpp | 43 +- .../src/slsReceiverImplementation.cpp | 428 +++++++------- .../src/slsReceiverTCPIPInterface.cpp | 171 +++--- slsSupportLib/include/logger.h | 68 +-- 32 files changed, 1058 insertions(+), 1138 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 056a65561..f6c884905 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ option (USE_GUI "GUI" OFF) if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 6.0) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -Wno-misleading-indentation") else () - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 ") endif () set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address") diff --git a/manual/manual-api/mainReceiver.cpp b/manual/manual-api/mainReceiver.cpp index f59cccae0..53bc76db5 100644 --- a/manual/manual-api/mainReceiver.cpp +++ b/manual/manual-api/mainReceiver.cpp @@ -101,15 +101,15 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){ PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row, "#### %d GetData: ####\n" - "frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu" - "\t\ttimestamp: %llu\t\tmodId: %u\t\t" + "frameNumber: %lu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %lu" + "\t\ttimestamp: %lu\t\tmodId: %u\t\t" "row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u" "\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u" //"\t\tpacketsMask:%s" "\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n", - detectorHeader.row, (long long unsigned int)detectorHeader.frameNumber, - detectorHeader.expLength, detectorHeader.packetNumber, (long long unsigned int)detectorHeader.bunchId, - (long long unsigned int)detectorHeader.timestamp, detectorHeader.modId, + detectorHeader.row, (long unsigned int)detectorHeader.frameNumber, + detectorHeader.expLength, detectorHeader.packetNumber, (long unsigned int)detectorHeader.bunchId, + (long unsigned int)detectorHeader.timestamp, detectorHeader.modId, detectorHeader.row, detectorHeader.column, detectorHeader.reserved, detectorHeader.debug, detectorHeader.roundRNumber, detectorHeader.detType, detectorHeader.version, diff --git a/slsDetectorServers/eigerDetectorServer/Beb.c b/slsDetectorServers/eigerDetectorServer/Beb.c index 7c20c2b40..70f7eae54 100644 --- a/slsDetectorServers/eigerDetectorServer/Beb.c +++ b/slsDetectorServers/eigerDetectorServer/Beb.c @@ -134,7 +134,7 @@ void Beb_Beb(int id) { if (!Beb_InitBebInfos()) exit(1); - FILE_LOG(logDEBUG5, ("Printing Beb infos:\n")); + FILE_LOG(logDEBUG1, ("Printing Beb infos:\n")); unsigned int i; for(i=1;iratemax) b0[b] = beforemax; else b0[b] = ratemax; } - /*FILE_LOG(logDEBUG5, ("After Loop s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t " + /*FILE_LOG(logDEBUG1, ("After Loop s: %f,\t sx: %f,\t sy: %f,\t sxx: %f,\t sxy: %f,\t " "next_i: %d,\t b: %d,\t Feb_Control_rate_meas[next_i]: %f\n", s, sx, sy, sxx, sxy, next_i, b, Feb_Control_rate_meas[next_i]));*/ // cout<0xfff) return 0; - FILE_LOG(logDEBUG5, ("FIW ch %d\n", ch)); + FILE_LOG(logDEBUG1, ("FIW ch %d\n", ch)); Feb_Interface_send_data_raw[0] = 0x8fff0000; if (Local_Write(ll,4,Feb_Interface_send_data_raw)!=4) return 0; diff --git a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c index 7679ad432..d180a729c 100644 --- a/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c +++ b/slsDetectorServers/eigerDetectorServer/LocalLinkInterface.c @@ -10,18 +10,18 @@ void Local_LocalLinkInterface1(struct LocalLinkInterface* ll,unsigned int ll_fifo_badr) { - FILE_LOG(logDEBUG5, ("Initialize PLB LL FIFOs\n")); + FILE_LOG(logDEBUG1, ("Initialize PLB LL FIFOs\n")); ll->ll_fifo_base=0; ll->ll_fifo_ctrl_reg=0; if (Local_Init(ll,ll_fifo_badr)) { Local_Reset(ll); - FILE_LOG(logDEBUG5, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll))); + FILE_LOG(logDEBUG1, ("\tFIFO Status : 0x%08x\n\n\n", Local_StatusVector(ll))); } else FILE_LOG(logERROR, ("\tCould not map LocalLink : 0x%08x\n\n\n", ll_fifo_badr)); } void Local_LocalLinkInterface(struct LocalLinkInterface* ll) { - FILE_LOG(logDEBUG5, ("Initializing new memory\n")); + FILE_LOG(logDEBUG1, ("Initializing new memory\n")); } @@ -57,7 +57,7 @@ int Local_Reset(struct LocalLinkInterface* ll) { int Local_Reset1(struct LocalLinkInterface* ll,unsigned int rst_mask) { ll->ll_fifo_ctrl_reg |= rst_mask; - FILE_LOG(logDEBUG5, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg)); + FILE_LOG(logDEBUG1, ("\tCTRL Register bits: 0x%08x\n",ll->ll_fifo_ctrl_reg)); HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg); HWIO_xfs_out32(ll->ll_fifo_base+4*PLB_LL_FIFO_REG_CTRL,ll->ll_fifo_ctrl_reg); @@ -92,9 +92,9 @@ int Local_Write(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buf last_word = (buffer_len-1)/4; word_ptr = (unsigned int *)buffer; - FILE_LOG(logDEBUG5, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base)); + FILE_LOG(logDEBUG1, ("LL Write - Len: %2d - If: %X - Data: ",buffer_len, ll->ll_fifo_base)); for (i=0; i < buffer_len/4; i++) - FILE_LOG(logDEBUG5, ("%.8X ",*(((unsigned *) buffer)+i))); + FILE_LOG(logDEBUG1, ("%.8X ",*(((unsigned *) buffer)+i))); while (words_send <= last_word) { @@ -138,7 +138,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff volatile unsigned int fifo_val; int sof = 0; - FILE_LOG(logDEBUG5, ("LL Read - If: %X - Data: ",ll->ll_fifo_base)); + FILE_LOG(logDEBUG1, ("LL Read - If: %X - Data: ",ll->ll_fifo_base)); word_ptr = (unsigned int *)buffer; do @@ -164,7 +164,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff { if ( (buffer_len >> 2) > buffer_ptr) { - FILE_LOG(logDEBUG5, ("%.8X ", fifo_val)); + FILE_LOG(logDEBUG1, ("%.8X ", fifo_val)); word_ptr[buffer_ptr++] = fifo_val; //write to buffer } else @@ -176,7 +176,7 @@ int Local_Read(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff if (status & PLB_LL_FIFO_STATUS_LL_EOF) { len = (buffer_ptr << 2) -3 + ( (status & PLB_LL_FIFO_STATUS_LL_REM)>>PLB_LL_FIFO_STATUS_LL_REM_SHIFT ); - FILE_LOG(logDEBUG5, ("Len: %d\n",len)); + FILE_LOG(logDEBUG1, ("Len: %d\n",len)); buffer_ptr = 0; return len; } @@ -209,7 +209,7 @@ int Local_Test(struct LocalLinkInterface* ll,unsigned int buffer_len, void *buff do{ len = Local_Read(ll,rec_buff_len,rec_buffer); - FILE_LOG(logDEBUG5, ("receive length: %i\n",len)); + FILE_LOG(logDEBUG1, ("receive length: %i\n",len)); if (len > 0) { rec_buffer[len]=0; diff --git a/slsDetectorServers/eigerDetectorServer/gitInfo.txt b/slsDetectorServers/eigerDetectorServer/gitInfo.txt index 136474476..f5bf1d811 100644 --- a/slsDetectorServers/eigerDetectorServer/gitInfo.txt +++ b/slsDetectorServers/eigerDetectorServer/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorPackage/slsDetectorServers/eigerDetectorServer URL: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git Repository Root: origin git@github.com:slsdetectorgroup/slsDetectorPackage.git -Repsitory UUID: dfad145e1492e961c95063aa5b2f54e5e1b418a0 -Revision: 3 +Repsitory UUID: 92fc837eb490650d91c2283943cbd729b2e36567 +Revision: 6 Branch: refactor Last Changed Author: Dhanya_Thattil -Last Changed Rev: 4127 -Last Changed Date: 2018-10-23 12:30:26.000000002 +0200 ./Beb.c +Last Changed Rev: 4131 +Last Changed Date: 2018-10-29 17:14:27.000000002 +0100 ./Beb.c diff --git a/slsDetectorServers/eigerDetectorServer/gitInfoEiger.h b/slsDetectorServers/eigerDetectorServer/gitInfoEiger.h index 2254b38c9..7181daf9c 100644 --- a/slsDetectorServers/eigerDetectorServer/gitInfoEiger.h +++ b/slsDetectorServers/eigerDetectorServer/gitInfoEiger.h @@ -1,6 +1,6 @@ #define GITURL "git@github.com:slsdetectorgroup/slsDetectorPackage.git" -#define GITREPUUID "dfad145e1492e961c95063aa5b2f54e5e1b418a0" +#define GITREPUUID "92fc837eb490650d91c2283943cbd729b2e36567" #define GITAUTH "Dhanya_Thattil" -#define GITREV 0x4127 -#define GITDATE 0x20181023 +#define GITREV 0x4131 +#define GITDATE 0x20181029 #define GITBRANCH "refactor" diff --git a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c index d03c23f3d..f145a556e 100644 --- a/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c +++ b/slsDetectorServers/eigerDetectorServer/slsDetectorFunctionList.c @@ -306,10 +306,10 @@ void initControlServer() { if (Feb_Control_OpenSerialCommunication()) ;// Feb_Control_CloseSerialCommunication(); } - FILE_LOG(logDEBUG5, ("Control server: FEB Initialization done\n")); + FILE_LOG(logDEBUG1, ("Control server: FEB Initialization done\n")); Beb_Beb(detid); Beb_SetDetectorNumber(getDetectorNumber()); - FILE_LOG(logDEBUG5, ("Control server: BEB Initialization done\n")); + FILE_LOG(logDEBUG1, ("Control server: BEB Initialization done\n")); setupDetector(); @@ -325,7 +325,7 @@ void initStopServer() { Feb_Interface_FebInterface(); Feb_Control_FebControl(); Feb_Control_Init(master,top,normal,getDetectorNumber()); - FILE_LOG(logDEBUG5, ("Stop server: FEB Initialization done\n")); + FILE_LOG(logDEBUG1, ("Stop server: FEB Initialization done\n")); #endif } @@ -385,10 +385,10 @@ void allocateDetectorStructureMemory() { detectorChans=malloc(NCHIP*NCHAN*sizeof(int)); detectorDacs=malloc(NDAC*sizeof(int)); detectorAdcs=malloc(NADC*sizeof(int)); - FILE_LOG(logDEBUG5, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules)); - FILE_LOG(logDEBUG5, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans)); - FILE_LOG(logDEBUG5, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs)); - FILE_LOG(logDEBUG5, ("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs)); + FILE_LOG(logDEBUG1, ("modules from 0x%x to 0x%x\n",detectorModules, detectorModules)); + FILE_LOG(logDEBUG1, ("chans from 0x%x to 0x%x\n",detectorChans, detectorChans)); + FILE_LOG(logDEBUG1, ("dacs from 0x%x to 0x%x\n",detectorDacs, detectorDacs)); + FILE_LOG(logDEBUG1, ("adcs from 0x%x to 0x%x\n",detectorAdcs, detectorAdcs)); (detectorModules)->dacs=detectorDacs; (detectorModules)->adcs=detectorAdcs; (detectorModules)->chanregs=detectorChans; @@ -455,7 +455,7 @@ void setupDetector() { #ifndef VIRTUAL Feb_Control_CheckSetup(); #endif - FILE_LOG(logDEBUG5, ("Setup detector done\n\n")); + FILE_LOG(logDEBUG1, ("Setup detector done\n\n")); } @@ -491,7 +491,7 @@ int setDynamicRange(int dr) { return eiger_dynamicrange; #else if (dr > 0) { - FILE_LOG(logDEBUG5, ("Setting dynamic range: %d\n", dr)); + FILE_LOG(logDEBUG1, ("Setting dynamic range: %d\n", dr)); if (Feb_Control_SetDynamicRange(dr)) { //EigerSetBitMode(dr); @@ -518,7 +518,7 @@ int setDynamicRange(int dr) { enum speedVariable setSpeed(int val) { if (val != -1) { - FILE_LOG(logDEBUG5, ("Setting Read out Speed: %d\n", val)); + FILE_LOG(logDEBUG1, ("Setting Read out Speed: %d\n", val)); #ifndef VIRTUAL if (Feb_Control_SetReadoutSpeed(val)) #endif @@ -538,15 +538,15 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) { switch(val) { case PARALLEL: val=E_PARALLEL; - FILE_LOG(logDEBUG5, ("Setting Read out Flag: Parallel\n")); + FILE_LOG(logDEBUG1, ("Setting Read out Flag: Parallel\n")); break; case NONPARALLEL: val=E_NON_PARALLEL; - FILE_LOG(logDEBUG5, ("Setting Read out Flag: Non Parallel\n")); + FILE_LOG(logDEBUG1, ("Setting Read out Flag: Non Parallel\n")); break; case SAFE: val=E_SAFE; - FILE_LOG(logDEBUG5, ("Setting Read out Flag: Safe\n")); + FILE_LOG(logDEBUG1, ("Setting Read out Flag: Safe\n")); break; default: @@ -567,11 +567,11 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) { switch(val) { case SHOW_OVERFLOW: val=1; - FILE_LOG(logDEBUG5, ("Setting Read out Flag: Overflow in 32 bit mode\n")); + FILE_LOG(logDEBUG1, ("Setting Read out Flag: Overflow in 32 bit mode\n")); break; case NOOVERFLOW: val=0; - FILE_LOG(logDEBUG5, ("Setting Read out Flag: No overflow in 32 bit mode\n")); + FILE_LOG(logDEBUG1, ("Setting Read out Flag: No overflow in 32 bit mode\n")); break; default: FILE_LOG(logERROR, ("Cannot set unknown readout flag. 0x%x\n", val)); @@ -591,11 +591,11 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) { switch(val) { case STORE_IN_RAM: val=1; - FILE_LOG(logDEBUG5, ("Setting Read out Flag: Store in Ram\n")); + FILE_LOG(logDEBUG1, ("Setting Read out Flag: Store in Ram\n")); break; case CONTINOUS_RO: val=0; - FILE_LOG(logDEBUG5, ("Setting Read out Flag: Continuous Readout\n")); + FILE_LOG(logDEBUG1, ("Setting Read out Flag: Continuous Readout\n")); break; default: @@ -638,7 +638,7 @@ enum readOutFlags setReadOutFlags(enum readOutFlags val) { break; } - FILE_LOG(logDEBUG5, ("Read out Flag: 0x%x\n", retval)); + FILE_LOG(logDEBUG1, ("Read out Flag: 0x%x\n", retval)); return retval; } @@ -659,7 +659,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) { switch(ind) { case FRAME_NUMBER: if (val >= 0) { - FILE_LOG(logDEBUG5, ("Setting number of frames: %d * %d\n", (unsigned int)val, eiger_ncycles)); + FILE_LOG(logDEBUG1, ("Setting number of frames: %d * %d\n", (unsigned int)val, eiger_ncycles)); #ifndef VIRTUAL if (Feb_Control_SetNExposures((unsigned int)val*eiger_ncycles)) { eiger_nexposures = val; @@ -678,7 +678,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) { case ACQUISITION_TIME: if (val >= 0) { - FILE_LOG(logDEBUG5, ("Setting exp time: %fs\n", val/(1E9))); + FILE_LOG(logDEBUG1, ("Setting exp time: %fs\n", val/(1E9))); #ifndef VIRTUAL Feb_Control_SetExposureTime(val/(1E9)); #else @@ -693,7 +693,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) { case SUBFRAME_ACQUISITION_TIME: if (val >= 0) { - FILE_LOG(logDEBUG5, ("Setting sub exp time: %lldns\n", (long long int)val)); + FILE_LOG(logDEBUG1, ("Setting sub exp time: %lldns\n", (long long int)val)); #ifndef VIRTUAL // calculate subdeadtime before settings subexptime subdeadtime = Feb_Control_GetSubFramePeriod() - @@ -743,7 +743,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) { case FRAME_PERIOD: if (val >= 0) { - FILE_LOG(logDEBUG5, ("Setting acq period: %fs\n", val/(1E9))); + FILE_LOG(logDEBUG1, ("Setting acq period: %fs\n", val/(1E9))); #ifndef VIRTUAL Feb_Control_SetExposurePeriod(val/(1E9)); #else @@ -758,7 +758,7 @@ int64_t setTimer(enum timerIndex ind, int64_t val) { case CYCLES_NUMBER: if (val >= 0) { - FILE_LOG(logDEBUG5, ("Setting number of triggers: %d * %d\n", + FILE_LOG(logDEBUG1, ("Setting number of triggers: %d * %d\n", (unsigned int)val,eiger_nexposures)); #ifndef VIRTUAL if (Feb_Control_SetNExposures((unsigned int)val*eiger_nexposures)) { @@ -1005,7 +1005,7 @@ int setThresholdEnergy(int ev) { /* parameters - dac, adc, hv */ void setDAC(enum DACINDEX ind, int val, int mV, int retval[]) { - FILE_LOG(logDEBUG5, ("Going to set dac %d to %d with mv mode %d \n", (int)ind, val, mV)); + FILE_LOG(logDEBUG1, ("Going to set dac %d to %d with mv mode %d \n", (int)ind, val, mV)); if (ind == VTHRESHOLD) { int ret[5]; setDAC(VCMP_LL,val,mV,retval); @@ -1040,7 +1040,7 @@ void setDAC(enum DACINDEX ind, int val, int mV, int retval[]) { FILE_LOG(logINFO, ("dac value outside range:%d\n",(int)ind)); strcpy(iname,dac_names[0]); } - FILE_LOG(logDEBUG5, ("%s dac %d: %s to %d %s\n", + FILE_LOG(logDEBUG1, ("%s dac %d: %s to %d %s\n", (val >= 0) ? "Setting" : "Getting", ind, iname, val, mV ? "mV" : "dac units")); @@ -1166,7 +1166,7 @@ void setTiming( enum externalCommunicationMode arg) { case BURST_TRIGGER: ret = 1; break; case GATE_FIX_NUMBER: ret = 3; break; } - FILE_LOG(logDEBUG5, ("Setting Triggering Mode: %d\n", (int)ret)); + FILE_LOG(logDEBUG1, ("Setting Triggering Mode: %d\n", (int)ret)); #ifndef VIRTUAL if (Feb_Control_SetTriggerMode(ret,1)) #endif @@ -1216,10 +1216,10 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t FILE_LOG(logINFO, ("src_port:%d\n" - "src_ip:%s\n" - "dst_ip:%s\n" - "src_mac:%s\n" - "dst_mac:%s\n", + "\tsrc_ip:%s\n" + "\tdst_ip:%s\n" + "\tsrc_mac:%s\n" + "\tdst_mac:%s\n", src_port, src_ip, dst_ip, src_mac, dst_mac)); @@ -1229,7 +1229,7 @@ int configureMAC(uint32_t destip, uint64_t destmac, uint64_t sourcemac, uint32_t if (!top) dst_port = udpport2; - FILE_LOG(logINFO, ("dst_port:%d\n", dst_port)); + FILE_LOG(logINFO, ("\tdst_port:%d\n", dst_port)); int i=0; /* for(i=0;i<32;i++) { modified for Aldo*/ @@ -1282,7 +1282,7 @@ int setDetectorPosition(int pos[]) { int setIODelay(int val) { if (val!=-1) { - FILE_LOG(logDEBUG5, ("Setting IO Delay: %d\n",val)); + FILE_LOG(logDEBUG1, ("Setting IO Delay: %d\n",val)); #ifndef VIRTUAL if (Feb_Control_SetIDelays(Feb_Control_GetModuleNumber(),val)) #endif @@ -1788,7 +1788,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) { int idac, ichan, iadc; int ret=OK; - FILE_LOG(logDEBUG5, ("Copying module %x to module %x\n",srcMod,destMod)); + FILE_LOG(logDEBUG1, ("Copying module %x to module %x\n",srcMod,destMod)); if (srcMod->serialnumber>=0) { @@ -1808,9 +1808,9 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) { return FAIL; } - FILE_LOG(logDEBUG5, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac)); - FILE_LOG(logDEBUG5, ("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc)); - FILE_LOG(logDEBUG5, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan)); + FILE_LOG(logDEBUG1, ("DACs: src %d, dest %d\n",srcMod->ndac,destMod->ndac)); + FILE_LOG(logDEBUG1, ("ADCs: src %d, dest %d\n",srcMod->nadc,destMod->nadc)); + FILE_LOG(logDEBUG1, ("Chans: src %d, dest %d\n",srcMod->nchan,destMod->nchan)); destMod->ndac=srcMod->ndac; destMod->nadc=srcMod->nadc; destMod->nchip=srcMod->nchip; @@ -1823,7 +1823,7 @@ int copyModule(sls_detector_module *destMod, sls_detector_module *srcMod) { destMod->tau=srcMod->tau; if (srcMod->eV>=0) destMod->eV=srcMod->eV; - FILE_LOG(logDEBUG5, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg )); + FILE_LOG(logDEBUG1, ("Copying register %x (%x)\n",destMod->reg,srcMod->reg )); if (destMod->nchan!=0) { for (ichan=0; ichan<(srcMod->nchan); ichan++) { diff --git a/slsDetectorServers/slsDetectorServer/communication_funcs.c b/slsDetectorServers/slsDetectorServer/communication_funcs.c index ed9e79d6d..ea89d2747 100755 --- a/slsDetectorServers/slsDetectorServer/communication_funcs.c +++ b/slsDetectorServers/slsDetectorServer/communication_funcs.c @@ -95,7 +95,7 @@ int bindSocket(unsigned short int port_number) { // success myport = port_number; ret = OK; - FILE_LOG(logDEBUG5, ("%s socket bound: isock=%d, port=%d, fd=%d\n", + FILE_LOG(logDEBUG1, ("%s socket bound: isock=%d, port=%d, fd=%d\n", (isControlServer ? "Control":"Stop"), isock, port_number, socketDescriptor)); } @@ -136,7 +136,7 @@ int acceptConnection(int socketDescriptor) { // timeout if (result == 0) { - FILE_LOG(logDEBUG5, ("%s socket select() timed out!\n", + FILE_LOG(logDEBUG1, ("%s socket select() timed out!\n", (isControlServer ? "control":"stop"), myport)); } @@ -148,14 +148,14 @@ int acceptConnection(int socketDescriptor) { // activity in descriptor set else if (result > 0) { - FILE_LOG(logDEBUG5, ("%s select returned!\n", (isControlServer ? "control":"stop"))); + FILE_LOG(logDEBUG1, ("%s select returned!\n", (isControlServer ? "control":"stop"))); // loop through the file descriptor set for (j = 0; j < maxfd + 1; ++j) { // checks if file descriptor part of set if (FD_ISSET(j, &tempset)) { - FILE_LOG(logDEBUG5, ("fd %d is set\n",j)); + FILE_LOG(logDEBUG1, ("fd %d is set\n",j)); // clear the temporary set FD_CLR(j, &tempset); @@ -216,7 +216,7 @@ int acceptConnection(int socketDescriptor) { // accept success else { inet_ntop(AF_INET, &(addressC.sin_addr), dummyClientIP, INET_ADDRSTRLEN); - FILE_LOG(logDEBUG5, ("%s socket accepted connection, fd= %d\n", + FILE_LOG(logDEBUG1, ("%s socket accepted connection, fd= %d\n", (isControlServer ? "control":"stop"), file_des)); // add the file descriptor from accept FD_SET(file_des, &readset); @@ -244,7 +244,7 @@ void closeConnection(int file_des) { void exitServer(int socketDescriptor) { if (socketDescriptor >= 0) close(socketDescriptor); - FILE_LOG(logDEBUG5, ("Closing %s server\n", (isControlServer ? "control":"stop"))); + FILE_LOG(logDEBUG1, ("Closing %s server\n", (isControlServer ? "control":"stop"))); FD_CLR(socketDescriptor, &readset); isock--; } @@ -320,7 +320,7 @@ int receiveDataOnly(int file_des, void* buf,int length) { int nreceiving; int nreceived; if (file_des<0) return -1; - FILE_LOG(logDEBUG5, ("want to receive %d Bytes to %s server\n", + FILE_LOG(logDEBUG1, ("want to receive %d Bytes to %s server\n", length, (isControlServer ? "control":"stop"))); while(length > 0) { @@ -381,7 +381,7 @@ int sendModule(int file_des, sls_detector_module *myMod) { n = sendData(file_des,myMod->chanregs, sizeof(int) * (myMod->nchan), INT32); if (!n) return -1; ts += n; #endif - FILE_LOG(logDEBUG5, ("module of size %d sent register %x\n", ts, myMod->reg)); + FILE_LOG(logDEBUG1, ("module of size %d sent register %x\n", ts, myMod->reg)); return ts; } @@ -439,7 +439,7 @@ int receiveModule(int file_des, sls_detector_module* myMod) { n = receiveData(file_des,&(myMod->chanregs), sizeof(int) * (myMod->nchan), INT32); if (!n) return -1; ts += n; #endif - FILE_LOG(logDEBUG5, ("received module of size %d register %x\n",ts,myMod->reg)); + FILE_LOG(logDEBUG1, ("received module of size %d register %x\n",ts,myMod->reg)); return ts; } diff --git a/slsDetectorServers/slsDetectorServer/slsDetectorServer.c b/slsDetectorServers/slsDetectorServer/slsDetectorServer.c index ef85d11b5..3dd67b651 100755 --- a/slsDetectorServers/slsDetectorServer/slsDetectorServer.c +++ b/slsDetectorServers/slsDetectorServer/slsDetectorServer.c @@ -72,7 +72,7 @@ int main(int argc, char *argv[]){ for (i = 0; i < argc; ++i) sprintf(cmd, "%s %s", cmd, argv[i]); sprintf(cmd,"%s -stopserver&", cmd); - FILE_LOG(logDEBUG5, ("Command to start stop server:%s\n", cmd)); + FILE_LOG(logDEBUG1, ("Command to start stop server:%s\n", cmd)); system(cmd); } #endif diff --git a/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c b/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c index 207b5add6..5b092ce80 100755 --- a/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c +++ b/slsDetectorServers/slsDetectorServer/slsDetectorServer_funcs.c @@ -84,11 +84,11 @@ int decode_function(int file_des) { int n = receiveData(file_des,&fnum,sizeof(fnum),INT32); if (n <= 0) { - FILE_LOG(logDEBUG5, ("ERROR reading from socket n=%d, fnum=%d, file_des=%d, fname=%s\n", + FILE_LOG(logDEBUG3, ("ERROR reading from socket n=%d, fnum=%d, file_des=%d, fname=%s\n", n, fnum, file_des, getFunctionName((enum detFuncs)fnum))); return FAIL; } else - FILE_LOG(logDEBUG5, ("Received %d bytes\n", n )); + FILE_LOG(logDEBUG3, ("Received %d bytes\n", n )); // jungfrau in programming mode #ifdef JUNGFRAUD @@ -106,14 +106,15 @@ int decode_function(int file_des) { FILE_LOG(logERROR, ("Unknown function enum %d\n", fnum)); ret=(M_nofunc)(file_des); } else { - FILE_LOG(logDEBUG5, (" calling function fnum=%d, (%s)\n", + FILE_LOG(logDEBUG1, (" calling function fnum=%d, (%s)\n", fnum, getFunctionName((enum detFuncs)fnum))); ret = (*flist[fnum])(file_des); if (ret == FAIL) { - FILE_LOG(logDEBUG5, ("Error executing the function = %d (%s)\n", + FILE_LOG(logDEBUG1, ("Error executing the function = %d (%s)\n", fnum, getFunctionName((enum detFuncs)fnum))); - } + } else FILE_LOG(logDEBUG1, ("Function (%s) executed ok\n", + getFunctionName((enum detFuncs)fnum))); } return ret; } @@ -252,7 +253,7 @@ void function_table() { int iloop = 0; for (iloop = 0; iloop < NUM_DET_FUNCTIONS ; ++iloop) { - FILE_LOG(logDEBUG5, ("function fnum=%d, (%s) located at 0x%x\n", iloop, + FILE_LOG(logDEBUG1, ("function fnum=%d, (%s) located at 0x%x\n", iloop, getFunctionName((enum detFuncs)iloop), (unsigned int)flist[iloop])); } } @@ -373,7 +374,7 @@ int get_detector_type(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); enum detectorType retval = myDetectorType; - FILE_LOG(logDEBUG5,("Returning detector type %d\n", retval)); + FILE_LOG(logDEBUG1,("Returning detector type %d\n", retval)); return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); } @@ -392,7 +393,7 @@ int set_external_signal_flag(int file_des) { int signalindex = args[0]; enum externalSignalFlag flag = args[1]; - FILE_LOG(logDEBUG5, ("Setting external signal %d to flag %d\n", signalindex, flag)); + FILE_LOG(logDEBUG1, ("Setting external signal %d to flag %d\n", signalindex, flag)); #ifndef GOTTHARDD functionNotImplemented(); @@ -404,7 +405,7 @@ int set_external_signal_flag(int file_des) { // get retval = getExtSignal(signalindex); validate((int)flag, (int)retval, "set external signal flag", 1); - FILE_LOG(logDEBUG5, ("External Signal Flag: %d\n", retval)); + FILE_LOG(logDEBUG1, ("External Signal Flag: %d\n", retval)); } #endif return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); @@ -421,7 +422,7 @@ int set_external_communication_mode(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting external communication mode to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Setting external communication mode to %d\n", arg)); // set if ((arg != GET_EXTERNAL_COMMUNICATION_MODE) && (Server_VerifyLock() == OK)) { @@ -442,7 +443,7 @@ int set_external_communication_mode(int file_des) { // get retval = getTiming(); validate((int)arg, (int)retval, "set timing mode", 0); - FILE_LOG(logDEBUG5, ("Timing Mode: %d\n",retval)); + FILE_LOG(logDEBUG1, ("Timing Mode: %d\n",retval)); return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); } @@ -457,7 +458,7 @@ int get_id(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Getting Id %d\n", arg)); + FILE_LOG(logDEBUG1, ("Getting Id %d\n", arg)); // get switch (arg) { @@ -468,7 +469,7 @@ int get_id(int file_des) { case DETECTOR_FIRMWARE_VERSION: case DETECTOR_SOFTWARE_VERSION: retval = getDetectorId(arg); - FILE_LOG(logDEBUG5, ("Id(%d): %lld\n", retval)); + FILE_LOG(logDEBUG1, ("Id(%d): %lld\n", retval)); break; default: modeNotImplemented("ID Index", (int)arg); @@ -492,9 +493,9 @@ int digital_test(int file_des) { enum digitalTestMode mode = args[0]; #ifdef GOTTHARDD int ival = args[1]; - FILE_LOG(logDEBUG5, ("Digital test, mode = %d, ival:%d\n", mode, ival)); + FILE_LOG(logDEBUG1, ("Digital test, mode = %d, ival:%d\n", mode, ival)); #else - FILE_LOG(logDEBUG5, ("Digital test, mode = %d\n", mode)); + FILE_LOG(logDEBUG1, ("Digital test, mode = %d\n", mode)); #endif #ifdef EIGERD @@ -505,7 +506,7 @@ int digital_test(int file_des) { switch (mode) { #ifdef GOTTHARDD case DIGITAL_BIT_TEST: - FILE_LOG(logDEBUG5, ("Setting digital test bit: %d\n", ival)); + FILE_LOG(logDEBUG1, ("Setting digital test bit: %d\n", ival)); if (ival >= 0) digitalTestBit = (ival > 0) ? 1 : 0; retval = digitalTestBit; @@ -514,7 +515,7 @@ int digital_test(int file_des) { case DETECTOR_FIRMWARE_TEST: case DETECTOR_BUS_TEST: retval = detectorTest(mode); - FILE_LOG(logDEBUG5, ("Digital Test (%d): %d\n", mode, retval)); + FILE_LOG(logDEBUG1, ("Digital Test (%d): %d\n", mode, retval)); break; default: modeNotImplemented("Digital Test Mode", (int)mode); @@ -630,7 +631,7 @@ int set_dac(int file_des) { // index exists if (ret == OK) { - FILE_LOG(logDEBUG5, ("Setting DAC %d to %d %s\n", serverDacIndex, val, + FILE_LOG(logDEBUG1, ("Setting DAC %d to %d %s\n", serverDacIndex, val, (mV ? "mV" : "dac units"))); // set & get @@ -641,7 +642,7 @@ int set_dac(int file_des) { #ifdef EIGERD case IO_DELAY: retval[0] = setIODelay(val); - FILE_LOG(logDEBUG5, ("IODelay: %d\n", retval[0])); + FILE_LOG(logDEBUG1, ("IODelay: %d\n", retval[0])); break; #endif @@ -649,7 +650,7 @@ int set_dac(int file_des) { case HV_POT: case HV_NEW: retval[0] = setHighVoltage(val); - FILE_LOG(logDEBUG5, ("High Voltage: %d\n", retval[0])); + FILE_LOG(logDEBUG1, ("High Voltage: %d\n", retval[0])); #ifdef EIGERD if ((retval[0] != SLAVE_HIGH_VOLTAGE_READ_VAL) && (retval[0] < 0)) { ret = FAIL; @@ -704,7 +705,7 @@ int set_dac(int file_des) { FILE_LOG(logERROR,(mess)); } } - FILE_LOG(logDEBUG5, ("Dac (%d): %d dac units and %d mV\n", serverDacIndex, retval[0], retval[1])); + FILE_LOG(logDEBUG1, ("Dac (%d): %d dac units and %d mV\n", serverDacIndex, retval[0], retval[1])); break; } } @@ -769,9 +770,9 @@ int get_adc(int file_des) { // valid index if (ret == OK) { - FILE_LOG(logDEBUG5, ("Getting ADC %d\n", serverAdcIndex)); + FILE_LOG(logDEBUG1, ("Getting ADC %d\n", serverAdcIndex)); retval = getADC(serverAdcIndex); - FILE_LOG(logDEBUG5, ("ADC(%d): %d\n", retval)); + FILE_LOG(logDEBUG1, ("ADC(%d): %d\n", retval)); } return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); } @@ -790,7 +791,7 @@ int write_register(int file_des) { return printSocketReadError(); uint32_t addr = args[0]; uint32_t val = args[1]; - FILE_LOG(logDEBUG5, ("Writing to register 0x%x, data 0x%x\n", addr, val)); + FILE_LOG(logDEBUG1, ("Writing to register 0x%x, data 0x%x\n", addr, val)); // only set if (Server_VerifyLock() == OK) { @@ -801,7 +802,7 @@ int write_register(int file_des) { sprintf(mess,"Could not write to register 0x%x. Wrote 0x%x but read 0x%x\n", addr, val, retval); FILE_LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG5, ("Write register (0x%x): 0x%x\n", retval)); + FILE_LOG(logDEBUG1, ("Write register (0x%x): 0x%x\n", retval)); } return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); } @@ -819,11 +820,11 @@ int read_register(int file_des) { if (receiveData(file_des, &addr, sizeof(addr), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Reading from register 0x%x\n", addr)); + FILE_LOG(logDEBUG1, ("Reading from register 0x%x\n", addr)); // get retval = readRegister(addr); - FILE_LOG(logDEBUG5, ("Read register (0x%x): 0x%x\n", retval)); + FILE_LOG(logDEBUG1, ("Read register (0x%x): 0x%x\n", retval)); return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); } @@ -892,7 +893,7 @@ int set_module(int file_des) { if (myAdc != NULL) free(myAdc); return printSocketReadError(); } - FILE_LOG(logDEBUG5, ("module register is %d, nchan %d, nchip %d, " + FILE_LOG(logDEBUG1, ("module register is %d, nchan %d, nchip %d, " "ndac %d, nadc %d, iodelay %d, tau %d, eV %d\n", module.reg, module.nchan, module.nchip, module.ndac, module.nadc, module.iodelay, module.tau, module.eV)); @@ -944,7 +945,7 @@ int set_module(int file_des) { ret = setModule(module, mess); retval = getSettings(); validate(module.reg, (int)retval, "set module (settings)", 0); - FILE_LOG(logDEBUG5, ("Settings: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Settings: %d\n", retval)); } if (myChan != NULL) free(myChan); if (myDac != NULL) free(myDac); @@ -1010,9 +1011,9 @@ int get_module(int file_des) { module.nadc = getNumberOfADCs(); // only get - FILE_LOG(logDEBUG5, ("Getting module\n")); + FILE_LOG(logDEBUG1, ("Getting module\n")); getModule(&module); - FILE_LOG(logDEBUG5, ("Getting module. Settings:%d\n", module.reg)); + FILE_LOG(logDEBUG1, ("Getting module. Settings:%d\n", module.reg)); } Server_SendResult(file_des, INT32, 1, NULL, 0); @@ -1040,7 +1041,7 @@ int set_settings(int file_des) { if (receiveData(file_des, &isett, sizeof(isett), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting settings %d\n", isett)); + FILE_LOG(logDEBUG1, ("Setting settings %d\n", isett)); //set & get if ((isett == GET_SETTINGS) || ((isett != GET_SETTINGS) && (Server_VerifyLock() == OK))) { @@ -1076,7 +1077,7 @@ int set_settings(int file_des) { // if index is okay, set & get if (ret == OK) { retval = setSettings(isett); - FILE_LOG(logDEBUG5, ("Settings: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Settings: %d\n", retval)); validate((int)isett, (int)retval, "set settings", 0); #if defined(JUNGFRAUD) || defined (GOTTHARDD) if (ret == OK && isett >= 0) { @@ -1101,13 +1102,13 @@ int get_threshold_energy(int file_des) { memset(mess, 0, sizeof(mess)); int retval = -1; - FILE_LOG(logDEBUG5, ("Getting Threshold energy\n")); + FILE_LOG(logDEBUG1, ("Getting Threshold energy\n")); #ifndef EIGERD functionNotImplemented(); #else // only get retval = getThresholdEnergy(); - FILE_LOG(logDEBUG5, ("Threshold energy: %d eV\n", retval)); + FILE_LOG(logDEBUG1, ("Threshold energy: %d eV\n", retval)); #endif return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); } @@ -1121,7 +1122,7 @@ int start_acquisition(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Starting Acquisition\n")); + FILE_LOG(logDEBUG1, ("Starting Acquisition\n")); // only set if (Server_VerifyLock() == OK) { ret = startStateMachine(); @@ -1129,7 +1130,7 @@ int start_acquisition(int file_des) { sprintf(mess, "Could not start acquisition\n"); FILE_LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG5, ("Starting Acquisition ret: %d\n", ret)); + FILE_LOG(logDEBUG1, ("Starting Acquisition ret: %d\n", ret)); } return Server_SendResult(file_des, INT32, 1, NULL, 0); } @@ -1140,7 +1141,7 @@ int stop_acquisition(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Stopping Acquisition\n")); + FILE_LOG(logDEBUG1, ("Stopping Acquisition\n")); // only set if (Server_VerifyLock() == OK) { ret = stopStateMachine(); @@ -1148,7 +1149,7 @@ int stop_acquisition(int file_des) { sprintf(mess, "Could not stop acquisition\n"); FILE_LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG5, ("Stopping Acquisition ret: %d\n", ret)); + FILE_LOG(logDEBUG1, ("Stopping Acquisition ret: %d\n", ret)); } return Server_SendResult(file_des, INT32, 1, NULL, 0); } @@ -1161,7 +1162,7 @@ int start_readout(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Starting readout\n")); + FILE_LOG(logDEBUG1, ("Starting readout\n")); #ifdef JUNGFRAUD functionNotImplemented(); #else @@ -1172,7 +1173,7 @@ int start_readout(int file_des) { sprintf(mess, "Could not start readout\n"); FILE_LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG5, ("Starting readout ret: %d\n", ret)); + FILE_LOG(logDEBUG1, ("Starting readout ret: %d\n", ret)); } #endif return Server_SendResult(file_des, INT32, 1, NULL, 0); @@ -1188,10 +1189,10 @@ int get_run_status(int file_des) { memset(mess, 0, sizeof(mess)); enum runStatus retval = ERROR; - FILE_LOG(logDEBUG5, ("Getting status\n")); + FILE_LOG(logDEBUG1, ("Getting status\n")); // only get retval = getRunStatus(); - FILE_LOG(logDEBUG5, ("Status: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Status: %d\n", retval)); return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); } @@ -1203,9 +1204,9 @@ int start_and_read_all(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Starting Acquisition and read all frames\n")); + FILE_LOG(logDEBUG1, ("Starting Acquisition and read all frames\n")); // start state machine - FILE_LOG(logDEBUG5, ("Stopping Acquisition\n")); + FILE_LOG(logDEBUG1, ("Stopping Acquisition\n")); // only set if (Server_VerifyLock() == OK) { ret = startStateMachine(); @@ -1213,7 +1214,7 @@ int start_and_read_all(int file_des) { sprintf(mess, "Could not start acquisition\n"); FILE_LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG5, ("Starting Acquisition ret: %d\n", ret)); + FILE_LOG(logDEBUG1, ("Starting Acquisition ret: %d\n", ret)); } @@ -1232,7 +1233,7 @@ int read_all(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Reading all frames\n")); + FILE_LOG(logDEBUG1, ("Reading all frames\n")); // only set if (Server_VerifyLock() == OK) { readFrame(&ret, mess); @@ -1258,7 +1259,7 @@ int set_timer(int file_des) { #ifdef EIGERD int64_t subexptime = 0; #endif - FILE_LOG(logDEBUG5, ("Setting timer index %d to %lld ns\n", ind, tns)); + FILE_LOG(logDEBUG1, ("Setting timer index %d to %lld ns\n", ind, tns)); // set & get if ((tns == -1) || ((tns != -1) && (Server_VerifyLock() == OK))) { @@ -1318,7 +1319,7 @@ int set_timer(int file_des) { validate64(tns, retval, "set timer", 0); } if (ret != FAIL) { - FILE_LOG(logDEBUG5, ("Timer index %d: %lld\n", ind, retval)); + FILE_LOG(logDEBUG1, ("Timer index %d: %lld\n", ind, retval)); } return Server_SendResult(file_des, INT64, 1, &retval, sizeof(retval)); } @@ -1337,7 +1338,7 @@ int get_time_left(int file_des) { if (receiveData(file_des, &ind, sizeof(ind), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Getting timer left index %d\n", ind)); + FILE_LOG(logDEBUG1, ("Getting timer left index %d\n", ind)); // only get // check index @@ -1362,7 +1363,7 @@ int get_time_left(int file_des) { case MEASUREMENT_TIME: #endif retval = getTimeLeft(ind); - FILE_LOG(logDEBUG5, ("Timer left index %d: %lld\n", ind, retval)); + FILE_LOG(logDEBUG1, ("Timer left index %d: %lld\n", ind, retval)); break; #ifdef JUNGFRAUD case DELAY_AFTER_TRIGGER: @@ -1392,7 +1393,7 @@ int set_dynamic_range(int file_des) { if (receiveData(file_des, &dr, sizeof(dr), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting dr to %d\n", dr)); + FILE_LOG(logDEBUG1, ("Setting dr to %d\n", dr)); // set & get if ((dr == -1) || ((dr != -1) && (Server_VerifyLock() == OK))) { @@ -1408,7 +1409,7 @@ int set_dynamic_range(int file_des) { case 4: case 8: case 32: #endif retval = setDynamicRange(dr); - FILE_LOG(logDEBUG5, ("Dynamic range: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Dynamic range: %d\n", retval)); validate(dr, retval, "set dynamic range", 0); if (dr >= 0) dataBytes=calculateDataBytes(); @@ -1457,7 +1458,7 @@ int set_readout_flags(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting readout flags to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Setting readout flags to %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -1474,8 +1475,8 @@ int set_readout_flags(int file_des) { case SHOW_OVERFLOW: case NOOVERFLOW: retval = setReadOutFlags(arg); - FILE_LOG(logDEBUG5, ("Read out flags: %d\n", retval)); - validate((int)arg, (int)retval, "set readout flag", 0); + FILE_LOG(logDEBUG1, ("Read out flags: 0x%x\n", retval)); + validate((int)arg, (int)(retval & arg), "set readout flag", 1); break; default: modeNotImplemented("Read out flag index", (int)arg); @@ -1516,11 +1517,11 @@ int set_roi(int file_des) { return printSocketReadError(); } } - FILE_LOG(logDEBUG5, ("Set ROI (narg:%d)\n", narg)); + FILE_LOG(logDEBUG1, ("Set ROI (narg:%d)\n", narg)); { int iloop = 0; for (iloop = 0; iloop < narg; ++iloop) { - FILE_LOG(logDEBUG5, ("%d: %d\t%d\t%d\t%d\n", + FILE_LOG(logDEBUG1, ("%d: %d\t%d\t%d\t%d\n", arg[iloop].xmin, arg[iloop].xmax, arg[iloop].ymin, arg[iloop].ymax)); } } @@ -1536,7 +1537,7 @@ int set_roi(int file_des) { "Set %d rois, but read %d rois\n", narg, nretval); FILE_LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG5, ("nRois: %d\n", nretval)); + FILE_LOG(logDEBUG1, ("nRois: %d\n", nretval)); } #endif @@ -1571,7 +1572,7 @@ int set_speed(int file_des) { return printSocketReadError(); enum speedVariable ind = args[0]; int val = args[1]; - FILE_LOG(logDEBUG5, ("Setting speed index %d to %d\n", ind, val)); + FILE_LOG(logDEBUG1, ("Setting speed index %d to %d\n", ind, val)); // set & get if ((val == -1) || ((val != -1) && (Server_VerifyLock() == OK))) { @@ -1580,7 +1581,7 @@ int set_speed(int file_des) { #ifdef JUNGFRAUD case ADC_PHASE: retval = adcPhase(val); - FILE_LOG(logDEBUG5, ("ADc Phase: %d\n", retval)); + FILE_LOG(logDEBUG1, ("ADc Phase: %d\n", retval)); if (val != 100000) { validate(val, retval, "set adc phase ", 0); } @@ -1588,7 +1589,7 @@ int set_speed(int file_des) { #endif case CLOCK_DIVIDER: retval = setSpeed(val); - FILE_LOG(logDEBUG5, ("Clock: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Clock: %d\n", retval)); validate(val, retval, "set clock ", 0); break; default: @@ -1622,7 +1623,7 @@ int lock_server(int file_des) { if (receiveData(file_des, &lock, sizeof(lock), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Locking Server to %d\n", lock)); + FILE_LOG(logDEBUG1, ("Locking Server to %d\n", lock)); // set if (lock >= 0) { @@ -1787,13 +1788,13 @@ int configure_mac(int file_des) { if (receiveData(file_des, args, sizeof(args), OTHER) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("\n Configuring UDP Destination\n")); + FILE_LOG(logDEBUG1, ("\n Configuring UDP Destination\n")); #ifdef GOTTHARDD - FILE_LOG(logDEBUG5, ("Digital Test Bit %d\t", digitalTestBit); + FILE_LOG(logDEBUG1, ("Digital Test Bit %d\t", digitalTestBit); #endif uint32_t dstIp = 0; sscanf(args[0], "%x", &dstIp); - FILE_LOG(logDEBUG5, ("Dst Ip Addr: %d.%d.%d.%d = 0x%x \n", + FILE_LOG(logDEBUG1, ("Dst Ip Addr: %d.%d.%d.%d = 0x%x \n", (dstIp >> 24) & 0xff, (dstIp >> 16) & 0xff, (dstIp >> 8) & 0xff, (dstIp) & 0xff, dstIp)); uint64_t dstMac = 0; @@ -1802,43 +1803,43 @@ int configure_mac(int file_des) { #else sscanf(args[1], "%llx", &dstMac); #endif - FILE_LOG(logDEBUG5, ("Dst Mac Addr: (0x) ")); + FILE_LOG(logDEBUG1, ("Dst Mac Addr: (0x) ")); { int iloop = 5; for (iloop = 5; iloop >= 0; --iloop) { - FILE_LOG(logDEBUG5, ("%x", (unsigned int)(((dstMac >> (8 * iloop)) & 0xFF)))); + FILE_LOG(logDEBUG1, ("%x", (unsigned int)(((dstMac >> (8 * iloop)) & 0xFF)))); if (iloop > 0) { - FILE_LOG(logDEBUG5, (":")); + FILE_LOG(logDEBUG1, (":")); } } } - FILE_LOG(logDEBUG5, (" = %llx\n", dstMac)); + FILE_LOG(logDEBUG1, (" = %llx\n", dstMac)); uint32_t dstPort = 0; sscanf(args[2], "%x", &dstPort); - FILE_LOG(logDEBUG5, ("Dst Port: %x\n", dstPort)); + FILE_LOG(logDEBUG1, ("Dst Port: %x\n", dstPort)); uint32_t dstPort2 = 0; sscanf(args[5], "%x", &dstPort2); - FILE_LOG(logDEBUG5, ("Dst Port2: %x\n", dstPort2)); + FILE_LOG(logDEBUG1, ("Dst Port2: %x\n", dstPort2)); uint64_t srcMac = 0; #ifdef VIRTUAL sscanf(args[3], "%lx", &srcMac); #else sscanf(args[3], "%llx", &srcMac); #endif - FILE_LOG(logDEBUG5, ("Src Mac Addr: (0x) ")); + FILE_LOG(logDEBUG1, ("Src Mac Addr: (0x) ")); { int iloop = 5; for (iloop = 5; iloop >= 0; --iloop) { - FILE_LOG(logDEBUG5, ("%x", (unsigned int)(((srcMac >> (8 * iloop)) & 0xFF)))); + FILE_LOG(logDEBUG1, ("%x", (unsigned int)(((srcMac >> (8 * iloop)) & 0xFF)))); if (iloop > 0) { - FILE_LOG(logDEBUG5, (":")); + FILE_LOG(logDEBUG1, (":")); } } } - FILE_LOG(logDEBUG5, (" = %llx\n", srcMac)); + FILE_LOG(logDEBUG1, (" = %llx\n", srcMac)); uint32_t srcIp = 0; sscanf(args[4], "%x", &srcIp); - FILE_LOG(logDEBUG5, ("Src Ip Addr: %d.%d.%d.%d = 0x%x \n", + FILE_LOG(logDEBUG1, ("Src Ip Addr: %d.%d.%d.%d = 0x%x \n", (srcIp >> 24) & 0xff, (srcIp >> 16) & 0xff, (srcIp >> 8) & 0xff, (srcIp) & 0xff, srcIp)); #if defined(JUNGFRAUD) || defined(EIGERD) @@ -1846,7 +1847,7 @@ int configure_mac(int file_des) { sscanf(args[6], "%x", &pos[0]); sscanf(args[7], "%x", &pos[1]); sscanf(args[8], "%x", &pos[2]); - FILE_LOG(logDEBUG5, ("Position: [%d, %d, %d]\n", pos[0], pos[1], pos[2])); + FILE_LOG(logDEBUG1, ("Position: [%d, %d, %d]\n", pos[0], pos[1], pos[2])); #endif // set only @@ -1863,12 +1864,12 @@ int configure_mac(int file_des) { #ifdef EIGERD // change mac to hardware mac if (srcMac != getDetectorMAC()) { - FILE_LOG(logERROR, ("actual detector mac address %llx does not match " + FILE_LOG(logWARNING, ("actual detector mac address %llx does not match " "the one from client %llx\n", (long long unsigned int)getDetectorMAC(), (long long unsigned int)srcMac)); srcMac = getDetectorMAC(); - FILE_LOG(logERROR,("matched detectormac to the hardware mac now\n")); + FILE_LOG(logWARNING,("matched detectormac to the hardware mac now\n")); } // always remember the ip sent from the client (could be for 10g(if not dhcp)) @@ -1877,7 +1878,7 @@ int configure_mac(int file_des) { //only for 1Gbe, change ip to hardware ip if (!enableTenGigabitEthernet(-1)) { - FILE_LOG(logERROR, ("using DHCP IP for Configuring MAC\n")); + FILE_LOG(logWARNING, ("Using DHCP IP for Configuring MAC\n")); srcIp = getDetectorIP(); } // 10 gbe (use ip given from client) @@ -1887,11 +1888,11 @@ int configure_mac(int file_des) { #endif #ifdef GOTTHARDD iretval = configureMAC(dstIp, dstMac, srcMac, srcIp, dstPort, dstPort2, digitalTestBit); - FILE_LOG(logDEBUG5, ("Configure mac retval: %d\n", iretval)); + FILE_LOG(logDEBUG1, ("Configure mac retval: %d\n", iretval)); FILE_LOG(logINFO, ("Configure MAC successful: %d\n", iretval)); #else iretval = configureMAC(dstIp, dstMac, srcMac, srcIp, dstPort, dstPort2); - FILE_LOG(logDEBUG5, ("Configure mac retval: %d\n", iretval)); + FILE_LOG(logDEBUG1, ("Configure mac retval: %d\n", iretval)); if (iretval == -1) { ret = FAIL; @@ -1938,7 +1939,7 @@ int load_image(int file_des) { return printSocketReadError(); } } - FILE_LOG(logDEBUG5, ("Loading %s image (ind:%d)\n", (index == DARK_IMAGE) ? "dark" : + FILE_LOG(logDEBUG1, ("Loading %s image (ind:%d)\n", (index == DARK_IMAGE) ? "dark" : ((index == GAIN_IMAGE) ? "gain" : "unknown"), index)); #ifndef GOTTHARDD @@ -1951,7 +1952,7 @@ int load_image(int file_des) { case DARK_IMAGE : case GAIN_IMAGE : ret = loadImage(index, ImageVals); - FILE_LOG(logDEBUG5, ("Loading image ret: %d\n", ret)); + FILE_LOG(logDEBUG1, ("Loading image ret: %d\n", ret)); if (ret == FAIL) { sprintf(mess, "Could not load image\n"); FILE_LOG(logERROR,(mess)); @@ -1980,7 +1981,7 @@ int read_counter_block(int file_des) { if (receiveData(file_des, &startACQ, sizeof(startACQ), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Read counter block with start acq bit: %d\n", startACQ)); + FILE_LOG(logDEBUG1, ("Read counter block with start acq bit: %d\n", startACQ)); #ifndef GOTTHARDD functionNotImplemented(); @@ -2009,7 +2010,7 @@ int reset_counter_block(int file_des) { if (receiveData(file_des, &startACQ, sizeof(startACQ), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Reset counter block with start acq bit: %d\n", startACQ)); + FILE_LOG(logDEBUG1, ("Reset counter block with start acq bit: %d\n", startACQ)); #ifndef GOTTHARDD functionNotImplemented(); @@ -2039,7 +2040,7 @@ int enable_ten_giga(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Enable/ Disable 10GbE : %d\n", arg)); + FILE_LOG(logDEBUG1, ("Enable/ Disable 10GbE : %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -2047,7 +2048,7 @@ int enable_ten_giga(int file_des) { // set & get if ((arg == -1) || ((arg != -1) && (Server_VerifyLock() == OK))) { retval = enableTenGigabitEthernet(arg); - FILE_LOG(logDEBUG5, ("10GbE: %d\n", retval)); + FILE_LOG(logDEBUG1, ("10GbE: %d\n", retval)); validate(arg, retval, "enable/disable 10GbE", 0); } #endif @@ -2065,7 +2066,7 @@ int set_all_trimbits(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Set all trmbits to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Set all trmbits to %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -2080,7 +2081,7 @@ int set_all_trimbits(int file_des) { } // get retval = getAllTrimbits(); - FILE_LOG(logDEBUG5, ("All trimbits: %d\n", retval)); + FILE_LOG(logDEBUG1, ("All trimbits: %d\n", retval)); validate(arg, retval, "set all trimbits", 0); #endif return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); @@ -2108,7 +2109,7 @@ int write_adc_register(int file_des) { return printSocketReadError(); uint32_t addr = args[0]; uint32_t val = args[1]; - FILE_LOG(logDEBUG5, ("Writing 0x%x to ADC Register 0x%x\n", val, addr)); + FILE_LOG(logDEBUG1, ("Writing 0x%x to ADC Register 0x%x\n", val, addr)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2131,7 +2132,7 @@ int set_counter_bit(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Set counter bit with value: %d\n", arg)); + FILE_LOG(logDEBUG1, ("Set counter bit with value: %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -2143,7 +2144,7 @@ int set_counter_bit(int file_des) { } // get retval = setCounterBit(-1); - FILE_LOG(logDEBUG5, ("Set counter bit retval: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Set counter bit retval: %d\n", retval)); validate(arg, retval, "set counter bit", 0); #endif return Server_SendResult(file_des, INT32, 1, &retval, sizeof(retval)); @@ -2160,7 +2161,7 @@ int pulse_pixel(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Pulse pixel, n: %d, x: %d, y: %d\n", args[0], args[1], args[2])); + FILE_LOG(logDEBUG1, ("Pulse pixel, n: %d, x: %d, y: %d\n", args[0], args[1], args[2])); #ifndef EIGERD functionNotImplemented(); @@ -2187,7 +2188,7 @@ int pulse_pixel_and_move(int file_des) { if (receiveData(file_des, args, sizeof(args), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Pulse pixel and move, n: %d, x: %d, y: %d\n", + FILE_LOG(logDEBUG1, ("Pulse pixel and move, n: %d, x: %d, y: %d\n", args[0], args[1], args[2])); #ifndef EIGERD @@ -2217,7 +2218,7 @@ int pulse_chip(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Pulse chip: %d\n", arg)); + FILE_LOG(logDEBUG1, ("Pulse chip: %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -2245,7 +2246,7 @@ int set_rate_correct(int file_des) { if (receiveData(file_des, &tau_ns, sizeof(tau_ns), INT64) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Set rate correct with tau %lld\n", (long long int)tau_ns)); + FILE_LOG(logDEBUG1, ("Set rate correct with tau %lld\n", (long long int)tau_ns)); #ifndef EIGERD functionNotImplemented(); @@ -2288,12 +2289,12 @@ int get_rate_correct(int file_des) { memset(mess, 0, sizeof(mess)); int64_t retval = -1; - FILE_LOG(logDEBUG5, ("Getting rate correction\n")); + FILE_LOG(logDEBUG1, ("Getting rate correction\n")); #ifndef EIGERD functionNotImplemented(); #else retval = getCurrentTau(); - FILE_LOG(logDEBUG5, ("Tau: %lld\n", (long long int)retval)); + FILE_LOG(logDEBUG1, ("Tau: %lld\n", (long long int)retval)); #endif return Server_SendResult(file_des, INT64, 1, &retval, sizeof(retval)); } @@ -2313,7 +2314,7 @@ int set_network_parameter(int file_des) { enum networkParameter mode = args[0]; int value = args[1]; enum NETWORKINDEX serverIndex = 0; - FILE_LOG(logDEBUG5, ("Set network parameter index %d to %d\n", mode, value)); + FILE_LOG(logDEBUG1, ("Set network parameter index %d to %d\n", mode, value)); #ifdef GOTTHARDD functionNotImplemented(); @@ -2351,7 +2352,7 @@ int set_network_parameter(int file_des) { // valid index if (ret == OK) { retval = setNetworkParameter(serverIndex, value); - FILE_LOG(logDEBUG5, ("Network Parameter index %d: %d\n", serverIndex, retval)); + FILE_LOG(logDEBUG1, ("Network Parameter index %d: %d\n", serverIndex, retval)); validate(value, retval, "set network parameter", 0); } } @@ -2368,7 +2369,7 @@ int program_fpga(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Programming FPGA\n")); + FILE_LOG(logDEBUG1, ("Programming FPGA\n")); #ifndef JUNGFRAUD //to receive any arguments int n = 1; @@ -2404,7 +2405,7 @@ int program_fpga(int file_des) { if (receiveData(file_des,&filesize,sizeof(filesize),INT32) < 0) return printSocketReadError(); totalsize = filesize; - FILE_LOG(logDEBUG5, ("Total program size is: %d\n", totalsize); + FILE_LOG(logDEBUG1, ("Total program size is: %d\n", totalsize); // opening file pointer to flash and telling FPGA to not touch flash if (startWritingFPGAprogram(&fp) != OK) { @@ -2428,7 +2429,7 @@ int program_fpga(int file_des) { unitprogramsize = MAX_FPGAPROGRAMSIZE; //2mb if (unitprogramsize > filesize) //less than 2mb unitprogramsize = filesize; - FILE_LOG(logDEBUG5, ("unit size to receive is:%d\n" + FILE_LOG(logDEBUG1, ("unit size to receive is:%d\n" "filesize:%d currentpointer:%d\n", unitprogramsize, filesize, currentPointer)); @@ -2473,7 +2474,7 @@ int program_fpga(int file_des) { if (fp != NULL) fclose(fp); - FILE_LOG(logDEBUG5, ("Done with program receiving command\n")); + FILE_LOG(logDEBUG1, ("Done with program receiving command\n")); if (isControlServer) { basictests(debugflag); @@ -2493,7 +2494,7 @@ int reset_fpga(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Reset FPGA\n")); + FILE_LOG(logDEBUG1, ("Reset FPGA\n")); #ifndef JUNGFRAUD functionNotImplemented(); #else @@ -2521,7 +2522,7 @@ int power_chip(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Powering chip to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Powering chip to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2529,7 +2530,7 @@ int power_chip(int file_des) { // set & get if ((arg == -1) || ((arg != -1) && (Server_VerifyLock() == OK))) { retval = powerChip(arg); - FILE_LOG(logDEBUG5, ("Power chip: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Power chip: %d\n", retval)); validate(arg, retval, "power on/off chip", 0); // narrow down error when powering on if (ret == FAIL && arg > 0) { @@ -2554,7 +2555,7 @@ int set_activate(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting activate mode to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Setting activate mode to %d\n", arg)); #ifndef EIGERD functionNotImplemented(); @@ -2562,7 +2563,7 @@ int set_activate(int file_des) { // set & get if ((arg == -1) || ((arg != -1) && (Server_VerifyLock() == OK))) { retval = activate(arg); - FILE_LOG(logDEBUG5, ("Activate: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Activate: %d\n", retval)); validate(arg, retval, "set activate", 0); } #endif @@ -2576,7 +2577,7 @@ int prepare_acquisition(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Preparing Acquisition\n")); + FILE_LOG(logDEBUG1, ("Preparing Acquisition\n")); #ifndef EIGERD functionNotImplemented(); #else @@ -2604,7 +2605,7 @@ int threshold_temp(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting threshold temperature to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Setting threshold temperature to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2620,7 +2621,7 @@ int threshold_temp(int file_des) { // valid temp else { retval = setThresholdTemperature(arg); - FILE_LOG(logDEBUG5, ("Threshold temperature: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Threshold temperature: %d\n", retval)); validate(arg, retval, "set threshold temperature", 0); } } @@ -2638,7 +2639,7 @@ int temp_control(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting temperature control to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Setting temperature control to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2646,7 +2647,7 @@ int temp_control(int file_des) { // set & get if ((arg == -1) || ((arg != -1) && (Server_VerifyLock() == OK))) { retval = setTemperatureControl(arg); - FILE_LOG(logDEBUG5, ("Temperature control: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Temperature control: %d\n", retval)); validate(arg, retval, "set temperature control", 0); } #endif @@ -2664,7 +2665,7 @@ int temp_event(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting temperature event to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Setting temperature event to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2672,7 +2673,7 @@ int temp_event(int file_des) { // set & get if ((arg == -1) || ((arg != -1) && (Server_VerifyLock() == OK))) { retval = setTemperatureEvent(arg); - FILE_LOG(logDEBUG5, ("Temperature event: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Temperature event: %d\n", retval)); validate(arg, retval, "set temperature event", 0); } #endif @@ -2691,7 +2692,7 @@ int auto_comp_disable(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting Auto comp disable to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Setting Auto comp disable to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2699,7 +2700,7 @@ int auto_comp_disable(int file_des) { // set & get if ((arg == -1) || ((arg != -1) && (Server_VerifyLock() == OK))) { retval = autoCompDisable(arg); - FILE_LOG(logDEBUG5, ("Auto comp disable: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Auto comp disable: %d\n", retval)); validate(arg, retval, "set auto comp disable", 0); } #endif @@ -2718,7 +2719,7 @@ int storage_cell_start(int file_des) { if (receiveData(file_des, &arg, sizeof(arg), INT32) < 0) return printSocketReadError(); - FILE_LOG(logDEBUG5, ("Setting Storage cell start to %d\n", arg)); + FILE_LOG(logDEBUG1, ("Setting Storage cell start to %d\n", arg)); #ifndef JUNGFRAUD functionNotImplemented(); @@ -2731,7 +2732,7 @@ int storage_cell_start(int file_des) { FILE_LOG(logERROR, (mess)); } else { retval = selectStoragecellStart(arg); - FILE_LOG(logDEBUG5, ("Storage cell start: %d\n", retval)); + FILE_LOG(logDEBUG1, ("Storage cell start: %d\n", retval)); validate(arg, retval, "set storage cell start", 0); } #endif @@ -2751,7 +2752,7 @@ int check_version(int file_des) { // check software- firmware compatibility and basic tests if (isControlServer) { - FILE_LOG(logDEBUG5, ("Checking software-firmware compatibility and basic test result\n")); + FILE_LOG(logDEBUG1, ("Checking software-firmware compatibility and basic test result\n")); // check if firmware check is done if (!isFirmwareCheckDone()) { @@ -2775,7 +2776,7 @@ int check_version(int file_des) { } if (ret == OK) { - FILE_LOG(logDEBUG5, ("Checking versioning compatibility with value %d\n",arg)); + FILE_LOG(logDEBUG1, ("Checking versioning compatibility with value %d\n",arg)); int64_t client_requiredVersion = arg; int64_t det_apiVersion = getDetectorId(CLIENT_SOFTWARE_API_VERSION); @@ -2811,7 +2812,7 @@ int software_trigger(int file_des) { ret = OK; memset(mess, 0, sizeof(mess)); - FILE_LOG(logDEBUG5, ("Software Trigger\n")); + FILE_LOG(logDEBUG1, ("Software Trigger\n")); #ifndef EIGERD functionNotImplemented(); #else @@ -2822,7 +2823,7 @@ int software_trigger(int file_des) { sprintf(mess, "Could not send software trigger\n"); FILE_LOG(logERROR,(mess)); } - FILE_LOG(logDEBUG5, ("Software trigger ret: %d\n", ret)); + FILE_LOG(logDEBUG1, ("Software trigger ret: %d\n", ret)); } #endif return Server_SendResult(file_des, INT32, 1 , NULL, 0); diff --git a/slsDetectorSoftware/sharedMemory/SharedMemory.cpp b/slsDetectorSoftware/sharedMemory/SharedMemory.cpp index 0dc645545..44911ddb4 100644 --- a/slsDetectorSoftware/sharedMemory/SharedMemory.cpp +++ b/slsDetectorSoftware/sharedMemory/SharedMemory.cpp @@ -1,6 +1,7 @@ #include "SharedMemory.h" #include "sls_detector_exceptions.h" #include "ansi.h" +#include "logger.h" #include #include // printf @@ -51,15 +52,13 @@ void* SharedMemory::CreateSharedMemory(size_t sz){ // create fd = shm_open(name.c_str(), O_CREAT | O_TRUNC | O_EXCL | O_RDWR, S_IRUSR | S_IWUSR); if (fd < 0) { - cprintf(RED, "Error: Create shared memory %s failed: %s\n", - name.c_str(), strerror(errno)); + FILE_LOG(logERROR) << "Create shared memory " << name << " failed: " << strerror(errno); throw SharedMemoryException(); } // resize if (ftruncate(fd, sz) < 0) { - cprintf(RED, "Error: Create shared memory %s failed at ftruncate: %s\n", - name.c_str(), strerror(errno)); + FILE_LOG(logERROR) << "Create shared memory " << name << " failed at ftruncate: " << strerror(errno); close(fd); RemoveSharedMemory(); throw SharedMemoryException(); @@ -67,7 +66,7 @@ void* SharedMemory::CreateSharedMemory(size_t sz){ // map void* addr = MapSharedMemory(sz); - printf("Shared memory created %s \n", name.c_str()); + FILE_LOG(logINFO) << "Shared memory created " << name; return addr; } @@ -75,8 +74,7 @@ void* SharedMemory::OpenSharedMemory(size_t sz){ // open fd = shm_open(name.c_str(), O_RDWR, 0); if (fd < 0) { - cprintf(RED, "Error: Open existing shared memory %s failed: %s\n", - name.c_str(), strerror(errno)); + FILE_LOG(logERROR) << "Open existing shared memory " << name << " failed: " << strerror(errno); throw SharedMemoryException(); } @@ -86,8 +84,7 @@ void* SharedMemory::OpenSharedMemory(size_t sz){ void SharedMemory::UnmapSharedMemory(void* addr) { if (munmap(addr, shmSize) < 0) { - cprintf(RED, "Error: Unmapping shared memory %s failed: %s\n", - name.c_str(), strerror(errno)); + FILE_LOG(logERROR) << "Unmapping shared memory " << name << " failed: " << strerror(errno); close(fd); throw SharedMemoryException(); } @@ -98,19 +95,17 @@ void SharedMemory::RemoveSharedMemory() { // silent exit if shm did not exist anyway if (errno == ENOENT) return; - cprintf(RED, "Error: Free Shared Memory %s Failed: %s\n", - name.c_str(), strerror(errno)); + FILE_LOG(logERROR) << "Free Shared Memory " << name << " Failed: " << strerror(errno); throw SharedMemoryException(); } - printf("Shared memory deleted %s \n", name.c_str()); + FILE_LOG(logINFO) << "Shared memory deleted " << name; } void* SharedMemory::MapSharedMemory(size_t sz) { void* addr = mmap(NULL, sz, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0); if (addr == MAP_FAILED) { - cprintf(RED, "Error: Mapping shared memory %s failed: %s\n", - name.c_str(), strerror(errno)); + FILE_LOG(logERROR) << "Mapping shared memory " << name << " failed: " << strerror(errno); close(fd); throw SharedMemoryException(); } @@ -138,10 +133,9 @@ std::string SharedMemory::ConstructSharedMemoryName(int multiId, int slsId) { std::string temp = ss.str(); if (temp.length() > NAME_MAX) { - cprintf(RED, "Error: Shared memory initialization failed. " - "%s has %lu characters. \n" - "Maximum is %d. Change the environment variable %s\n", - temp.c_str(), temp.length(), NAME_MAX, SHM_ENV_NAME); + FILE_LOG(logERROR) << "Shared memory initialization failed. " << + temp << " has " << temp.length() << " characters. \n" + "Maximum is " << NAME_MAX << ". Change the environment variable " << SHM_ENV_NAME; throw SharedMemoryException(); } return temp; @@ -152,8 +146,8 @@ int SharedMemory::VerifySizeMatch(size_t expectedSize) { struct stat sb; // could not fstat if (fstat(fd, &sb) < 0) { - cprintf(RED, "Error: Could not verify existing shared memory %s size match " - "(could not fstat): %s\n", name.c_str(), strerror(errno)); + FILE_LOG(logERROR) << "Could not verify existing shared memory " << name << " size match " + "(could not fstat): " << strerror(errno); close(fd); throw SharedMemoryException(); } @@ -161,11 +155,8 @@ int SharedMemory::VerifySizeMatch(size_t expectedSize) { //size does not match long unsigned int sz = (long unsigned int)sb.st_size; if (sz != expectedSize) { - cprintf(RED, "Warning: Existing shared memory %s size does not match.\n", - name.c_str()); -#ifdef VERBOSE - cprintf(RED, " Expected %ld, found %ld\n", expectedSize, sz); -#endif + FILE_LOG(logERROR) << "Existing shared memory " << name << " size does not match"; + FILE_LOG(logDEBUG1) << "Expected " << expectedSize << ", found " << sz; throw SharedMemoryException(); return 1; } diff --git a/slsDetectorSoftware/slsDetector/slsDetector.cpp b/slsDetectorSoftware/slsDetector/slsDetector.cpp index ef3aab5c7..2ca1c7d8e 100644 --- a/slsDetectorSoftware/slsDetector/slsDetector.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetector.cpp @@ -124,7 +124,7 @@ int slsDetector::checkVersionCompatibility(portType t) { setErrorMask((getErrorMask())|(VERSION_COMPATIBILITY)); return FAIL; } - FILE_LOG(logDEBUG5) << "Checking version compatibility with detector with " + FILE_LOG(logDEBUG1) << "Checking version compatibility with detector with " "value " << std::hex << arg << std::dec; @@ -155,7 +155,7 @@ int slsDetector::checkVersionCompatibility(portType t) { else { fnum = F_RECEIVER_CHECK_VERSION; arg = APIRECEIVER; - FILE_LOG(logDEBUG5) << "Checking version compatibility with receiver with " + FILE_LOG(logDEBUG1) << "Checking version compatibility with receiver with " "value " << std::hex << arg << std::dec; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { @@ -188,7 +188,7 @@ int64_t slsDetector::getId( idMode mode) { int arg = (int)mode; int64_t retval = -1; - FILE_LOG(logDEBUG5) << "Getting id type " << mode; + FILE_LOG(logDEBUG1) << "Getting id type " << mode; // client version if (mode == THIS_SOFTWARE_VERSION) { @@ -226,7 +226,7 @@ int64_t slsDetector::getId( idMode mode) { } if (ret != FAIL) { - FILE_LOG(logDEBUG5) << "Id ("<< mode << "): 0x" << std::hex << retval << std::dec; + FILE_LOG(logDEBUG1) << "Id ("<< mode << "): 0x" << std::hex << retval << std::dec; } return retval; @@ -377,7 +377,7 @@ int slsDetector::calculateSharedMemorySize(detectorType type) { sizeof(sls_detector_module) + sizeof(int) * nd + sizeof(int) * nch * nc; - FILE_LOG(logDEBUG5) << "Size of shared memory is " << sz; + FILE_LOG(logDEBUG1) << "Size of shared memory is " << sz; return sz; } @@ -723,16 +723,16 @@ int slsDetector::receiveModule(sls_detector_module* myMod) { ts += controlSocket->ReceiveDataOnly(&(myMod->eV), sizeof(myMod->eV)); ts += controlSocket->ReceiveDataOnly(myMod->dacs,sizeof(int)*(myMod->ndac)); - FILE_LOG(logDEBUG5) << "received dacs of size "<< ts; + FILE_LOG(logDEBUG1) << "received dacs of size "<< ts; ts += controlSocket->ReceiveDataOnly(myMod->adcs,sizeof(int)*(myMod->nadc)); - FILE_LOG(logDEBUG5) << "received adc of size "<< ts; + FILE_LOG(logDEBUG1) << "received adc of size "<< ts; if (thisDetector->myDetectorType == EIGER) { ts += controlSocket->ReceiveDataOnly(myMod->chanregs, sizeof(int)*(myMod->nchan)); - FILE_LOG(logDEBUG5) << "nchans= " << thisDetector->nChans << " nchips= " << thisDetector->nChips + FILE_LOG(logDEBUG1) << "nchans= " << thisDetector->nChans << " nchips= " << thisDetector->nChips << "mod - nchans= " << myMod->nchan << " nchips= " <nchip << "received chans of size "<< ts; } - FILE_LOG(logDEBUG5) << "received module of size "<< ts << " register " << myMod->reg; + FILE_LOG(logDEBUG1) << "received module of size "<< ts << " register " << myMod->reg; return ts; } @@ -781,7 +781,7 @@ slsDetectorDefs::detectorType slsDetector::getDetectorType(const char *name, int return retval; } - FILE_LOG(logDEBUG5) << "Getting detector type "; + FILE_LOG(logDEBUG1) << "Getting detector type "; if (mySocket->Connect() >= 0) { mySocket->SendDataOnly(&fnum,sizeof(fnum)); mySocket->ReceiveDataOnly(&ret,sizeof(ret)); @@ -791,7 +791,7 @@ slsDetectorDefs::detectorType slsDetector::getDetectorType(const char *name, int FILE_LOG(logERROR) << "Cannot connect to server " << name << " over port " << cport; } if (ret != FAIL) { - FILE_LOG(logDEBUG5) << "Detector type is " << retval; + FILE_LOG(logDEBUG1) << "Detector type is " << retval; } delete mySocket; @@ -803,7 +803,7 @@ int slsDetector::setDetectorType(detectorType const type) { int fnum = F_GET_DETECTOR_TYPE; int ret = FAIL; detectorType retval = GENERIC; - FILE_LOG(logDEBUG5) << "Setting detector type to " << type; + FILE_LOG(logDEBUG1) << "Setting detector type to " << type; // if unspecified, then get from detector if (type == GET_DETECTOR_TYPE) { @@ -818,7 +818,7 @@ int slsDetector::setDetectorType(detectorType const type) { thisDetector->myDetectorType = GENERIC; } else { thisDetector->myDetectorType = (detectorType)retval; - FILE_LOG(logDEBUG5) << "Detector Type: " << retval; + FILE_LOG(logDEBUG1) << "Detector Type: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -842,7 +842,7 @@ int slsDetector::setDetectorType(detectorType const type) { FILE_LOG(logERROR) << "Could not send detector type to receiver"; setErrorMask((getErrorMask())|(RECEIVER_DET_HOSTTYPE_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver Type: " << retval; + FILE_LOG(logDEBUG1) << "Receiver Type: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -873,7 +873,7 @@ std::string slsDetector::getDetectorType() { int slsDetector::getTotalNumberOfChannels() { - FILE_LOG(logDEBUG5) << "Get total number of channels"; + FILE_LOG(logDEBUG1) << "Get total number of channels"; if (thisDetector->myDetectorType == JUNGFRAUCTB) { if (thisDetector->roFlags & DIGITAL_ONLY) @@ -896,7 +896,7 @@ int slsDetector::getTotalNumberOfChannels() { * thisDetector->timerValue[SAMPLES_JCTB]; } - FILE_LOG(logDEBUG5) << "Total number of channels: " << + FILE_LOG(logDEBUG1) << "Total number of channels: " << thisDetector->nChans * thisDetector->nChips << ". Data bytes: " << thisDetector->dataBytes; @@ -986,12 +986,12 @@ std::string slsDetector::checkOnline() { delete controlSocket; controlSocket = 0; retval = std::string(thisDetector->hostname); - FILE_LOG(logDEBUG5) << "offline!"; + FILE_LOG(logDEBUG1) << "offline!"; } else { thisDetector->onlineFlag = ONLINE_FLAG; controlSocket->SetTimeOut(100); disconnectControl(); - FILE_LOG(logDEBUG5) << "online!"; + FILE_LOG(logDEBUG1) << "online!"; } } //still cannot connect to socket, stopSocket=0 @@ -1002,12 +1002,12 @@ std::string slsDetector::checkOnline() { delete stopSocket; stopSocket = 0; retval = std::string(thisDetector->hostname); - FILE_LOG(logDEBUG5) << "stop offline!"; + FILE_LOG(logDEBUG1) << "stop offline!"; } else { thisDetector->onlineFlag = ONLINE_FLAG; stopSocket->SetTimeOut(100); disconnectStop(); - FILE_LOG(logDEBUG5) << "stop online!"; + FILE_LOG(logDEBUG1) << "stop online!"; } } return retval; @@ -1023,7 +1023,7 @@ int slsDetector::setTCPSocket(std::string const name, int const control_port, in if (name.empty()) { strcpy(thisName,thisDetector->hostname); } else { - FILE_LOG(logDEBUG5) << "Setting hostname"; + FILE_LOG(logDEBUG1) << "Setting hostname"; strcpy(thisName, name.c_str()); strcpy(thisDetector->hostname, thisName); if (controlSocket) { @@ -1040,7 +1040,7 @@ int slsDetector::setTCPSocket(std::string const name, int const control_port, in if (control_port <= 0) { thisCP = thisDetector->controlPort; } else { - FILE_LOG(logDEBUG5) << "Setting control port"; + FILE_LOG(logDEBUG1) << "Setting control port"; thisCP = control_port; thisDetector->controlPort = thisCP; if (controlSocket) { @@ -1053,7 +1053,7 @@ int slsDetector::setTCPSocket(std::string const name, int const control_port, in if (stop_port <= 0) { thisSP = thisDetector->stopPort; } else { - FILE_LOG(logDEBUG5) << "Setting stop port"; + FILE_LOG(logDEBUG1) << "Setting stop port"; thisSP = stop_port; thisDetector->stopPort = thisSP; if (stopSocket) { @@ -1066,7 +1066,7 @@ int slsDetector::setTCPSocket(std::string const name, int const control_port, in if (!controlSocket) { try { controlSocket = new MySocketTCP(thisName, thisCP); - FILE_LOG(logDEBUG5) << "Control socket connected " << thisName << " " << thisCP; + FILE_LOG(logDEBUG1) << "Control socket connected " << thisName << " " << thisCP; } catch(...) { FILE_LOG(logERROR) << "Could not connect control socket " << thisName << " " << thisCP; controlSocket = 0; @@ -1079,7 +1079,7 @@ int slsDetector::setTCPSocket(std::string const name, int const control_port, in if (!stopSocket) { try { stopSocket = new MySocketTCP(thisName, thisSP); - FILE_LOG(logDEBUG5) << "Stop socket connected " << thisName << " " << thisSP; + FILE_LOG(logDEBUG1) << "Stop socket connected " << thisName << " " << thisSP; } catch(...) { FILE_LOG(logERROR) << "Could not connect Stop socket " << thisName << " " << thisSP; stopSocket = 0; @@ -1090,7 +1090,7 @@ int slsDetector::setTCPSocket(std::string const name, int const control_port, in if (ret == FAIL) { thisDetector->onlineFlag = OFFLINE_FLAG; - FILE_LOG(logDEBUG5) << "Detector offline"; + FILE_LOG(logDEBUG1) << "Detector offline"; } // check online and version compatibility @@ -1132,7 +1132,7 @@ int slsDetector::setPort(portType index, int num) { switch(index) { case CONTROL_PORT: - FILE_LOG(logDEBUG5) << "Setting control port " << " to " << num; + FILE_LOG(logDEBUG1) << "Setting control port " << " to " << num; // same port if (num == thisDetector->controlPort) @@ -1140,7 +1140,7 @@ int slsDetector::setPort(portType index, int num) { // control socket not created if (!controlSocket) { - FILE_LOG(logDEBUG5) << "Control socket not created. " + FILE_LOG(logDEBUG1) << "Control socket not created. " "Connecting to port: " << thisDetector->controlPort; setTCPSocket(); } @@ -1155,7 +1155,7 @@ int slsDetector::setPort(portType index, int num) { setErrorMask((getErrorMask())|(COULDNOT_SET_CONTROL_PORT)); } else { thisDetector->controlPort = retval; - FILE_LOG(logDEBUG5) << "Control port: " << retval; + FILE_LOG(logDEBUG1) << "Control port: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1163,7 +1163,7 @@ int slsDetector::setPort(portType index, int num) { break; case STOP_PORT: - FILE_LOG(logDEBUG5) << "Setting stop port " << " to " << num; + FILE_LOG(logDEBUG1) << "Setting stop port " << " to " << num; // same port if (num == thisDetector->stopPort) @@ -1171,7 +1171,7 @@ int slsDetector::setPort(portType index, int num) { // stop socket not created if (!stopSocket) { - FILE_LOG(logDEBUG5) << "Stop socket not created. " + FILE_LOG(logDEBUG1) << "Stop socket not created. " "Connecting to port: " << thisDetector->stopPort; setTCPSocket(); } @@ -1186,21 +1186,27 @@ int slsDetector::setPort(portType index, int num) { setErrorMask((getErrorMask())|(COULDNOT_SET_STOP_PORT)); } else { thisDetector->stopPort = retval; - FILE_LOG(logDEBUG5) << "Stop port: " << retval; + FILE_LOG(logDEBUG1) << "Stop port: " << retval; } } break; case DATA_PORT: - FILE_LOG(logDEBUG5) << "Setting receiver port " << " to " << num; + FILE_LOG(logDEBUG1) << "Setting receiver port " << " to " << num; // same port if (num == thisDetector->receiverTCPPort) return thisDetector->receiverTCPPort; + // if receiver hostname not given yet + if (!strcmp(thisDetector->receiver_hostname, "none")) { + thisDetector->receiverTCPPort = num; + break; + } + // control socket not created if (!dataSocket) { - FILE_LOG(logDEBUG5) << "Stop socket not created. " + FILE_LOG(logDEBUG1) << "Data socket not created. " "Connecting to port: " << thisDetector->receiverTCPPort;; setReceiverTCPSocket(); } @@ -1215,7 +1221,7 @@ int slsDetector::setPort(portType index, int num) { setErrorMask((getErrorMask())|(COULDNOT_SET_DATA_PORT)); } else { thisDetector->receiverTCPPort = retval; - FILE_LOG(logDEBUG5) << "Receiver port: " << retval; + FILE_LOG(logDEBUG1) << "Receiver port: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -1259,7 +1265,7 @@ int slsDetector::lockServer(int lock) { int fnum = F_LOCK_SERVER; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting detector server lock to " << lock; + FILE_LOG(logDEBUG1) << "Setting detector server lock to " << lock; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &lock, sizeof(lock), &retval, sizeof(retval)); @@ -1269,7 +1275,7 @@ int slsDetector::lockServer(int lock) { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Lock: " << retval; + FILE_LOG(logDEBUG1) << "Lock: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1282,7 +1288,7 @@ std::string slsDetector::getLastClientIP() { int fnum = F_GET_LAST_CLIENT_IP; int ret = FAIL; char retval[INET_ADDRSTRLEN] = {0}; - FILE_LOG(logDEBUG5) << "Getting last client ip to detector server"; + FILE_LOG(logDEBUG1) << "Getting last client ip to detector server"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -1292,7 +1298,7 @@ std::string slsDetector::getLastClientIP() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Last client IP to detector: " << retval; + FILE_LOG(logDEBUG1) << "Last client IP to detector: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1305,7 +1311,7 @@ std::string slsDetector::getLastClientIP() { int slsDetector::exitServer() { int fnum = F_EXIT_SERVER; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Sending exit command to detector server"; + FILE_LOG(logDEBUG1) << "Sending exit command to detector server"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, NULL, 0); @@ -1323,7 +1329,7 @@ int slsDetector::execCommand(std::string cmd) { char arg[MAX_STR_LENGTH] = {0}; char retval[MAX_STR_LENGTH] = {0}; strcpy(arg, cmd.c_str()); - FILE_LOG(logDEBUG5) << "Sending command to detector " << arg; + FILE_LOG(logDEBUG1) << "Sending command to detector " << arg; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, @@ -1348,7 +1354,7 @@ int slsDetector::updateDetectorNoWait() { char lastClientIP[INET_ADDRSTRLEN] = {0}; n += controlSocket->ReceiveDataOnly(lastClientIP, sizeof(lastClientIP)); - FILE_LOG(logDEBUG5) << "Updating detector last modified by " << lastClientIP; + FILE_LOG(logDEBUG1) << "Updating detector last modified by " << lastClientIP; n += controlSocket->ReceiveDataOnly(&i32, sizeof(i32)); thisDetector->dynamicRange = i32; @@ -1417,7 +1423,7 @@ int slsDetector::updateDetectorNoWait() { int slsDetector::updateDetector() { int fnum = F_UPDATE_CLIENT; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Sending update client to detector server"; + FILE_LOG(logDEBUG1) << "Sending update client to detector server"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, NULL, 0); @@ -1450,7 +1456,7 @@ int slsDetector::writeConfigurationFile(std::string const fname, multiSlsDetecto int slsDetector::writeConfigurationFile(std::ofstream &outfile, multiSlsDetector* m) { - FILE_LOG(logDEBUG5) << "Write configuration file"; + FILE_LOG(logDEBUG1) << "Write configuration file"; std::vector names; // common config @@ -1532,7 +1538,7 @@ slsDetectorDefs::detectorSettings slsDetector::getSettings() { slsDetectorDefs::detectorSettings slsDetector::setSettings( detectorSettings isettings) { - FILE_LOG(logDEBUG5) << "slsDetector setSettings " << isettings; + FILE_LOG(logDEBUG1) << "slsDetector setSettings " << isettings; if (isettings == -1) return getSettings(); @@ -1565,7 +1571,7 @@ slsDetectorDefs::detectorSettings slsDetector::sendSettingsOnly(detectorSettings int ret = FAIL; int arg = (int)isettings; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting settings to " << arg; + FILE_LOG(logDEBUG1) << "Setting settings to " << arg; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -1575,7 +1581,7 @@ slsDetectorDefs::detectorSettings slsDetector::sendSettingsOnly(detectorSettings if (ret == FAIL) { setErrorMask((getErrorMask())|(SETTINGS_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Settings: " << retval; + FILE_LOG(logDEBUG1) << "Settings: " << retval; thisDetector->currentSettings = (detectorSettings)retval; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -1590,7 +1596,7 @@ int slsDetector::getThresholdEnergy() { int fnum = F_GET_THRESHOLD_ENERGY; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Getting threshold energy"; + FILE_LOG(logDEBUG1) << "Getting threshold energy"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -1600,7 +1606,7 @@ int slsDetector::getThresholdEnergy() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Threshold: " << retval; + FILE_LOG(logDEBUG1) << "Threshold: " << retval; thisDetector->currentThresholdEV = retval; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -1685,7 +1691,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti ostfn << thisDetector->settingsDir << ssettings << "/" << e_eV << "eV" << "/noise.sn" << std::setfill('0') << std::setw(3) << std::dec << getId(DETECTOR_SERIAL_NUMBER) << std::setbase(10); std::string settingsfname = ostfn.str(); - FILE_LOG(logDEBUG5) << "Settings File is " << settingsfname; + FILE_LOG(logDEBUG1) << "Settings File is " << settingsfname; //read the files myMod = createModule(); // readSettings also checks if create module is null @@ -1720,7 +1726,7 @@ int slsDetector::setThresholdEnergyAndSettings(int e_eV, detectorSettings isetti getId(DETECTOR_SERIAL_NUMBER) << std::setbase(10); std::string settingsfname2 = ostfn.str(); //read the files - FILE_LOG(logDEBUG5) << "Settings Files are " << settingsfname1 << " and " << settingsfname2; + FILE_LOG(logDEBUG1) << "Settings Files are " << settingsfname1 << " and " << settingsfname2; sls_detector_module *myMod1=createModule(); sls_detector_module *myMod2=createModule(); if (NULL == readSettingsFile(settingsfname1, myMod1, tb)) { @@ -1844,7 +1850,7 @@ slsDetectorDefs::runStatus slsDetector::getRunStatus() { int fnum = F_GET_RUN_STATUS; int ret = FAIL; runStatus retval = ERROR; - FILE_LOG(logDEBUG5) << "Getting status"; + FILE_LOG(logDEBUG1) << "Getting status"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectStop() == OK) { ret = thisDetectorStop->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -1854,7 +1860,7 @@ slsDetectorDefs::runStatus slsDetector::getRunStatus() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Detector status: " << runStatusType(retval); + FILE_LOG(logDEBUG1) << "Detector status: " << runStatusType(retval); if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1866,7 +1872,7 @@ slsDetectorDefs::runStatus slsDetector::getRunStatus() { int slsDetector::prepareAcquisition() { int fnum = F_PREPARE_ACQUISITION; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Preparing Detector for Acquisition"; + FILE_LOG(logDEBUG1) << "Preparing Detector for Acquisition"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, NULL, 0); @@ -1876,7 +1882,7 @@ int slsDetector::prepareAcquisition() { if (ret == FAIL) { setErrorMask((getErrorMask())|(PREPARE_ACQUISITION)); } else { - FILE_LOG(logDEBUG5) << "Prepare Acquisition successful"; + FILE_LOG(logDEBUG1) << "Prepare Acquisition successful"; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1891,7 +1897,7 @@ int slsDetector::prepareAcquisition() { int slsDetector::startAcquisition() { int fnum = F_START_ACQUISITION; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Starting Acquisition"; + FILE_LOG(logDEBUG1) << "Starting Acquisition"; thisDetector->stoppedFlag = 0; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -1902,7 +1908,7 @@ int slsDetector::startAcquisition() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Starting Acquisition successful"; + FILE_LOG(logDEBUG1) << "Starting Acquisition successful"; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1921,7 +1927,7 @@ int slsDetector::stopAcquisition() { int fnum = F_STOP_ACQUISITION; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Stopping Acquisition"; + FILE_LOG(logDEBUG1) << "Stopping Acquisition"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectStop() == OK) { ret = thisDetectorStop->Client_Send(fnum, NULL, 0, NULL, 0); @@ -1931,7 +1937,7 @@ int slsDetector::stopAcquisition() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Stopping Acquisition successful"; + FILE_LOG(logDEBUG1) << "Stopping Acquisition successful"; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1949,7 +1955,7 @@ int slsDetector::stopAcquisition() { int slsDetector::sendSoftwareTrigger() { int fnum = F_SOFTWARE_TRIGGER; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Sending software trigger"; + FILE_LOG(logDEBUG1) << "Sending software trigger"; thisDetector->stoppedFlag = 0; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -1960,7 +1966,7 @@ int slsDetector::sendSoftwareTrigger() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Sending software trigger successful"; + FILE_LOG(logDEBUG1) << "Sending software trigger successful"; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1972,7 +1978,7 @@ int slsDetector::sendSoftwareTrigger() { int slsDetector::startAndReadAll() { int fnum = F_START_AND_READ_ALL; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Starting and reading all frames"; + FILE_LOG(logDEBUG1) << "Starting and reading all frames"; thisDetector->stoppedFlag = 0; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -1984,7 +1990,7 @@ int slsDetector::startAndReadAll() { thisDetector->stoppedFlag = 1; setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Detector successfully finished acquisition"; + FILE_LOG(logDEBUG1) << "Detector successfully finished acquisition"; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -1996,7 +2002,7 @@ int slsDetector::startAndReadAll() { int slsDetector::startReadOut() { int fnum = F_START_READOUT; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Starting readout"; + FILE_LOG(logDEBUG1) << "Starting readout"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, NULL, 0); @@ -2006,7 +2012,7 @@ int slsDetector::startReadOut() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Starting detector readout successful"; + FILE_LOG(logDEBUG1) << "Starting detector readout successful"; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -2018,7 +2024,7 @@ int slsDetector::startReadOut() { int slsDetector::readAll() { int fnum = F_READ_ALL; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Reading all frames"; + FILE_LOG(logDEBUG1) << "Reading all frames"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, NULL, 0); @@ -2029,7 +2035,7 @@ int slsDetector::readAll() { thisDetector->stoppedFlag = 1; setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Detector successfully finished reading all frames"; + FILE_LOG(logDEBUG1) << "Detector successfully finished reading all frames"; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -2045,7 +2051,7 @@ int slsDetector::configureMAC() { memset(args, 0, sizeof(args)); char retvals[3][50]; memset(retvals, 0, sizeof(retvals)); - FILE_LOG(logDEBUG5) << "Configuring MAC"; + FILE_LOG(logDEBUG1) << "Configuring MAC"; // if rx_udpip is none @@ -2075,7 +2081,7 @@ int slsDetector::configureMAC() { setErrorMask((getErrorMask())|(COULD_NOT_CONFIGURE_MAC)); return FAIL; } - FILE_LOG(logDEBUG5) << "rx_hostname and rx_udpip is valid "; + FILE_LOG(logDEBUG1) << "rx_hostname and rx_udpip is valid "; // copy to args strcpy(args[0],thisDetector->receiverUDPIP); @@ -2093,7 +2099,7 @@ int slsDetector::configureMAC() { // col for horiz. udp ports pos[1] = (detId / max) * ((thisDetector->myDetectorType == EIGER) ? 2 : 1); // pos[2] (z is reserved) - FILE_LOG(logDEBUG5) << "Detector [" << detId << "] - (" + FILE_LOG(logDEBUG1) << "Detector [" << detId << "] - (" << pos[0] << "," << pos[1] << ")"; sprintf(args[6], "%x", pos[0]); sprintf(args[7], "%x", pos[1]); @@ -2110,7 +2116,7 @@ int slsDetector::configureMAC() { } bzero(args[0], 50); strcpy(args[0],cword); - FILE_LOG(logDEBUG5) << "receiver udp ip:" << args[0] << "-"; + FILE_LOG(logDEBUG1) << "receiver udp ip:" << args[0] << "-"; } { //converting MACaddress to std::hex @@ -2123,9 +2129,9 @@ int slsDetector::configureMAC() { } bzero(args[1], 50); strcpy(args[1],cword); - FILE_LOG(logDEBUG5) << "receiver udp mac:" << args[1] << "-"; + FILE_LOG(logDEBUG1) << "receiver udp mac:" << args[1] << "-"; } - FILE_LOG(logDEBUG5) << "receiver udp port:" << args[2] << "-"; + FILE_LOG(logDEBUG1) << "receiver udp port:" << args[2] << "-"; { std::stringstream ss(args[3]); char cword[50]=""; @@ -2136,7 +2142,7 @@ int slsDetector::configureMAC() { } bzero(args[3], 50); strcpy(args[3],cword); - FILE_LOG(logDEBUG5) << "detecotor udp mac:" << args[3] << "-"; + FILE_LOG(logDEBUG1) << "detecotor udp mac:" << args[3] << "-"; } { //converting IPaddress to std::hex @@ -2149,12 +2155,12 @@ int slsDetector::configureMAC() { } bzero(args[4], 50); strcpy(args[4],cword); - FILE_LOG(logDEBUG5) << "detecotor udp ip:" << args[4] << "-"; + FILE_LOG(logDEBUG1) << "detecotor udp ip:" << args[4] << "-"; } - FILE_LOG(logDEBUG5) << "receiver udp port2:" << args[5] << "-"; - FILE_LOG(logDEBUG5) << "row:" << args[6] << "-"; - FILE_LOG(logDEBUG5) << "col:" << args[7] << "-"; - FILE_LOG(logDEBUG5) << "reserved:" << args[8] << "-"; + FILE_LOG(logDEBUG1) << "receiver udp port2:" << args[5] << "-"; + FILE_LOG(logDEBUG1) << "row:" << args[6] << "-"; + FILE_LOG(logDEBUG1) << "col:" << args[7] << "-"; + FILE_LOG(logDEBUG1) << "reserved:" << args[8] << "-"; // send to server @@ -2209,13 +2215,13 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) { int ret = FAIL; int64_t args[2] = {(int64_t)index, t}; int64_t retval = -1; - FILE_LOG(logDEBUG5) << "Setting " << getTimerType(index) << " to " << t << " ns/value"; + FILE_LOG(logDEBUG1) << "Setting " << getTimerType(index) << " to " << t << " ns/value"; // meausurement is only shm level if (index == MEASUREMENTS_NUMBER) { if (t >= 0) { thisDetector->timerValue[index] = t; - FILE_LOG(logDEBUG5) << getTimerType(index) << ": " << t; + FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << t; } return thisDetector->timerValue[index]; } @@ -2230,7 +2236,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) { if (ret == FAIL) { setErrorMask((getErrorMask())|(DETECTOR_TIMER_VALUE_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << getTimerType(index) << ": " << retval; + FILE_LOG(logDEBUG1) << getTimerType(index) << ": " << retval; thisDetector->timerValue[index] = retval; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -2284,7 +2290,7 @@ int64_t slsDetector::setTimer(timerIndex index, int64_t t) { ((thisDetector->timerValue[STORAGE_CELL_NUMBER] > 0) ? (thisDetector->timerValue[STORAGE_CELL_NUMBER])+1 : 1); } - FILE_LOG(logDEBUG5) << "Sending " << + FILE_LOG(logDEBUG1) << "Sending " << (((index == FRAME_NUMBER) || (index == CYCLES_NUMBER) || (index == STORAGE_CELL_NUMBER)) ? @@ -2337,7 +2343,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index) { int fnum = F_GET_TIME_LEFT; int ret = FAIL; int64_t retval = -1; - FILE_LOG(logDEBUG5) << "Getting " << getTimerType(index) << " left"; + FILE_LOG(logDEBUG1) << "Getting " << getTimerType(index) << " left"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectStop() == OK) { @@ -2348,7 +2354,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index) { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << getTimerType(index) << " left: " << retval; + FILE_LOG(logDEBUG1) << getTimerType(index) << " left: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -2361,7 +2367,7 @@ int slsDetector::setSpeed(speedVariable sp, int value) { int fnum = F_SET_SPEED; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting speed index " << sp << " to " << value; + FILE_LOG(logDEBUG1) << "Setting speed index " << sp << " to " << value; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &value, sizeof(value), &retval, sizeof(retval)); @@ -2371,7 +2377,7 @@ int slsDetector::setSpeed(speedVariable sp, int value) { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULD_NOT_SET_SPEED_PARAMETERS)); } else { - FILE_LOG(logDEBUG5) << "Speed index " << sp << ": " << retval; + FILE_LOG(logDEBUG1) << "Speed index " << sp << ": " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -2384,7 +2390,7 @@ int slsDetector::setDynamicRange(int n) { int fnum = F_SET_DYNAMIC_RANGE; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting dynamic range to " << n; + FILE_LOG(logDEBUG1) << "Setting dynamic range to " << n; // send to detector int olddr = thisDetector->dynamicRange; @@ -2410,7 +2416,7 @@ int slsDetector::setDynamicRange(int n) { } // ret might be set to OK above if (ret != FAIL) { - FILE_LOG(logDEBUG5) << "Dynamic Range: " << retval; + FILE_LOG(logDEBUG1) << "Dynamic Range: " << retval; thisDetector->dynamicRange = retval; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -2429,8 +2435,8 @@ int slsDetector::setDynamicRange(int n) { retval / 8; if (thisDetector->myDetectorType == JUNGFRAUCTB) getTotalNumberOfChannels(); - FILE_LOG(logDEBUG5) << "Data bytes " << thisDetector->dataBytes; - FILE_LOG(logDEBUG5) << "Data bytes including gap pixels" << thisDetector->dataBytesInclGapPixels; + FILE_LOG(logDEBUG1) << "Data bytes " << thisDetector->dataBytes; + FILE_LOG(logDEBUG1) << "Data bytes including gap pixels" << thisDetector->dataBytesInclGapPixels; } // send to receiver @@ -2448,7 +2454,7 @@ int slsDetector::setDynamicRange(int n) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_DYNAMIC_RANGE)); } else { - FILE_LOG(logDEBUG5) << "Receiver Dynamic range: " << retval; + FILE_LOG(logDEBUG1) << "Receiver Dynamic range: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -2476,7 +2482,7 @@ int slsDetector::setDAC(int val, dacIndex index, int mV) { int ret = FAIL; int args[3] = {(int)index, mV, val}; int retvals[2] = {-1, -1}; - FILE_LOG(logDEBUG5) << "Setting DAC " << index << " to " << val << (mV ? "mV" : "dac units"); + FILE_LOG(logDEBUG1) << "Setting DAC " << index << " to " << val << (mV ? "mV" : "dac units"); if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), retvals, sizeof(retvals)); @@ -2486,7 +2492,7 @@ int slsDetector::setDAC(int val, dacIndex index, int mV) { if (ret == FAIL) setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); else { - FILE_LOG(logDEBUG5) << "Dac index " << index << ": " + FILE_LOG(logDEBUG1) << "Dac index " << index << ": " << retvals[0] << " dac units (" << retvals[1] << "mV)"; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -2503,7 +2509,7 @@ int slsDetector::getADC(dacIndex index) { int ret = FAIL; int arg = (int)index; int retval = -1; - FILE_LOG(logDEBUG5) << "Getting ADC " << index; + FILE_LOG(logDEBUG1) << "Getting ADC " << index; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -2513,7 +2519,7 @@ int slsDetector::getADC(dacIndex index) { if (ret == FAIL) setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); else - FILE_LOG(logDEBUG5) << "ADC (" << index << "): " << retval; + FILE_LOG(logDEBUG1) << "ADC (" << index << "): " << retval; /*commented out to allow adc read during acquire else if (ret == FORCE_UPDATE) updateDetector();*/ @@ -2528,7 +2534,7 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication int ret = FAIL; int arg = (int)pol; externalCommunicationMode retval = GET_EXTERNAL_COMMUNICATION_MODE; - FILE_LOG(logDEBUG5) << "Setting communication to mode " << pol; + FILE_LOG(logDEBUG1) << "Setting communication to mode " << pol; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -2538,7 +2544,7 @@ slsDetectorDefs::externalCommunicationMode slsDetector::setExternalCommunication if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Timing Mode: " << retval; + FILE_LOG(logDEBUG1) << "Timing Mode: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -2553,7 +2559,7 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags( int ret = FAIL; int args[2] = {signalindex, pol}; externalSignalFlag retval = GET_EXTERNAL_SIGNAL_FLAG; - FILE_LOG(logDEBUG5) << "Setting signal " << signalindex << " to flag " << pol; + FILE_LOG(logDEBUG1) << "Setting signal " << signalindex << " to flag " << pol; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval)); @@ -2563,7 +2569,7 @@ slsDetectorDefs::externalSignalFlag slsDetector::setExternalSignalFlags( if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Ext Signal (" << signalindex << "): " << retval; + FILE_LOG(logDEBUG1) << "Ext Signal (" << signalindex << "): " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -2577,7 +2583,7 @@ int slsDetector::setReadOutFlags(readOutFlags flag) { int ret = FAIL; int arg = (int)flag; readOutFlags retval = GET_READOUT_FLAGS; - FILE_LOG(logDEBUG5) << "Setting readout flags to " << flag; + FILE_LOG(logDEBUG1) << "Setting readout flags to " << flag; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -2587,11 +2593,8 @@ int slsDetector::setReadOutFlags(readOutFlags flag) { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULD_NOT_SET_READOUT_FLAGS)); } else { - FILE_LOG(logDEBUG5) << "Readout flag: " << retval; + FILE_LOG(logDEBUG1) << "Readout flag: " << retval; thisDetector->roFlags = (readOutFlags)retval; - if (thisDetector->myDetectorType == JUNGFRAUCTB) { - getTotalNumberOfChannels(); - } if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -2605,7 +2608,7 @@ uint32_t slsDetector::writeRegister(uint32_t addr, uint32_t val) { int ret = FAIL; uint32_t args[2] = {addr, val}; uint32_t retval = -1; - FILE_LOG(logDEBUG5) << "Writing to register 0x" << std::hex << + FILE_LOG(logDEBUG1) << "Writing to register 0x" << std::hex << addr << "data: 0x" << std::hex << val << std::dec; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -2616,7 +2619,7 @@ uint32_t slsDetector::writeRegister(uint32_t addr, uint32_t val) { if (ret == FAIL) setErrorMask((getErrorMask())|(REGISER_WRITE_READ)); else { - FILE_LOG(logDEBUG5) << "Register 0x" << + FILE_LOG(logDEBUG1) << "Register 0x" << std::hex << addr << ": 0x" << std::hex << retval << std::dec; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -2631,7 +2634,7 @@ uint32_t slsDetector::readRegister(uint32_t addr) { int ret = FAIL; uint32_t arg = -1; uint32_t retval = -1; - FILE_LOG(logDEBUG5) << "Reading register 0x" << std::hex << addr << std::dec; + FILE_LOG(logDEBUG1) << "Reading register 0x" << std::hex << addr << std::dec; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -2641,7 +2644,7 @@ uint32_t slsDetector::readRegister(uint32_t addr) { if (ret == FAIL) setErrorMask((getErrorMask())|(REGISER_WRITE_READ)); else { - FILE_LOG(logDEBUG5) << "Register 0x" << + FILE_LOG(logDEBUG1) << "Register 0x" << std::hex << addr << ": 0x" << std::hex << retval << std::dec; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -2842,7 +2845,7 @@ std::string slsDetector::getReceiverRealUDPSocketBufferSize() { int fnum = F_RECEIVER_REAL_UDP_SOCK_BUF_SIZE; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Getting real UDP Socket Buffer size to receiver"; + FILE_LOG(logDEBUG1) << "Getting real UDP Socket Buffer size to receiver"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -2852,7 +2855,7 @@ std::string slsDetector::getReceiverRealUDPSocketBufferSize() { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER)); } else { - FILE_LOG(logDEBUG5) << "Real Receiver UDP Socket Buffer size: " << retval; + FILE_LOG(logDEBUG1) << "Real Receiver UDP Socket Buffer size: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -2874,7 +2877,7 @@ std::string slsDetector::setDetectorMAC(std::string detectorMAC) { else { strcpy(thisDetector->detectorMAC, detectorMAC.c_str()); if (!strcmp(thisDetector->receiver_hostname, "none")) { - FILE_LOG(logDEBUG5) << "Receiver hostname not set yet"; + FILE_LOG(logDEBUG1) << "Receiver hostname not set yet"; } else if (setUDPConnection() == FAIL) { FILE_LOG(logWARNING) << "UDP connection set up failed"; } @@ -2897,7 +2900,7 @@ std::string slsDetector::setDetectorIP(std::string detectorIP) { else { strcpy(thisDetector->detectorIP, detectorIP.c_str()); if (!strcmp(thisDetector->receiver_hostname, "none")) { - FILE_LOG(logDEBUG5) << "Receiver hostname not set yet"; + FILE_LOG(logDEBUG1) << "Receiver hostname not set yet"; } else if (setUDPConnection() == FAIL) { FILE_LOG(logWARNING) << "UDP connection set up failed"; } @@ -2908,7 +2911,7 @@ std::string slsDetector::setDetectorIP(std::string detectorIP) { std::string slsDetector::setReceiver(std::string receiverIP) { - FILE_LOG(logDEBUG5) << "Setting up Receiver with " << receiverIP; + FILE_LOG(logDEBUG1) << "Setting up Receiver with " << receiverIP; // recieverIP is none if (receiverIP == "none") { memset(thisDetector->receiver_hostname, 0, MAX_STR_LENGTH); @@ -2928,7 +2931,7 @@ std::string slsDetector::setReceiver(std::string receiverIP) { strcpy(thisDetector->receiver_hostname, receiverIP.c_str()); if (setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG) { - FILE_LOG(logDEBUG5) << + FILE_LOG(logDEBUG1) << "detector type:" << (slsDetectorDefs::getDetectorType(thisDetector->myDetectorType)) << "\ndetector id:" << detId << "\ndetector hostname:" << thisDetector->hostname << @@ -3023,7 +3026,7 @@ std::string slsDetector::setReceiverUDPIP(std::string udpip) { else { strcpy(thisDetector->receiverUDPIP,udpip.c_str()); if (!strcmp(thisDetector->receiver_hostname, "none")) { - FILE_LOG(logDEBUG5) << "Receiver hostname not set yet"; + FILE_LOG(logDEBUG1) << "Receiver hostname not set yet"; } else if (setUDPConnection() == FAIL) { FILE_LOG(logWARNING) << "UDP connection set up failed"; } @@ -3045,7 +3048,7 @@ std::string slsDetector::setReceiverUDPMAC(std::string udpmac) { else { strcpy(thisDetector->receiverUDPMAC, udpmac.c_str()); if (!strcmp(thisDetector->receiver_hostname, "none")) { - FILE_LOG(logDEBUG5) << "Receiver hostname not set yet"; + FILE_LOG(logDEBUG1) << "Receiver hostname not set yet"; } // not doing setUDPConnection as rx_udpmac will get replaced,(must use configuremac) strcpy(thisDetector->receiverUDPMAC,udpmac.c_str()); @@ -3057,7 +3060,7 @@ std::string slsDetector::setReceiverUDPMAC(std::string udpmac) { int slsDetector::setReceiverUDPPort(int udpport) { thisDetector->receiverUDPPort = udpport; if (!strcmp(thisDetector->receiver_hostname, "none")) { - FILE_LOG(logDEBUG5) << "Receiver hostname not set yet"; + FILE_LOG(logDEBUG1) << "Receiver hostname not set yet"; } else if (setUDPConnection() == FAIL) { FILE_LOG(logWARNING) << "UDP connection set up failed"; @@ -3069,7 +3072,7 @@ int slsDetector::setReceiverUDPPort(int udpport) { int slsDetector::setReceiverUDPPort2(int udpport) { thisDetector->receiverUDPPort2 = udpport; if (!strcmp(thisDetector->receiver_hostname, "none")) { - FILE_LOG(logDEBUG5) << "Receiver hostname not set yet"; + FILE_LOG(logDEBUG1) << "Receiver hostname not set yet"; } else if (setUDPConnection() == FAIL) { FILE_LOG(logWARNING) << "UDP connection set up failed"; @@ -3092,7 +3095,7 @@ std::string slsDetector::setReceiverStreamingPort(std::string port) { int ret = FAIL; int arg = thisDetector->receiver_zmqport; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending receiver streaming port to receiver " << arg; + FILE_LOG(logDEBUG1) << "Sending receiver streaming port to receiver " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3102,7 +3105,7 @@ std::string slsDetector::setReceiverStreamingPort(std::string port) { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER)); } else { - FILE_LOG(logDEBUG5) << "Receiver streaming port: " << retval; + FILE_LOG(logDEBUG1) << "Receiver streaming port: " << retval; thisDetector->receiver_zmqport = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -3132,7 +3135,7 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) { int ret = FAIL; char args[MAX_STR_LENGTH] = {0}; char retvals[MAX_STR_LENGTH] = {0}; - FILE_LOG(logDEBUG5) << "Sending receiver streaming IP to receiver " << sourceIP; + FILE_LOG(logDEBUG1) << "Sending receiver streaming IP to receiver " << sourceIP; // if empty, give rx_hostname if (sourceIP.empty()) { @@ -3163,7 +3166,7 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) { // if zmqip is empty, update it if (! strlen(thisDetector->zmqip)) strcpy(thisDetector->zmqip, args); - FILE_LOG(logDEBUG5) << "Sending receiver streaming IP to receiver " << args; + FILE_LOG(logDEBUG1) << "Sending receiver streaming IP to receiver " << args; // send to receiver if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { @@ -3174,7 +3177,7 @@ std::string slsDetector::setReceiverStreamingIP(std::string sourceIP) { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER)); } else { - FILE_LOG(logDEBUG5) << "Receiver streaming port: " << retvals; + FILE_LOG(logDEBUG1) << "Receiver streaming port: " << retvals; memset(thisDetector->receiver_zmqip, 0, MAX_STR_LENGTH); strcpy(thisDetector->receiver_zmqip, retvals); if (ret == FORCE_UPDATE) @@ -3191,7 +3194,7 @@ std::string slsDetector::setAdditionalJsonHeader(std::string jsonheader) { char args[MAX_STR_LENGTH] = {0}; char retvals[MAX_STR_LENGTH] = {0}; strcpy(args, jsonheader.c_str()); - FILE_LOG(logDEBUG5) << "Sending additional json header " << args; + FILE_LOG(logDEBUG1) << "Sending additional json header " << args; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, args, sizeof(args), retvals, sizeof(retvals)); @@ -3201,7 +3204,7 @@ std::string slsDetector::setAdditionalJsonHeader(std::string jsonheader) { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER)); } else { - FILE_LOG(logDEBUG5) << "Additional json header: " << retvals; + FILE_LOG(logDEBUG1) << "Additional json header: " << retvals; memset(thisDetector->receiver_additionalJsonHeader, 0, MAX_STR_LENGTH); strcpy(thisDetector->receiver_additionalJsonHeader, retvals); if (ret == FORCE_UPDATE) @@ -3217,7 +3220,7 @@ std::string slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) { int ret = FAIL; int arg = udpsockbufsize; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending UDP Socket Buffer size to receiver " << arg; + FILE_LOG(logDEBUG1) << "Sending UDP Socket Buffer size to receiver " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3227,7 +3230,7 @@ std::string slsDetector::setReceiverUDPSocketBufferSize(int udpsockbufsize) { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULDNOT_SET_NETWORK_PARAMETER)); } else { - FILE_LOG(logDEBUG5) << "Receiver UDP Socket Buffer size: " << retval; + FILE_LOG(logDEBUG1) << "Receiver UDP Socket Buffer size: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -3241,7 +3244,7 @@ std::string slsDetector::setDetectorNetworkParameter(networkParameter index, int int ret = FAIL; int args[2] = {(int)index, delay}; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting network parameter index " << index << " to " << delay; + FILE_LOG(logDEBUG1) << "Setting network parameter index " << index << " to " << delay; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval)); @@ -3251,7 +3254,7 @@ std::string slsDetector::setDetectorNetworkParameter(networkParameter index, int if (ret == FAIL) { setErrorMask((getErrorMask())|(DETECTOR_NETWORK_PARAMETER)); } else { - FILE_LOG(logDEBUG5) << "Network Parameter (" << index << "): " << retval; + FILE_LOG(logDEBUG1) << "Network Parameter (" << index << "): " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -3265,11 +3268,11 @@ int slsDetector::setUDPConnection() { int ret = FAIL; char args[3][MAX_STR_LENGTH] = {0}; char retvals[MAX_STR_LENGTH] = {0}; - FILE_LOG(logDEBUG5) << "Setting UDP Connection"; + FILE_LOG(logDEBUG1) << "Setting UDP Connection"; // called before set up if (!strcmp(thisDetector->receiver_hostname, "none")) { - FILE_LOG(logDEBUG5) << "Receiver hostname not set yet."; + FILE_LOG(logDEBUG1) << "Receiver hostname not set yet."; return FAIL; } // if no udp ip given, use hostname @@ -3296,19 +3299,19 @@ int slsDetector::setUDPConnection() { strcpy(args[0],thisDetector->receiverUDPIP); sprintf(args[1],"%d",thisDetector->receiverUDPPort); sprintf(args[2],"%d",thisDetector->receiverUDPPort2); - FILE_LOG(logDEBUG5) << "Receiver udp ip address: " << thisDetector->receiverUDPIP; - FILE_LOG(logDEBUG5) << "Receiver udp port: " << thisDetector->receiverUDPPort; - FILE_LOG(logDEBUG5) << "Receiver udp port2: " << thisDetector->receiverUDPPort2; + FILE_LOG(logDEBUG1) << "Receiver udp ip address: " << thisDetector->receiverUDPIP; + FILE_LOG(logDEBUG1) << "Receiver udp port: " << thisDetector->receiverUDPPort; + FILE_LOG(logDEBUG1) << "Receiver udp port2: " << thisDetector->receiverUDPPort2; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, args, sizeof(args), retvals, sizeof(retvals)); - disconnectControl(); + disconnectData(); // handle ret if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Receiver UDP MAC returned : " << retvals; + FILE_LOG(logDEBUG1) << "Receiver UDP MAC returned : " << retvals; memset(thisDetector->receiverUDPMAC, 0, MAX_STR_LENGTH); strcpy(thisDetector->receiverUDPMAC, retvals); if (ret == FORCE_UPDATE) @@ -3320,7 +3323,7 @@ int slsDetector::setUDPConnection() { } } } - printReceiverConfiguration(logDEBUG5); + printReceiverConfiguration(logDEBUG1); return ret; } @@ -3330,7 +3333,7 @@ int slsDetector::digitalTest( digitalTestMode mode, int ival) { int ret = FAIL; int args[2] = {(int)mode, ival}; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending digital test of mode " << mode << ", ival " << ival; + FILE_LOG(logDEBUG1) << "Sending digital test of mode " << mode << ", ival " << ival; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval)); @@ -3340,7 +3343,7 @@ int slsDetector::digitalTest( digitalTestMode mode, int ival) { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Digital Test returned: " << retval; + FILE_LOG(logDEBUG1) << "Digital Test returned: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -3352,7 +3355,7 @@ int slsDetector::digitalTest( digitalTestMode mode, int ival) { int slsDetector::loadImageToDetector(imageType index,std::string const fname) { int ret = FAIL; short int args[thisDetector->nChans * thisDetector->nChips]; - FILE_LOG(logDEBUG5) << "Loading " << (!index ? "Dark" : "Gain") << "image from file " << fname; + FILE_LOG(logDEBUG1) << "Loading " << (!index ? "Dark" : "Gain") << "image from file " << fname; if (readDataFile(fname, args, getTotalNumberOfChannels())) { ret = sendImageToDetector(index,args); @@ -3368,7 +3371,7 @@ int slsDetector::loadImageToDetector(imageType index,std::string const fname) { int slsDetector::sendImageToDetector(imageType index,short int imageVals[]) { int fnum = F_LOAD_IMAGE; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Sending image to detector"; + FILE_LOG(logDEBUG1) << "Sending image to detector"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, @@ -3388,7 +3391,7 @@ int slsDetector::sendImageToDetector(imageType index,short int imageVals[]) { int slsDetector::writeCounterBlockFile(std::string const fname,int startACQ) { int ret = FAIL; short int retvals[thisDetector->nChans * thisDetector->nChips]; - FILE_LOG(logDEBUG5) << "Reading Counter to " << fname << + FILE_LOG(logDEBUG1) << "Reading Counter to " << fname << (startACQ ? " and Restarting Acquisition" : "\n"); ret = getCounterBlock(retvals, startACQ); @@ -3404,7 +3407,7 @@ int slsDetector::getCounterBlock(short int image[],int startACQ) { int fnum = F_READ_COUNTER_BLOCK; int ret = FAIL; int arg = startACQ; - FILE_LOG(logDEBUG5) << "Reading Counter block with startacq: " << startACQ; + FILE_LOG(logDEBUG1) << "Reading Counter block with startacq: " << startACQ; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, @@ -3425,7 +3428,7 @@ int slsDetector::resetCounterBlock(int startACQ) { int fnum = F_RESET_COUNTER_BLOCK; int ret = FAIL; int arg = startACQ; - FILE_LOG(logDEBUG5) << "Resetting Counter with startacq: " << startACQ; + FILE_LOG(logDEBUG1) << "Resetting Counter with startacq: " << startACQ; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), NULL, 0); @@ -3446,7 +3449,7 @@ int slsDetector::setCounterBit(int i) { int ret = FAIL; int arg = i; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending counter bit " << arg; + FILE_LOG(logDEBUG1) << "Sending counter bit " << arg; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3456,7 +3459,7 @@ int slsDetector::setCounterBit(int i) { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULD_NOT_SET_COUNTER_BIT)); } else { - FILE_LOG(logDEBUG5) << "Counter bit: " << retval; + FILE_LOG(logDEBUG1) << "Counter bit: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -3515,7 +3518,7 @@ int slsDetector::sendROI(int n, ROI roiLimits[]) { ROI* arg = (roiLimits != NULL) ? roiLimits : thisDetector->roiLimits; int nretval = 0; ROI retval[MAX_ROIS]; - FILE_LOG(logDEBUG5) << "Sending ROI to detector" << narg; + FILE_LOG(logDEBUG1) << "Sending ROI to detector" << narg; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { controlSocket->SendDataOnly(&fnum, sizeof(fnum)); @@ -3546,10 +3549,10 @@ int slsDetector::sendROI(int n, ROI roiLimits[]) { nrec += controlSocket->ReceiveDataOnly(&retval[i].ymax, sizeof(int)); } thisDetector->nROI = nretval; - FILE_LOG(logDEBUG5) << "nRoi: " << nretval; + FILE_LOG(logDEBUG1) << "nRoi: " << nretval; for (int i = 0; i < nretval; ++i) { thisDetector->roiLimits[i] = retval[i]; - FILE_LOG(logDEBUG5) << "ROI [" << i << "] (" << + FILE_LOG(logDEBUG1) << "ROI [" << i << "] (" << thisDetector->roiLimits[i].xmin << "," << thisDetector->roiLimits[i].xmax << "," << thisDetector->roiLimits[i].ymin << "," << @@ -3573,7 +3576,7 @@ int slsDetector::sendROI(int n, ROI roiLimits[]) { ret = FAIL; narg = thisDetector->nROI; arg = thisDetector->roiLimits; - FILE_LOG(logDEBUG5) << "Sending ROI to receiver " << thisDetector->nROI; + FILE_LOG(logDEBUG1) << "Sending ROI to receiver " << thisDetector->nROI; if (connectData() == OK) { dataSocket->SendDataOnly(&fnum, sizeof(fnum)); @@ -3608,7 +3611,7 @@ int slsDetector::writeAdcRegister(int addr, int val) { int fnum = F_WRITE_ADC_REG; int ret = FAIL; uint32_t args[2] = {(uint32_t)addr, (uint32_t)val}; - FILE_LOG(logDEBUG5) << "Writing to ADC register 0x" << std::hex << + FILE_LOG(logDEBUG1) << "Writing to ADC register 0x" << std::hex << addr << "data: 0x" << std::hex << val << std::dec; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -3630,7 +3633,7 @@ int slsDetector::activate(int const enable) { int ret = FAIL; int arg = enable; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting activate flag to " << arg; + FILE_LOG(logDEBUG1) << "Setting activate flag to " << arg; // detector if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -3641,7 +3644,7 @@ int slsDetector::activate(int const enable) { if (ret == FAIL) { setErrorMask((getErrorMask())|(DETECTOR_ACTIVATE)); } else { - FILE_LOG(logDEBUG5) << "Activate: " << retval; + FILE_LOG(logDEBUG1) << "Activate: " << retval; thisDetector->activated = retval; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -3654,7 +3657,7 @@ int slsDetector::activate(int const enable) { ret = FAIL; arg = thisDetector->activated; retval = -1; - FILE_LOG(logDEBUG5) << "Setting activate flag " << arg << " to receiver"; + FILE_LOG(logDEBUG1) << "Setting activate flag " << arg << " to receiver"; if (connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3676,7 +3679,7 @@ int slsDetector::setDeactivatedRxrPaddingMode(int padding) { int ret = OK; int arg = padding; int retval = -1; - FILE_LOG(logDEBUG5) << "Deactivated Receiver Padding Enable: " << arg; + FILE_LOG(logDEBUG1) << "Deactivated Receiver Padding Enable: " << arg; if (thisDetector->receiverOnlineFlag==ONLINE_FLAG && connectData() == OK) { ret=thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3686,7 +3689,7 @@ int slsDetector::setDeactivatedRxrPaddingMode(int padding) { if (ret == FAIL) setErrorMask((getErrorMask())|(RECEIVER_ACTIVATE)); else { - FILE_LOG(logDEBUG5) << "Deactivated Receiver Padding Enable:" << retval; + FILE_LOG(logDEBUG1) << "Deactivated Receiver Padding Enable:" << retval; thisDetector->receiver_deactivatedPaddingEnable = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -3718,7 +3721,7 @@ int slsDetector::setFlippedData(dimension d, int value) { if (value > -1) thisDetector->flippedData[d] = (value > 0) ? 1 : 0; args[1] = thisDetector->flippedData[d]; - FILE_LOG(logDEBUG5) << "Setting flipped data across axis " << d << " with value: " << value; + FILE_LOG(logDEBUG1) << "Setting flipped data across axis " << d << " with value: " << value; if (thisDetector->receiverOnlineFlag==ONLINE_FLAG && connectData() == OK) { ret=thisReceiver->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval)); @@ -3728,7 +3731,7 @@ int slsDetector::setFlippedData(dimension d, int value) { if (ret == FAIL) setErrorMask((getErrorMask())|(RECEIVER_FLIPPED_DATA_NOT_SET)); else { - FILE_LOG(logDEBUG5) << "Flipped data:" << retval; + FILE_LOG(logDEBUG1) << "Flipped data:" << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -3742,7 +3745,7 @@ int slsDetector::setAllTrimbits(int val) { int ret = FAIL; int arg = val; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting all trimbits to " << val; + FILE_LOG(logDEBUG1) << "Setting all trimbits to " << val; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3752,7 +3755,7 @@ int slsDetector::setAllTrimbits(int val) { if (ret == FAIL) { setErrorMask((getErrorMask())|(ALLTIMBITS_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "All trimbit value: " << retval; + FILE_LOG(logDEBUG1) << "All trimbit value: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -3767,7 +3770,7 @@ int slsDetector::enableGapPixels(int val) { int ret = OK; int arg = val; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending gap pixels enable to receiver: " << arg; + FILE_LOG(logDEBUG1) << "Sending gap pixels enable to receiver: " << arg; if (thisDetector->receiverOnlineFlag==ONLINE_FLAG && connectData() == OK) { ret=thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3777,7 +3780,7 @@ int slsDetector::enableGapPixels(int val) { if (ret == FAIL) setErrorMask((getErrorMask())|(RECEIVER_ENABLE_GAPPIXELS_NOT_SET)); else { - FILE_LOG(logDEBUG5) << "Gap pixels enable to receiver:" << retval; + FILE_LOG(logDEBUG1) << "Gap pixels enable to receiver:" << retval; thisDetector->gappixels = retval; // update databytes @@ -3822,7 +3825,7 @@ int slsDetector::pulsePixel(int n, int x, int y) { int fnum = F_PULSE_PIXEL; int ret = FAIL; int args[3] = {n , x, y}; - FILE_LOG(logDEBUG5) << "Pulsing pixel " << n << " number of times at (" << + FILE_LOG(logDEBUG1) << "Pulsing pixel " << n << " number of times at (" << x << "," << y << ")"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -3843,7 +3846,7 @@ int slsDetector::pulsePixelNMove(int n, int x, int y) { int fnum = F_PULSE_PIXEL_AND_MOVE; int ret = FAIL; int args[3] = {n, x, y}; - FILE_LOG(logDEBUG5) << "Pulsing pixel " << n << " number of times and move by delta (" << + FILE_LOG(logDEBUG1) << "Pulsing pixel " << n << " number of times and move by delta (" << x << "," << y << ")"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -3864,7 +3867,7 @@ int slsDetector::pulseChip(int n) { int fnum = F_PULSE_CHIP; int ret = FAIL; int arg = n; - FILE_LOG(logDEBUG5) << "Pulsing chip " << n << " number of times"; + FILE_LOG(logDEBUG1) << "Pulsing chip " << n << " number of times"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), NULL, 0); @@ -3885,7 +3888,7 @@ int slsDetector::setThresholdTemperature(int val) { int ret = FAIL; int arg = val; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting threshold temperature to " << val; + FILE_LOG(logDEBUG1) << "Setting threshold temperature to " << val; if (thisDetector->onlineFlag == ONLINE_FLAG && connectStop() == OK) { ret = thisDetectorStop->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3895,7 +3898,7 @@ int slsDetector::setThresholdTemperature(int val) { if (ret == FAIL) { setErrorMask((getErrorMask())|(TEMPERATURE_CONTROL)); } else { - FILE_LOG(logDEBUG5) << "Threshold temperature: " << retval; + FILE_LOG(logDEBUG1) << "Threshold temperature: " << retval; } // no updateDetector as it is stop server } return retval; @@ -3907,7 +3910,7 @@ int slsDetector::setTemperatureControl(int val) { int ret = FAIL; int arg = val; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting temperature control to " << val; + FILE_LOG(logDEBUG1) << "Setting temperature control to " << val; if (thisDetector->onlineFlag == ONLINE_FLAG && connectStop() == OK) { ret = thisDetectorStop->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3917,7 +3920,7 @@ int slsDetector::setTemperatureControl(int val) { if (ret == FAIL) { setErrorMask((getErrorMask())|(TEMPERATURE_CONTROL)); } else { - FILE_LOG(logDEBUG5) << "Temperature control: " << retval; + FILE_LOG(logDEBUG1) << "Temperature control: " << retval; } // no updateDetector as it is stop server } return retval; @@ -3929,7 +3932,7 @@ int slsDetector::setTemperatureEvent(int val) { int ret = FAIL; int arg = val; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting temperature event to " << val; + FILE_LOG(logDEBUG1) << "Setting temperature event to " << val; if (thisDetector->onlineFlag == ONLINE_FLAG && connectStop() == OK) { ret = thisDetectorStop->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3939,7 +3942,7 @@ int slsDetector::setTemperatureEvent(int val) { if (ret == FAIL) { setErrorMask((getErrorMask())|(TEMPERATURE_CONTROL)); } else { - FILE_LOG(logDEBUG5) << "Temperature event: " << retval; + FILE_LOG(logDEBUG1) << "Temperature event: " << retval; } // no updateDetector as it is stop server } return retval; @@ -3951,7 +3954,7 @@ int slsDetector::setStoragecellStart(int pos) { int ret = FAIL; int arg = pos; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting storage cell start to " << pos; + FILE_LOG(logDEBUG1) << "Setting storage cell start to " << pos; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -3961,7 +3964,7 @@ int slsDetector::setStoragecellStart(int pos) { if (ret == FAIL) { setErrorMask((getErrorMask())|(STORAGE_CELL_START)); } else { - FILE_LOG(logDEBUG5) << "Storage cell start: " << retval; + FILE_LOG(logDEBUG1) << "Storage cell start: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -3977,7 +3980,7 @@ int slsDetector::programFPGA(std::string fname) { setErrorMask((getErrorMask())|(PROGRAMMING_ERROR)); return FAIL; } - FILE_LOG(logDEBUG5) << "Programming FPGA with file name:" << fname; + FILE_LOG(logDEBUG1) << "Programming FPGA with file name:" << fname; size_t filesize = 0; char* fpgasrc = NULL; @@ -4010,7 +4013,7 @@ int slsDetector::programFPGA(std::string fname) { } // convert src to dst rawbin - FILE_LOG(logDEBUG5) << "Converting " << fname << " to " << destfname; + FILE_LOG(logDEBUG1) << "Converting " << fname << " to " << destfname; { int filepos, x, y, i; // Remove header (0...11C) @@ -4047,7 +4050,7 @@ int slsDetector::programFPGA(std::string fname) { setErrorMask((getErrorMask())|(PROGRAMMING_ERROR)); return FAIL; } - FILE_LOG(logDEBUG5) << "File has been converted to " << destfname; + FILE_LOG(logDEBUG1) << "File has been converted to " << destfname; //loading dst file to memory FILE* fp = fopen(destfname,"r"); @@ -4090,14 +4093,14 @@ int slsDetector::programFPGA(std::string fname) { return FAIL; } unlink(destfname); // delete temporary file - FILE_LOG(logDEBUG5) << "Successfully loaded the rawbin file to program memory"; + FILE_LOG(logDEBUG1) << "Successfully loaded the rawbin file to program memory"; } // send program from memory to detector int fnum = F_PROGRAM_FPGA; int ret = FAIL; char mess[MAX_STR_LENGTH] = {0}; - FILE_LOG(logDEBUG5) << "Sending programming binary to detector"; + FILE_LOG(logDEBUG1) << "Sending programming binary to detector"; if (thisDetector->onlineFlag == ONLINE_FLAG) { if (connectControl() == OK) { @@ -4144,7 +4147,7 @@ int slsDetector::programFPGA(std::string fname) { unitprogramsize = MAX_FPGAPROGRAMSIZE; //2mb if (unitprogramsize > filesize) //less than 2mb unitprogramsize = filesize; - FILE_LOG(logDEBUG5) << "unitprogramsize:" << unitprogramsize << + FILE_LOG(logDEBUG1) << "unitprogramsize:" << unitprogramsize << "\t filesize:" << filesize; controlSocket->SendDataOnly(fpgasrc + currentPointer, unitprogramsize); @@ -4217,7 +4220,7 @@ int slsDetector::programFPGA(std::string fname) { int slsDetector::resetFPGA() { int fnum = F_RESET_FPGA; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Sending reset FPGA"; + FILE_LOG(logDEBUG1) << "Sending reset FPGA"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, NULL, 0); @@ -4238,7 +4241,7 @@ int slsDetector::powerChip(int ival) { int ret = FAIL; int arg = ival; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting power chip to " << ival; + FILE_LOG(logDEBUG1) << "Setting power chip to " << ival; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -4248,7 +4251,7 @@ int slsDetector::powerChip(int ival) { if (ret == FAIL) { setErrorMask((getErrorMask())|(POWER_CHIP)); } else { - FILE_LOG(logDEBUG5) << "Power chip: " << retval; + FILE_LOG(logDEBUG1) << "Power chip: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -4262,7 +4265,7 @@ int slsDetector::setAutoComparatorDisableMode(int ival) { int ret = FAIL; int arg = ival; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting auto comp disable mode to " << ival; + FILE_LOG(logDEBUG1) << "Setting auto comp disable mode to " << ival; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -4272,7 +4275,7 @@ int slsDetector::setAutoComparatorDisableMode(int ival) { if (ret == FAIL) { setErrorMask((getErrorMask())|(AUTO_COMP_DISABLE)); } else { - FILE_LOG(logDEBUG5) << "Auto comp disable: " << retval; + FILE_LOG(logDEBUG1) << "Auto comp disable: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -4300,7 +4303,7 @@ int slsDetector::setModule(sls_detector_module module, int tb) { int fnum = F_SET_MODULE; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting module with tb:" << tb; + FILE_LOG(logDEBUG1) << "Setting module with tb:" << tb; //to exclude trimbits if (!tb) { @@ -4324,7 +4327,7 @@ int slsDetector::setModule(sls_detector_module module, int tb) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } controlSocket->ReceiveDataOnly(&retval,sizeof(retval)); - FILE_LOG(logDEBUG5) << "Set Module returned: " << retval; + FILE_LOG(logDEBUG1) << "Set Module returned: " << retval; disconnectControl(); if (ret == FORCE_UPDATE) @@ -4368,7 +4371,7 @@ int slsDetector::setModule(sls_detector_module module, int tb) { slsDetectorDefs::sls_detector_module *slsDetector::getModule() { int fnum = F_GET_MODULE; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Getting module"; + FILE_LOG(logDEBUG1) << "Getting module"; sls_detector_module *myMod = createModule(); if (myMod == NULL) { @@ -4430,7 +4433,7 @@ int slsDetector::setRateCorrection(int64_t t) { int fnum = F_SET_RATE_CORRECT; int ret = FAIL; int64_t arg = t; - FILE_LOG(logDEBUG5) << "Setting Rate Correction to " << arg; + FILE_LOG(logDEBUG1) << "Setting Rate Correction to " << arg; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { char mess[MAX_STR_LENGTH] = {0}; @@ -4456,7 +4459,7 @@ int64_t slsDetector::getRateCorrection() { int fnum = F_GET_RATE_CORRECT; int ret = FAIL; int64_t retval = -1; - FILE_LOG(logDEBUG5) << "Getting rate correction"; + FILE_LOG(logDEBUG1) << "Getting rate correction"; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -4466,7 +4469,7 @@ int64_t slsDetector::getRateCorrection() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Rate correction: " << retval; + FILE_LOG(logDEBUG1) << "Rate correction: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -4478,12 +4481,12 @@ int64_t slsDetector::getRateCorrection() { void slsDetector::printReceiverConfiguration(TLogLevel level) { FILE_LOG(level) << "#Detector " << detId << ":\n" << "Receiver Hostname:\t" << getNetworkParameter(RECEIVER_HOSTNAME) << - "Detector UDP IP (Source):\t\t" << getNetworkParameter(DETECTOR_IP) << - "Detector UDP MAC:\t\t" << getNetworkParameter(DETECTOR_MAC) << - "Receiver UDP IP:\t" << getNetworkParameter(RECEIVER_UDP_IP) << - "Receiver UDP MAC:\t" << getNetworkParameter(RECEIVER_UDP_MAC) << - "Receiver UDP Port:\t" << getNetworkParameter(RECEIVER_UDP_PORT) << - "Receiver UDP Port2:\t" << getNetworkParameter(RECEIVER_UDP_PORT2); + "\nDetector UDP IP (Source):\t\t" << getNetworkParameter(DETECTOR_IP) << + "\nDetector UDP MAC:\t\t" << getNetworkParameter(DETECTOR_MAC) << + "\nReceiver UDP IP:\t" << getNetworkParameter(RECEIVER_UDP_IP) << + "\nReceiver UDP MAC:\t" << getNetworkParameter(RECEIVER_UDP_MAC) << + "\nReceiver UDP Port:\t" << getNetworkParameter(RECEIVER_UDP_PORT) << + "\nReceiver UDP Port2:\t" << getNetworkParameter(RECEIVER_UDP_PORT2); } @@ -4525,13 +4528,13 @@ std::string slsDetector::checkReceiverOnline() { thisDetector->receiverOnlineFlag = OFFLINE_FLAG; delete dataSocket; dataSocket = 0; - FILE_LOG(logDEBUG5) << "receiver " << detId << " offline!"; + FILE_LOG(logDEBUG1) << "receiver " << detId << " offline!"; return std::string(thisDetector->receiver_hostname); } else { thisDetector->receiverOnlineFlag = ONLINE_FLAG; dataSocket->SetTimeOut(100); disconnectData(); - FILE_LOG(logDEBUG5) << "receiver " << detId << " online!"; + FILE_LOG(logDEBUG1) << "receiver " << detId << " online!"; } } return retval; @@ -4545,9 +4548,14 @@ int slsDetector::setReceiverTCPSocket(std::string const name, int const receiver // rx_hostname if (name.empty()) { + if (!strcmp(thisDetector->receiver_hostname, "none")) { + FILE_LOG(logDEBUG1) << "No rx_hostname given yet"; + thisDetector->receiverOnlineFlag = OFFLINE_FLAG; + return FAIL; + } strcpy(thisName,thisDetector->receiver_hostname); } else { - FILE_LOG(logDEBUG5) << "Setting rx_hostname"; + FILE_LOG(logDEBUG1) << "Setting rx_hostname"; strcpy(thisName, name.c_str()); strcpy(thisDetector->receiver_hostname, thisName); if (dataSocket) { @@ -4560,7 +4568,7 @@ int slsDetector::setReceiverTCPSocket(std::string const name, int const receiver if (receiver_port <= 0) { thisRP = thisDetector->receiverTCPPort; } else { - FILE_LOG(logDEBUG5) << "Setting data port"; + FILE_LOG(logDEBUG1) << "Setting data port"; thisRP = receiver_port; thisDetector->receiverTCPPort = thisRP; if (dataSocket) { @@ -4573,7 +4581,7 @@ int slsDetector::setReceiverTCPSocket(std::string const name, int const receiver if (!dataSocket) { try { dataSocket = new MySocketTCP(thisName, thisRP); - FILE_LOG(logDEBUG5) << "Data socket connected " << thisName << " " << thisRP; + FILE_LOG(logDEBUG1) << "Data socket connected " << thisName << " " << thisRP; } catch(...) { FILE_LOG(logERROR) << "Could not connect Data socket " << thisName << " " << thisRP; dataSocket = 0; @@ -4583,7 +4591,7 @@ int slsDetector::setReceiverTCPSocket(std::string const name, int const receiver if (ret == FAIL) { thisDetector->receiverOnlineFlag = OFFLINE_FLAG; - FILE_LOG(logDEBUG5) << "Receiver offline"; + FILE_LOG(logDEBUG1) << "Receiver offline"; } // check online and version compatibility @@ -4604,7 +4612,7 @@ int slsDetector::lockReceiver(int lock) { int fnum = F_LOCK_RECEIVER; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting receiver server lock to " << lock; + FILE_LOG(logDEBUG1) << "Setting receiver server lock to " << lock; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &lock, sizeof(lock), &retval, sizeof(retval)); @@ -4614,7 +4622,7 @@ int slsDetector::lockReceiver(int lock) { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Receiver Lock: " << retval; + FILE_LOG(logDEBUG1) << "Receiver Lock: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -4627,7 +4635,7 @@ std::string slsDetector::getReceiverLastClientIP() { int fnum = F_GET_LAST_RECEIVER_CLIENT_IP; int ret = FAIL; char retval[INET_ADDRSTRLEN] = {0}; - FILE_LOG(logDEBUG5) << "Getting last client ip to receiver server"; + FILE_LOG(logDEBUG1) << "Getting last client ip to receiver server"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -4637,7 +4645,7 @@ std::string slsDetector::getReceiverLastClientIP() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Last client IP to receiver: " << retval; + FILE_LOG(logDEBUG1) << "Last client IP to receiver: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -4649,7 +4657,7 @@ std::string slsDetector::getReceiverLastClientIP() { int slsDetector::exitReceiver() { int fnum = F_EXIT_RECEIVER; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Sending exit command to receiver server"; + FILE_LOG(logDEBUG1) << "Sending exit command to receiver server"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, NULL, 0); @@ -4667,7 +4675,7 @@ int slsDetector::execReceiverCommand(std::string cmd) { char arg[MAX_STR_LENGTH] = {0}; char retval[MAX_STR_LENGTH] = {0}; strcpy(arg, cmd.c_str()); - FILE_LOG(logDEBUG5) << "Sending command to receiver " << arg; + FILE_LOG(logDEBUG1) << "Sending command to receiver " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, arg, sizeof(arg), retval, sizeof(retval)); @@ -4691,7 +4699,7 @@ int slsDetector::updateReceiverNoWait() { char lastClientIP[INET_ADDRSTRLEN] = {0}; n += dataSocket->ReceiveDataOnly(lastClientIP, sizeof(lastClientIP)); - FILE_LOG(logDEBUG5) << "Updating receiver last modified by " << lastClientIP; + FILE_LOG(logDEBUG1) << "Updating receiver last modified by " << lastClientIP; // filepath n += dataSocket->ReceiveDataOnly(cstring, sizeof(cstring)); @@ -4778,7 +4786,7 @@ int slsDetector::updateReceiverNoWait() { int slsDetector::updateReceiver() { int fnum = F_UPDATE_RECEIVER_CLIENT; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Sending update client to receiver server"; + FILE_LOG(logDEBUG1) << "Sending update client to receiver server"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, NULL, 0); @@ -4797,7 +4805,7 @@ void slsDetector::sendMultiDetectorSize() { int ret = FAIL; int args[2] = {thisDetector->multiSize[0], thisDetector->multiSize[1]}; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending multi detector size to Receiver (" << + FILE_LOG(logDEBUG1) << "Sending multi detector size to Receiver (" << thisDetector->multiSize[0] << "," << thisDetector->multiSize[1] << ")"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { @@ -4808,7 +4816,7 @@ void slsDetector::sendMultiDetectorSize() { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_MULTI_DET_SIZE_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver multi size returned: " << retval; + FILE_LOG(logDEBUG1) << "Receiver multi size returned: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -4821,7 +4829,7 @@ void slsDetector::setDetectorId() { int ret = FAIL; int arg = detId; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending detector pos id to Receiver " << detId; + FILE_LOG(logDEBUG1) << "Sending detector pos id to Receiver " << detId; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -4831,7 +4839,7 @@ void slsDetector::setDetectorId() { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_DET_POSID_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver Position Id returned: " << retval; + FILE_LOG(logDEBUG1) << "Receiver Position Id returned: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -4845,7 +4853,7 @@ void slsDetector::setDetectorHostname() { char args[MAX_STR_LENGTH] = {0}; char retvals[MAX_STR_LENGTH] = {0}; strcpy(args, thisDetector->hostname); - FILE_LOG(logDEBUG5) << "Sending detector hostname to Receiver " << args; + FILE_LOG(logDEBUG1) << "Sending detector hostname to Receiver " << args; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, args, sizeof(args), retvals, sizeof(retvals)); @@ -4855,7 +4863,7 @@ void slsDetector::setDetectorHostname() { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_DET_HOSTNAME_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver set detector hostname: " << retvals; + FILE_LOG(logDEBUG1) << "Receiver set detector hostname: " << retvals; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -4875,7 +4883,7 @@ std::string slsDetector::setFilePath(std::string s) { char args[MAX_STR_LENGTH] = {0}; char retvals[MAX_STR_LENGTH] = {0}; strcpy(args, s.c_str()); - FILE_LOG(logDEBUG5) << "Sending file path to Receiver " << args; + FILE_LOG(logDEBUG1) << "Sending file path to Receiver " << args; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, args, sizeof(args), retvals, sizeof(retvals)); @@ -4889,7 +4897,7 @@ std::string slsDetector::setFilePath(std::string s) { } else setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver file path: " << retvals; + FILE_LOG(logDEBUG1) << "Receiver file path: " << retvals; strcpy(thisDetector->receiver_filePath, retvals); if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -4912,7 +4920,7 @@ std::string slsDetector::setFileName(std::string s) { char args[MAX_STR_LENGTH] = {0}; char retvals[MAX_STR_LENGTH] = {0}; strcpy(args, s.c_str()); - FILE_LOG(logDEBUG5) << "Sending file name to Receiver " << args; + FILE_LOG(logDEBUG1) << "Sending file name to Receiver " << args; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, args, sizeof(args), retvals, sizeof(retvals)); @@ -4922,7 +4930,7 @@ std::string slsDetector::setFileName(std::string s) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver file name: " << retvals; + FILE_LOG(logDEBUG1) << "Receiver file name: " << retvals; strcpy(thisDetector->receiver_fileName, retvals); if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -4939,7 +4947,7 @@ int slsDetector::setReceiverFramesPerFile(int f) { int ret = FAIL; int arg = f; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting receiver frames per file to " << arg; + FILE_LOG(logDEBUG1) << "Setting receiver frames per file to " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -4949,7 +4957,7 @@ int slsDetector::setReceiverFramesPerFile(int f) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver frames per file: " << retval; + FILE_LOG(logDEBUG1) << "Receiver frames per file: " << retval; thisDetector->receiver_framesPerFile = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -4965,7 +4973,7 @@ slsDetectorDefs::frameDiscardPolicy slsDetector::setReceiverFramesDiscardPolicy( int ret = FAIL; int arg = (int)f; frameDiscardPolicy retval = (frameDiscardPolicy)-1; - FILE_LOG(logDEBUG5) << "Setting receiver frames discard policy to " << arg; + FILE_LOG(logDEBUG1) << "Setting receiver frames discard policy to " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -4975,7 +4983,7 @@ slsDetectorDefs::frameDiscardPolicy slsDetector::setReceiverFramesDiscardPolicy( if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver frames discard policy: " << retval; + FILE_LOG(logDEBUG1) << "Receiver frames discard policy: " << retval; thisDetector->receiver_frameDiscardMode = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -4991,7 +4999,7 @@ int slsDetector::setReceiverPartialFramesPadding(int f) { int ret = FAIL; int arg = f; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting receiver partial frames enable to " << arg; + FILE_LOG(logDEBUG1) << "Setting receiver partial frames enable to " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5001,7 +5009,7 @@ int slsDetector::setReceiverPartialFramesPadding(int f) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver partial frames enable: " << retval; + FILE_LOG(logDEBUG1) << "Receiver partial frames enable: " << retval; thisDetector->receiver_framePadding = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -5018,7 +5026,7 @@ slsDetectorDefs::fileFormat slsDetector::setFileFormat(fileFormat f) { int ret = FAIL; int arg = f; fileFormat retval = (fileFormat)-1; - FILE_LOG(logDEBUG5) << "Setting receiver file format to " << arg; + FILE_LOG(logDEBUG1) << "Setting receiver file format to " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5028,7 +5036,7 @@ slsDetectorDefs::fileFormat slsDetector::setFileFormat(fileFormat f) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver file format: " << retval; + FILE_LOG(logDEBUG1) << "Receiver file format: " << retval; thisDetector->receiver_fileFormatType = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -5055,7 +5063,7 @@ int slsDetector::setFileIndex(int i) { int ret = FAIL; int arg = i; int retval = -1; - FILE_LOG(logDEBUG5) << "Setting file index to " << arg; + FILE_LOG(logDEBUG1) << "Setting file index to " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5065,7 +5073,7 @@ int slsDetector::setFileIndex(int i) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver file index: " << retval; + FILE_LOG(logDEBUG1) << "Receiver file index: " << retval; thisDetector->receiver_fileIndex = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -5087,7 +5095,7 @@ int slsDetector::startReceiver() { int fnum = F_START_RECEIVER; int ret = FAIL; char mess[MAX_STR_LENGTH] = {0}; - FILE_LOG(logDEBUG5) << "Starting Receiver"; + FILE_LOG(logDEBUG1) << "Starting Receiver"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, NULL, 0, mess); @@ -5111,7 +5119,7 @@ int slsDetector::startReceiver() { int slsDetector::stopReceiver() { int fnum = F_STOP_RECEIVER; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Stopping Receiver"; + FILE_LOG(logDEBUG1) << "Stopping Receiver"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, NULL, 0); @@ -5131,7 +5139,7 @@ slsDetectorDefs::runStatus slsDetector::getReceiverStatus() { int fnum = F_GET_RECEIVER_STATUS; int ret = FAIL; runStatus retval = ERROR; - FILE_LOG(logDEBUG5) << "Getting Receiver Status"; + FILE_LOG(logDEBUG1) << "Getting Receiver Status"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -5141,7 +5149,7 @@ slsDetectorDefs::runStatus slsDetector::getReceiverStatus() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Receiver Status: " << runStatusType(retval); + FILE_LOG(logDEBUG1) << "Receiver Status: " << runStatusType(retval); if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -5154,7 +5162,7 @@ int slsDetector::getFramesCaughtByReceiver() { int fnum = F_GET_RECEIVER_FRAMES_CAUGHT; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Getting Frames Caught by Receiver"; + FILE_LOG(logDEBUG1) << "Getting Frames Caught by Receiver"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -5164,7 +5172,7 @@ int slsDetector::getFramesCaughtByReceiver() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Frames Caught by Receiver: " << retval; + FILE_LOG(logDEBUG1) << "Frames Caught by Receiver: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -5177,7 +5185,7 @@ int slsDetector::getReceiverCurrentFrameIndex() { int fnum = F_GET_RECEIVER_FRAME_INDEX; int ret = FAIL; int retval = -1; - FILE_LOG(logDEBUG5) << "Getting Current Frame Index of Receiver"; + FILE_LOG(logDEBUG1) << "Getting Current Frame Index of Receiver"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, &retval, sizeof(retval)); @@ -5187,7 +5195,7 @@ int slsDetector::getReceiverCurrentFrameIndex() { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Current Frame Index of Receiver: " << retval; + FILE_LOG(logDEBUG1) << "Current Frame Index of Receiver: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -5199,7 +5207,7 @@ int slsDetector::getReceiverCurrentFrameIndex() { int slsDetector::resetFramesCaught() { int fnum = F_RESET_RECEIVER_FRAMES_CAUGHT; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Reset Frames Caught by Receiver"; + FILE_LOG(logDEBUG1) << "Reset Frames Caught by Receiver"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, NULL, 0); @@ -5221,7 +5229,7 @@ int slsDetector::enableWriteToFile(int enable) { int ret = FAIL; int arg = enable; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending enable file write to receiver: " << arg; + FILE_LOG(logDEBUG1) << "Sending enable file write to receiver: " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5231,7 +5239,7 @@ int slsDetector::enableWriteToFile(int enable) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver file write enable: " << retval; + FILE_LOG(logDEBUG1) << "Receiver file write enable: " << retval; thisDetector->receiver_fileWriteEnable = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -5248,7 +5256,7 @@ int slsDetector::overwriteFile(int enable) { int ret = FAIL; int arg = enable; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending enable file overwrite to receiver: " << arg; + FILE_LOG(logDEBUG1) << "Sending enable file overwrite to receiver: " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5258,7 +5266,7 @@ int slsDetector::overwriteFile(int enable) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver file overwrite enable: " << retval; + FILE_LOG(logDEBUG1) << "Receiver file overwrite enable: " << retval; thisDetector->receiver_overWriteEnable = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -5275,7 +5283,7 @@ int slsDetector::setReceiverStreamingFrequency(int freq) { int ret = FAIL; int arg = freq; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending read frequency to receiver: " << arg; + FILE_LOG(logDEBUG1) << "Sending read frequency to receiver: " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5285,7 +5293,7 @@ int slsDetector::setReceiverStreamingFrequency(int freq) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_STREAMING_FREQUENCY)); } else { - FILE_LOG(logDEBUG5) << "Receiver read frequency: " << retval; + FILE_LOG(logDEBUG1) << "Receiver read frequency: " << retval; thisDetector->receiver_read_freq = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -5302,7 +5310,7 @@ int slsDetector::setReceiverStreamingTimer(int time_in_ms) { int ret = FAIL; int arg = time_in_ms; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending read timer to receiver: " << arg; + FILE_LOG(logDEBUG1) << "Sending read timer to receiver: " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5312,7 +5320,7 @@ int slsDetector::setReceiverStreamingTimer(int time_in_ms) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_STREAMING_TIMER)); } else { - FILE_LOG(logDEBUG5) << "Receiver read timer: " << retval; + FILE_LOG(logDEBUG1) << "Receiver read timer: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -5327,7 +5335,7 @@ int slsDetector::enableDataStreamingFromReceiver(int enable) { int ret = FAIL; int arg = enable; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending Data Streaming to receiver: " << arg; + FILE_LOG(logDEBUG1) << "Sending Data Streaming to receiver: " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5337,7 +5345,7 @@ int slsDetector::enableDataStreamingFromReceiver(int enable) { if (ret == FAIL) { setErrorMask((getErrorMask())|(DATA_STREAMING)); } else { - FILE_LOG(logDEBUG5) << "Receiver Data Streaming: " << retval; + FILE_LOG(logDEBUG1) << "Receiver Data Streaming: " << retval; thisDetector->receiver_upstream = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -5353,7 +5361,7 @@ int slsDetector::enableTenGigabitEthernet(int i) { int ret = FAIL; int arg = i; int retval = -1; - FILE_LOG(logDEBUG5) << "Enabling / Disabling 10Gbe: " << arg; + FILE_LOG(logDEBUG1) << "Enabling / Disabling 10Gbe: " << arg; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5363,7 +5371,7 @@ int slsDetector::enableTenGigabitEthernet(int i) { if (ret == FAIL) { setErrorMask((getErrorMask())|(DETECTOR_TEN_GIGA)); } else { - FILE_LOG(logDEBUG5) << "10Gbe: " << retval; + FILE_LOG(logDEBUG1) << "10Gbe: " << retval; thisDetector->tenGigaEnable = retval; if (ret == FORCE_UPDATE) ret = updateDetector(); @@ -5389,7 +5397,7 @@ int slsDetector::enableTenGigabitEthernet(int i) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_TEN_GIGA)); } else { - FILE_LOG(logDEBUG5) << "Receiver 10Gbe enable: " << retval; + FILE_LOG(logDEBUG1) << "Receiver 10Gbe enable: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -5404,7 +5412,7 @@ int slsDetector::setReceiverFifoDepth(int i) { int ret = FAIL; int arg = i; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending Receiver Fifo Depth: " << arg; + FILE_LOG(logDEBUG1) << "Sending Receiver Fifo Depth: " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5414,7 +5422,7 @@ int slsDetector::setReceiverFifoDepth(int i) { if (ret == FAIL) { setErrorMask((getErrorMask())|(COULD_NOT_SET_FIFO_DEPTH)); } else { - FILE_LOG(logDEBUG5) << "Receiver Fifo Depth: " << retval; + FILE_LOG(logDEBUG1) << "Receiver Fifo Depth: " << retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); } @@ -5429,7 +5437,7 @@ int slsDetector::setReceiverSilentMode(int i) { int ret = FAIL; int arg = i; int retval = -1; - FILE_LOG(logDEBUG5) << "Sending Receiver Silent Mode: " << arg; + FILE_LOG(logDEBUG1) << "Sending Receiver Silent Mode: " << arg; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, &arg, sizeof(arg), &retval, sizeof(retval)); @@ -5439,7 +5447,7 @@ int slsDetector::setReceiverSilentMode(int i) { if (ret == FAIL) { setErrorMask((getErrorMask())|(RECEIVER_PARAMETER_NOT_SET)); } else { - FILE_LOG(logDEBUG5) << "Receiver Data Streaming: " << retval; + FILE_LOG(logDEBUG1) << "Receiver Data Streaming: " << retval; thisDetector->receiver_silentMode = retval; if (ret == FORCE_UPDATE) ret = updateReceiver(); @@ -5454,7 +5462,7 @@ int slsDetector::setReceiverSilentMode(int i) { int slsDetector::restreamStopFromReceiver() { int fnum = F_RESTREAM_STOP_FROM_RECEIVER; int ret = FAIL; - FILE_LOG(logDEBUG5) << "Restream stop dummy from Receiver via zmq"; + FILE_LOG(logDEBUG1) << "Restream stop dummy from Receiver via zmq"; if (thisDetector->receiverOnlineFlag == ONLINE_FLAG && connectData() == OK) { ret = thisReceiver->Client_Send(fnum, NULL, 0, NULL, 0); @@ -5493,7 +5501,7 @@ uint64_t slsDetector::setCTBWord(int addr, uint64_t word) { int mode = 0; // sets word uint64_t args[3] = {(uint64_t) mode, (uint64_t)addr, word}; uint64_t retval = -1; - FILE_LOG(logDEBUG5) << "Setting CTB word, addr: 0x" << std::hex << addr << ", word: 0x" << word << std::dec; + FILE_LOG(logDEBUG1) << "Setting CTB word, addr: 0x" << std::hex << addr << ", word: 0x" << word << std::dec; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval)); @@ -5503,7 +5511,7 @@ uint64_t slsDetector::setCTBWord(int addr, uint64_t word) { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Set CTB word: " << retval; + FILE_LOG(logDEBUG1) << "Set CTB word: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -5518,7 +5526,7 @@ int slsDetector::setCTBPatLoops(int level,int &start, int &stop, int &n) { int mode = 1; // sets loop uint64_t args[5] = {(uint64_t) mode, (uint64_t)level, (uint64_t)start, (uint64_t)stop, (uint64_t)n}; uint64_t retvals[3] = {0, 0, 0}; - FILE_LOG(logDEBUG5) << "Setting CTB Pat Loops, " + FILE_LOG(logDEBUG1) << "Setting CTB Pat Loops, " "level: " << level << ", start: " << start << ", stop: " << stop << ", n: " << n; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -5529,7 +5537,7 @@ int slsDetector::setCTBPatLoops(int level,int &start, int &stop, int &n) { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Set CTB Pat Loops: " << + FILE_LOG(logDEBUG1) << "Set CTB Pat Loops: " << retvals[0] << ", " << retvals[1] << ", " << retvals[2]; start = retvals[0]; stop = retvals[1]; @@ -5548,7 +5556,7 @@ int slsDetector::setCTBPatWaitAddr(int level, int addr) { int mode = 2; // sets loop uint64_t args[3] = {(uint64_t) mode, (uint64_t)level, (uint64_t)addr}; uint64_t retval = -1; - FILE_LOG(logDEBUG5) << "Setting CTB Wait Addr, " + FILE_LOG(logDEBUG1) << "Setting CTB Wait Addr, " "level: " << level << ", addr: 0x" << std::hex << addr << std::dec; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { @@ -5559,7 +5567,7 @@ int slsDetector::setCTBPatWaitAddr(int level, int addr) { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Set CTB Wait Addr: " << retval; + FILE_LOG(logDEBUG1) << "Set CTB Wait Addr: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -5574,7 +5582,7 @@ int slsDetector::setCTBPatWaitTime(int level, uint64_t t) { int mode = 3; // sets loop uint64_t args[3] = {(uint64_t) mode, (uint64_t)level, t}; uint64_t retval = -1; - FILE_LOG(logDEBUG5) << "Setting CTB Wait Time, level: " << level << ", t: " << t; + FILE_LOG(logDEBUG1) << "Setting CTB Wait Time, level: " << level << ", t: " << t; if (thisDetector->onlineFlag == ONLINE_FLAG && connectControl() == OK) { ret = thisDetectorControl->Client_Send(fnum, args, sizeof(args), &retval, sizeof(retval)); @@ -5584,7 +5592,7 @@ int slsDetector::setCTBPatWaitTime(int level, uint64_t t) { if (ret == FAIL) { setErrorMask((getErrorMask())|(OTHER_ERROR_CODE)); } else { - FILE_LOG(logDEBUG5) << "Set CTB Wait Time: " << retval; + FILE_LOG(logDEBUG1) << "Set CTB Wait Time: " << retval; if (ret == FORCE_UPDATE) ret = updateDetector(); } @@ -5656,7 +5664,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::interpolateTrim( slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string fname, sls_detector_module* myMod, int tb) { - FILE_LOG(logDEBUG5) << "Read settings file " << fname; + FILE_LOG(logDEBUG1) << "Read settings file " << fname; // flag creating module to delete later bool modCreated = false; @@ -5751,9 +5759,9 @@ slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string return NULL; } for(int i = 0; i < myMod->ndac; ++i) - FILE_LOG(logDEBUG5) << "dac " << i << ":" << myMod->dacs[i]; - FILE_LOG(logDEBUG5) << "iodelay:" << myMod->iodelay; - FILE_LOG(logDEBUG5) << "tau:" << myMod->tau; + FILE_LOG(logDEBUG1) << "dac " << i << ":" << myMod->dacs[i]; + FILE_LOG(logDEBUG1) << "iodelay:" << myMod->iodelay; + FILE_LOG(logDEBUG1) << "tau:" << myMod->tau; } // gotthard, jungfrau @@ -5762,7 +5770,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string std::string str; while(infile.good()) { getline(infile,str); - FILE_LOG(logDEBUG5) << str; + FILE_LOG(logDEBUG1) << str; std::string sargname; int ival = 0; std::istringstream ssstr(str); @@ -5772,7 +5780,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string if (sargname == names[i]) { myMod->dacs[i] = ival; found = true; - FILE_LOG(logDEBUG5) << names[i] << "(" << i << "): " << ival; + FILE_LOG(logDEBUG1) << names[i] << "(" << i << "): " << ival; ++idac; } } @@ -5803,7 +5811,7 @@ slsDetectorDefs::sls_detector_module* slsDetector::readSettingsFile(std::string int slsDetector::writeSettingsFile(std::string fname, sls_detector_module mod) { - FILE_LOG(logDEBUG5) << "Write settings file " << fname; + FILE_LOG(logDEBUG1) << "Write settings file " << fname; std::vector names; switch (thisDetector->myDetectorType) { @@ -5871,7 +5879,7 @@ int slsDetector::writeSettingsFile(std::string fname, sls_detector_module mod) // gotthard, jungfrau else { for (int i = 0; i < mod.ndac; ++i) { - FILE_LOG(logDEBUG5) << "dac " << i << ": " << mod.dacs[i]; + FILE_LOG(logDEBUG1) << "dac " << i << ": " << mod.dacs[i]; outfile << names[i] << " " << (int)mod.dacs[i] << std::endl; } } diff --git a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp index 673876488..fa2797a7b 100644 --- a/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp +++ b/slsDetectorSoftware/slsDetector/slsDetectorCommand.cpp @@ -2726,7 +2726,7 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action, int d sscanf(args[1], "%ld",&ival); myDet->setRateCorrection(ival, detPos); } - sprintf(answer,"%lld",myDet->getRateCorrection(detPos)); + sprintf(answer,"%ld",myDet->getRateCorrection(detPos)); return string(answer); } diff --git a/slsReceiverSoftware/include/BinaryFileStatic.h b/slsReceiverSoftware/include/BinaryFileStatic.h index 7d2445f61..b528f8d73 100644 --- a/slsReceiverSoftware/include/BinaryFileStatic.h +++ b/slsReceiverSoftware/include/BinaryFileStatic.h @@ -123,12 +123,14 @@ class BinaryFileStatic { { if(!owenable){ if (NULL == (fd = fopen((const char *) fname.c_str(), "wx"))){ - cprintf(RED,"Error in creating binary master file (without overwrite enable) %s\n",fname.c_str()); + FILE_LOG(logERROR) << "Could not create binary master file " + "(without overwrite enable) " << fname; fd = 0; return 1; } }else if (NULL == (fd = fopen((const char *) fname.c_str(), "w"))){ - cprintf(RED,"Error in creating binary master file (with overwrite enable) %s\n",fname.c_str()); + FILE_LOG(logERROR) << "Could not create binary master file " + "(with overwrite enable) " << fname; fd = 0; return 1; } @@ -179,8 +181,8 @@ class BinaryFileStatic { (long long int)acquisitionPeriod, ctime(&t)); if (strlen(message) > MAX_MASTER_FILE_LENGTH) { - cprintf(RED,"Master File Size %d is greater than max str size %d\n", - (int)strlen(message), MAX_MASTER_FILE_LENGTH); + FILE_LOG(logERROR) << "Master File Size " << strlen(message) << + " is greater than max str size " << MAX_MASTER_FILE_LENGTH; return 1; } diff --git a/slsReceiverSoftware/include/File.h b/slsReceiverSoftware/include/File.h index afe1a9aba..750c2296e 100644 --- a/slsReceiverSoftware/include/File.h +++ b/slsReceiverSoftware/include/File.h @@ -53,7 +53,7 @@ class File : private virtual slsDetectorDefs { /** * Print all member values */ - virtual void PrintMembers(); + virtual void PrintMembers(TLogLevel level = logDEBUG1); /** * Get Type @@ -85,8 +85,8 @@ class File : private virtual slsDetectorDefs { * @returns OK or FAIL */ virtual int CreateFile(uint64_t fnum){ - cprintf(RED,"This is a generic function CreateFile that should be " - "overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function CreateFile that should be " + "overloaded by a derived class"; return OK; } @@ -94,16 +94,16 @@ class File : private virtual slsDetectorDefs { * Close Current File */ virtual void CloseCurrentFile() { - cprintf(RED,"This is a generic function CloseCurrentFile that should be " - "overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function CloseCurrentFile that should be " + "overloaded by a derived class"; } /** * Close Files */ virtual void CloseAllFiles() { - cprintf(RED,"This is a generic function that should be overloaded " - "by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function that should be overloaded " + "by a derived class"; } /** @@ -114,8 +114,8 @@ class File : private virtual slsDetectorDefs { * @param OK or FAIL */ virtual int WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t nump) { - cprintf(RED,"This is a generic function WriteToFile that " - "should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function WriteToFile that " + "should be overloaded by a derived class"; return FAIL; } @@ -134,8 +134,8 @@ class File : private virtual slsDetectorDefs { virtual int CreateMasterFile(bool en, uint32_t size, uint32_t nx, uint32_t ny, uint64_t at, uint64_t st, uint64_t sp, uint64_t ap) { - cprintf(RED,"This is a generic function CreateMasterFile that " - "should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function CreateMasterFile that " + "should be overloaded by a derived class"; return OK; } @@ -146,8 +146,8 @@ class File : private virtual slsDetectorDefs { * @param ny number of pixels in y direction */ virtual void SetNumberofPixels(uint32_t nx, uint32_t ny) { - cprintf(RED,"This is a generic function SetNumberofPixels that " - "should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function SetNumberofPixels that " + "should be overloaded by a derived class"; } /** @@ -156,8 +156,8 @@ class File : private virtual slsDetectorDefs { * @param numf number of images caught */ virtual void EndofAcquisition(bool anyPacketsCaught, uint64_t numf) { - cprintf(RED,"This is a generic function EndofAcquisition that " - "should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function EndofAcquisition that " + "should be overloaded by a derived class"; } protected: diff --git a/slsReceiverSoftware/include/GeneralData.h b/slsReceiverSoftware/include/GeneralData.h index ad97a15f2..0ee8a0ec6 100644 --- a/slsReceiverSoftware/include/GeneralData.h +++ b/slsReceiverSoftware/include/GeneralData.h @@ -161,7 +161,7 @@ public: * @param i ROI */ virtual void SetROI(std::vector i) { - cprintf(RED,"This is a generic function that should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function that should be overloaded by a derived class"; }; /** @@ -171,7 +171,7 @@ public: * @returns adc configured */ virtual const int GetAdcConfigured(int index, std::vector* i) const{ - cprintf(RED,"This is a generic function that should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function that should be overloaded by a derived class"; return 0; }; @@ -181,7 +181,7 @@ public: * @param tgEnable true if 10GbE is enabled, else false */ virtual void SetDynamicRange(int dr, bool tgEnable) { - cprintf(RED,"This is a generic function that should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function that should be overloaded by a derived class"; }; /** @@ -190,7 +190,7 @@ public: * @param dr dynamic range */ virtual void SetTenGigaEnable(bool tgEnable, int dr) { - cprintf(RED,"This is a generic function that should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function that should be overloaded by a derived class"; }; /** @@ -199,7 +199,7 @@ public: * @param nroich number of channels in roi */ virtual void setNumberofSamples(const uint64_t ns, uint32_t nroich) { - cprintf(RED,"This is a generic function that should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function that should be overloaded by a derived class"; }; /** @@ -207,38 +207,38 @@ public: * @param enable true if gap pixels enable, else false */ virtual void SetGapPixelsEnable(bool b, int dr) { - cprintf(RED,"This is a generic function that should be overloaded by a derived class\n"); + FILE_LOG(logERROR) << "This is a generic function that should be overloaded by a derived class"; }; /** * Print all variables */ - virtual void Print() const { - FILE_LOG(logDEBUG) << "\n\nDetector Data Variables:"; - FILE_LOG(logDEBUG) << "myDetectorType: " << slsDetectorDefs::getDetectorType(myDetectorType); - FILE_LOG(logDEBUG) << "Pixels X: " << nPixelsX; - FILE_LOG(logDEBUG) << "Pixels Y: " << nPixelsY; - FILE_LOG(logDEBUG) << "Empty Header: " << emptyHeader; - FILE_LOG(logDEBUG) << "Header Size in Packet: " << headerSizeinPacket; - FILE_LOG(logDEBUG) << "Data Size: " << dataSize; - FILE_LOG(logDEBUG) << "Packet Size: " << packetSize; - FILE_LOG(logDEBUG) << "Packets per Frame: " << packetsPerFrame; - FILE_LOG(logDEBUG) << "Image Size: " << imageSize; - FILE_LOG(logDEBUG) << "Frame Index Mask: " << frameIndexMask; - FILE_LOG(logDEBUG) << "Frame Index Offset: " << frameIndexOffset; - FILE_LOG(logDEBUG) << "Packet Index Mask: " << packetIndexMask; - FILE_LOG(logDEBUG) << "Packet Index Offset: " << packetIndexOffset; - FILE_LOG(logDEBUG) << "Max Frames Per File: " << maxFramesPerFile; - FILE_LOG(logDEBUG) << "Fifo Buffer Header Size: " << fifoBufferHeaderSize; - FILE_LOG(logDEBUG) << "Default Fifo Depth: " << defaultFifoDepth; - FILE_LOG(logDEBUG) << "Threads Per Receiver: " << threadsPerReceiver; - FILE_LOG(logDEBUG) << "Header Packet Size: " << headerPacketSize; - FILE_LOG(logDEBUG) << "Complete Pixels X: " << nPixelsXComplete; - FILE_LOG(logDEBUG) << "Complete Pixels Y: " << nPixelsYComplete; - FILE_LOG(logDEBUG) << "Complete Image Size: " << imageSizeComplete; - FILE_LOG(logDEBUG) << "Standard Header: " << standardheader; - FILE_LOG(logDEBUG) << "UDP Socket Buffer Size: " << defaultUdpSocketBufferSize; + virtual void Print(TLogLevel level = logDEBUG1) const { + FILE_LOG(level) << "\n\nDetector Data Variables:"; + FILE_LOG(level) << "myDetectorType: " << slsDetectorDefs::getDetectorType(myDetectorType); + FILE_LOG(level) << "Pixels X: " << nPixelsX; + FILE_LOG(level) << "Pixels Y: " << nPixelsY; + FILE_LOG(level) << "Empty Header: " << emptyHeader; + FILE_LOG(level) << "Header Size in Packet: " << headerSizeinPacket; + FILE_LOG(level) << "Data Size: " << dataSize; + FILE_LOG(level) << "Packet Size: " << packetSize; + FILE_LOG(level) << "Packets per Frame: " << packetsPerFrame; + FILE_LOG(level) << "Image Size: " << imageSize; + FILE_LOG(level) << "Frame Index Mask: " << frameIndexMask; + FILE_LOG(level) << "Frame Index Offset: " << frameIndexOffset; + FILE_LOG(level) << "Packet Index Mask: " << packetIndexMask; + FILE_LOG(level) << "Packet Index Offset: " << packetIndexOffset; + FILE_LOG(level) << "Max Frames Per File: " << maxFramesPerFile; + FILE_LOG(level) << "Fifo Buffer Header Size: " << fifoBufferHeaderSize; + FILE_LOG(level) << "Default Fifo Depth: " << defaultFifoDepth; + FILE_LOG(level) << "Threads Per Receiver: " << threadsPerReceiver; + FILE_LOG(level) << "Header Packet Size: " << headerPacketSize; + FILE_LOG(level) << "Complete Pixels X: " << nPixelsXComplete; + FILE_LOG(level) << "Complete Pixels Y: " << nPixelsYComplete; + FILE_LOG(level) << "Complete Image Size: " << imageSizeComplete; + FILE_LOG(level) << "Standard Header: " << standardheader; + FILE_LOG(level) << "UDP Socket Buffer Size: " << defaultUdpSocketBufferSize; }; }; diff --git a/slsReceiverSoftware/include/HDF5File.h b/slsReceiverSoftware/include/HDF5File.h index dcd1e7760..81390c542 100644 --- a/slsReceiverSoftware/include/HDF5File.h +++ b/slsReceiverSoftware/include/HDF5File.h @@ -55,7 +55,7 @@ class HDF5File : private virtual slsDetectorDefs, public File, public HDF5FileSt /** * Print all member values */ - void PrintMembers(); + void PrintMembers(TLogLevel level = logDEBUG1); /** * Set Number of pixels diff --git a/slsReceiverSoftware/include/HDF5FileStatic.h b/slsReceiverSoftware/include/HDF5FileStatic.h index 38e304c6d..123bda26f 100644 --- a/slsReceiverSoftware/include/HDF5FileStatic.h +++ b/slsReceiverSoftware/include/HDF5FileStatic.h @@ -112,7 +112,7 @@ public: fd = 0; } } catch(Exception error) { - cprintf(RED,"Error in closing HDF5 handles of index %d\n", ind); + FILE_LOG(logERROR) << "Could not close HDF5 handles of index " << ind; error.printErrorStack(); } } @@ -130,7 +130,7 @@ public: fd = 0; } } catch(Exception error) { - cprintf(RED,"Error in closing master HDF5 handles\n"); + FILE_LOG(logERROR) << "Could not close master HDF5 handles"; error.printErrorStack(); } } @@ -144,7 +144,7 @@ public: { if(fd) { if (H5Fclose(fd) < 0 ) - cprintf(RED,"Error in closing virtual HDF5 handles\n"); + FILE_LOG(logERROR) << "Could not close virtual HDF5 handles"; fd = 0; } } @@ -177,7 +177,7 @@ public: memspace.close(); } catch(Exception error){ - cprintf(RED,"Error in writing to file in object %d\n",ind); + FILE_LOG(logERROR) << "Could not write to file in object " << ind; error.printErrorStack(); return 1; } @@ -239,7 +239,7 @@ public: }i=14; } catch(Exception error){ - cprintf(RED,"Error in writing parameters (index:%d) to file in object %d\n", i, ind); + FILE_LOG(logERROR) << "Could not write parameters (index:" << i << ") to file in object " << ind; error.printErrorStack(); return 1; } @@ -282,7 +282,7 @@ public: } catch(Exception error){ - cprintf(RED,"Error in extending dataset in object %d\n",ind); + FILE_LOG(logERROR) << "Could not extend dataset in object " << ind; error.printError(); return 1; } @@ -417,7 +417,7 @@ public: fd->close(); } catch(Exception error) { - cprintf(RED,"Error in creating master HDF5 handles\n"); + FILE_LOG(logERROR) << "Could not create master HDF5 handles"; error.printErrorStack(); if (fd) fd->close(); return 1; @@ -521,7 +521,7 @@ public: } } catch(Exception error){ - cprintf(RED,"Error in creating HDF5 handles in object %d\n",ind); + FILE_LOG(logERROR) << "Could not create HDF5 handles in object " << ind; error.printErrorStack(); if (fd) fd->close(); return 1; @@ -571,36 +571,36 @@ public: hid_t dfal = H5Pcreate (H5P_FILE_ACCESS); if (dfal < 0) return CloseFileOnError(fd, - std::string("Error in creating file access property for virtual file ") + std::string("Could not create file access property for virtual file ") + virtualFileName + std::string("\n")); if (H5Pset_fclose_degree (dfal, H5F_CLOSE_STRONG) < 0) return CloseFileOnError(fd, - std::string("Error in setting strong file close degree for virtual file ") + std::string("Could not set strong file close degree for virtual file ") + virtualFileName + std::string("\n")); fd = H5Fcreate( virtualFileName.c_str(), H5F_ACC_TRUNC, H5P_DEFAULT, dfal); if (fd < 0) return CloseFileOnError(fd, - std::string("Error in creating virtual file ") + virtualFileName + std::string("\n")); + std::string("Could not create virtual file ") + virtualFileName + std::string("\n")); //attributes - version hid_t dataspace_attr = H5Screate (H5S_SCALAR); if (dataspace_attr < 0) return CloseFileOnError(fd, - std::string("Error in creating dataspace for attribute in virtual file ") + std::string("Could not create dataspace for attribute in virtual file ") + virtualFileName + std::string("\n")); hid_t attrid = H5Acreate2 (fd, "version", H5T_NATIVE_DOUBLE, dataspace_attr, H5P_DEFAULT, H5P_DEFAULT); if (attrid < 0) return CloseFileOnError(fd, - std::string("Error in creating attribute in virtual file ") + std::string("Could not create attribute in virtual file ") + virtualFileName + std::string("\n")); double attr_data = version; if (H5Awrite (attrid, H5T_NATIVE_DOUBLE, &attr_data) < 0) return CloseFileOnError(fd, - std::string("Error in writing attribute in virtual file ") + std::string("Could not write attribute in virtual file ") + virtualFileName + std::string("\n")); if (H5Aclose (attrid) < 0) return CloseFileOnError(fd, - std::string("Error in closing attribute in virtual file ") + std::string("Could not close attribute in virtual file ") + virtualFileName + std::string("\n")); @@ -609,13 +609,13 @@ public: hid_t vdsDataspace = H5Screate_simple(3, vdsdims ,NULL); if (vdsDataspace < 0) return CloseFileOnError(fd, - std::string("Error in creating virtual dataspace in virtual file ") + std::string("Could not create virtual dataspace in virtual file ") + virtualFileName + std::string("\n")); hsize_t vdsdims_para[2] = {numf, (unsigned int) numDety * numDetz}; hid_t vdsDataspace_para = H5Screate_simple(2, vdsdims_para, NULL); if (vdsDataspace_para < 0) return CloseFileOnError(fd, - std::string("Error in creating virtual dataspace (parameters) in virtual file ") + std::string("Could not create virtual dataspace (parameters) in virtual file ") + virtualFileName + std::string("\n")); @@ -623,23 +623,23 @@ public: hid_t dcpl = H5Pcreate (H5P_DATASET_CREATE); if (dcpl < 0) return CloseFileOnError(fd, - std::string("Error in creating file creation properties in virtual file ") + std::string("Could not create file creation properties in virtual file ") + virtualFileName + std::string("\n")); int fill_value = -1; if (H5Pset_fill_value (dcpl, GetDataTypeinC(dataType), &fill_value) < 0) return CloseFileOnError(fd, - std::string("Error in creating fill value in virtual file ") + std::string("Could not create fill value in virtual file ") + virtualFileName + std::string("\n")); hid_t dcpl_para[parameterNames.size()]; for (unsigned int i = 0; i < parameterNames.size(); ++i) { dcpl_para[i] = H5Pcreate (H5P_DATASET_CREATE); if (dcpl_para[i] < 0) return CloseFileOnError(fd, - std::string("Error in creating file creation properties (parameters) in virtual file ") + std::string("Could not create file creation properties (parameters) in virtual file ") + virtualFileName + std::string("\n")); if (H5Pset_fill_value (dcpl_para[i], GetDataTypeinC(parameterDataTypes[i]), &fill_value) < 0) return CloseFileOnError(fd, - std::string("Error in creating fill value (parameters) in virtual file ") + std::string("Could not create fill value (parameters) in virtual file ") + virtualFileName + std::string("\n")); } @@ -661,13 +661,13 @@ public: //setect hyperslabs if (H5Sselect_hyperslab (vdsDataspace, H5S_SELECT_SET, offset, NULL, count, NULL) < 0) { - cprintf(RED,"could not select hyperslab\n"); + FILE_LOG(logERROR) << "Could not select hyperslab"; error = true; break; } if (H5Sselect_hyperslab (vdsDataspace_para, H5S_SELECT_SET, offset_para, NULL, count_para, NULL) < 0) { - cprintf(RED,"could not select hyperslab for parameters\n"); + FILE_LOG(logERROR) << "Could not select hyperslab for parameters"; error = true; break; } @@ -696,20 +696,20 @@ public: hid_t srcDataspace = H5Screate_simple(3, srcdims, srcdimsmax); if (srcDataspace < 0) return CloseFileOnError(fd, - std::string("Error in creating source dataspace in virtual file ") + std::string("Could not create source dataspace in virtual file ") + virtualFileName + std::string("\n")); hsize_t srcdims_para[1] = {nDimx}; hsize_t srcdimsmax_para[1] = {H5S_UNLIMITED}; hid_t srcDataspace_para = H5Screate_simple(1, srcdims_para, srcdimsmax_para); if (srcDataspace_para < 0) return CloseFileOnError(fd, - std::string("Error in creating source dataspace (parameters) in virtual file ") + std::string("Could not create source dataspace (parameters) in virtual file ") + virtualFileName + std::string("\n")); //mapping if (H5Pset_virtual(dcpl, vdsDataspace, relative_srcFileName.c_str(), srcDatasetName.c_str(), srcDataspace) < 0) { - cprintf(RED,"could not set mapping for paramter 1\n"); + FILE_LOG(logERROR) << "Could not set mapping for paramter 1"; error = true; break; } @@ -717,7 +717,7 @@ public: for (unsigned int k = 0; k < parameterNames.size(); ++k) { if (H5Pset_virtual(dcpl_para[k], vdsDataspace_para, relative_srcFileName.c_str(), parameterNames[k], srcDataspace_para) < 0) { - cprintf(RED,"could not set mapping for paramter %d\n", k); + FILE_LOG(logERROR) << "Could not set mapping for paramter " << k; error = true; break; } @@ -736,7 +736,7 @@ public: } if (error) return CloseFileOnError(fd, - std::string("Error in mapping files in virtual file ") + std::string("Could not map files in virtual file ") + virtualFileName + std::string("\n")); //dataset @@ -745,7 +745,7 @@ public: GetDataTypeinC(dataType), vdsDataspace, H5P_DEFAULT, dcpl, H5P_DEFAULT); if (vdsdataset < 0) return CloseFileOnError(fd, - std::string("Error in creating virutal dataset in virtual file ") + std::string("Could not create virutal dataset in virtual file ") + virtualFileName + std::string("\n")); @@ -757,7 +757,7 @@ public: H5P_DEFAULT, dcpl_para[i], H5P_DEFAULT); if (vdsdataset_para < 0) return CloseFileOnError(fd, - std::string("Error in creating virutal dataset (parameters) in virtual file ") + std::string("Could not create virutal dataset (parameters) in virtual file ") + virtualFileName + std::string("\n")); } @@ -798,7 +798,7 @@ public: data_out = (T*)malloc(sizeof(T)*(nDimx*nDimy*nDimz)); break; default: - cprintf(RED,"invalid rank. Options: 2 or 3\n"); + FILE_LOG(logERROR) << "Invalid rank. Options: 2 or 3"; return 0; } if (datatype == PredType::STD_U16LE) { @@ -810,7 +810,7 @@ public: } else if (datatype == PredType::STD_U8LE) { FILE_LOG(logINFO) << "datatype:8"; } else { - FILE_LOG(logERROR) << "unknown datatype"; + FILE_LOG(logERROR) << "Unknown datatype: " << datetype; return 1; } FILE_LOG(logINFO) << "owenable:" << (owenable?1:0) << std::endl @@ -861,7 +861,7 @@ public: newfd->close(); oldfd->close(); } catch(Exception error){ - cprintf(RED,"Error in copying virtual files\n"); + FILE_LOG(logERROR) << "Could not copy virtual files"; error.printErrorStack(); free(data_out); oldfd->close(); @@ -890,20 +890,20 @@ public: hid_t dfal = H5Pcreate (H5P_FILE_ACCESS); if (dfal < 0) - return CloseFileOnError( vfd, std::string("Error in creating file access property for link\n")); + return CloseFileOnError( vfd, std::string("Could not create file access property for link\n")); if (H5Pset_fclose_degree (dfal, H5F_CLOSE_STRONG) < 0) - return CloseFileOnError( vfd, std::string("Error in setting strong file close degree for link\n")); + return CloseFileOnError( vfd, std::string("Could not set strong file close degree for link\n")); //open master file hid_t mfd = H5Fopen( masterFileName.c_str(), H5F_ACC_RDWR, dfal); if (mfd < 0) - return CloseFileOnError( vfd, std::string("Error in opening master file\n")); + return CloseFileOnError( vfd, std::string("Could not open master file\n")); //open virtual file vfd = H5Fopen( virtualfname.c_str(), H5F_ACC_RDWR, dfal); if (vfd < 0) { H5Fclose(mfd); mfd = 0; - return CloseFileOnError( vfd, std::string("Error in opening virtual file\n")); + return CloseFileOnError( vfd, std::string("Could not open virtual file\n")); } // find relative path @@ -918,13 +918,13 @@ public: hid_t vdset = H5Dopen2( vfd, virtualDatasetname.c_str(), H5P_DEFAULT); if (vdset < 0) { H5Fclose(mfd); - return CloseFileOnError( vfd, std::string("Error in opening virtual data dataset\n")); + return CloseFileOnError( vfd, std::string("Could not open virtual data dataset\n")); } sprintf(linkname, "/entry/data/%s",virtualDatasetname.c_str()); if(H5Lcreate_external( relative_virtualfname.c_str(), virtualDatasetname.c_str(), mfd, linkname, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5Fclose(mfd); mfd = 0; - return CloseFileOnError( vfd, std::string("Error in creating link to data dataset\n")); + return CloseFileOnError( vfd, std::string("Could not create link to data dataset\n")); } H5Dclose(vdset); @@ -933,14 +933,14 @@ public: hid_t vdset_para = H5Dopen2( vfd, (std::string (parameterNames[i])).c_str(), H5P_DEFAULT); if (vdset_para < 0) { H5Fclose(mfd); mfd = 0; - return CloseFileOnError( vfd, std::string("Error in opening virtual parameter dataset to create link\n")); + return CloseFileOnError( vfd, std::string("Could not open virtual parameter dataset to create link\n")); } sprintf(linkname, "/entry/data/%s",(std::string (parameterNames[i])).c_str()); if(H5Lcreate_external( relative_virtualfname.c_str(), (std::string (parameterNames[i])).c_str(), mfd, linkname, H5P_DEFAULT, H5P_DEFAULT) < 0) { H5Fclose(mfd); mfd = 0; - return CloseFileOnError( vfd, std::string("Error in creating link to virtual parameter dataset\n")); + return CloseFileOnError( vfd, std::string("Could not create link to virtual parameter dataset\n")); } } @@ -956,7 +956,7 @@ public: * @returns 1 for fail */ static int CloseFileOnError(hid_t& fd, const std::string msg) { - cprintf(RED, "%s", msg.c_str()); + FILE_LOG(logERROR) << msg; if(fd > 0) H5Fclose(fd); fd = 0; diff --git a/slsReceiverSoftware/src/BinaryFile.cpp b/slsReceiverSoftware/src/BinaryFile.cpp index 639c70328..47af53f20 100644 --- a/slsReceiverSoftware/src/BinaryFile.cpp +++ b/slsReceiverSoftware/src/BinaryFile.cpp @@ -106,8 +106,7 @@ int BinaryFile::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_ // if write error if (ret != buffersize) { - cprintf(RED,"%d Error: Write to file failed for image number %lld\n", - index, (long long int)fnum); + FILE_LOG(logERROR) << index << " Error: Write to file failed for image number " << fnum; return FAIL; } return OK; diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index bce6e0379..f2825b5f5 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -166,18 +166,14 @@ void DataProcessor::RecordFirstIndices(uint64_t fnum) { firstAcquisitionIndex = fnum; } -#ifdef VERBOSE - cprintf(BLUE,"%d First Acquisition Index:%lld\tFirst Measurement Index:%lld\n", - index, (long long int)firstAcquisitionIndex, (long long int)firstMeasurementIndex); -#endif + FILE_LOG(logDEBUG1) << index << " First Acquisition Index:" << firstAcquisitionIndex << + "\tFirst Measurement Index:" << firstMeasurementIndex; } void DataProcessor::SetGeneralData(GeneralData* g) { generalData = g; -#ifdef VERY_VERBOSE generalData->Print(); -#endif if (file) { if (file->GetFileType() == HDF5) { file->SetNumberofPixels(generalData->nPixelsX, generalData->nPixelsY); @@ -278,16 +274,12 @@ void DataProcessor::EndofAcquisition(bool anyPacketsCaught, uint64_t numf) { void DataProcessor::ThreadExecution() { char* buffer=0; fifo->PopAddress(buffer); -#ifdef FIFODEBUG - if (!index) cprintf(BLUE,"DataProcessor %d, pop 0x%p buffer:%s\n", - index,(void*)(buffer),buffer); -#endif + FILE_LOG(logDEBUG5) << "DataProcessor " << index << ", " + "pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer; //check dummy uint32_t numBytes = (uint32_t)(*((uint32_t*)buffer)); -#ifdef VERBOSE - if (!index) cprintf(BLUE,"DataProcessor %d, Numbytes:%u\n", index,numBytes); -#endif + FILE_LOG(logDEBUG1) << "DataProcessor " << index << ", Numbytes:" << numBytes; if (numBytes == DUMMY_PACKET_VALUE) { StopProcessing(buffer); return; @@ -304,10 +296,8 @@ void DataProcessor::ThreadExecution() { void DataProcessor::StopProcessing(char* buf) { -#ifdef VERBOSE - if (!index) - cprintf(RED,"DataProcessing %d: Dummy\n", index); -#endif + FILE_LOG(logDEBUG1) << "DataProcessing " << index << ": Dummy"; + //stream or free if (*dataStreamEnable) fifo->PushAddressToStream(buf); @@ -317,9 +307,7 @@ void DataProcessor::StopProcessing(char* buf) { if (file) file->CloseCurrentFile(); StopRunning(); -#ifdef VERBOSE - FILE_LOG(logINFO) << index << ": Processing Completed"; -#endif + FILE_LOG(logDEBUG1) << index << ": Processing Completed"; } @@ -335,16 +323,9 @@ void DataProcessor::ProcessAnImage(char* buf) { numTotalFramesCaught++; } - -#ifdef VERBOSE - if (!index) - cprintf(BLUE,"DataProcessing %d: fnum:%lu\n", index, fnum); -#endif + FILE_LOG(logDEBUG1) << "DataProcessing " << index << ": fnum:" << fnum; if (!measurementStartedFlag) { -#ifdef VERBOSE - if (!index) cprintf(BLUE,"DataProcessing %d: fnum:%lu\n", index, fnum); -#endif RecordFirstIndices(fnum); if (*dataStreamEnable) { @@ -418,11 +399,10 @@ bool DataProcessor::SendToStreamer() { bool DataProcessor::CheckTimer() { struct timespec end; clock_gettime(CLOCK_REALTIME, &end); -#ifdef VERBOSE - cprintf(BLUE,"%d Timer elapsed time:%f seconds\n", index, - ( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec ) - / 1000000000.0); -#endif + + FILE_LOG(logDEBUG1) << index << " Timer elapsed time:" << + (( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec ) / 1000000000.0) + << " seconds"; //still less than streaming timer, keep waiting if((( end.tv_sec - timerBegin.tv_sec ) + ( end.tv_nsec - timerBegin.tv_nsec ) / 1000000000.0) < ((double)*streamingTimerInMs/1000.00)) @@ -464,9 +444,8 @@ void DataProcessor::PadMissingPackets(char* buf) { uint32_t dsize = generalData->dataSize; uint32_t fifohsize = generalData->fifoBufferHeaderSize; uint32_t corrected_dsize = dsize - ((pperFrame * dsize) - generalData->imageSize); -#ifdef VERBOSE - cprintf(RED,"bitmask:%s\n", pmask.to_string().c_str()); -#endif + FILE_LOG(logDEBUG1) << "bitmask: " << pmask.to_string(); + for (unsigned int pnum = 0; pnum < pperFrame; ++pnum) { // not missing packet diff --git a/slsReceiverSoftware/src/DataStreamer.cpp b/slsReceiverSoftware/src/DataStreamer.cpp index fee9fca24..1f3427f8b 100644 --- a/slsReceiverSoftware/src/DataStreamer.cpp +++ b/slsReceiverSoftware/src/DataStreamer.cpp @@ -108,18 +108,14 @@ void DataStreamer::RecordFirstIndices(uint64_t fnum) { firstAcquisitionIndex = fnum; } -#ifdef VERBOSE - cprintf(BLUE,"%d First Acquisition Index:%lld\tFirst Measurement Index:%lld\n", - index, (long long int)firstAcquisitionIndex, (long long int)firstMeasurementIndex); -#endif + FILE_LOG(logDEBUG1) << index << " First Acquisition Index: " << firstAcquisitionIndex << + "\tFirst Measurement Index: " << firstMeasurementIndex; } void DataStreamer::SetGeneralData(GeneralData* g) { generalData = g; -#ifdef VERY_VERBOSE generalData->Print(); -#endif } int DataStreamer::SetThreadPriority(int priority) { @@ -138,7 +134,7 @@ void DataStreamer::CreateZmqSockets(int* nunits, uint32_t port, const char* srci try { zmqSocket = new ZmqSocket(portnum, (strlen(srcip)?srcip:NULL)); } catch (...) { - cprintf(RED, "Error: Could not create Zmq socket on port %d for Streamer %d\n", portnum, index); + FILE_LOG(logERROR) << "Could not create Zmq socket on port " << portnum << " for Streamer " << index; throw; } FILE_LOG(logINFO) << index << " Streamer: Zmq Server started at " << zmqSocket->GetZmqServerAddress(); @@ -156,15 +152,13 @@ void DataStreamer::CloseZmqSocket() { void DataStreamer::ThreadExecution() { char* buffer=0; fifo->PopAddressToStream(buffer); -#ifdef FIFODEBUG - if (!index) cprintf(BLUE,"DataStreamer %d, pop 0x%p buffer:%s\n", index,(void*)(buffer),buffer); -#endif + FILE_LOG(logDEBUG5) << "DataStreamer " << index << ", " + "pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer; + //check dummy uint32_t numBytes = (uint32_t)(*((uint32_t*)buffer)); -#ifdef VERBOSE - cprintf(GREEN,"DataStreamer %d, Numbytes:%u\n", index,numBytes); -#endif + FILE_LOG(logDEBUG1) << "DataStreamer " << index << ", Numbytes:" << numBytes; if (numBytes == DUMMY_PACKET_VALUE) { StopProcessing(buffer); return; @@ -180,20 +174,17 @@ void DataStreamer::ThreadExecution() { void DataStreamer::StopProcessing(char* buf) { -#ifdef VERBOSE - if (!index) - cprintf(RED,"DataStreamer %d: Dummy\n", index); -#endif + FILE_LOG(logDEBUG1) << "DataStreamer " << index << ": Dummy"; + sls_receiver_header* header = (sls_receiver_header*) (buf); //send dummy header and data - if (!SendHeader(header, 0, 0, 0, true)) - cprintf(RED,"Error: Could not send zmq dummy header for streamer %d\n", index); + if (!SendHeader(header, 0, 0, 0, true)) { + FILE_LOG(logERROR) << "Could not send zmq dummy header for streamer " << index; + } fifo->FreeAddress(buf); StopRunning(); -#ifdef VERBOSE - FILE_LOG(logINFO) << index << ": Streaming Completed"; -#endif + FILE_LOG(logDEBUG1) << index << ": Streaming Completed"; } /** buf includes only the standard header */ @@ -201,14 +192,9 @@ void DataStreamer::ProcessAnImage(char* buf) { sls_receiver_header* header = (sls_receiver_header*) (buf + FIFO_HEADER_NUMBYTES); uint64_t fnum = header->detHeader.frameNumber; -#ifdef VERBOSE - cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index,fnum); -#endif + FILE_LOG(logDEBUG1) << "DataStreamer " << index << ": fnum:" << fnum; if (!measurementStartedFlag) { -#ifdef VERBOSE - if (!index) cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index, fnum); -#endif RecordFirstIndices(fnum); } @@ -220,17 +206,16 @@ void DataStreamer::ProcessAnImage(char* buf) { //write imagesize if (!SendHeader(header, generalData->imageSizeComplete, - generalData->nPixelsXComplete, generalData->nPixelsYComplete, false)) - cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n", - (long long int) fnum, index); - + generalData->nPixelsXComplete, generalData->nPixelsYComplete, false)) { + FILE_LOG(logERROR) << "Could not send zmq header for fnum " << fnum << " and streamer " << index; + } memcpy(completeBuffer + ((generalData->imageSize) * adcConfigured), buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header), (uint32_t)(*((uint32_t*)buf)) ); - if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete)) - cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n", - (long long int) fnum, index); + if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete)) { + FILE_LOG(logERROR) << "Could not send zmq data for fnum " << fnum << " and streamer " << index; + } } @@ -238,14 +223,13 @@ void DataStreamer::ProcessAnImage(char* buf) { else { if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)), - generalData->nPixelsX, generalData->nPixelsY, false)) // new size possibly from callback - cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n", - (long long int) fnum, index); - + generalData->nPixelsX, generalData->nPixelsY, false)) {// new size possibly from callback + FILE_LOG(logERROR) << "Could not send zmq header for fnum " << fnum << " and streamer " << index; + } if (!zmqSocket->SendData(buf + FIFO_HEADER_NUMBYTES + sizeof(sls_receiver_header), - (uint32_t)(*((uint32_t*)buf)) )) // new size possibly from callback - cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n", - (long long int) fnum, index); + (uint32_t)(*((uint32_t*)buf)) )) {// new size possibly from callback + FILE_LOG(logERROR) << "Could not send zmq data for fnum " << fnum << " and streamer " << index; + } } } diff --git a/slsReceiverSoftware/src/Fifo.cpp b/slsReceiverSoftware/src/Fifo.cpp index a39be358a..2e690ceb5 100644 --- a/slsReceiverSoftware/src/Fifo.cpp +++ b/slsReceiverSoftware/src/Fifo.cpp @@ -21,22 +21,21 @@ Fifo::Fifo(int ind, uint32_t fifoItemSize, uint32_t depth): fifoDepth(depth), status_fifoBound(0), status_fifoFree(depth){ - FILE_LOG(logDEBUG) << __AT__ << " called"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(CreateFifos(fifoItemSize) == FAIL) throw std::exception(); } Fifo::~Fifo() { - FILE_LOG(logDEBUG) << __AT__ << " called"; - //cprintf(BLUE,"Fifo Object %d: Goodbye\n", index); + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; DestroyFifos(); } int Fifo::CreateFifos(uint32_t fifoItemSize) { - FILE_LOG(logDEBUG) << __AT__ << " called"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; //destroy if not already DestroyFifos(); @@ -69,7 +68,7 @@ int Fifo::CreateFifos(uint32_t fifoItemSize) { void Fifo::DestroyFifos(){ - FILE_LOG(logDEBUG) << __AT__ << " called"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(memory) { free(memory); diff --git a/slsReceiverSoftware/src/File.cpp b/slsReceiverSoftware/src/File.cpp index d7748cb26..b72324e39 100644 --- a/slsReceiverSoftware/src/File.cpp +++ b/slsReceiverSoftware/src/File.cpp @@ -38,8 +38,8 @@ std::string File::GetCurrentFileName() { return currentFileName; } -void File::PrintMembers() { - FILE_LOG(logINFO) << "\nGeneral Writer Variables:" << std::endl +void File::PrintMembers(TLogLevel level) { + FILE_LOG(level) << "\nGeneral Writer Variables:" << std::endl << "Index: " << index << std::endl << "Max Frames Per File: " << *maxFramesPerFile << std::endl << "Number of Detectors in x dir: " << numDetX << std::endl diff --git a/slsReceiverSoftware/src/HDF5File.cpp b/slsReceiverSoftware/src/HDF5File.cpp index f6a4ffe75..f494f48ea 100644 --- a/slsReceiverSoftware/src/HDF5File.cpp +++ b/slsReceiverSoftware/src/HDF5File.cpp @@ -38,9 +38,7 @@ HDF5File::HDF5File(int ind, uint32_t* maxf, dataspace_para(0), extNumImages(0) { -#ifdef VERBOSE PrintMembers(); -#endif dataset_para.clear(); parameterNames.clear(); parameterDataTypes.clear(); @@ -95,15 +93,15 @@ HDF5File::~HDF5File() { CloseAllFiles(); } -void HDF5File::PrintMembers() { +void HDF5File::PrintMembers(TLogLevel level) { File::PrintMembers(); UpdateDataType(); if (datatype == PredType::STD_U8LE) { - FILE_LOG(logINFO) << "Data Type: 4 or 8"; + FILE_LOG(level) << "Data Type: 4 or 8"; } else if (datatype == PredType::STD_U16LE) { - FILE_LOG(logINFO) << "Data Type: 16"; + FILE_LOG(level) << "Data Type: 16"; } else if (datatype == PredType::STD_U32LE) { - FILE_LOG(logINFO) << "Data Type: 32"; + FILE_LOG(level) << "Data Type: 32"; } else { FILE_LOG(logERROR) << "unknown data type"; } @@ -154,8 +152,6 @@ int HDF5File::CreateFile(uint64_t fnum) { return FAIL; } pthread_mutex_unlock(&Mutex); - if (dataspace == NULL) - cprintf(RED,"Got nothing!\n"); if(!(*silentMode)) { FILE_LOG(logINFO) << *udpPortNumber << ": HDF5 File created: " << currentFileName; @@ -214,9 +210,8 @@ int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t if (HDF5FileStatic::ExtendDataset(index, dataspace, dataset, dataspace_para, dataset_para, *numImages) == OK) { if (!(*silentMode)) { - cprintf(BLUE,"%d Extending HDF5 dataset by %llu, Total x Dimension: %llu\n", - index, (long long unsigned int)extNumImages, - (long long unsigned int)(extNumImages + *numImages)); + FILE_LOG(logINFO) << index << " Extending HDF5 dataset by " << + extNumImages << ", Total x Dimension: " << (extNumImages + *numImages); } extNumImages += *numImages; } @@ -238,7 +233,7 @@ int HDF5File::WriteToFile(char* buffer, int buffersize, uint64_t fnum, uint32_t } } pthread_mutex_unlock(&Mutex); - cprintf(RED,"%d Error: Write to file failed\n", index); + FILE_LOG(logERROR) << index << "Write to file failed"; return FAIL; } diff --git a/slsReceiverSoftware/src/Listener.cpp b/slsReceiverSoftware/src/Listener.cpp index b28b86377..3508a749d 100644 --- a/slsReceiverSoftware/src/Listener.cpp +++ b/slsReceiverSoftware/src/Listener.cpp @@ -159,19 +159,18 @@ void Listener::RecordFirstIndices(uint64_t fnum) { } if(!(*silentMode)) { - if (!index) cprintf(BLUE,"%d First Acquisition Index:%lu\n" - "%d First Measurement Index:%lu\n", - index, firstAcquisitionIndex, - index, firstMeasurementIndex); + if (!index) { + FILE_LOG(logINFOBLUE) << index << + " First Acquisition Index: " << firstAcquisitionIndex; + FILE_LOG(logDEBUG1) << index << " First Measurement Index: " << firstMeasurementIndex; + } } } void Listener::SetGeneralData(GeneralData*& g) { generalData = g; -#ifdef VERY_VERBOSE generalData->Print(); -#endif } @@ -300,9 +299,8 @@ void Listener::ThreadExecution() { int rc = 0; fifo->GetNewAddress(buffer); -#ifdef FIFODEBUG - cprintf(GREEN,"Listener %d, pop 0x%p buffer:%s\n", index,(void*)(buffer),buffer); -#endif + FILE_LOG(logDEBUG5) << "Listener " << index << ", " + "pop 0x" << std::hex << (void*)(buffer) << std::dec << ":" << buffer; //udpsocket doesnt exist if (*activated && !udpSocketAlive && !carryOverFlag) { @@ -320,7 +318,6 @@ void Listener::ThreadExecution() { //error check, (should not be here) if not transmitting yet (previous if) rc should be > 0 if (rc == 0) { - //cprintf(RED,"%d Socket shut down while waiting for future packet. udpsocketalive:%d\n",index, udpSocketAlive ); if (!udpSocketAlive) { (*((uint32_t*)buffer)) = 0; StopListening(buffer); @@ -362,10 +359,8 @@ void Listener::StopListening(char* buf) { StopRunning(); sem_post(&semaphore_socket); -#ifdef VERBOSE - cprintf(GREEN,"%d: Listening Packets (%u) : %llu\n", index, *udpPortNumber, numPacketsCaught); - cprintf(GREEN,"%d: Listening Completed\n", index); -#endif + FILE_LOG(logDEBUG1) << index << ": Listening Packets (" << *udpPortNumber << ") : " << numPacketsCaught; + FILE_LOG(logDEBUG1) << index << ": Listening Completed"; } @@ -418,7 +413,7 @@ uint32_t Listener::ListenToAnImage(char* buf) { //look for carry over if (carryOverFlag) { - //cprintf(RED,"%d carry flag\n",index); + FILE_LOG(logDEBUG3) << index << "carry flag"; //check if its the current image packet // -------------------------- new header ---------------------------------------------------------------------- if (standardheader) { @@ -434,7 +429,8 @@ uint32_t Listener::ListenToAnImage(char* buf) { //------------------------------------------------------------------------------------------------------------ if (fnum != currentFrameIndex) { if (fnum < currentFrameIndex) { - cprintf(RED,"Error:(Weird), With carry flag: Frame number %lu less than current frame number %lu\n", fnum, currentFrameIndex); + FILE_LOG(logERROR) << "(Weird), With carry flag: Frame number " << + fnum << " less than current frame number " << currentFrameIndex; return 0; } switch(*frameDiscardMode) { @@ -551,25 +547,22 @@ uint32_t Listener::ListenToAnImage(char* buf) { // Eiger Firmware in a weird state if (myDetectorType == EIGER && fnum == 0) { - cprintf(RED,"[%u]: Got Frame Number Zero from Firmware. Discarding Packet\n", *udpPortNumber); + FILE_LOG(logERROR) << "[" << *udpPortNumber << "]: Got Frame Number " + "Zero from Firmware. Discarding Packet"; numPacketsCaught--; return 0; } lastCaughtFrameIndex = fnum; + FILE_LOG(logDEBUG5) << "Listening " << index << ": currentfindex:" << currentFrameIndex << + ", fnum:" << fnum << ", pnum:" << pnum << ", numpackets:" << numpackets; -#ifdef VERBOSE - //if (!index) - cprintf(GREEN,"Listening %d: currentfindex:%lu, fnum:%lu, pnum:%u numpackets:%u\n", - index,currentFrameIndex, fnum, pnum, numpackets); -#endif if (!measurementStartedFlag) RecordFirstIndices(fnum); //future packet by looking at image number (all other detectors) if (fnum != currentFrameIndex) { - //cprintf(RED,"setting carry over flag to true num:%llu nump:%u\n",fnum, numpackets ); carryOverFlag = true; memcpy(carryOverPacket,listeningPacket, generalData->packetSize); @@ -641,19 +634,18 @@ uint32_t Listener::ListenToAnImage(char* buf) { void Listener::PrintFifoStatistics() { -#ifdef VERBOSE - cout << "numFramesStatistic:" << numFramesStatistic << " numPacketsStatistic:" << numPacketsStatistic << endl; -#endif + FILE_LOG(logDEBUG1) << "numFramesStatistic:" << numFramesStatistic << " numPacketsStatistic:" << numPacketsStatistic; + //calculate packet loss int64_t loss = -1; loss = (numFramesStatistic*(generalData->packetsPerFrame)) - numPacketsStatistic; numPacketsStatistic = 0; numFramesStatistic = 0; - if (loss) - cprintf(RED,"[%u]: Packet_Loss:%lu Used_Fifo_Max_Level:%d \tFree_Slots_Min_Level:%d \tCurrent_Frame#:%lu\n", - *udpPortNumber,loss, fifo->GetMaxLevelForFifoBound() , fifo->GetMinLevelForFifoFree(), currentFrameIndex); - else - cprintf(GREEN,"[%u]: Packet_Loss:%lu Used_Fifo_Max_Level:%d \tFree_Slots_Min_Level:%d \tCurrent_Frame#:%lu\n", - *udpPortNumber,loss, fifo->GetMaxLevelForFifoBound(), fifo->GetMinLevelForFifoFree(), currentFrameIndex); + FILE_LOG(loss ? logINFORED : logINFOGREEN) << "[" << *udpPortNumber << "]: " + "Packet_Loss:" << loss << + " Used_Fifo_Max_Level:" << fifo->GetMaxLevelForFifoBound() << + " \tFree_Slots_Min_Level:" << fifo->GetMinLevelForFifoFree() << + " \tCurrent_Frame#:" << currentFrameIndex; + } diff --git a/slsReceiverSoftware/src/ThreadObject.cpp b/slsReceiverSoftware/src/ThreadObject.cpp index cd381cc21..6c49d191f 100644 --- a/slsReceiverSoftware/src/ThreadObject.cpp +++ b/slsReceiverSoftware/src/ThreadObject.cpp @@ -74,7 +74,8 @@ void* ThreadObject::StartThread(void* thisPointer) { void ThreadObject::RunningThread() { - cprintf(BLUE,"Created [ %s Thread %d, Tid: %ld ]\n", GetType().c_str(),index, (long)syscall(SYS_gettid)); + FILE_LOG(logINFOBLUE) << "Created [ " << GetType() << "Thread " << index << ", " + "Tid: " << syscall(SYS_gettid) << "]"; while(true) { while(IsRunning()) { @@ -88,7 +89,8 @@ void ThreadObject::RunningThread() { sem_wait(&semaphore); if(killThread) { - cprintf(BLUE,"Exiting [ %s Thread %d, Tid: %ld ]\n", GetType().c_str(),index, (long)syscall(SYS_gettid)); + FILE_LOG(logINFOBLUE) << "Exiting [ " << GetType() << + " Thread " << index << ", Tid: " << syscall(SYS_gettid) << "]"; pthread_exit(NULL); } diff --git a/slsReceiverSoftware/src/main.cpp b/slsReceiverSoftware/src/main.cpp index 500c01748..d301dbb78 100644 --- a/slsReceiverSoftware/src/main.cpp +++ b/slsReceiverSoftware/src/main.cpp @@ -24,18 +24,21 @@ void sigInterruptHandler(int p){ keeprunning = false; } +/** Define Colors to print data call back in different colors for different recievers */ /* -int StartAcq(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*p){ - printf("#### StartAcq: filepath:%s filename:%s fileindex:%llu datasize:%u ####\n", - filepath, filename, fileindex, datasize); +#define PRINT_IN_COLOR(c,f, ...) printf ("\033[%dm" f RESET, 30 + c+1, ##__VA_ARGS__) - cprintf(BLUE, "--StartAcq: returning 0\n"); +int StartAcq(char* filepath, char* filename, uint64_t fileindex, uint32_t datasize, void*p){ + FILE_LOG(logINFO) << "#### StartAcq: " + "filepath: " << filepath << "filename: " << filename << + "fileindex: " << fileindex << "datasize: " << datasize << " ####"; + FILE_LOG(logINFO) << "--StartAcq: returning 0"; return 0; } void AcquisitionFinished(uint64_t frames, void*p){ - cprintf(BLUE, "#### AcquisitionFinished: frames:%llu ####\n",frames); + FILE_LOG(logINFO) << "#### AcquisitionFinished: frames:" << frames << " ####"; } @@ -45,16 +48,16 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){ PRINT_IN_COLOR (detectorHeader.modId?detectorHeader.modId:detectorHeader.row, "#### %d GetData: ####\n" - "frameNumber: %llu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %llu" - "\t\ttimestamp: %llu\t\tmodId: %u\t\t" - "xCrow%u\t\tcolumn: %u\t\tcolumn: %u\t\tdebug: %u" + "frameNumber: %lu\t\texpLength: %u\t\tpacketNumber: %u\t\tbunchId: %lu" + "\t\ttimestamp: %lu\t\tmodId: %u\t\t" + "row: %u\t\tcolumn: %u\t\treserved: %u\t\tdebug: %u" "\t\troundRNumber: %u\t\tdetType: %u\t\tversion: %u" //"\t\tpacketsMask:%s" "\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n", - detectorHeader.row, detectorHeader.frameNumber, - detectorHeader.expLength, detectorHeader.packetNumber, detectorHeader.bunchId, - detectorHeader.timestamp, detectorHeader.modId, - detectorHeader.row, detectorHeader.column, detectorHeader.column, + detectorHeader.row, (long unsigned int)detectorHeader.frameNumber, + detectorHeader.expLength, detectorHeader.packetNumber, (long unsigned int)detectorHeader.bunchId, + (long unsigned int)detectorHeader.timestamp, detectorHeader.modId, + detectorHeader.row, detectorHeader.column, detectorHeader.reserved, detectorHeader.debug, detectorHeader.roundRNumber, detectorHeader.detType, detectorHeader.version, //header->packetsMask.to_string().c_str(), @@ -66,7 +69,7 @@ void GetData(char* metadata, char* datapointer, uint32_t datasize, void* p){ int main(int argc, char *argv[]) { keeprunning = true; - cprintf(BLUE,"Created [ Tid: %ld ]\n", (long)syscall(SYS_gettid)); + FILE_LOG(logINFOBLUE) << "Created [ Tid: " << syscall(SYS_gettid) << " ]"; // Catch signal SIGINT to close files and call destructors properly struct sigaction sa; @@ -74,7 +77,7 @@ int main(int argc, char *argv[]) { sa.sa_handler=sigInterruptHandler; // handler function sigemptyset(&sa.sa_mask); // dont block additional signals during invocation of handler if (sigaction(SIGINT, &sa, NULL) == -1) { - cprintf(RED, "Could not set handler function for SIGINT\n"); + FILE_LOG(logERROR) << "Could not set handler function for SIGINT"; } @@ -85,7 +88,7 @@ int main(int argc, char *argv[]) { asa.sa_handler=SIG_IGN; // handler function sigemptyset(&asa.sa_mask); // dont block additional signals during invocation of handler if (sigaction(SIGPIPE, &asa, NULL) == -1) { - cprintf(RED, "Could not set handler function for SIGPIPE\n"); + FILE_LOG(logERROR) << "Could not set handler function for SIGPIPE"; } @@ -93,7 +96,7 @@ int main(int argc, char *argv[]) { slsReceiverUsers *receiver = new slsReceiverUsers(argc, argv, ret); if(ret==slsDetectorDefs::FAIL){ delete receiver; - cprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid)); + FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; exit(EXIT_FAILURE); } @@ -142,18 +145,18 @@ int main(int argc, char *argv[]) { //start tcp server thread if (receiver->start() == slsDetectorDefs::FAIL){ delete receiver; - cprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid)); + FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; exit(EXIT_FAILURE); } FILE_LOG(logINFO) << "Ready ... "; - cprintf(RESET, "\n[ Press \'Ctrl+c\' to exit ]\n"); + FILE_LOG(logINFO) << "[ Press \'Ctrl+c\' to exit ]"; while(keeprunning) pause(); delete receiver; - cprintf(BLUE,"Exiting [ Tid: %ld ]\n", (long)syscall(SYS_gettid)); - FILE_LOG(logINFO) << "Goodbye!"; + FILE_LOG(logINFOBLUE) << "Exiting [ Tid: " << syscall(SYS_gettid) << " ]"; + FILE_LOG(logINFO) << "Exiting Receiver"; return 0; } diff --git a/slsReceiverSoftware/src/slsReceiverImplementation.cpp b/slsReceiverSoftware/src/slsReceiverImplementation.cpp index 35c6813fc..94a156e76 100644 --- a/slsReceiverSoftware/src/slsReceiverImplementation.cpp +++ b/slsReceiverSoftware/src/slsReceiverImplementation.cpp @@ -24,16 +24,19 @@ /** cosntructor & destructor */ slsReceiverImplementation::slsReceiverImplementation() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; InitializeMembers(); } slsReceiverImplementation::~slsReceiverImplementation() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; DeleteMembers(); } void slsReceiverImplementation::DeleteMembers() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (generalData) { delete generalData; generalData=0; @@ -58,7 +61,7 @@ void slsReceiverImplementation::DeleteMembers() { void slsReceiverImplementation::InitializeMembers() { - + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; //**detector parameters*** myDetectorType = GENERIC; for (int i = 0; i < MAX_DIMENSIONS; ++i) @@ -113,7 +116,7 @@ void slsReceiverImplementation::InitializeMembers() { dataStreamEnable = false; streamingPort = 0; memset(streamingSrcIP, 0, sizeof(streamingSrcIP)); - memset(additionalJsonHeader, 0, sizeof(additionalJsonHeader)); + memset(additionalJsonHeader, 0, sizeof(additionalJsonHeader)); //** class objects *** generalData = 0; @@ -135,77 +138,77 @@ void slsReceiverImplementation::InitializeMembers() { /**initial parameters***/ int* slsReceiverImplementation::getMultiDetectorSize() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return (int*) numDet; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return (int*) numDet; } int slsReceiverImplementation::getDetectorPositionId() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return detID; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return detID; } std::string slsReceiverImplementation::getDetectorHostname() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; return std::string(detHostname); } int slsReceiverImplementation::getFlippedData(int axis) const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(axis<0 || axis > 1) return -1; return flippedData[axis]; } bool slsReceiverImplementation::getGapPixelsEnable() const { - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; return gapPixelsEnable; } /***file parameters***/ slsDetectorDefs::fileFormat slsReceiverImplementation::getFileFormat() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return fileFormatType; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return fileFormatType; } std::string slsReceiverImplementation::getFileName() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; return std::string(fileName); } std::string slsReceiverImplementation::getFilePath() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; return std::string(filePath); } uint64_t slsReceiverImplementation::getFileIndex() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return fileIndex; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return fileIndex; } uint32_t slsReceiverImplementation::getFramesPerFile() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return framesPerFile; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return framesPerFile; } slsDetectorDefs::frameDiscardPolicy slsReceiverImplementation::getFrameDiscardPolicy() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return frameDiscardMode; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return frameDiscardMode; } bool slsReceiverImplementation::getFramePaddingEnable() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return framePadding; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return framePadding; } bool slsReceiverImplementation::getFileWriteEnable() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return fileWriteEnable; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return fileWriteEnable; } bool slsReceiverImplementation::getOverwriteEnable() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return overwriteEnable; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return overwriteEnable; } @@ -261,130 +264,130 @@ int64_t slsReceiverImplementation::getAcquisitionIndex() const { /***connection parameters***/ uint32_t slsReceiverImplementation::getUDPPortNumber() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return udpPortNum[0]; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return udpPortNum[0]; } uint32_t slsReceiverImplementation::getUDPPortNumber2() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return udpPortNum[1]; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return udpPortNum[1]; } std::string slsReceiverImplementation::getEthernetInterface() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; return std::string(eth); } /***acquisition parameters***/ std::vector slsReceiverImplementation::getROI() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return roi; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return roi; } uint32_t slsReceiverImplementation::getStreamingFrequency() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return streamingFrequency; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return streamingFrequency; } uint32_t slsReceiverImplementation::getStreamingTimer() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return streamingTimerInMs; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return streamingTimerInMs; } bool slsReceiverImplementation::getDataStreamEnable() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return dataStreamEnable; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return dataStreamEnable; } uint64_t slsReceiverImplementation::getAcquisitionPeriod() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return acquisitionPeriod; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return acquisitionPeriod; } uint64_t slsReceiverImplementation::getAcquisitionTime() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return acquisitionTime; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return acquisitionTime; } uint64_t slsReceiverImplementation::getSubExpTime() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return subExpTime; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return subExpTime; } uint64_t slsReceiverImplementation::getSubPeriod() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return subPeriod; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return subPeriod; } uint64_t slsReceiverImplementation::getNumberOfFrames() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return numberOfFrames; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return numberOfFrames; } uint64_t slsReceiverImplementation::getNumberofSamples() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return numberOfSamples; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return numberOfSamples; } uint32_t slsReceiverImplementation::getDynamicRange() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return dynamicRange;} + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return dynamicRange;} bool slsReceiverImplementation::getTenGigaEnable() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return tengigaEnable; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return tengigaEnable; } uint32_t slsReceiverImplementation::getFifoDepth() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return fifoDepth; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return fifoDepth; } /***receiver status***/ slsDetectorDefs::runStatus slsReceiverImplementation::getStatus() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return status; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return status; } bool slsReceiverImplementation::getSilentMode() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return silentMode; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return silentMode; } bool slsReceiverImplementation::getActivate() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return activated; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return activated; } bool slsReceiverImplementation::getDeactivatedPadding() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return deactivatedPaddingEnable; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return deactivatedPaddingEnable; } uint32_t slsReceiverImplementation::getStreamingPort() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return streamingPort; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return streamingPort; } std::string slsReceiverImplementation::getStreamingSourceIP() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; return std::string(streamingSrcIP); } std::string slsReceiverImplementation::getAdditionalJsonHeader() const{ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return std::string(additionalJsonHeader); + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return std::string(additionalJsonHeader); } uint32_t slsReceiverImplementation::getUDPSocketBufferSize() const { - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return udpSocketBufferSize; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return udpSocketBufferSize; } uint32_t slsReceiverImplementation::getActualUDPSocketBufferSize() const { - FILE_LOG(logDEBUG) << __AT__ << " starting"; - return actualUDPSocketBufferSize; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + return actualUDPSocketBufferSize; } @@ -396,7 +399,7 @@ uint32_t slsReceiverImplementation::getActualUDPSocketBufferSize() const { /**initial parameters***/ void slsReceiverImplementation::setDetectorHostname(const char *c){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(strlen(c)) strcpy(detHostname, c); @@ -405,7 +408,7 @@ void slsReceiverImplementation::setDetectorHostname(const char *c){ void slsReceiverImplementation::setMultiDetectorSize(const int* size) { - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; char message[100]; strcpy(message, "Detector Size: ("); for (int i = 0; i < MAX_DIMENSIONS; ++i) { @@ -423,7 +426,7 @@ void slsReceiverImplementation::setMultiDetectorSize(const int* size) { void slsReceiverImplementation::setFlippedData(int axis, int enable){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(axis<0 || axis>1) return; flippedData[axis] = enable==0?0:1; FILE_LOG(logINFO) << "Flipped Data: " << flippedData[0] << " , " << flippedData[1]; @@ -469,7 +472,7 @@ void slsReceiverImplementation::setFileFormat(const fileFormat f){ void slsReceiverImplementation::setFileName(const char c[]){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(strlen(c)) strcpy(fileName, c); @@ -478,7 +481,7 @@ void slsReceiverImplementation::setFileName(const char c[]){ void slsReceiverImplementation::setFilePath(const char c[]){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(strlen(c)){ @@ -494,7 +497,7 @@ void slsReceiverImplementation::setFilePath(const char c[]){ void slsReceiverImplementation::setFileIndex(const uint64_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; fileIndex = i; FILE_LOG(logINFO) << "File Index: " << fileIndex; @@ -502,7 +505,7 @@ void slsReceiverImplementation::setFileIndex(const uint64_t i){ void slsReceiverImplementation::setFramesPerFile(const uint32_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; framesPerFile = i; FILE_LOG(logINFO) << "Frames per file: " << framesPerFile; @@ -510,7 +513,7 @@ void slsReceiverImplementation::setFramesPerFile(const uint32_t i){ void slsReceiverImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if (i >= 0 && i < NUM_DISCARD_POLICIES) frameDiscardMode = i; @@ -520,7 +523,7 @@ void slsReceiverImplementation::setFrameDiscardPolicy(const frameDiscardPolicy i void slsReceiverImplementation::setFramePaddingEnable(const bool i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; framePadding = i; FILE_LOG(logINFO) << "Frame Padding: " << framePadding; @@ -531,7 +534,7 @@ void slsReceiverImplementation::setFileWriteEnable(const bool b){ if (fileWriteEnable != b){ fileWriteEnable = b; for (unsigned int i = 0; i < dataProcessor.size(); ++i) { - dataProcessor[i]->SetupFileWriter(fileWriteEnable, (int*)numDet, + dataProcessor[i]->SetupFileWriter(fileWriteEnable, (int*)numDet, &framesPerFile, fileName, filePath, &fileIndex, &overwriteEnable, &detID, &numThreads, &numberOfFrames, &dynamicRange, &udpPortNum[i], generalData); @@ -543,7 +546,7 @@ void slsReceiverImplementation::setFileWriteEnable(const bool b){ void slsReceiverImplementation::setOverwriteEnable(const bool b){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; overwriteEnable = b; FILE_LOG(logINFO) << "Overwrite Enable: " << stringEnable(overwriteEnable); @@ -552,37 +555,37 @@ void slsReceiverImplementation::setOverwriteEnable(const bool b){ /***connection parameters***/ void slsReceiverImplementation::setUDPPortNumber(const uint32_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; udpPortNum[0] = i; FILE_LOG(logINFO) << "UDP Port Number[0]: " << udpPortNum[0]; } void slsReceiverImplementation::setUDPPortNumber2(const uint32_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; udpPortNum[1] = i; FILE_LOG(logINFO) << "UDP Port Number[1]: " << udpPortNum[1]; } void slsReceiverImplementation::setEthernetInterface(const char* c){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; strcpy(eth, c); FILE_LOG(logINFO) << "Ethernet Interface: " << eth; } int slsReceiverImplementation::setUDPSocketBufferSize(const uint32_t s) { - if (listener.size()) - return listener[0]->CreateDummySocketForUDPSocketBufferSize(s); - return FAIL; + if (listener.size()) + return listener[0]->CreateDummySocketForUDPSocketBufferSize(s); + return FAIL; } /***acquisition parameters***/ int slsReceiverImplementation::setROI(const std::vector i) { if (myDetectorType != GOTTHARD) { - cprintf(RED, "Error: Can not set ROI for this detector\n"); + FILE_LOG(logERROR) << "Can not set ROI for this detector"; return FAIL; } @@ -651,7 +654,7 @@ int slsReceiverImplementation::setStreamingFrequency(const uint32_t freq) { } void slsReceiverImplementation::setStreamingTimer(const uint32_t time_in_ms){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; streamingTimerInMs = time_in_ms; FILE_LOG(logINFO) << "Streamer Timer: " << streamingTimerInMs; @@ -669,23 +672,23 @@ int slsReceiverImplementation::setDataStreamEnable(const bool enable) { dataStreamer.clear(); if (enable) { - for ( int i = 0; i < numThreads; ++i ) { - try { - DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange, - &roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode); - dataStreamer.push_back(s); - dataStreamer[i]->SetGeneralData(generalData); - dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP); - } - catch(...) { - for (std::vector::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) - delete(*it); - dataStreamer.clear(); - dataStreamEnable = false; - return FAIL; - } - } - SetThreadPriorities(); + for ( int i = 0; i < numThreads; ++i ) { + try { + DataStreamer* s = new DataStreamer(i, fifo[i], &dynamicRange, + &roi, &fileIndex, flippedData, additionalJsonHeader, &silentMode); + dataStreamer.push_back(s); + dataStreamer[i]->SetGeneralData(generalData); + dataStreamer[i]->CreateZmqSockets(&numThreads, streamingPort, streamingSrcIP); + } + catch(...) { + for (std::vector::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) + delete(*it); + dataStreamer.clear(); + dataStreamEnable = false; + return FAIL; + } + } + SetThreadPriorities(); } } FILE_LOG(logINFO) << "Data Send to Gui: " << dataStreamEnable; @@ -701,21 +704,21 @@ void slsReceiverImplementation::setStreamingPort(const uint32_t i) { void slsReceiverImplementation::setStreamingSourceIP(const char c[]){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; strcpy(streamingSrcIP, c); FILE_LOG(logINFO) << "Streaming Source IP: " << streamingSrcIP; } void slsReceiverImplementation::setAdditionalJsonHeader(const char c[]){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; - strcpy(additionalJsonHeader, c); - FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + strcpy(additionalJsonHeader, c); + FILE_LOG(logINFO) << "Additional JSON Header: " << additionalJsonHeader; } int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; acquisitionPeriod = i; FILE_LOG(logINFO) << "Acquisition Period: " << (double)acquisitionPeriod/(1E9) << "s"; @@ -725,7 +728,7 @@ int slsReceiverImplementation::setAcquisitionPeriod(const uint64_t i){ } int slsReceiverImplementation::setAcquisitionTime(const uint64_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; acquisitionTime = i; FILE_LOG(logINFO) << "Acquisition Time: " << (double)acquisitionTime/(1E9) << "s"; @@ -735,21 +738,21 @@ int slsReceiverImplementation::setAcquisitionTime(const uint64_t i){ } void slsReceiverImplementation::setSubExpTime(const uint64_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; subExpTime = i; FILE_LOG(logINFO) << "Sub Exposure Time: " << (double)subExpTime/(1E9) << "s"; } void slsReceiverImplementation::setSubPeriod(const uint64_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; subPeriod = i; FILE_LOG(logINFO) << "Sub Exposure Period: " << (double)subPeriod/(1E9) << "s"; } int slsReceiverImplementation::setNumberOfFrames(const uint64_t i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; numberOfFrames = i; FILE_LOG(logINFO) << "Number of Frames: " << numberOfFrames; @@ -824,7 +827,7 @@ int slsReceiverImplementation::setFifoDepth(const uint32_t i) { /***receiver parameters***/ bool slsReceiverImplementation::setActivate(bool enable){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; activated = enable; FILE_LOG(logINFO) << "Activation: " << stringEnable(activated); return activated; @@ -832,14 +835,14 @@ bool slsReceiverImplementation::setActivate(bool enable){ bool slsReceiverImplementation::setDeactivatedPadding(bool enable){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; deactivatedPaddingEnable = enable; FILE_LOG(logINFO) << "Deactivated Padding Enable: " << stringEnable(deactivatedPaddingEnable); return deactivatedPaddingEnable; } void slsReceiverImplementation::setSilentMode(const bool i){ - FILE_LOG(logDEBUG) << __AT__ << " starting"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; silentMode = i; FILE_LOG(logINFO) << "Silent Mode: " << i; @@ -854,7 +857,7 @@ void slsReceiverImplementation::setSilentMode(const bool i){ /***initial functions***/ int slsReceiverImplementation::setDetectorType(const detectorType d) { - FILE_LOG(logDEBUG) << "Setting receiver type"; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; DeleteMembers(); InitializeMembers(); myDetectorType = d; @@ -897,30 +900,30 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) { //create threads for ( int i = 0; i < numThreads; ++i ) { - try { - Listener* l = new Listener(i, myDetectorType, fifo[i], &status, - &udpPortNum[i], eth, &numberOfFrames, &dynamicRange, - &udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile, + try { + Listener* l = new Listener(i, myDetectorType, fifo[i], &status, + &udpPortNum[i], eth, &numberOfFrames, &dynamicRange, + &udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile, &frameDiscardMode, &activated, &deactivatedPaddingEnable, &silentMode); - listener.push_back(l); + listener.push_back(l); - DataProcessor* p = new DataProcessor(i, myDetectorType, fifo[i], &fileFormatType, - fileWriteEnable, &dataStreamEnable, &gapPixelsEnable, - &dynamicRange, &streamingFrequency, &streamingTimerInMs, + DataProcessor* p = new DataProcessor(i, myDetectorType, fifo[i], &fileFormatType, + fileWriteEnable, &dataStreamEnable, &gapPixelsEnable, + &dynamicRange, &streamingFrequency, &streamingTimerInMs, &framePadding, &activated, &deactivatedPaddingEnable, &silentMode, - rawDataReadyCallBack, rawDataModifyReadyCallBack, pRawDataReady); - dataProcessor.push_back(p); - } - catch (...) { - FILE_LOG(logERROR) << "Could not create listener/dataprocessor threads (index:" << i << ")"; - for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) - delete(*it); - listener.clear(); - for (std::vector::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) - delete(*it); - dataProcessor.clear(); - return FAIL; - } + rawDataReadyCallBack, rawDataModifyReadyCallBack, pRawDataReady); + dataProcessor.push_back(p); + } + catch (...) { + FILE_LOG(logERROR) << "Could not create listener/dataprocessor threads (index:" << i << ")"; + for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) + delete(*it); + listener.clear(); + for (std::vector::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) + delete(*it); + dataProcessor.clear(); + return FAIL; + } } //set up writer and callbacks @@ -931,8 +934,8 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) { SetThreadPriorities(); - // check udp socket buffer size - setUDPSocketBufferSize(udpSocketBufferSize); + // check udp socket buffer size + setUDPSocketBufferSize(udpSocketBufferSize); FILE_LOG(logDEBUG) << " Detector type set to " << getDetectorType(d); return OK; @@ -942,6 +945,7 @@ int slsReceiverImplementation::setDetectorType(const detectorType d) { void slsReceiverImplementation::setDetectorPositionId(const int i){ + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; detID = i; FILE_LOG(logINFO) << "Detector Position Id:" << detID; for (unsigned int i = 0; i < dataProcessor.size(); ++i) { @@ -962,6 +966,7 @@ void slsReceiverImplementation::setDetectorPositionId(const int i){ /***acquisition functions***/ void slsReceiverImplementation::resetAcquisitionCount() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) (*it)->ResetParametersforNewAcquisition(); @@ -977,7 +982,7 @@ void slsReceiverImplementation::resetAcquisitionCount() { int slsReceiverImplementation::startReceiver(char *c) { - cprintf(RESET,"\n"); + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; FILE_LOG(logINFO) << "Starting Receiver"; ResetParametersforNewMeasurement(); @@ -1023,6 +1028,7 @@ int slsReceiverImplementation::startReceiver(char *c) { void slsReceiverImplementation::stopReceiver(){ + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; FILE_LOG(logINFO) << "Stopping Receiver"; //set status to transmitting @@ -1031,14 +1037,14 @@ void slsReceiverImplementation::stopReceiver(){ //wait for the processes (Listener and DataProcessor) to be done bool running = true; while(running) { - running = false; - for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) - if ((*it)->IsRunning()) - running = true; - for (std::vector::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) - if ((*it)->IsRunning()) - running = true; - usleep(5000); + running = false; + for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) + if ((*it)->IsRunning()) + running = true; + for (std::vector::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) + if ((*it)->IsRunning()) + running = true; + usleep(5000); } @@ -1057,13 +1063,13 @@ void slsReceiverImplementation::stopReceiver(){ //wait for the processes (DataStreamer) to be done running = true; - while(running) { - running = false; - for (std::vector::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) - if ((*it)->IsRunning()) - running = true; - usleep(5000); - } + while(running) { + running = false; + for (std::vector::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) + if ((*it)->IsRunning()) + running = true; + usleep(5000); + } status = RUN_FINISHED; FILE_LOG(logINFO) << "Status: " << runStatusType(status); @@ -1075,20 +1081,15 @@ void slsReceiverImplementation::stopReceiver(){ tot += dataProcessor[i]->GetNumFramesCaught(); uint64_t missingpackets = numberOfFrames*generalData->packetsPerFrame-listener[i]->GetPacketsCaught(); - if ((int)missingpackets > 0) { - cprintf(RED, "\n[Port %d]\n",udpPortNum[i]); - cprintf(RED, "Missing Packets\t\t: %lld\n",(long long int)missingpackets); - cprintf(RED, "Complete Frames\t\t: %lld\n",(long long int)dataProcessor[i]->GetNumFramesCaught()); - cprintf(RED, "Last Frame Caught\t: %lld\n",(long long int)listener[i]->GetLastFrameIndexCaught()); - }else{ - cprintf(GREEN, "\n[Port %d]\n",udpPortNum[i]); - cprintf(GREEN, "Missing Packets\t\t: %lld\n",(long long int)missingpackets); - cprintf(GREEN, "Complete Frames\t\t: %lld\n",(long long int)dataProcessor[i]->GetNumFramesCaught()); - cprintf(GREEN, "Last Frame Caught\t: %lld\n",(long long int)listener[i]->GetLastFrameIndexCaught()); - } + FILE_LOG(((int)missingpackets > 0) ? logINFORED : logINFOGREEN) << + "Summary of Port " << udpPortNum[i] << + "\n\tMissing Packets\t\t: " << missingpackets << + "\n\tComplete Frames\t\t: " << dataProcessor[i]->GetNumFramesCaught() << + "\n\tLast Frame Caught\t: " << listener[i]->GetLastFrameIndexCaught(); + } + if(!activated) { + FILE_LOG(logINFORED) << "Deactivated Receiver"; } - if(!activated) - cprintf(RED,"Note: Deactivated Receiver\n"); //callback if (acquisitionFinishedCallBack) acquisitionFinishedCallBack((tot/numThreads), pAcquisitionFinished); @@ -1104,6 +1105,7 @@ void slsReceiverImplementation::stopReceiver(){ void slsReceiverImplementation::startReadout(){ + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; if(status == RUNNING){ // wait for incoming delayed packets @@ -1117,11 +1119,8 @@ void slsReceiverImplementation::startReadout(){ //wait as long as there is change from prev totalP, while(prev != totalP){ -#ifdef VERY_VERBOSE - cprintf(MAGENTA,"waiting for all packets prevP:%d totalP:%d\n", - prev,totalP); - -#endif + FILE_LOG(logDEBUG3) << "waiting for all packets prevP:" << prev << + " totalP: " << totalP; //usleep(1*1000*1000);usleep(1*1000*1000);usleep(1*1000*1000);usleep(1*1000*1000); usleep(5*1000);/* Need to find optimal time **/ @@ -1130,9 +1129,7 @@ void slsReceiverImplementation::startReadout(){ for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) totalP += (*it)->GetPacketsCaught(); -#ifdef VERY_VERBOSE - cprintf(MAGENTA,"\tupdated: totalP:%d\n",totalP); -#endif + FILE_LOG(logDEBUG3) << "\tupdated: totalP:" << totalP; } } @@ -1147,6 +1144,7 @@ void slsReceiverImplementation::startReadout(){ void slsReceiverImplementation::shutDownUDPSockets() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) (*it)->ShutDownUDPSocket(); } @@ -1154,6 +1152,7 @@ void slsReceiverImplementation::shutDownUDPSockets() { void slsReceiverImplementation::closeFiles() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; uint64_t maxIndexCaught = 0; bool anycaught = false; for (std::vector::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) { @@ -1168,6 +1167,7 @@ void slsReceiverImplementation::closeFiles() { int slsReceiverImplementation::restreamStop() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; bool ret = OK; for (std::vector::const_iterator it = dataStreamer.begin(); it != dataStreamer.end(); ++it) { if ((*it)->RestreamStop() == FAIL) @@ -1202,40 +1202,41 @@ void slsReceiverImplementation::registerCallBackRawDataReady(void (*func)(char* } void slsReceiverImplementation::registerCallBackRawDataModifyReady(void (*func)(char* , - char*, uint32_t&, void*),void *arg){ - rawDataModifyReadyCallBack=func; - pRawDataReady=arg; + char*, uint32_t&, void*),void *arg){ + rawDataModifyReadyCallBack=func; + pRawDataReady=arg; } void slsReceiverImplementation::SetLocalNetworkParameters() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; // to increase Max length of input packet queue int max_back_log; const char *proc_file_name = "/proc/sys/net/core/netdev_max_backlog"; { - std::ifstream proc_file(proc_file_name); - proc_file >> max_back_log; + std::ifstream proc_file(proc_file_name); + proc_file >> max_back_log; } if (max_back_log < MAX_SOCKET_INPUT_PACKET_QUEUE) { - std::ofstream proc_file(proc_file_name); - if (proc_file.good()) { - proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << std::endl; - cprintf(GREEN, "Max length of input packet queue " - "[/proc/sys/net/core/netdev_max_backlog] modified to %d\n", - MAX_SOCKET_INPUT_PACKET_QUEUE); - } else { - const char *msg = "Could not change max length of " - "input packet queue [net.core.netdev_max_backlog]. (No Root Privileges?)"; - FILE_LOG(logWARNING) << msg; - } + std::ofstream proc_file(proc_file_name); + if (proc_file.good()) { + proc_file << MAX_SOCKET_INPUT_PACKET_QUEUE << std::endl; + FILE_LOG(logINFOBLUE) << "Max length of input packet queue " + "[/proc/sys/net/core/netdev_max_backlog] modified to " << + MAX_SOCKET_INPUT_PACKET_QUEUE; + } else { + FILE_LOG(logWARNING) << "Could not change max length of " + "input packet queue [net.core.netdev_max_backlog]. (No Root Privileges?)"; + } } } void slsReceiverImplementation::SetThreadPriorities() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it){ if ((*it)->SetThreadPriority(LISTENER_PRIORITY) == FAIL) { @@ -1252,7 +1253,8 @@ void slsReceiverImplementation::SetThreadPriorities() { int slsReceiverImplementation::SetupFifoStructure() { - numberofJobs = 1; + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; + numberofJobs = 1; for (std::vector::const_iterator it = fifo.begin(); it != fifo.end(); ++it) @@ -1261,18 +1263,18 @@ int slsReceiverImplementation::SetupFifoStructure() { for ( int i = 0; i < numThreads; ++i ) { //create fifo structure - try { - Fifo* f = new Fifo (i, - (generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize), - fifoDepth); - fifo.push_back(f); - } catch (...) { - cprintf(RED,"Error: Could not allocate memory for fifo structure of index %d\n", i); - for (std::vector::const_iterator it = fifo.begin(); it != fifo.end(); ++it) - delete(*it); - fifo.clear(); - return FAIL; - } + try { + Fifo* f = new Fifo (i, + (generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize), + fifoDepth); + fifo.push_back(f); + } catch (...) { + FILE_LOG(logERROR) << "Could not allocate memory for fifo structure of index " << i; + for (std::vector::const_iterator it = fifo.begin(); it != fifo.end(); ++it) + delete(*it); + fifo.clear(); + return FAIL; + } //set the listener & dataprocessor threads to point to the right fifo if(listener.size())listener[i]->SetFifo(fifo[i]); if(dataProcessor.size())dataProcessor[i]->SetFifo(fifo[i]); @@ -1287,6 +1289,7 @@ int slsReceiverImplementation::SetupFifoStructure() { void slsReceiverImplementation::ResetParametersforNewMeasurement() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) (*it)->ResetParametersforNewMeasurement(); for (std::vector::const_iterator it = dataProcessor.begin(); it != dataProcessor.end(); ++it) @@ -1303,6 +1306,7 @@ void slsReceiverImplementation::ResetParametersforNewMeasurement() { int slsReceiverImplementation::CreateUDPSockets() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; bool error = false; for (unsigned int i = 0; i < listener.size(); ++i) if (listener[i]->CreateUDPSockets() == FAIL) { @@ -1320,6 +1324,7 @@ int slsReceiverImplementation::CreateUDPSockets() { int slsReceiverImplementation::SetupWriter() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; bool error = false; for (unsigned int i = 0; i < dataProcessor.size(); ++i) if (dataProcessor[i]->CreateNewFile(tengigaEnable, @@ -1338,6 +1343,7 @@ int slsReceiverImplementation::SetupWriter() { void slsReceiverImplementation::StartRunning() { + FILE_LOG(logDEBUG3) << __SHORT_AT__ << " called"; //set running mask and post semaphore to start the inner loop in execution thread for (std::vector::const_iterator it = listener.begin(); it != listener.end(); ++it) { (*it)->StartRunning(); diff --git a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp index 92645edb0..67503f615 100644 --- a/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp +++ b/slsReceiverSoftware/src/slsReceiverTCPIPInterface.cpp @@ -141,7 +141,7 @@ void* slsReceiverTCPIPInterface::startTCPServerThread(void *this_pointer){ void slsReceiverTCPIPInterface::startTCPServer(){ - cprintf(BLUE,"Created [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid)); + FILE_LOG(logINFOBLUE) << "Created [ TCP server Tid: " << syscall(SYS_gettid) << "]";; FILE_LOG(logINFO) << "SLS Receiver starting TCP Server on port " << portNumber << std::endl; int ret = OK; @@ -159,7 +159,7 @@ void slsReceiverTCPIPInterface::startTCPServer(){ } mySock->exitServer(); - cprintf(BLUE,"Exiting [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid)); + FILE_LOG(logINFOBLUE) << "Exiting [ TCP server Tid: " << syscall(SYS_gettid) <<"]"; pthread_exit(NULL); } @@ -170,7 +170,7 @@ void slsReceiverTCPIPInterface::startTCPServer(){ receiver->shutDownUDPSockets(); } } - cprintf(BLUE,"Exiting [ TCP server Tid: %ld ]\n", (long)syscall(SYS_gettid)); + FILE_LOG(logINFOBLUE) << "Exiting [ TCP server Tid: " << syscall(SYS_gettid) <<"]"; pthread_exit(NULL); } } @@ -229,7 +229,7 @@ int slsReceiverTCPIPInterface::function_table(){ flist[F_RECEIVER_DEACTIVATED_PADDING_ENABLE] = &slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable; for (int i = NUM_DET_FUNCTIONS + 1; i < NUM_REC_FUNCTIONS ; i++) { - FILE_LOG(logDEBUG5) << "function fnum: " << i << " (" << + FILE_LOG(logDEBUG1) << "function fnum: " << i << " (" << getFunctionNameFromEnum((enum detFuncs)i) << ") located at " << flist[i]; } @@ -243,28 +243,29 @@ int slsReceiverTCPIPInterface::decode_function(){ ret = FAIL; int n = mySock->ReceiveDataOnly(&fnum,sizeof(fnum)); if (n <= 0) { - FILE_LOG(logDEBUG5) << "Could not read socket. " + FILE_LOG(logDEBUG3) << "Could not read socket. " "Received " << n << " bytes," << "fnum:" << fnum << " " "(" << getFunctionNameFromEnum((enum detFuncs)fnum) << ")"; return FAIL; } else - FILE_LOG(logDEBUG5) << "Received " << n << " bytes"; + FILE_LOG(logDEBUG3) << "Received " << n << " bytes"; if (fnum <= NUM_DET_FUNCTIONS || fnum >= NUM_REC_FUNCTIONS) { FILE_LOG(logERROR) << "Unknown function enum " << fnum; ret = (this->M_nofunc)(); } else{ - FILE_LOG(logDEBUG5) << "calling function fnum: "<< fnum << " " + FILE_LOG(logDEBUG1) << "calling function fnum: "<< fnum << " " "(" << getFunctionNameFromEnum((enum detFuncs)fnum) << ") " "located at " << flist[fnum]; ret = (this->*flist[fnum])(); if (ret == FAIL) { - FILE_LOG(logDEBUG5) << "Failed to execute function = " << fnum << " (" + FILE_LOG(logDEBUG1) << "Failed to execute function = " << fnum << " (" << getFunctionNameFromEnum((enum detFuncs)fnum) << ")"; - } + } else FILE_LOG(logDEBUG1) << "Function " << + getFunctionNameFromEnum((enum detFuncs)fnum) << " executed OK"; } return ret; } @@ -352,7 +353,7 @@ int slsReceiverTCPIPInterface::exec_command() { int slsReceiverTCPIPInterface::exit_server() { - cprintf(BG_RED, "Closing server\n"); + FILE_LOG(logINFO) << "Closing server"; ret = OK; memset(mess, 0, sizeof(mess)); interface->Server_SendResult(false, ret, NULL, 0); @@ -369,7 +370,7 @@ int slsReceiverTCPIPInterface::lock_receiver() { // get args, return if socket crashed if (interface->Server_ReceiveArg(ret, mess, &lock, sizeof(lock)) == FAIL) return FAIL; - FILE_LOG(logDEBUG5) << "Locking Server to " << lock; + FILE_LOG(logDEBUG1) << "Locking Server to " << lock; // execute action if (lock >= 0) { @@ -642,7 +643,7 @@ int slsReceiverTCPIPInterface::set_detector_hostname() { // get std::string s = receiver->getDetectorHostname(); strcpy(retval, s.c_str()); - if (s.length()) { + if (!s.length()) { ret = FAIL; sprintf(mess, "hostname not set\n"); FILE_LOG(logERROR) << mess; @@ -675,9 +676,9 @@ int slsReceiverTCPIPInterface::set_roi() { return interface->Server_SocketCrash(); arg.push_back(temp); } - FILE_LOG(logDEBUG5) << "Set ROI narg: " << narg; + FILE_LOG(logDEBUG1) << "Set ROI narg: " << narg; for (int iloop = 0; iloop < narg; ++iloop) { - FILE_LOG(logDEBUG5) << "(" << arg[iloop].xmin << ", " << + FILE_LOG(logDEBUG1) << "(" << arg[iloop].xmin << ", " << arg[iloop].xmax << ", " << arg[iloop].ymin << ", " << arg[iloop].ymax << ")"; } @@ -705,7 +706,7 @@ int slsReceiverTCPIPInterface::setup_udp(){ ret = OK; memset(mess, 0, sizeof(mess)); char args[3][MAX_STR_LENGTH] = {0}; - char retval[MAX_STR_LENGTH] = {0}; + char retvals[MAX_STR_LENGTH] = {0}; // get args, return if socket crashed, ret is fail if receiver is not null if (interface->Server_ReceiveArg(ret, mess, args, sizeof(args), true, receiver) == FAIL) @@ -755,13 +756,13 @@ int slsReceiverTCPIPInterface::setup_udp(){ FILE_LOG(logERROR) << mess; } else { - strcpy(retval,temp.c_str()); - FILE_LOG(logINFO) << "Reciever MAC Address: " << retval; + strcpy(retvals,temp.c_str()); + FILE_LOG(logINFO) << "Reciever MAC Address: " << retvals; } } } } - return interface->Server_SendResult(true, ret, retval, sizeof(retval), mess); + return interface->Server_SendResult(true, ret, retvals, sizeof(retvals), mess); } @@ -778,7 +779,7 @@ int slsReceiverTCPIPInterface::set_timer() { // base object not null if (ret == OK) { - FILE_LOG(logDEBUG5) << "Setting timer index " << index[0] << " to " << index[1]; + FILE_LOG(logDEBUG1) << "Setting timer index " << index[0] << " to " << index[1]; // set if (index[1] >= 0) { @@ -848,7 +849,7 @@ int slsReceiverTCPIPInterface::set_timer() { break; } validate((int)index[1], (int)retval, std::string("set timer"), 0); - FILE_LOG(logDEBUG5) << slsDetectorDefs::getTimerType((timerIndex)(index[0])) << ":" << retval; + FILE_LOG(logDEBUG1) << slsDetectorDefs::getTimerType((timerIndex)(index[0])) << ":" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -871,7 +872,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() { if (dr >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting dynamic range: " << dr; + FILE_LOG(logDEBUG1) << "Setting dynamic range: " << dr; bool exists = false; switch (dr) { case 16: @@ -903,7 +904,7 @@ int slsReceiverTCPIPInterface::set_dynamic_range() { // get retval = receiver->getDynamicRange(); validate(dr, retval, std::string("set dynamic range"), 0); - FILE_LOG(logDEBUG5) << "dynamic range: " << retval; + FILE_LOG(logDEBUG1) << "dynamic range: " << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -926,7 +927,7 @@ int slsReceiverTCPIPInterface::set_streaming_frequency() { if (index >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting streaming frequency: " << index; + FILE_LOG(logDEBUG1) << "Setting streaming frequency: " << index; ret = receiver->setStreamingFrequency(index); if(ret == FAIL) { strcpy(mess, "Could not allocate memory for listening fifo\n"); @@ -952,9 +953,9 @@ int slsReceiverTCPIPInterface::get_status(){ interface->Server_ReceiveArg(ret, mess, NULL, 0, true, receiver); if (ret == OK) { - FILE_LOG(logDEBUG5) << "Getting Status"; + FILE_LOG(logDEBUG1) << "Getting Status"; retval = receiver->getStatus(); - FILE_LOG(logDEBUG5) << "Status:" << runStatusType(retval); + FILE_LOG(logDEBUG1) << "Status:" << runStatusType(retval); } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -980,7 +981,7 @@ int slsReceiverTCPIPInterface::start_receiver(){ sprintf(mess,"Cannot start Receiver as it is in %s state\n",runStatusType(s).c_str()); FILE_LOG(logERROR) << mess; }else { - FILE_LOG(logDEBUG5) << "Starting Reciever"; + FILE_LOG(logDEBUG1) << "Starting Reciever"; ret = receiver->startReceiver(mess); if (ret == FAIL) { FILE_LOG(logERROR) << mess; @@ -1006,7 +1007,7 @@ int slsReceiverTCPIPInterface::stop_receiver(){ // verify if receiver is unlocked if (interface->Server_VerifyLock(ret, mess, lockStatus) == OK) { if(receiver->getStatus() != IDLE) { - FILE_LOG(logDEBUG5) << "Stopping Reciever"; + FILE_LOG(logDEBUG1) << "Stopping Reciever"; receiver->stopReceiver(); } enum runStatus s = receiver->getStatus(); @@ -1038,18 +1039,18 @@ int slsReceiverTCPIPInterface::set_file_dir() { if (ret == OK) { // set if (strlen(fPath)) { - FILE_LOG(logDEBUG5) << "Setting file path: " << fPath; + FILE_LOG(logDEBUG1) << "Setting file path: " << fPath; receiver->setFilePath(fPath); } // get std::string s = receiver->getFilePath(); strcpy(retval, s.c_str()); - if ((s.length()) || (strlen(fPath) && strcasecmp(fPath, retval))) { + if ((!s.length()) || (strlen(fPath) && strcasecmp(fPath, retval))) { ret = FAIL; strcpy(mess,"receiver file path does not exist\n"); FILE_LOG(logERROR) << mess; } else - FILE_LOG(logDEBUG5) << "file path:" << retval; + FILE_LOG(logDEBUG1) << "file path:" << retval; } return interface->Server_SendResult(true, ret, retval, MAX_STR_LENGTH, mess); } @@ -1070,18 +1071,18 @@ int slsReceiverTCPIPInterface::set_file_name() { if (ret == OK) { // set if (strlen(fName)) { - FILE_LOG(logDEBUG5) << "Setting file name: " << fName; + FILE_LOG(logDEBUG1) << "Setting file name: " << fName; receiver->setFileName(fName); } // get std::string s = receiver->getFileName(); strcpy(retval, s.c_str()); - if (s.length()) { + if (!s.length()) { ret = FAIL; strcpy(mess, "file name is empty\n"); FILE_LOG(logERROR) << mess; } else - FILE_LOG(logDEBUG5) << "file name:" << retval; + FILE_LOG(logDEBUG1) << "file name:" << retval; } return interface->Server_SendResult(true, ret, retval, MAX_STR_LENGTH, mess); } @@ -1104,14 +1105,14 @@ int slsReceiverTCPIPInterface::set_file_index() { if (index >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting file index: " << index; + FILE_LOG(logDEBUG1) << "Setting file index: " << index; receiver->setFileIndex(index); } } // get retval=receiver->getFileIndex(); validate(index, retval, std::string("set file index"), 0); - FILE_LOG(logDEBUG5) << "file index:" << retval; + FILE_LOG(logDEBUG1) << "file index:" << retval; } return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess); } @@ -1127,9 +1128,9 @@ int slsReceiverTCPIPInterface::get_frame_index(){ interface->Server_ReceiveArg(ret, mess, NULL, 0, true, receiver); if (ret == OK) { - FILE_LOG(logDEBUG5) << "Getting frame index"; + FILE_LOG(logDEBUG1) << "Getting frame index"; retval = receiver->getAcquisitionIndex(); - FILE_LOG(logDEBUG5) << "frame index:" << retval; + FILE_LOG(logDEBUG1) << "frame index:" << retval; } return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess); } @@ -1145,9 +1146,9 @@ int slsReceiverTCPIPInterface::get_frames_caught(){ interface->Server_ReceiveArg(ret, mess, NULL, 0, true, receiver); if (ret == OK) { - FILE_LOG(logDEBUG5) << "Getting frames caught"; + FILE_LOG(logDEBUG1) << "Getting frames caught"; retval = receiver->getTotalFramesCaught(); - FILE_LOG(logDEBUG5) << "frames caught:" << retval; + FILE_LOG(logDEBUG1) << "frames caught:" << retval; } return interface->Server_SendResult(true, ret, &retval,sizeof(retval), mess); } @@ -1166,7 +1167,7 @@ int slsReceiverTCPIPInterface::reset_frames_caught(){ // only set // verify if receiver is unlocked if (interface->Server_VerifyLock(ret, mess, lockStatus) == OK) { - FILE_LOG(logDEBUG5) << "Reset frames caught"; + FILE_LOG(logDEBUG1) << "Reset frames caught"; receiver->resetAcquisitionCount(); } } @@ -1191,14 +1192,14 @@ int slsReceiverTCPIPInterface::enable_file_write(){ if (enable >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting File write enable:" << enable; + FILE_LOG(logDEBUG1) << "Setting File write enable:" << enable; receiver->setFileWriteEnable(enable); } } // get retval = receiver->getFileWriteEnable(); validate(enable, retval, std::string("set file write enable"), 0); - FILE_LOG(logDEBUG5) << "file write enable:" << retval; + FILE_LOG(logDEBUG1) << "file write enable:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1221,14 +1222,14 @@ int slsReceiverTCPIPInterface::enable_overwrite() { if (index >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting File overwrite enable:" << index; + FILE_LOG(logDEBUG1) << "Setting File overwrite enable:" << index; receiver->setOverwriteEnable(index); } } // get retval = receiver->getOverwriteEnable(); validate(index, retval, std::string("set file overwrite enable"), 0); - FILE_LOG(logDEBUG5) << "file overwrite enable:" << retval; + FILE_LOG(logDEBUG1) << "file overwrite enable:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1254,14 +1255,14 @@ int slsReceiverTCPIPInterface::enable_tengiga() { if (val >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting 10GbE:" << val; + FILE_LOG(logDEBUG1) << "Setting 10GbE:" << val; ret = receiver->setTenGigaEnable(val); } } // get retval = receiver->getTenGigaEnable(); validate(val, retval, std::string("set 10GbE"), 0); - FILE_LOG(logDEBUG5) << "10Gbe:" << retval; + FILE_LOG(logDEBUG1) << "10Gbe:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1284,7 +1285,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() { if (value >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting fifo depth:" << value; + FILE_LOG(logDEBUG1) << "Setting fifo depth:" << value; ret = receiver->setFifoDepth(value); if (ret == FAIL) { strcpy(mess,"Could not set fifo depth"); @@ -1295,7 +1296,7 @@ int slsReceiverTCPIPInterface::set_fifo_depth() { // get retval = receiver->getFifoDepth(); validate(value, retval, std::string("set fifo depth"), 0); - FILE_LOG(logDEBUG5) << "fifo depth:" << retval; + FILE_LOG(logDEBUG1) << "fifo depth:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1321,14 +1322,14 @@ int slsReceiverTCPIPInterface::set_activate() { if (enable >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting activate:" << enable; + FILE_LOG(logDEBUG1) << "Setting activate:" << enable; receiver->setActivate(enable > 0 ? true : false); } } // get retval = (int)receiver->getActivate(); validate(enable, retval, std::string("set activate"), 0); - FILE_LOG(logDEBUG5) << "Activate: " << retval; + FILE_LOG(logDEBUG1) << "Activate: " << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1351,14 +1352,14 @@ int slsReceiverTCPIPInterface::set_data_stream_enable(){ if (index >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting data stream enable:" << index; + FILE_LOG(logDEBUG1) << "Setting data stream enable:" << index; ret = receiver->setDataStreamEnable(index); } } // get retval = receiver->getDataStreamEnable(); validate(index, retval, std::string("set data stream enable"), 0); - FILE_LOG(logDEBUG5) << "data streaming enable:" << retval; + FILE_LOG(logDEBUG1) << "data streaming enable:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1381,14 +1382,14 @@ int slsReceiverTCPIPInterface::set_streaming_timer(){ if (index >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting streaming timer:" << index; + FILE_LOG(logDEBUG1) << "Setting streaming timer:" << index; receiver->setStreamingTimer(index); } } // get retval=receiver->getStreamingTimer(); validate(index, retval, std::string("set data stream timer"), 0); - FILE_LOG(logDEBUG5) << "Streaming timer:" << retval; + FILE_LOG(logDEBUG1) << "Streaming timer:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1414,14 +1415,14 @@ int slsReceiverTCPIPInterface::set_flipped_data(){ if (args[1] >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting flipped data:" << args[1]; + FILE_LOG(logDEBUG1) << "Setting flipped data:" << args[1]; receiver->setFlippedData(args[0],args[1]); } } // get retval=receiver->getFlippedData(args[0]); validate(args[1], retval, std::string("set flipped data"), 0); - FILE_LOG(logDEBUG5) << "Flipped Data:" << retval; + FILE_LOG(logDEBUG1) << "Flipped Data:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1444,14 +1445,14 @@ int slsReceiverTCPIPInterface::set_file_format() { if (f >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting file format:" << f; + FILE_LOG(logDEBUG1) << "Setting file format:" << f; receiver->setFileFormat(f); } } // get retval = receiver->getFileFormat(); validate(f, retval, std::string("set file format"), 0); - FILE_LOG(logDEBUG5) << "File Format: " << retval; + FILE_LOG(logDEBUG1) << "File Format: " << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1474,14 +1475,14 @@ int slsReceiverTCPIPInterface::set_detector_posid() { if (arg >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting detector position id:" << arg; + FILE_LOG(logDEBUG1) << "Setting detector position id:" << arg; receiver->setDetectorPositionId(arg); } } // get retval = receiver->getDetectorPositionId(); validate(arg, retval, std::string("set detector position id"), 0); - FILE_LOG(logDEBUG5) << "Position Id:" << retval; + FILE_LOG(logDEBUG1) << "Position Id:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1504,7 +1505,7 @@ int slsReceiverTCPIPInterface::set_multi_detector_size() { if((arg[0] > 0) && (arg[1] > 0)) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting multi detector size:" << arg[0] << "," << arg[1]; + FILE_LOG(logDEBUG1) << "Setting multi detector size:" << arg[0] << "," << arg[1]; receiver->setMultiDetectorSize(arg); } } @@ -1516,7 +1517,7 @@ int slsReceiverTCPIPInterface::set_multi_detector_size() { else retval *= temp[i]; } - FILE_LOG(logDEBUG5) << "Multi Detector Size:" << retval; + FILE_LOG(logDEBUG1) << "Multi Detector Size:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1539,14 +1540,14 @@ int slsReceiverTCPIPInterface::set_streaming_port() { if (port >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting streaming port:" << port; + FILE_LOG(logDEBUG1) << "Setting streaming port:" << port; receiver->setStreamingPort(port); } } // get retval = receiver->getStreamingPort(); validate(port, retval, std::string("set streaming port"), 0); - FILE_LOG(logDEBUG5) << "streaming port:" << retval; + FILE_LOG(logDEBUG1) << "streaming port:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1568,12 +1569,12 @@ int slsReceiverTCPIPInterface::set_streaming_source_ip() { // only set // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting streaming source ip:" << arg; + FILE_LOG(logDEBUG1) << "Setting streaming source ip:" << arg; receiver->setStreamingSourceIP(arg); } // get strcpy(retval, receiver->getStreamingSourceIP().c_str()); - FILE_LOG(logDEBUG5) << "streaming source ip:" << retval; + FILE_LOG(logDEBUG1) << "streaming source ip:" << retval; } return interface->Server_SendResult(true, ret, retval, MAX_STR_LENGTH, mess); } @@ -1596,14 +1597,14 @@ int slsReceiverTCPIPInterface::set_silent_mode() { if (value >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting silent mode:" << value; + FILE_LOG(logDEBUG1) << "Setting silent mode:" << value; receiver->setSilentMode(value); } } // get retval = (int)receiver->getSilentMode(); validate(value, retval, std::string("set silent mode"), 0); - FILE_LOG(logDEBUG5) << "silent mode:" << retval; + FILE_LOG(logDEBUG1) << "silent mode:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1629,14 +1630,14 @@ int slsReceiverTCPIPInterface::enable_gap_pixels() { if (enable >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting gap pixels enable:" << enable; + FILE_LOG(logDEBUG1) << "Setting gap pixels enable:" << enable; receiver->setGapPixelsEnable(enable); } } // get retval = receiver->getGapPixelsEnable(); validate(enable, retval, std::string("set gap pixels enable"), 0); - FILE_LOG(logDEBUG5) << "Gap Pixels Enable: " << retval; + FILE_LOG(logDEBUG1) << "Gap Pixels Enable: " << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1660,7 +1661,7 @@ int slsReceiverTCPIPInterface::restream_stop(){ sprintf(mess,"Could not restream stop packet as data Streaming is disabled.\n"); FILE_LOG(logERROR) << mess; } else { - FILE_LOG(logDEBUG5) << "Restreaming stop"; + FILE_LOG(logDEBUG1) << "Restreaming stop"; ret = receiver->restreamStop(); if (ret == FAIL) { sprintf(mess,"Could not restream stop packet.\n"); @@ -1689,12 +1690,12 @@ int slsReceiverTCPIPInterface::set_additional_json_header() { // only set // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting additional json header: " << arg; + FILE_LOG(logDEBUG1) << "Setting additional json header: " << arg; receiver->setAdditionalJsonHeader(arg); } // get strcpy(retval, receiver->getAdditionalJsonHeader().c_str()); - FILE_LOG(logDEBUG5) << "additional json header:" << retval; + FILE_LOG(logDEBUG1) << "additional json header:" << retval; } return interface->Server_SendResult(true, ret, retval, MAX_STR_LENGTH, mess); } @@ -1717,7 +1718,7 @@ int slsReceiverTCPIPInterface::set_udp_socket_buffer_size() { if (index >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting UDP Socket Buffer size: " << index; + FILE_LOG(logDEBUG1) << "Setting UDP Socket Buffer size: " << index; if (receiver->setUDPSocketBufferSize(index) == FAIL) { ret = FAIL; strcpy(mess, "Could not create dummy UDP Socket to test buffer size\n"); @@ -1728,7 +1729,7 @@ int slsReceiverTCPIPInterface::set_udp_socket_buffer_size() { // get retval = receiver->getUDPSocketBufferSize(); validate(index, retval, std::string("set udp socket buffer size (No CAP_NET_ADMIN privileges?)"), 0); - FILE_LOG(logDEBUG5) << "UDP Socket Buffer Size:" << retval; + FILE_LOG(logDEBUG1) << "UDP Socket Buffer Size:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1744,7 +1745,7 @@ int slsReceiverTCPIPInterface::get_real_udp_socket_buffer_size(){ interface->Server_ReceiveArg(ret, mess, NULL, 0, true, receiver); if (ret == OK) { - FILE_LOG(logDEBUG5) << "Getting actual UDP buffer size"; + FILE_LOG(logDEBUG1) << "Getting actual UDP buffer size"; retval = receiver->getActualUDPSocketBufferSize(); } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); @@ -1768,14 +1769,14 @@ int slsReceiverTCPIPInterface::set_frames_per_file() { if (index >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting frames per file: " << index; + FILE_LOG(logDEBUG1) << "Setting frames per file: " << index; receiver->setFramesPerFile(index); } } // get retval = receiver->getFramesPerFile(); validate(index, retval, std::string("set frames per file"), 0); - FILE_LOG(logDEBUG5) << "frames per file:" << retval; + FILE_LOG(logDEBUG1) << "frames per file:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1790,7 +1791,7 @@ int slsReceiverTCPIPInterface::check_version_compatibility() { // get args, return if socket crashed if (interface->Server_ReceiveArg(ret, mess, &arg, sizeof(arg)) == FAIL) return FAIL; - FILE_LOG(logDEBUG5) << "Checking versioning compatibility with value " << arg; + FILE_LOG(logDEBUG1) << "Checking versioning compatibility with value " << arg; int64_t client_requiredVersion = arg; int64_t rx_apiVersion = APIRECEIVER; int64_t rx_version = getReceiverVersion(); @@ -1838,14 +1839,14 @@ int slsReceiverTCPIPInterface::set_discard_policy() { if (index >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting frames discard policy: " << index; + FILE_LOG(logDEBUG1) << "Setting frames discard policy: " << index; receiver->setFrameDiscardPolicy((frameDiscardPolicy)index); } } // get retval = receiver->getFrameDiscardPolicy(); validate(index, retval, std::string("set discard policy"), 0); - FILE_LOG(logDEBUG5) << "frame discard policy:" << retval; + FILE_LOG(logDEBUG1) << "frame discard policy:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1869,14 +1870,14 @@ int slsReceiverTCPIPInterface::set_padding_enable() { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { index = (index == 0) ? 0 : 1; - FILE_LOG(logDEBUG5) << "Setting frames padding enable: " << index; + FILE_LOG(logDEBUG1) << "Setting frames padding enable: " << index; receiver->setFramePaddingEnable(index); } } // get retval = (int)receiver->getFramePaddingEnable(); validate(index, retval, std::string("set frame padding enable"), 0); - FILE_LOG(logDEBUG5) << "Frame Padding Enable:" << retval; + FILE_LOG(logDEBUG1) << "Frame Padding Enable:" << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } @@ -1902,14 +1903,14 @@ int slsReceiverTCPIPInterface::set_deactivated_receiver_padding_enable() { if (enable >= 0) { // verify if receiver is unlocked and idle if (interface->Server_VerifyLockAndIdle(ret, mess, lockStatus, receiver->getStatus(), fnum) == OK) { - FILE_LOG(logDEBUG5) << "Setting deactivated padding enable: " << enable; + FILE_LOG(logDEBUG1) << "Setting deactivated padding enable: " << enable; receiver->setDeactivatedPadding(enable > 0 ? true : false); } } // get retval = (int)receiver->getDeactivatedPadding(); validate(enable, retval, std::string("set deactivated padding enable"), 0); - FILE_LOG(logDEBUG5) << "Deactivated Padding Enable: " << retval; + FILE_LOG(logDEBUG1) << "Deactivated Padding Enable: " << retval; } return interface->Server_SendResult(true, ret, &retval, sizeof(retval), mess); } diff --git a/slsSupportLib/include/logger.h b/slsSupportLib/include/logger.h index a7b99eefe..e1a75ab51 100644 --- a/slsSupportLib/include/logger.h +++ b/slsSupportLib/include/logger.h @@ -36,8 +36,9 @@ inline std::string NowTime(); - -enum TLogLevel {logERROR, logWARNING, logINFO, logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5}; +// 1 normal debug, 3 function names, 5 fifodebug +enum TLogLevel {logERROR, logWARNING, logINFOBLUE, logINFOGREEN, logINFORED, logINFO, + logDEBUG, logDEBUG1, logDEBUG2, logDEBUG3, logDEBUG4, logDEBUG5}; template class Log{ public: @@ -63,20 +64,11 @@ public: 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 + +#define FILELOG_DECLSPEC class FILELOG_DECLSPEC FILELog : public Log {}; -//typedef Log FILELog; + #define FILE_LOG(level) \ if (level > FILELOG_MAX_LEVEL) ; \ @@ -84,29 +76,6 @@ class FILELOG_DECLSPEC FILELog : public Log {}; else FILELog().Get(level) -#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) - -#include - - - -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 inline std::string NowTime() @@ -127,8 +96,6 @@ inline std::string NowTime() return result; } -#endif //WIN32 - template Log::Log():lev(logDEBUG){} @@ -138,7 +105,7 @@ template std::ostringstream& Log::Get(TLogLevel level) os << "- " << NowTime(); os << " " << ToString(level) << ": "; if (level > logDEBUG) - os << std::string(level - logDEBUG, '\t'); + os << std::string(level - logDEBUG, ' '); return os; } @@ -156,7 +123,9 @@ template TLogLevel& Log::ReportingLevel() template std::string Log::ToString(TLogLevel level) { - static const char* const buffer[] = {"ERROR", "WARNING", "INFO", "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4","DEBUG5"}; + static const char* const buffer[] = { + "ERROR", "WARNING", "INFO", "INFO", "INFO", "INFO", + "DEBUG", "DEBUG1", "DEBUG2", "DEBUG3", "DEBUG4","DEBUG5"}; return buffer[level]; } @@ -211,21 +180,10 @@ inline void Output2FILE::Output(const std::string& msg, TLogLevel level) case logERROR: cprintf(RED BOLD,"%s",msg.c_str()); break; case logWARNING: cprintf(YELLOW BOLD,"%s",msg.c_str()); break; case logINFO: cprintf(RESET,"%s",msg.c_str()); break; + case logINFOBLUE: cprintf(BLUE,"%s",msg.c_str()); break; + case logINFORED: cprintf(RED,"%s",msg.c_str()); break; + case logINFOGREEN: cprintf(GREEN,"%s",msg.c_str()); break; default: fprintf(pStream,"%s",msg.c_str()); out = false; break; } fflush(out ? stdout : 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 - -