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:
2018-03-21 17:08:38 +01:00
parent a1936cb884
commit a74e8f68f7
16 changed files with 83 additions and 54 deletions

View File

@ -33,12 +33,14 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
* @param freq pointer to streaming frequency
* @param timer pointer to timer if streaming frequency is random
* @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,
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);
/**
@ -393,10 +395,11 @@ class DataProcessor : private virtual slsReceiverDefs, public ThreadObject {
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* 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,
char*, uint32_t, void*);
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,
char*, uint32_t*, void*);
void *pRawDataReady;

View File

@ -166,12 +166,13 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/**
* Create and send Json Header
* @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 ny number of pixels in y dim
* @param dummy true if its a dummy header
* @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 */
static const std::string TypeName;

View File

@ -600,10 +600,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* 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,
char*, uint32_t, void*),void *arg);
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);
@ -736,10 +738,11 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* 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,
char*, uint32_t, void*);
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,
char*, uint32_t*, void*);
void *pRawDataReady;

View File

@ -689,10 +689,10 @@ class UDPInterface {
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* 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,
char*, uint32_t, void*),void *arg) = 0;
char*, uint32_t*, void*),void *arg) = 0;
protected:

View File

@ -24,6 +24,7 @@ using namespace rapidjson;
#define MAX_STR_LENGTH 1000
//#define ZMQ_DETAIL
#define ROIVERBOSITY
class ZmqSocket {
@ -426,7 +427,15 @@ public:
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 {
cprintf(RED,"Error: Received weird packet size %d for socket %d\n", length, index);
memset(buf,0xFF,size);

View File

@ -91,10 +91,12 @@ class slsReceiver : private virtual slsReceiverDefs {
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* 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,
char*, uint32_t, void*),void *arg);
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);

View File

@ -95,8 +95,10 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
* dataPointer is the pointer to the data
* 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,
char*, uint32_t, void*),void *arg);
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);
private:
@ -344,10 +346,11 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
* detType is the detector type see :: detectorType
* version is the version number of this structure format
* 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,
char*, uint32_t, void*);
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,
char*, uint32_t*, void*);
void *pRawDataReady;

View File

@ -69,7 +69,7 @@ public:
*/
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,
char* datapointer, uint32_t datasize, void*),void *arg);
char* datapointer, uint32_t* datasize, void*),void *arg);
//receiver object
slsReceiver* receiver;