slsReceiver: deactivated no longer writes 0xFFFF, creates empty files

This commit is contained in:
maliakal_d 2018-05-29 14:32:14 +02:00
parent 0f6cb4dc41
commit 542dda8ece
3 changed files with 5 additions and 50 deletions

View File

@ -27,7 +27,6 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
* @param s pointer to receiver status
* @param portno pointer to udp port number
* @param e ethernet interface
* @param act pointer to activated
* @param nf pointer to number of images to catch
* @param dr pointer to dynamic range
* @param us pointer to udp socket buffer size
@ -35,7 +34,7 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
* @param fpf pointer to frames per file
*/
Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
uint32_t* portno, char* e, int* act, uint64_t* nf, uint32_t* dr,
uint32_t* portno, char* e, uint64_t* nf, uint32_t* dr,
uint32_t* us, uint32_t* as, uint32_t* fpf);
/**
@ -180,13 +179,6 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
*/
uint32_t ListenToAnImage(char* buf);
/**
* Create an image (for deactivated detectors),
* @param buffer
* @returns image size or 0
*/
uint32_t CreateAnImage(char* buf);
/**
* Print Fifo Statistics
*/
@ -223,9 +215,6 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
/** ethernet interface */
char* eth;
/** if the detector is activated */
int* activated;
/** Number of Images to catch */
uint64_t* numImages;

View File

@ -20,7 +20,7 @@ const string Listener::TypeName = "Listener";
Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
uint32_t* portno, char* e, int* act, uint64_t* nf, uint32_t* dr,
uint32_t* portno, char* e, uint64_t* nf, uint32_t* dr,
uint32_t* us, uint32_t* as, uint32_t* fpf) :
ThreadObject(ind),
runningFlag(0),
@ -31,7 +31,6 @@ Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
udpSocket(0),
udpPortNumber(portno),
eth(e),
activated(act),
numImages(nf),
dynamicRange(dr),
udpSocketBufferSize(us),
@ -182,9 +181,6 @@ int Listener::SetThreadPriority(int priority) {
int Listener::CreateUDPSockets() {
if (!(*activated))
return OK;
//if eth is mistaken with ip address
if (strchr(eth,'.') != NULL){
memset(eth, 0, MAX_STR_LENGTH);
@ -241,11 +237,6 @@ int Listener::CreateDummySocketForUDPSocketBufferSize(uint32_t s) {
uint32_t temp = *udpSocketBufferSize;
*udpSocketBufferSize = s;
if (!(*activated))
return OK;
//if eth is mistaken with ip address
if (strchr(eth,'.') != NULL){
memset(eth, 0, MAX_STR_LENGTH);
@ -295,7 +286,7 @@ void Listener::ThreadExecution() {
#endif
//udpsocket doesnt exist
if (*activated && !udpSocketAlive && !carryOverFlag) {
if (!udpSocketAlive && !carryOverFlag) {
//FILE_LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not created or shut down earlier";
(*((uint32_t*)buffer)) = 0;
StopListening(buffer);
@ -304,19 +295,10 @@ void Listener::ThreadExecution() {
//get data
if ((*status != TRANSMITTING && udpSocketAlive) || carryOverFlag) {
if (*activated)
rc = ListenToAnImage(buffer);
else
rc = CreateAnImage(buffer + generalData->fifoBufferHeaderSize);
rc = ListenToAnImage(buffer);
}
/*//done acquiring (removing this, else the last incomplete image will not be sent, directly going to dummy msg)
if ((*status == TRANSMITTING) || ( (!(*activated)) && (rc == 0)) ) {
StopListening(buffer);
return;
}*/
//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 );
@ -559,22 +541,6 @@ uint32_t Listener::ListenToAnImage(char* buf) {
}
uint32_t Listener::CreateAnImage(char* buf) {
if (!measurementStartedFlag)
RecordFirstIndices(0);
if (currentFrameIndex == *numImages)
return 0;
//update parameters
numPacketsCaught++; //record immediately to get more time before socket shutdown
//reset data to -1
memset(buf, 0xFF, generalData->dataSize);
return generalData->imageSize;
}
void Listener::PrintFifoStatistics() {

View File

@ -373,7 +373,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
try {
Listener* l = new Listener(i, myDetectorType, fifo[i], &status,
&udpPortNum[i], eth, &activated, &numberOfFrames, &dynamicRange,
&udpPortNum[i], eth, &numberOfFrames, &dynamicRange,
&udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile);
listener.push_back(l);