mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-23 15:00:02 +02:00
slsReceiver: deactivated no longer writes 0xFFFF, creates empty files
This commit is contained in:
parent
0f6cb4dc41
commit
542dda8ece
@ -27,7 +27,6 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
|||||||
* @param s pointer to receiver status
|
* @param s pointer to receiver status
|
||||||
* @param portno pointer to udp port number
|
* @param portno pointer to udp port number
|
||||||
* @param e ethernet interface
|
* @param e ethernet interface
|
||||||
* @param act pointer to activated
|
|
||||||
* @param nf pointer to number of images to catch
|
* @param nf pointer to number of images to catch
|
||||||
* @param dr pointer to dynamic range
|
* @param dr pointer to dynamic range
|
||||||
* @param us pointer to udp socket buffer size
|
* @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
|
* @param fpf pointer to frames per file
|
||||||
*/
|
*/
|
||||||
Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
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);
|
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);
|
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
|
* Print Fifo Statistics
|
||||||
*/
|
*/
|
||||||
@ -223,9 +215,6 @@ class Listener : private virtual slsReceiverDefs, public ThreadObject {
|
|||||||
/** ethernet interface */
|
/** ethernet interface */
|
||||||
char* eth;
|
char* eth;
|
||||||
|
|
||||||
/** if the detector is activated */
|
|
||||||
int* activated;
|
|
||||||
|
|
||||||
/** Number of Images to catch */
|
/** Number of Images to catch */
|
||||||
uint64_t* numImages;
|
uint64_t* numImages;
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ const string Listener::TypeName = "Listener";
|
|||||||
|
|
||||||
|
|
||||||
Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
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) :
|
uint32_t* us, uint32_t* as, uint32_t* fpf) :
|
||||||
ThreadObject(ind),
|
ThreadObject(ind),
|
||||||
runningFlag(0),
|
runningFlag(0),
|
||||||
@ -31,7 +31,6 @@ Listener::Listener(int ind, detectorType dtype, Fifo*& f, runStatus* s,
|
|||||||
udpSocket(0),
|
udpSocket(0),
|
||||||
udpPortNumber(portno),
|
udpPortNumber(portno),
|
||||||
eth(e),
|
eth(e),
|
||||||
activated(act),
|
|
||||||
numImages(nf),
|
numImages(nf),
|
||||||
dynamicRange(dr),
|
dynamicRange(dr),
|
||||||
udpSocketBufferSize(us),
|
udpSocketBufferSize(us),
|
||||||
@ -182,9 +181,6 @@ int Listener::SetThreadPriority(int priority) {
|
|||||||
|
|
||||||
int Listener::CreateUDPSockets() {
|
int Listener::CreateUDPSockets() {
|
||||||
|
|
||||||
if (!(*activated))
|
|
||||||
return OK;
|
|
||||||
|
|
||||||
//if eth is mistaken with ip address
|
//if eth is mistaken with ip address
|
||||||
if (strchr(eth,'.') != NULL){
|
if (strchr(eth,'.') != NULL){
|
||||||
memset(eth, 0, MAX_STR_LENGTH);
|
memset(eth, 0, MAX_STR_LENGTH);
|
||||||
@ -241,11 +237,6 @@ int Listener::CreateDummySocketForUDPSocketBufferSize(uint32_t s) {
|
|||||||
uint32_t temp = *udpSocketBufferSize;
|
uint32_t temp = *udpSocketBufferSize;
|
||||||
*udpSocketBufferSize = s;
|
*udpSocketBufferSize = s;
|
||||||
|
|
||||||
if (!(*activated))
|
|
||||||
return OK;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if eth is mistaken with ip address
|
//if eth is mistaken with ip address
|
||||||
if (strchr(eth,'.') != NULL){
|
if (strchr(eth,'.') != NULL){
|
||||||
memset(eth, 0, MAX_STR_LENGTH);
|
memset(eth, 0, MAX_STR_LENGTH);
|
||||||
@ -295,7 +286,7 @@ void Listener::ThreadExecution() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//udpsocket doesnt exist
|
//udpsocket doesnt exist
|
||||||
if (*activated && !udpSocketAlive && !carryOverFlag) {
|
if (!udpSocketAlive && !carryOverFlag) {
|
||||||
//FILE_LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not created or shut down earlier";
|
//FILE_LOG(logERROR) << "Listening_Thread " << index << ": UDP Socket not created or shut down earlier";
|
||||||
(*((uint32_t*)buffer)) = 0;
|
(*((uint32_t*)buffer)) = 0;
|
||||||
StopListening(buffer);
|
StopListening(buffer);
|
||||||
@ -304,19 +295,10 @@ void Listener::ThreadExecution() {
|
|||||||
|
|
||||||
//get data
|
//get data
|
||||||
if ((*status != TRANSMITTING && udpSocketAlive) || carryOverFlag) {
|
if ((*status != TRANSMITTING && udpSocketAlive) || carryOverFlag) {
|
||||||
if (*activated)
|
rc = ListenToAnImage(buffer);
|
||||||
rc = ListenToAnImage(buffer);
|
|
||||||
else
|
|
||||||
rc = CreateAnImage(buffer + generalData->fifoBufferHeaderSize);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*//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
|
//error check, (should not be here) if not transmitting yet (previous if) rc should be > 0
|
||||||
if (rc <= 0) {
|
if (rc <= 0) {
|
||||||
//cprintf(RED,"%d Socket shut down while waiting for future packet. udpsocketalive:%d\n",index, udpSocketAlive );
|
//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() {
|
void Listener::PrintFifoStatistics() {
|
||||||
|
@ -373,7 +373,7 @@ int UDPStandardImplementation::setDetectorType(const detectorType d) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Listener* l = new Listener(i, myDetectorType, fifo[i], &status,
|
Listener* l = new Listener(i, myDetectorType, fifo[i], &status,
|
||||||
&udpPortNum[i], eth, &activated, &numberOfFrames, &dynamicRange,
|
&udpPortNum[i], eth, &numberOfFrames, &dynamicRange,
|
||||||
&udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile);
|
&udpSocketBufferSize, &actualUDPSocketBufferSize, &framesPerFile);
|
||||||
listener.push_back(l);
|
listener.push_back(l);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user