From 52d3140a3aa19b68ea6e9560f8848090d0164f03 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Tue, 2 Dec 2014 10:12:00 +0100 Subject: [PATCH 1/6] a version of receiver for gemma with bottom --- .../include/UDPStandardImplementation.h | 2 +- .../src/UDPStandardImplementation.cpp | 20 +++++++++++++++++-- slsReceiverSoftware/src/slsReceiver.cpp | 13 +++++++++--- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/slsReceiverSoftware/include/UDPStandardImplementation.h b/slsReceiverSoftware/include/UDPStandardImplementation.h index 6b5c0c0c4..dca52e6a4 100644 --- a/slsReceiverSoftware/include/UDPStandardImplementation.h +++ b/slsReceiverSoftware/include/UDPStandardImplementation.h @@ -47,7 +47,7 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase */ virtual ~UDPStandardImplementation(); - + void configure(map config_map); /** * delete and free member parameters diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 0ac51c321..cb8d66c25 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -91,6 +91,22 @@ UDPStandardImplementation::UDPStandardImplementation() } +void UDPStandardImplementation::configure(map config_map){ + FILE_LOG(logWARNING) << __AT__ << " called"; + + map::const_iterator pos; + pos = config_map.find("mode"); + if (pos != config_map.end() ){ + int b; + if(!sscanf(pos->second.c_str(), "%d", &b)){ + cout << "Warning: Could not parse mode. Assuming top mode." << endl; + b = 0; + } + bottom = b!= 0; + cout << "bottom:"<< bottom << endl; + } +}; + void UDPStandardImplementation::initializeMembers(){ myDetectorType = GENERIC; maxPacketsPerFile = 0; @@ -945,12 +961,12 @@ int UDPStandardImplementation::createUDPSockets(){ port[1] = server_port[1]; /** eiger specific */ - /* + if(bottom){ port[0] = server_port[1]; port[1] = server_port[0]; } - */ + //if eth is mistaken with ip address if (strchr(eth,'.')!=NULL) strcpy(eth,""); diff --git a/slsReceiverSoftware/src/slsReceiver.cpp b/slsReceiverSoftware/src/slsReceiver.cpp index 595a39868..6ffc2fdf9 100644 --- a/slsReceiverSoftware/src/slsReceiver.cpp +++ b/slsReceiverSoftware/src/slsReceiver.cpp @@ -65,6 +65,13 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){ switch(c){ + case 'm': + int b; + sscanf(optarg, "%d", &b); + bottom = b != 0; + configuration_map["mode"] = optarg; + break; + case 'f': fname = optarg; //cout << long_options[option_index].name << " " << optarg << endl; @@ -86,7 +93,7 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){ string help_message = """\nSLS Receiver Server\n\n"""; help_message += """usage: slsReceiver --config config_fname [--rx_tcpport port]\n\n"""; help_message += """\t--config:\t configuration filename for SLS Detector receiver\n"""; - help_message += """\t--mode:\t ???\n"""; + help_message += """\t--mode:\t 1 for bottom and 0 for top\n"""; help_message += """\t--rx_tcpport:\t TCP Communication Port with the client. Default: 1954.\n\n"""; help_message += """\t--rest_hostname:\t Receiver hostname:port. It applies only to REST receivers, and indicates the hostname of the REST backend. Default: localhost:8081.\n\n"""; @@ -120,10 +127,10 @@ slsReceiver::slsReceiver(int argc, char *argv[], int &success){ } if (success==OK){ - FILE_LOG(logINFO) << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << endl; + FILE_LOG(logINFO) << "SLS Receiver starting " << udp_interface_type << " on port " << tcpip_port_no << " with mode " << bottom << endl; udp_interface = UDPInterface::create(udp_interface_type); udp_interface->configure(configuration_map); - tcpipInterface = new slsReceiverTCPIPInterface(success, udp_interface, tcpip_port_no); + tcpipInterface = new slsReceiverTCPIPInterface(success, udp_interface, tcpip_port_no, bottom); //tcp ip interface } } From f79f3cf0217417819b8e7a9293375f16da76d7a6 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Mon, 8 Dec 2014 09:17:56 +0100 Subject: [PATCH 2/6] makefile crash if files dont exist in make clean, fixed --- slsReceiverSoftware/Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/slsReceiverSoftware/Makefile b/slsReceiverSoftware/Makefile index 2a6303f93..c445eaa8c 100644 --- a/slsReceiverSoftware/Makefile +++ b/slsReceiverSoftware/Makefile @@ -79,8 +79,9 @@ mysocket_test: clean: buildclean make testclean - rm $(DESTDIR)/libSlsReceiver.a $(DESTDIR)/libSlsReceiver.so - rm $(PROGS) + if test -e $(DESTDIR)/libSlsReceiver.a; then rm $(DESTDIR)/libSlsReceiver.a;fi + if test -e $(DESTDIR)/libSlsReceiver.so; then rm $(DESTDIR)/libSlsReceiver.so;fi + if test -e $(PROGS); then rm $(PROGS);fi builddir: if [ ! -d $(BUILDDIR) ]; then mkdir $(BUILDDIR); fi From 169c0a43cef9bcf1176315f475cf6eee6d363f92 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Mon, 8 Dec 2014 10:25:42 +0100 Subject: [PATCH 3/6] updating version numbers --- slsReceiverSoftware/gitInfo.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/slsReceiverSoftware/gitInfo.txt b/slsReceiverSoftware/gitInfo.txt index 410c414c3..d680dad1d 100644 --- a/slsReceiverSoftware/gitInfo.txt +++ b/slsReceiverSoftware/gitInfo.txt @@ -1,9 +1,9 @@ Path: slsDetectorsPackage/slsReceiverSoftware URL: origin git@gitorious.psi.ch:sls_det_software/sls_receiver_software.git Repository Root: origin git@gitorious.psi.ch:sls_det_software/sls_receiver_software.git -Repsitory UUID: e019a6ce7d96d4ac9cb5762b7137245aedb4d5b8 -Revision: 22 -Branch: master -Last Changed Author: Anna_Bergamaschi -Last Changed Rev: 22 -Last Changed Date: 2014-10-15 09:22:40 +0200 +Repsitory UUID: 879c5e2ee129acfd70aba4ae6fab829cc5409350 +Revision: 67 +Branch: gemma +Last Changed Author: Maliakal_Dhanya +Last Changed Rev: 67 +Last Changed Date: 2014-12-08 09:17:56 +0100 From 76c9d2c61bd839d5126ac2400a2463a73ef760d5 Mon Sep 17 00:00:00 2001 From: Maliakal Dhanya Date: Wed, 14 Jan 2015 10:48:36 +0100 Subject: [PATCH 4/6] lot of couts and some pre and post --- .../src/UDPStandardImplementation.cpp | 118 ++++++++++-------- 1 file changed, 69 insertions(+), 49 deletions(-) diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index cb8d66c25..ca8715eda 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -864,8 +864,10 @@ void UDPStandardImplementation::setupFifoStructure(){ void UDPStandardImplementation::readFrame(char* c,char** raw, uint32_t &fnum, uint32_t &fstartind){ FILE_LOG(logDEBUG) << __AT__ << " called"; //point to gui data - if (guiData == NULL) + if (guiData == NULL){ guiData = latestData; + cout <<"gui data not null anymore" << endl; + } //copy data and filename strcpy(c,guiFileName); @@ -873,22 +875,22 @@ void UDPStandardImplementation::readFrame(char* c,char** raw, uint32_t &fnum, ui fstartind = getStartFrameIndex(); //could not get gui data - if(!guiDataReady){ + if(!guiDataReady){cout<<"gui data not ready"<ReceiveDataOnly(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS, maxBufferSize); + cout<<"value:"<fnum)<pop(wbuf[i]); numpackets = (uint16_t)(*((uint16_t*)wbuf[i])); -#ifdef VERYDEBUG - cout << ithread << " numpackets:" << dec << numpackets << endl; -#endif +//#ifdef VERYDEBUG + cout << ithread << " numpackets:" << dec << numpackets << "for fifo :"<< i << endl; +//#endif } -#ifdef VERYDEBUG +//#ifdef VERYDEBUG cout << ithread << " numpackets:" << dec << numpackets << endl; cout << ithread << " *** writer popped from fifo " << (void*) wbuf[0]<< endl; cout << ithread << " *** writer popped from fifo " << (void*) wbuf[1]<< endl; -#endif +//#endif //last dummy packet @@ -1890,8 +1910,8 @@ int loop; } - if(myDetectorType == EIGER) { - copyFrameToGui(wbuf,currframenum); + if(myDetectorType == EIGER) {cout<<"gonna copy frame"<push(wbuf[i])); #ifdef VERYDEBUG @@ -2001,7 +2021,7 @@ void UDPStandardImplementation::startFrameIndices(int ithread){ startAcquisitionIndex=startFrameIndex; currframenum = startAcquisitionIndex; acqStarted = true; - cout << "startAcquisitionIndex:" << startAcquisitionIndex<push(buffer[ithread])); -#ifdef VERYDEBUG +//#ifdef VERYDEBUG cout << ithread << " pushed in dummy buffer:" << (void*)buffer[ithread] << endl; -#endif +//#endif } //reset mask and exit loop @@ -2108,9 +2128,9 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer[]){ FILE_LOG(logDEBUG) << __AT__ << " called"; int i,j; -#ifdef VERYDEBUG - cout << ithread << " **********************popped last dummy frame:" << (void*)wbuffer[wIndex] << endl; -#endif +//#ifdef VERYDEBUG + cout << ithread << " **********************popped last dummy frame:" << (void*)wbuffer[0] << endl; +//#endif //free fifo for(i=0;i Date: Fri, 30 Jan 2015 10:58:30 +0100 Subject: [PATCH 5/6] unnecessary long wait in receiver --- slsReceiverSoftware/src/UDPStandardImplementation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index ca8715eda..145ad5ca0 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -1495,7 +1495,7 @@ int UDPStandardImplementation::startReceiver(char message[]){ for(i=0; i < numWriterThreads; ++i) sem_post(&writersmp[i]); - usleep(5000000); + //usleep(5000000); cout << "Receiver Started.\nStatus:" << status << endl; return OK; From 7fd12f97b4b08b3192ecd4b8436a23d8360d76e7 Mon Sep 17 00:00:00 2001 From: Dhanya Maliakal Date: Fri, 30 Jan 2015 16:49:30 +0100 Subject: [PATCH 6/6] some unnecessary printouts --- .../src/UDPBaseImplementation.cpp | 2 + .../src/UDPStandardImplementation.cpp | 48 +++++++++++-------- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/slsReceiverSoftware/src/UDPBaseImplementation.cpp b/slsReceiverSoftware/src/UDPBaseImplementation.cpp index de09ae694..1c6b1a976 100644 --- a/slsReceiverSoftware/src/UDPBaseImplementation.cpp +++ b/slsReceiverSoftware/src/UDPBaseImplementation.cpp @@ -203,7 +203,9 @@ inline char* UDPBaseImplementation::setFilePath(const char c[]){ FILE_LOG(logDEB } } FILE_LOG(logDEBUG) << __AT__ << getFilePath(); +#ifdef VERBOSE cout << getFilePath() << " " << filePath << endl; +#endif return getFilePath(); } diff --git a/slsReceiverSoftware/src/UDPStandardImplementation.cpp b/slsReceiverSoftware/src/UDPStandardImplementation.cpp index 145ad5ca0..29843ff94 100644 --- a/slsReceiverSoftware/src/UDPStandardImplementation.cpp +++ b/slsReceiverSoftware/src/UDPStandardImplementation.cpp @@ -866,7 +866,7 @@ void UDPStandardImplementation::readFrame(char* c,char** raw, uint32_t &fnum, ui //point to gui data if (guiData == NULL){ guiData = latestData; - cout <<"gui data not null anymore" << endl; + //cout <<"gui data not null anymore" << endl; } //copy data and filename @@ -875,22 +875,26 @@ void UDPStandardImplementation::readFrame(char* c,char** raw, uint32_t &fnum, ui fstartind = getStartFrameIndex(); //could not get gui data - if(!guiDataReady){cout<<"gui data not ready"< DO_NOTHING){ @@ -1645,7 +1653,7 @@ int UDPStandardImplementation::startListening(){ /* if(!ithread){*/ rc = udpSocket[ithread]->ReceiveDataOnly(buffer[ithread] + HEADER_SIZE_NUM_TOT_PACKETS, maxBufferSize); - cout<<"value:"<fnum)<fnum)<pop(wbuf[i]); numpackets = (uint16_t)(*((uint16_t*)wbuf[i])); //#ifdef VERYDEBUG @@ -1855,11 +1863,11 @@ int loop; //#endif } -//#ifdef VERYDEBUG +#ifdef VERYDEBUG cout << ithread << " numpackets:" << dec << numpackets << endl; cout << ithread << " *** writer popped from fifo " << (void*) wbuf[0]<< endl; cout << ithread << " *** writer popped from fifo " << (void*) wbuf[1]<< endl; -//#endif +#endif //last dummy packet @@ -1910,8 +1918,10 @@ int loop; } - if(myDetectorType == EIGER) {cout<<"gonna copy frame"<push(wbuf[i])); #ifdef VERYDEBUG @@ -2080,9 +2090,9 @@ int i; cout << ithread << " going to push in dummy buffer:" << (void*)buffer[ithread] << " with num packets:"<< (*((uint16_t*)(buffer[ithread]))) << endl; #endif while(!fifo[ithread]->push(buffer[ithread])); -//#ifdef VERYDEBUG +#ifdef VERYDEBUG cout << ithread << " pushed in dummy buffer:" << (void*)buffer[ithread] << endl; -//#endif +#endif } //reset mask and exit loop @@ -2128,9 +2138,9 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer[]){ FILE_LOG(logDEBUG) << __AT__ << " called"; int i,j; -//#ifdef VERYDEBUG +#ifdef VERYDEBUG cout << ithread << " **********************popped last dummy frame:" << (void*)wbuffer[0] << endl; -//#endif +#endif //free fifo for(i=0;i