mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-22 22:40:02 +02:00
last packet even if many padded packets in between should be written (from carryoverflag)
This commit is contained in:
parent
0cd18a3b7a
commit
a40d18f8b2
@ -250,7 +250,7 @@ void Listener::ThreadExecution() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//udpsocket doesnt exist
|
//udpsocket doesnt exist
|
||||||
if (*activated && !udpSocket) {
|
if (*activated && !udpSocket && !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);
|
||||||
@ -258,7 +258,7 @@ void Listener::ThreadExecution() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//get data
|
//get data
|
||||||
if (*status != TRANSMITTING && udpSocket) {
|
if ((*status != TRANSMITTING && udpSocket) || carryOverFlag) {
|
||||||
if (*activated)
|
if (*activated)
|
||||||
rc = ListenToAnImage(buffer);
|
rc = ListenToAnImage(buffer);
|
||||||
else
|
else
|
||||||
@ -351,13 +351,13 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
|
|
||||||
//copy packet
|
//copy packet
|
||||||
switch(myDetectorType) {
|
switch(myDetectorType) {
|
||||||
//for gotthard, 1st packet: 4 bytes fnum, CACA, 1278 bytes data
|
//for gotthard, 1st packet: 4 bytes fnum, CACA + CACA, 639*2 bytes data
|
||||||
// 2nd packet: 4 bytes fnu, 1282 bytes data !!
|
// 2nd packet: 4 bytes fnum, previous 1*2 bytes data + 640*2 bytes data !!
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
if(!pnum)
|
if(!pnum)
|
||||||
memcpy(buf + fifohsize + (pnum * dsize), carryOverPacket + hsize+4, dsize-2);
|
memcpy(buf + fifohsize , carryOverPacket + hsize+4, dsize-2);
|
||||||
else
|
else
|
||||||
memcpy(buf + fifohsize + (pnum * dsize) - 2, carryOverPacket + hsize, dsize+2);
|
memcpy(buf + fifohsize + dsize - 2, carryOverPacket + hsize, dsize+2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
memcpy(buf + fifohsize + (pnum * dsize), carryOverPacket + hsize, dsize);
|
memcpy(buf + fifohsize + (pnum * dsize), carryOverPacket + hsize, dsize);
|
||||||
@ -423,6 +423,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
|
|
||||||
lastCaughtFrameIndex = fnum;
|
lastCaughtFrameIndex = fnum;
|
||||||
|
|
||||||
|
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
//if (!index)
|
//if (!index)
|
||||||
bprintf(GREEN,"Listening %d: currentfindex:%lu, fnum:%lu, pnum:%u numpackets:%u\n",
|
bprintf(GREEN,"Listening %d: currentfindex:%lu, fnum:%lu, pnum:%u numpackets:%u\n",
|
||||||
@ -435,7 +436,7 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
|
|
||||||
//future packet by looking at image number (all other detectors)
|
//future packet by looking at image number (all other detectors)
|
||||||
if (fnum != currentFrameIndex) {
|
if (fnum != currentFrameIndex) {
|
||||||
//bprintf(RED,"setting carry over flag to true\n");
|
//bprintf(RED,"setting carry over flag to true num:%llu nump:%u\n",fnum, numpackets );
|
||||||
carryOverFlag = true;
|
carryOverFlag = true;
|
||||||
memcpy(carryOverPacket,listeningPacket, generalData->packetSize);
|
memcpy(carryOverPacket,listeningPacket, generalData->packetSize);
|
||||||
|
|
||||||
@ -445,8 +446,8 @@ uint32_t Listener::ListenToAnImage(char* buf) {
|
|||||||
|
|
||||||
//copy packet
|
//copy packet
|
||||||
switch(myDetectorType) {
|
switch(myDetectorType) {
|
||||||
//for gotthard, 1st packet: 4 bytes fnum, CACA, 1278 bytes data
|
//for gotthard, 1st packet: 4 bytes fnum, CACA + CACA, 639*2 bytes data
|
||||||
// 2nd packet: 4 bytes fnu, 1282 bytes data !!
|
// 2nd packet: 4 bytes fnum, previous 1*2 bytes data + 640*2 bytes data !!
|
||||||
case GOTTHARD:
|
case GOTTHARD:
|
||||||
if(!pnum)
|
if(!pnum)
|
||||||
memcpy(buf + fifohsize + (pnum * dsize), listeningPacket + hsize+4, dsize-2);
|
memcpy(buf + fifohsize + (pnum * dsize), listeningPacket + hsize+4, dsize-2);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user