diff --git a/slsReceiverSoftware/include/DataProcessor.h b/slsReceiverSoftware/include/DataProcessor.h index d485b4f90..e29999896 100644 --- a/slsReceiverSoftware/include/DataProcessor.h +++ b/slsReceiverSoftware/include/DataProcessor.h @@ -24,7 +24,6 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject { /** * Constructor * Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofDataProcessors - * @param ind self index * @param f address of Fifo pointer * @param ftype pointer to file format type * @param fwenable pointer to file writer enable @@ -32,7 +31,7 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject { * @param dataReadycb pointer to data ready call back function * @param pDataReadycb pointer to arguments of data ready call back function */ - DataProcessor(int ind, Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable, + DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable, void (*dataReadycb)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, char*, uint32_t, void*), void *pDataReadycb); diff --git a/slsReceiverSoftware/include/DataStreamer.h b/slsReceiverSoftware/include/DataStreamer.h index 7926d7d7c..1a2201a05 100644 --- a/slsReceiverSoftware/include/DataStreamer.h +++ b/slsReceiverSoftware/include/DataStreamer.h @@ -20,14 +20,13 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject { /** * Constructor * Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofDataStreamers - * @param ind self index * @param f address of Fifo pointer * @param dr pointer to dynamic range * @param freq pointer to streaming frequency * @param timer pointer to timer if streaming frequency is random * @param sEnable pointer to short frame enable */ - DataStreamer(int ind, Fifo*& f, uint32_t* dr, uint32_t* freq, uint32_t* timer, int* sEnable); + DataStreamer(Fifo*& f, uint32_t* dr, uint32_t* freq, uint32_t* timer, int* sEnable); /** * Destructor diff --git a/slsReceiverSoftware/include/Fifo.h b/slsReceiverSoftware/include/Fifo.h index 846a1ecdb..92305f58c 100644 --- a/slsReceiverSoftware/include/Fifo.h +++ b/slsReceiverSoftware/include/Fifo.h @@ -20,12 +20,11 @@ class Fifo : private virtual slsReceiverDefs { /** * Constructor * Calls CreateFifos that creates fifos and allocates memory - * @param ind self index * @param fifoItemSize size of each fifo item * @param fifoDepth fifo depth * @param success true if successful, else false */ - Fifo(int ind, uint32_t fifoItemSize, uint32_t fifoDepth, bool &success); + Fifo(uint32_t fifoItemSize, uint32_t fifoDepth, bool &success); /** * Destructor diff --git a/slsReceiverSoftware/include/Listener.h b/slsReceiverSoftware/include/Listener.h index 57d059c05..8a0e57d2c 100644 --- a/slsReceiverSoftware/include/Listener.h +++ b/slsReceiverSoftware/include/Listener.h @@ -21,7 +21,6 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject { /** * Constructor * Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofListerners - * @param ind self index * @param dtype detector type * @param f address of Fifo pointer * @param s pointer to receiver status @@ -31,7 +30,7 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject { * @param nf pointer to number of images to catch * @param dr pointer to dynamic range */ - Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno, char* e, int* act, uint64_t* nf, uint32_t* dr); + Listener(detectorType dtype, Fifo*& f, runStatus* s, uint32_t* portno, char* e, int* act, uint64_t* nf, uint32_t* dr); /** * Destructor diff --git a/slsReceiverSoftware/include/ThreadObject.h b/slsReceiverSoftware/include/ThreadObject.h index 29fac7786..5b5639cea 100644 --- a/slsReceiverSoftware/include/ThreadObject.h +++ b/slsReceiverSoftware/include/ThreadObject.h @@ -19,8 +19,9 @@ class ThreadObject : private virtual slsReceiverDefs { public: /** * Constructor + * @param ind self index */ - ThreadObject(); + ThreadObject(int ind); /** * Destructor diff --git a/slsReceiverSoftware/include/UDPInterface.h b/slsReceiverSoftware/include/UDPInterface.h index e11b869b3..88c447143 100644 --- a/slsReceiverSoftware/include/UDPInterface.h +++ b/slsReceiverSoftware/include/UDPInterface.h @@ -27,6 +27,29 @@ class UDPInterface { * * UDPInterface *udp_interface = UDPInterface::create() * + * Sequence of Calls from client (upon setting receiver) + * -setDetectorType + * -setMultiDetectorSize + * -setDetectorPositionId + * -initialize + * -setUDPPortNumber,setUDPPortNumber2,setEthernetInterface + * -setFilePath + * -setFileName + * -setFileIndex + * -setFileFormat + * -setFileWriteEnable + * -setOverwriteEnable + * -setFrameIndexEnable + * -setAcquisitionPeriod + * -setNumberOfFrames + * -setAcquisitionTime + * -setDynamicRange + * -setFlippedData + * -setActivate + * -setTenGigaEnable + * -setStreamingPort + * -setDataStreamEnable + * * * supported sequence of method-calls: * diff --git a/slsReceiverSoftware/include/UDPRESTImplementation.h b/slsReceiverSoftware/include/UDPRESTImplementation.h index 3fa6cb88f..2dddf767b 100644 --- a/slsReceiverSoftware/include/UDPRESTImplementation.h +++ b/slsReceiverSoftware/include/UDPRESTImplementation.h @@ -115,27 +115,9 @@ public: * Overridden method * Shuts down and deletes UDP Sockets * TCPIPInterface can also call this in case of illegal shutdown of receiver - * @return OK or FAIL */ - int shutDownUDPSockets(); + void shutDownUDPSockets(); - /** - * Overridden method - * Get the buffer-current frame read by receiver - * @param c pointer to current file name - * @param raw address of pointer, pointing to current frame to send to gui - * @param startAcq start index of the acquisition - * @param startFrame start index of the scan - */ - void readFrame(char* c,char** raw, uint64_t &startAcq, uint64_t &startFrame); - - /** - * Overridden method - * Closes file / all files(data compression involves multiple files) - * TCPIPInterface can also call this in case of illegal shutdown of receiver - * @param i thread index valid for datacompression using root files, -1 for all threads - */ - void closeFile(int i = -1); uint64_t getTotalFramesCaught() const; diff --git a/slsReceiverSoftware/include/UDPStandardImplementation.h b/slsReceiverSoftware/include/UDPStandardImplementation.h index 933728b47..7b5537775 100644 --- a/slsReceiverSoftware/include/UDPStandardImplementation.h +++ b/slsReceiverSoftware/include/UDPStandardImplementation.h @@ -177,7 +177,6 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase /** * Closes file / all files(data compression involves multiple files) - * TCPIPInterface can also call this in case of illegal shutdown of receiver */ void closeFiles(); @@ -248,11 +247,6 @@ private: /** Number of Jobs */ int numberofJobs; - //*** mutex *** - /** Status mutex */ - pthread_mutex_t statusMutex; - - //** class objects *** /** General Data Properties */ GeneralData* generalData; diff --git a/slsReceiverSoftware/src/DataProcessor.cpp b/slsReceiverSoftware/src/DataProcessor.cpp index 8c5d61946..13d83ca4e 100644 --- a/slsReceiverSoftware/src/DataProcessor.cpp +++ b/slsReceiverSoftware/src/DataProcessor.cpp @@ -31,12 +31,12 @@ uint64_t DataProcessor::RunningMask(0x0); pthread_mutex_t DataProcessor::Mutex = PTHREAD_MUTEX_INITIALIZER; -DataProcessor::DataProcessor(int ind, Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable, +DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool* fwenable, bool* dsEnable, void (*dataReadycb)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t, uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t, char*, uint32_t, void*), void *pDataReadycb) : - ThreadObject(), + ThreadObject(NumberofDataProcessors), generalData(0), fifo(f), file(0), @@ -53,8 +53,6 @@ DataProcessor::DataProcessor(int ind, Fifo*& f, fileFormat* ftype, bool* fwenabl rawDataReadyCallBack(dataReadycb), pRawDataReady(pDataReadycb) { - index = ind; - if(ThreadObject::CreateThread()){ pthread_mutex_lock(&Mutex); ErrorMask ^= (1<SetGeneralData(generalData); // check again if (streamingPort == 0) @@ -375,8 +372,8 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) { //create threads for ( int i=0; i < numThreads; ++i ) { - listener.push_back(new Listener(i, myDetectorType, fifo[i], &status, &udpPortNum[i], eth, &activated, &numberOfFrames, &dynamicRange)); - dataProcessor.push_back(new DataProcessor(i, fifo[i], &fileFormatType, &fileWriteEnable, &dataStreamEnable, + listener.push_back(new Listener(myDetectorType, fifo[i], &status, &udpPortNum[i], eth, &activated, &numberOfFrames, &dynamicRange)); + dataProcessor.push_back(new DataProcessor(fifo[i], &fileFormatType, &fileWriteEnable, &dataStreamEnable, rawDataReadyCallBack,pRawDataReady)); if (Listener::GetErrorMask() || DataProcessor::GetErrorMask()) { FILE_LOG (logERROR) << "Error: Could not creates listener/dataprocessor threads (index:" << i << ")"; @@ -467,9 +464,7 @@ int UDPStandardImplementation::startReceiver(char *c) { FILE_LOG(logINFO) << "Ready ..."; //status - pthread_mutex_lock(&statusMutex); status = RUNNING; - pthread_mutex_unlock(&(statusMutex)); //Let Threads continue to be ready for acquisition StartRunning(); @@ -509,9 +504,7 @@ void UDPStandardImplementation::stopReceiver(){ usleep(5000); } - pthread_mutex_lock(&statusMutex); status = RUN_FINISHED; - pthread_mutex_unlock(&(statusMutex)); FILE_LOG(logINFO) << "Status: " << runStatusType(status); @@ -541,9 +534,7 @@ void UDPStandardImplementation::stopReceiver(){ } //change status - pthread_mutex_lock(&statusMutex); status = IDLE; - pthread_mutex_unlock(&(statusMutex)); FILE_LOG(logINFO) << "Receiver Stopped"; FILE_LOG(logINFO) << "Status: " << runStatusType(status); @@ -588,10 +579,7 @@ void UDPStandardImplementation::startReadout(){ } //set status - pthread_mutex_lock(&statusMutex); status = TRANSMITTING; - pthread_mutex_unlock(&statusMutex); - FILE_LOG(logINFO) << "Status: Transmitting"; } //shut down udp sockets so as to make listeners push dummy (end) packets for processors @@ -732,7 +720,7 @@ int UDPStandardImplementation::SetupFifoStructure() { for ( int i = 0; i < numThreads; i++ ) { //create fifo structure bool success = true; - fifo.push_back( new Fifo (i, + fifo.push_back( new Fifo ( (generalData->imageSize) * numberofJobs + (generalData->fifoBufferHeaderSize), fifoDepth, success)); if (!success) {