zmq fixed to have additional json headers using rx_zmqjsonheader

This commit is contained in:
2018-04-09 16:33:14 +02:00
parent ccdc7d22e9
commit 2bd8e6c166
14 changed files with 195 additions and 10 deletions

View File

@ -25,8 +25,9 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
* @param sEnable pointer to short frame enable
* @param fi pointer to file index
* @param fd flipped data enable for x and y dimensions
* @param ajh additional json header
*/
DataStreamer(Fifo*& f, uint32_t* dr, int* sEnable, uint64_t* fi, int* fd);
DataStreamer(Fifo*& f, uint32_t* dr, int* sEnable, uint64_t* fi, int* fd, char* ajh);
/**
* Destructor
@ -233,5 +234,8 @@ class DataStreamer : private virtual slsReceiverDefs, public ThreadObject {
/** flipped data across both dimensions enable */
int* flippedData;
/** additional json header */
char* additionJsonHeader;
};

View File

@ -271,6 +271,12 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/
char *getStreamingSourceIP() const;
/**
* Get additional json header
* @return additional json header
*/
char *getAdditionalJsonHeader() const;
/*************************************************************************
* Setters ***************************************************************
@ -555,6 +561,11 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/
void setStreamingSourceIP(const char* c);
/**
* Set additional json header
*/
void setAdditionalJsonHeader(const char* c);
/*
* Restream stop dummy packet from receiver
* @return OK or FAIL
@ -712,6 +723,8 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
uint32_t streamingPort;
/** streaming port */
char streamingSrcIP[MAX_STR_LENGTH];
/** additional json header */
char additionalJsonHeader[MAX_STR_LENGTH];
//***receiver parameters***
uint32_t silentMode;

View File

@ -51,6 +51,7 @@ class UDPInterface {
* -setGapPixelsEnable
* -setStreamingPort
* -setStreamingSourceIP
* -setAdditionalJsonHeader
* -setDataStreamEnable
*
*
@ -357,6 +358,12 @@ class UDPInterface {
*/
virtual char *getStreamingSourceIP() const = 0;
/**
* Get additional json header
* @return additional json header
*/
virtual char *getAdditionalJsonHeader() const = 0;
/*************************************************************************
* Setters ***************************************************************
@ -643,6 +650,11 @@ class UDPInterface {
*/
virtual void setStreamingSourceIP(const char* c) = 0;
/**
* Set additional json header
*/
virtual void setAdditionalJsonHeader(const char* c) = 0;
/*
* Restream stop dummy packet from receiver
* @return OK or FAIL

View File

@ -276,7 +276,8 @@ public:
uint64_t bunchId = 0, uint64_t timestamp = 0,
uint16_t modId = 0, uint16_t xCoord = 0, uint16_t yCoord = 0, uint16_t zCoord = 0,
uint32_t debug = 0, uint16_t roundRNumber = 0,
uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0) {
uint8_t detType = 0, uint8_t version = 0, int* flippedData = 0,
char* additionalJsonHeader = 0) {
char buf[MAX_STR_LENGTH] = "";
@ -310,7 +311,7 @@ public:
//additional stuff
"\"flippedDataX\":%u"
"}\n\0";
;//"}\n\0";
int length = sprintf(buf, jsonHeaderFormat,
jsonversion, dynamicrange, fileIndex, npixelsx, npixelsy, imageSize,
acqIndex, fIndex, (fname == NULL)? "":fname, dummy?0:1,
@ -322,9 +323,15 @@ public:
//additional stuff
((flippedData == 0 ) ? 0 :flippedData[0])
);
if (additionalJsonHeader && strlen(additionalJsonHeader)) {
length = sprintf(buf, "%s, %s}\n%c", buf, additionalJsonHeader, '\0');
} else {
length = sprintf(buf, "%s}\n%c", buf, '\0');
}
#ifdef VERBOSE
//if(!index)
FILE_LOG(logINFO) << index << ": Streamer: buf:" << buf;
cprintf(BLUE,"%d : STreamer: buf: %s\n", index, buf);
#endif
if(zmq_send (socketDescriptor, buf, length, dummy?0:ZMQ_SNDMORE) < 0) {

View File

@ -297,6 +297,9 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
/** restream stop packet */
int restream_stop();
/** set additional json header */
int set_additional_json_header();
/** detector type */

View File

@ -63,6 +63,8 @@ enum recFuncs{
F_SET_RECEIVER_SILENT_MODE, /** < sets the receiver silent mode */
F_ENABLE_GAPPIXELS_IN_RECEIVER, /** < sets gap pixels in the receiver */
F_RESTREAM_STOP_FROM_RECEIVER, /** < restream stop from receiver */
F_ADDITIONAL_JSON_HEADER, /** < additional json header */
/* Always append functions hereafter!!! */