mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 03:10:02 +02: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:
parent
a1936cb884
commit
a74e8f68f7
@ -103,12 +103,12 @@ void AcquisitionFinished(uint64_t frames, void*p){
|
|||||||
* @param detType detector type see :: detectorType
|
* @param detType detector type see :: detectorType
|
||||||
* @param version version of standard header (structure format)
|
* @param version version of standard header (structure format)
|
||||||
* @param datapointer pointer to data
|
* @param datapointer pointer to data
|
||||||
* @param datasize data size in bytes
|
* @param datasize data size in bytes. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||||
* @param p pointer to object
|
* @param p pointer to object
|
||||||
*/
|
*/
|
||||||
void GetData(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
|
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,
|
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 (modId?modId:xCoord,
|
PRINT_IN_COLOR (modId?modId:xCoord,
|
||||||
"#### %d GetData: ####\n"
|
"#### %d GetData: ####\n"
|
||||||
@ -117,7 +117,8 @@ void GetData(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, ui
|
|||||||
"version: %u\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
"version: %u\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||||
xCoord, frameNumber, expLength, packetNumber, bunchId, timestamp, modId,
|
xCoord, frameNumber, expLength, packetNumber, bunchId, timestamp, modId,
|
||||||
xCoord, yCoord, zCoord, debug, roundRNumber, detType, version,
|
xCoord, yCoord, zCoord, debug, roundRNumber, detType, version,
|
||||||
((uint8_t)(*((uint8_t*)(datapointer)))), datasize);
|
((uint8_t)(*((uint8_t*)(datapointer)))), *datasize);
|
||||||
|
*datasize = 26000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,12 +33,14 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
|||||||
* @param freq pointer to streaming frequency
|
* @param freq pointer to streaming frequency
|
||||||
* @param timer pointer to timer if streaming frequency is random
|
* @param timer pointer to timer if streaming frequency is random
|
||||||
* @param dataReadycb pointer to data ready call back function
|
* @param dataReadycb pointer to data ready call back function
|
||||||
* @param pDataReadycb pointer to arguments of data ready call back function
|
* @param pDataReadycb pointer to arguments of data ready call back function. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||||
*/
|
*/
|
||||||
DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
||||||
uint32_t* freq, uint32_t* timer,
|
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,
|
void (*dataReadycb)(uint64_t, uint32_t, uint32_t, uint64_t,
|
||||||
char*, uint32_t, void*),
|
uint64_t, uint16_t, uint16_t, uint16_t, uint16_t,
|
||||||
|
uint32_t, uint16_t, uint8_t, uint8_t,
|
||||||
|
char*, uint32_t*, void*),
|
||||||
void *pDataReadycb);
|
void *pDataReadycb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -393,10 +395,11 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
|
|||||||
* detType is the detector type see :: detectorType
|
* detType is the detector type see :: detectorType
|
||||||
* version is the version number of this structure format
|
* version is the version number of this structure format
|
||||||
* dataPointer is the pointer to the data
|
* dataPointer is the pointer to the data
|
||||||
* dataSize in bytes is the size of the data in bytes
|
* dataSize in bytes is the size of the data in bytes. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||||
*/
|
*/
|
||||||
void (*rawDataReadyCallBack)(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,
|
void (*rawDataReadyCallBack)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t,
|
||||||
char*, uint32_t, void*);
|
uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||||
|
char*, uint32_t*, void*);
|
||||||
void *pRawDataReady;
|
void *pRawDataReady;
|
||||||
|
|
||||||
|
|
||||||
|
@ -166,12 +166,13 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
|
|||||||
/**
|
/**
|
||||||
* Create and send Json Header
|
* Create and send Json Header
|
||||||
* @param header header of image
|
* @param header header of image
|
||||||
|
* @param size data size (could have been modified in call back)
|
||||||
* @param nx number of pixels in x dim
|
* @param nx number of pixels in x dim
|
||||||
* @param ny number of pixels in y dim
|
* @param ny number of pixels in y dim
|
||||||
* @param dummy true if its a dummy header
|
* @param dummy true if its a dummy header
|
||||||
* @returns 0 if error, else 1
|
* @returns 0 if error, else 1
|
||||||
*/
|
*/
|
||||||
int SendHeader(sls_detector_header* header, uint32_t nx = 0, uint32_t ny = 0, bool dummy = true);
|
int SendHeader(sls_detector_header* header, uint32_t size = 0, uint32_t nx = 0, uint32_t ny = 0, bool dummy = true);
|
||||||
|
|
||||||
/** type of thread */
|
/** type of thread */
|
||||||
static const std::string TypeName;
|
static const std::string TypeName;
|
||||||
|
@ -600,10 +600,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
* detType is the detector type see :: detectorType
|
* detType is the detector type see :: detectorType
|
||||||
* version is the version number of this structure format
|
* version is the version number of this structure format
|
||||||
* dataPointer is the pointer to the data
|
* dataPointer is the pointer to the data
|
||||||
* dataSize in bytes is the size of the data in bytes
|
* dataSize in bytes is the size of the data in bytes. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||||
*/
|
*/
|
||||||
void 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,
|
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t,
|
||||||
char*, uint32_t, void*),void *arg);
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -736,10 +738,11 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
|
|||||||
* detType is the detector type see :: detectorType
|
* detType is the detector type see :: detectorType
|
||||||
* version is the version number of this structure format
|
* version is the version number of this structure format
|
||||||
* dataPointer is the pointer to the data
|
* dataPointer is the pointer to the data
|
||||||
* dataSize in bytes is the size of the data in bytes
|
* dataSize in bytes is the size of the data in bytes. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||||
*/
|
*/
|
||||||
void (*rawDataReadyCallBack)(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,
|
void (*rawDataReadyCallBack)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t,
|
||||||
char*, uint32_t, void*);
|
uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||||
|
char*, uint32_t*, void*);
|
||||||
void *pRawDataReady;
|
void *pRawDataReady;
|
||||||
|
|
||||||
|
|
||||||
|
@ -689,10 +689,10 @@ class UDPInterface {
|
|||||||
* detType is the detector type see :: detectorType
|
* detType is the detector type see :: detectorType
|
||||||
* version is the version number of this structure format
|
* version is the version number of this structure format
|
||||||
* dataPointer is the pointer to the data
|
* dataPointer is the pointer to the data
|
||||||
* dataSize in bytes is the size of the data in bytes
|
* dataSize in bytes is the size of the data in bytes. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||||
*/
|
*/
|
||||||
virtual void 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,
|
virtual void 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) = 0;
|
char*, uint32_t*, void*),void *arg) = 0;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -24,6 +24,7 @@ using namespace rapidjson;
|
|||||||
#define MAX_STR_LENGTH 1000
|
#define MAX_STR_LENGTH 1000
|
||||||
|
|
||||||
//#define ZMQ_DETAIL
|
//#define ZMQ_DETAIL
|
||||||
|
#define ROIVERBOSITY
|
||||||
|
|
||||||
class ZmqSocket {
|
class ZmqSocket {
|
||||||
|
|
||||||
@ -426,7 +427,15 @@ public:
|
|||||||
memcpy(buf, (char*)zmq_msg_data(&message), size);
|
memcpy(buf, (char*)zmq_msg_data(&message), size);
|
||||||
}
|
}
|
||||||
|
|
||||||
//incorrect size
|
//incorrect size (smaller)
|
||||||
|
else if (length < size){
|
||||||
|
#ifdef ROIVERBOSITY
|
||||||
|
cprintf(RED,"Error: Received smaller packet size %d for socket %d\n", length, index);
|
||||||
|
#endif
|
||||||
|
memcpy(buf, (char*)zmq_msg_data(&message), length);
|
||||||
|
memset(buf+length,0xFF,size-length);
|
||||||
|
}
|
||||||
|
//incorrect size (larger)
|
||||||
else {
|
else {
|
||||||
cprintf(RED,"Error: Received weird packet size %d for socket %d\n", length, index);
|
cprintf(RED,"Error: Received weird packet size %d for socket %d\n", length, index);
|
||||||
memset(buf,0xFF,size);
|
memset(buf,0xFF,size);
|
||||||
|
@ -91,10 +91,12 @@ class slsReceiver : private virtual slsReceiverDefs {
|
|||||||
* detType is the detector type see :: detectorType
|
* detType is the detector type see :: detectorType
|
||||||
* version is the version number of this structure format
|
* version is the version number of this structure format
|
||||||
* dataPointer is the pointer to the data
|
* dataPointer is the pointer to the data
|
||||||
* dataSize in bytes is the size of the data in bytes
|
* dataSize in bytes is the size of the data in bytes. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||||
*/
|
*/
|
||||||
void 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,
|
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t,
|
||||||
char*, uint32_t, void*),void *arg);
|
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);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -95,8 +95,10 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
* dataPointer is the pointer to the data
|
* dataPointer is the pointer to the data
|
||||||
* dataSize in bytes is the size of the data in bytes
|
* dataSize in bytes is the size of the data in bytes
|
||||||
*/
|
*/
|
||||||
void 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,
|
void registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t, uint32_t,
|
||||||
char*, uint32_t, void*),void *arg);
|
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);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
@ -344,10 +346,11 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
|||||||
* detType is the detector type see :: detectorType
|
* detType is the detector type see :: detectorType
|
||||||
* version is the version number of this structure format
|
* version is the version number of this structure format
|
||||||
* dataPointer is the pointer to the data
|
* dataPointer is the pointer to the data
|
||||||
* dataSize in bytes is the size of the data in bytes
|
* dataSize in bytes is the size of the data in bytes. To write/stream a smaller size of processed data, change this value (only smaller value is allowed).
|
||||||
*/
|
*/
|
||||||
void (*rawDataReadyCallBack)(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,
|
void (*rawDataReadyCallBack)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t,
|
||||||
char*, uint32_t, void*);
|
uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||||
|
char*, uint32_t*, void*);
|
||||||
void *pRawDataReady;
|
void *pRawDataReady;
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
void registerCallBackRawDataReady(void (*func)(uint64_t frameNumber, uint32_t expLength, uint32_t packetNumber, uint64_t bunchId, uint64_t timestamp,
|
void 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,
|
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 object
|
//receiver object
|
||||||
slsReceiver* receiver;
|
slsReceiver* receiver;
|
||||||
|
@ -35,8 +35,9 @@ bool DataProcessor::SilentMode(false);
|
|||||||
|
|
||||||
DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
DataProcessor::DataProcessor(Fifo*& f, fileFormat* ftype, bool fwenable, bool* dsEnable, bool* gpEnable, uint32_t* dr,
|
||||||
uint32_t* freq, uint32_t* timer,
|
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,
|
void (*dataReadycb)(uint64_t, uint32_t, uint32_t, uint64_t, uint64_t,
|
||||||
char*, uint32_t, void*),
|
uint16_t, uint16_t, uint16_t, uint16_t, uint32_t, uint16_t, uint8_t, uint8_t,
|
||||||
|
char*, uint32_t*, void*),
|
||||||
void *pDataReadycb) :
|
void *pDataReadycb) :
|
||||||
|
|
||||||
ThreadObject(NumberofDataProcessors),
|
ThreadObject(NumberofDataProcessors),
|
||||||
@ -316,7 +317,7 @@ void DataProcessor::ThreadExecution() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessAnImage(buffer + FIFO_HEADER_NUMBYTES);
|
ProcessAnImage(buffer);
|
||||||
|
|
||||||
//stream (if time/freq to stream) or free
|
//stream (if time/freq to stream) or free
|
||||||
if (*dataStreamEnable && SendToStreamer())
|
if (*dataStreamEnable && SendToStreamer())
|
||||||
@ -348,7 +349,7 @@ void DataProcessor::StopProcessing(char* buf) {
|
|||||||
/** buf includes only the standard header */
|
/** buf includes only the standard header */
|
||||||
void DataProcessor::ProcessAnImage(char* buf) {
|
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;
|
uint64_t fnum = header->frameNumber;
|
||||||
currentFrameIndex = fnum;
|
currentFrameIndex = fnum;
|
||||||
uint32_t nump = header->packetNumber;
|
uint32_t nump = header->packetNumber;
|
||||||
@ -381,7 +382,7 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (*gapPixelsEnable && (*dynamicRange!=4))
|
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]
|
// x coord is 0 for detector in pos [0,0,0]
|
||||||
if (xcoordin1D) {
|
if (xcoordin1D) {
|
||||||
@ -409,14 +410,14 @@ void DataProcessor::ProcessAnImage(char* buf) {
|
|||||||
header->roundRNumber,
|
header->roundRNumber,
|
||||||
header->detType,
|
header->detType,
|
||||||
header->version,
|
header->version,
|
||||||
buf + sizeof(sls_detector_header),
|
buf + FIFO_HEADER_NUMBYTES + sizeof(sls_detector_header),
|
||||||
generalData->imageSize,
|
(uint32_t*)buf,
|
||||||
pRawDataReady);
|
pRawDataReady);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (file)
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ProcessAnImage(buffer + FIFO_HEADER_NUMBYTES);
|
ProcessAnImage(buffer);
|
||||||
|
|
||||||
//free
|
//free
|
||||||
fifo->FreeAddress(buffer);
|
fifo->FreeAddress(buffer);
|
||||||
@ -216,7 +216,7 @@ void DataStreamer::StopProcessing(char* buf) {
|
|||||||
#endif
|
#endif
|
||||||
sls_detector_header* header = (sls_detector_header*) (buf);
|
sls_detector_header* header = (sls_detector_header*) (buf);
|
||||||
//send dummy header and data
|
//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);
|
cprintf(RED,"Error: Could not send zmq dummy header for streamer %d\n", index);
|
||||||
|
|
||||||
fifo->FreeAddress(buf);
|
fifo->FreeAddress(buf);
|
||||||
@ -229,7 +229,7 @@ void DataStreamer::StopProcessing(char* buf) {
|
|||||||
/** buf includes only the standard header */
|
/** buf includes only the standard header */
|
||||||
void DataStreamer::ProcessAnImage(char* buf) {
|
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;
|
uint64_t fnum = header->frameNumber;
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index,fnum);
|
cprintf(MAGENTA,"DataStreamer %d: fnum:%lu\n", index,fnum);
|
||||||
@ -245,11 +245,11 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
|||||||
//shortframe gotthard
|
//shortframe gotthard
|
||||||
if (completeBuffer) {
|
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",
|
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||||
(long long int) fnum, index);
|
(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))
|
if (!zmqSocket->SendData(completeBuffer, generalData->imageSizeComplete))
|
||||||
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||||
(long long int) fnum, index);
|
(long long int) fnum, index);
|
||||||
@ -259,11 +259,11 @@ void DataStreamer::ProcessAnImage(char* buf) {
|
|||||||
//normal
|
//normal
|
||||||
else {
|
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",
|
cprintf(RED,"Error: Could not send zmq header for fnum %lld and streamer %d\n",
|
||||||
(long long int) fnum, index);
|
(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",
|
cprintf(RED,"Error: Could not send zmq data for fnum %lld and streamer %d\n",
|
||||||
(long long int) fnum, index);
|
(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)
|
if (dummy)
|
||||||
return zmqSocket->SendHeaderData(index, dummy,SLS_DETECTOR_JSON_HEADER_VERSION);
|
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;
|
uint64_t acquisitionIndex = header->frameNumber - firstAcquisitionIndex;
|
||||||
|
|
||||||
return zmqSocket->SendHeaderData(index, dummy, SLS_DETECTOR_JSON_HEADER_VERSION, *dynamicRange, *fileIndex,
|
return zmqSocket->SendHeaderData(index, dummy, SLS_DETECTOR_JSON_HEADER_VERSION, *dynamicRange, *fileIndex,
|
||||||
nx, ny,generalData->imageSize,
|
nx, ny, size,
|
||||||
acquisitionIndex, frameIndex, fileNametoStream,
|
acquisitionIndex, frameIndex, fileNametoStream,
|
||||||
header->frameNumber, header->expLength, header->packetNumber, header->bunchId, header->timestamp,
|
header->frameNumber, header->expLength, header->packetNumber, header->bunchId, header->timestamp,
|
||||||
header->modId, header->xCoord, header->yCoord, header->zCoord,
|
header->modId, header->xCoord, header->yCoord, header->zCoord,
|
||||||
|
@ -614,8 +614,10 @@ void UDPBaseImplementation::registerCallBackAcquisitionFinished(void (*func)(uin
|
|||||||
pAcquisitionFinished=arg;
|
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,
|
void UDPBaseImplementation::registerCallBackRawDataReady(void (*func)(uint64_t,
|
||||||
char*, uint32_t, void*),void *arg){
|
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;
|
rawDataReadyCallBack=func;
|
||||||
pRawDataReady=arg;
|
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,
|
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,
|
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,
|
PRINT_IN_COLOR (xCoord,
|
||||||
"#### %d GetData: ####\n"
|
"#### %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",
|
"version: %u\t\tfirstbytedata: 0x%x\t\tdatsize: %u\n\n",
|
||||||
xCoord, frameNumber, expLength, packetNumber, bunchId, timestamp, modId,
|
xCoord, frameNumber, expLength, packetNumber, bunchId, timestamp, modId,
|
||||||
xCoord, yCoord, zCoord, debug, roundRNumber, detType, version,
|
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,
|
void slsReceiver::registerCallBackRawDataReady(void (*func)(uint64_t, uint32_t,
|
||||||
char*, uint32_t, void*),void *arg){
|
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
|
//tcpipInterface
|
||||||
if(udp_interface)
|
if(udp_interface)
|
||||||
udp_interface->registerCallBackRawDataReady(func,arg);
|
udp_interface->registerCallBackRawDataReady(func,arg);
|
||||||
|
@ -170,8 +170,10 @@ void slsReceiverTCPIPInterface::registerCallBackAcquisitionFinished(void (*func)
|
|||||||
pAcquisitionFinished=arg;
|
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,
|
void slsReceiverTCPIPInterface::registerCallBackRawDataReady(void (*func)(uint64_t,
|
||||||
char*, uint32_t, void*),void *arg){
|
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;
|
rawDataReadyCallBack=func;
|
||||||
pRawDataReady=arg;
|
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,
|
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,
|
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);
|
receiver->registerCallBackRawDataReady(func,arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user