mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2026-01-20 09:31:03 +01:00
size change in receiver call back API now streamed, gui allows smaller packet size than expected to be caught and replaced the rest with 0xFF
This commit is contained in:
@@ -35,8 +35,9 @@ bool DataProcessor::SilentMode(false);
|
||||
|
||||
DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
||||
uint32_t* freq, uint32_t* timer,
|
||||
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 (*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(NumberofDataProcessors),
|
||||
@@ -316,7 +317,7 @@ void DataProcessor::ThreadExecution() {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessAnImage(buffer + FIFO_HEADER_NUMBYTES);
|
||||
ProcessAnImage(buffer);
|
||||
|
||||
//stream (if time/freq to stream) or free
|
||||
if (*dataStreamEnable && SendToStreamer())
|
||||
@@ -348,7 +349,7 @@ void DataProcessor::StopProcessing(char* buf) {
|
||||
/** buf includes only the standard header */
|
||||
void DataProcessor::ProcessAnImage(char* buf) {
|
||||
|
||||
sls_detector_header* header = (sls_detector_header*) (buf);
|
||||
sls_detector_header* header = (sls_detector_header*) (buf + FIFO_HEADER_NUMBYTES);
|
||||
uint64_t fnum = header->frameNumber;
|
||||
currentFrameIndex = fnum;
|
||||
uint32_t nump = header->packetNumber;
|
||||
@@ -381,7 +382,7 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
||||
}
|
||||
|
||||
if (*gapPixelsEnable && (*dynamicRange!=4))
|
||||
InsertGapPixels(buf + sizeof(sls_detector_header), *dynamicRange);
|
||||
InsertGapPixels(buf + FIFO_HEADER_NUMBYTES + sizeof(sls_detector_header), *dynamicRange);
|
||||
|
||||
// x coord is 0 for detector in pos [0,0,0]
|
||||
if (xcoordin1D) {
|
||||
@@ -409,14 +410,14 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
||||
header->roundRNumber,
|
||||
header->detType,
|
||||
header->version,
|
||||
buf + sizeof(sls_detector_header),
|
||||
generalData->imageSize,
|
||||
buf + FIFO_HEADER_NUMBYTES + sizeof(sls_detector_header),
|
||||
(uint32_t*)buf,
|
||||
pRawDataReady);
|
||||
}
|
||||
|
||||
|
||||
if (file)
|
||||
file->WriteToFile(buf, sizeof(sls_detector_header) + generalData->imageSize, fnum-firstMeasurementIndex, nump);
|
||||
file->WriteToFile(buf + FIFO_HEADER_NUMBYTES, sizeof(sls_detector_header) + (uint32_t)(*((uint32_t*)buf)), fnum-firstMeasurementIndex, nump);
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -200,7 +200,7 @@ void DataStreamer::ThreadExecution() {
|
||||
return;
|
||||
}
|
||||
|
||||
ProcessAnImage(buffer + FIFO_HEADER_NUMBYTES);
|
||||
ProcessAnImage(buffer);
|
||||
|
||||
//free
|
||||
fifo->FreeAddress(buffer);
|
||||
@@ -216,7 +216,7 @@ void DataStreamer::StopProcessing(char* buf) {
|
||||
#endif
|
||||
sls_detector_header* header = (sls_detector_header*) (buf);
|
||||
//send dummy header and data
|
||||
if (!SendHeader(header, 0, 0, true))
|
||||
if (!SendHeader(header, 0, 0, 0, true))
|
||||
cprintf(RED,"Error: Could not send zmq dummy header for streamer %d\n", index);
|
||||
|
||||
fifo->FreeAddress(buf);
|
||||
@@ -229,7 +229,7 @@ void DataStreamer::StopProcessing(char* buf) {
|
||||
/** buf includes only the standard header */
|
||||
void DataStreamer::ProcessAnImage(char* buf) {
|
||||
|
||||
sls_detector_header* header = (sls_detector_header*) (buf);
|
||||
sls_detector_header* header = (sls_detector_header*) (buf + FIFO_HEADER_NUMBYTES);
|
||||
uint64_t fnum = header->frameNumber;
|
||||
#ifdef VERBOSE
|
||||
cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index,fnum);
|
||||
@@ -245,11 +245,11 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
//shortframe gotthard
|
||||
if (completeBuffer) {
|
||||
|
||||
if (!SendHeader(header, generalData->nPixelsXComplete, generalData->nPixelsYComplete, false))
|
||||
if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)), generalData->nPixelsXComplete, generalData->nPixelsYComplete, false))
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
||||
memcpy(completeBuffer + ((generalData->imageSize)**shortFrameEnable), buf + sizeof(sls_detector_header), generalData->imageSize);
|
||||
memcpy(completeBuffer + ((generalData->imageSize)**shortFrameEnable), buf + FIFO_HEADER_NUMBYTES + sizeof(sls_detector_header), (uint32_t)(*((uint32_t*)buf)) ); // new size possibly from callback
|
||||
if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete))
|
||||
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
@@ -259,11 +259,11 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
//normal
|
||||
else {
|
||||
|
||||
if (!SendHeader(header, generalData->nPixelsX, generalData->nPixelsY, false))
|
||||
if (!SendHeader(header, (uint32_t)(*((uint32_t*)buf)), generalData->nPixelsX, generalData->nPixelsY, false)) // new size possibly from callback
|
||||
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
|
||||
if (!zmqSocket->SendData(buf + sizeof(sls_detector_header), generalData->imageSize))
|
||||
if (!zmqSocket->SendData(buf + FIFO_HEADER_NUMBYTES + sizeof(sls_detector_header), (uint32_t)(*((uint32_t*)buf)) )) // new size possibly from callback
|
||||
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||
(long long int) fnum, index);
|
||||
}
|
||||
@@ -271,7 +271,7 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
||||
|
||||
|
||||
|
||||
int DataStreamer::SendHeader(sls_detector_header* header, uint32_t nx, uint32_t ny, bool dummy) {
|
||||
int DataStreamer::SendHeader(sls_detector_header* header, uint32_t size, uint32_t nx, uint32_t ny, bool dummy) {
|
||||
|
||||
if (dummy)
|
||||
return zmqSocket->SendHeaderData(index, dummy,SLS_DETECTOR_JSON_HEADER_VERSION);
|
||||
@@ -280,7 +280,7 @@ int DataStreamer::SendHeader(sls_detector_header* header, uint32_t nx, uint32_t
|
||||
uint64_t acquisitionIndex = header->frameNumber - firstAcquisitionIndex;
|
||||
|
||||
return zmqSocket->SendHeaderData(index, dummy, SLS_DETECTOR_JSON_HEADER_VERSION, *dynamicRange, *fileIndex,
|
||||
nx, ny,generalData->imageSize,
|
||||
nx, ny, size,
|
||||
acquisitionIndex, frameIndex, fileNametoStream,
|
||||
header->frameNumber, header->expLength, header->packetNumber, header->bunchId, header->timestamp,
|
||||
header->modId, header->xCoord, header->yCoord, header->zCoord,
|
||||
|
||||
@@ -614,8 +614,10 @@ void UDPBaseImplementation::registerCallBackAcquisitionFinished(void (*func)(uin
|
||||
pAcquisitionFinished=arg;
|
||||
}
|
||||
|
||||
void UDPBaseImplementation::registerCallBackRawDataReady(void (*func)(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 *arg){
|
||||
void UDPBaseImplementation::registerCallBackRawDataReady(void (*func)(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 *arg){
|
||||
rawDataReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ void AcquisitionFinished(uint64_t frames, void*p){
|
||||
|
||||
void GetData(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
|
||||
uint16_t modId, uint16_t xCoord, uint16_t yCoord, uint16_t zCoord, uint32_t debug, uint16_t roundRNumber, uint8_t detType, uint8_t version,
|
||||
char* datapointer, uint32_t datasize, void* p){
|
||||
char* datapointer, uint32_t* datasize, void* p){
|
||||
|
||||
PRINT_IN_COLOR (xCoord,
|
||||
"#### %d GetData: ####\n"
|
||||
@@ -51,7 +51,7 @@ void GetData(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, ui
|
||||
"version: %u\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||
xCoord, frameNumber, expLength, packetNumber, bunchId, timestamp, modId,
|
||||
xCoord, yCoord, zCoord, debug, roundRNumber, detType, version,
|
||||
((uint8_t)(*((uint8_t*)(datapointer)))), datasize);
|
||||
((uint8_t)(*((uint8_t*)(datapointer)))), *datasize);
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
@@ -150,8 +150,10 @@ void slsReceiver::registerCallBackAcquisitionFinished(void (*func)(uint64_t, voi
|
||||
}
|
||||
|
||||
|
||||
void slsReceiver::registerCallBackRawDataReady(void (*func)(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 *arg){
|
||||
void slsReceiver::registerCallBackRawDataReady(void (*func)(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 *arg){
|
||||
//tcpipInterface
|
||||
if(udp_interface)
|
||||
udp_interface->registerCallBackRawDataReady(func,arg);
|
||||
|
||||
@@ -170,8 +170,10 @@ void slsReceiverTCPIPInterface::registerCallBackAcquisitionFinished(void (*func)
|
||||
pAcquisitionFinished=arg;
|
||||
}
|
||||
|
||||
void slsReceiverTCPIPInterface::registerCallBackRawDataReady(void (*func)(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 *arg){
|
||||
void slsReceiverTCPIPInterface::registerCallBackRawDataReady(void (*func)(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 *arg){
|
||||
rawDataReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ void slsReceiverUsers::registerCallBackAcquisitionFinished(void (*func)(uint64_t
|
||||
|
||||
void slsReceiverUsers::registerCallBackRawDataReady(void (*func)(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
|
||||
uint16_t modId, uint16_t xCoord, uint16_t yCoord, uint16_t zCoord, uint32_t debug, uint16_t roundRNumber, uint8_t detType, uint8_t version,
|
||||
char* datapointer, uint32_t datasize, void*), void *arg){
|
||||
char* datapointer, uint32_t* datasize, void*), void *arg){
|
||||
receiver->registerCallBackRawDataReady(func,arg);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user