mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-19 16:27:13 +02:00
format receiver
This commit is contained in:
273
slsReceiverSoftware/src/DataStreamer.h
Executable file → Normal file
273
slsReceiverSoftware/src/DataStreamer.h
Executable file → Normal file
@ -18,174 +18,173 @@ class ZmqSocket;
|
||||
#include <map>
|
||||
|
||||
class DataStreamer : private virtual slsDetectorDefs, public ThreadObject {
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* Calls Base Class CreateThread(), sets ErrorMask if error and increments NumberofDataStreamers
|
||||
|
||||
public:
|
||||
/**
|
||||
* Constructor
|
||||
* Calls Base Class CreateThread(), sets ErrorMask if error and increments
|
||||
* NumberofDataStreamers
|
||||
* @param ind self index
|
||||
* @param f address of Fifo pointer
|
||||
* @param dr pointer to dynamic range
|
||||
* @param r roi
|
||||
* @param fi pointer to file index
|
||||
* @param fd flipped data enable for x dimension
|
||||
* @param nd pointer to number of detectors in each dimension
|
||||
* @param qe pointer to quad Enable
|
||||
* @param tot pointer to total number of frames
|
||||
*/
|
||||
DataStreamer(int ind, Fifo* f, uint32_t* dr, ROI* r,
|
||||
uint64_t* fi, int fd, int* nd, bool* qe, uint64_t* tot);
|
||||
* @param f address of Fifo pointer
|
||||
* @param dr pointer to dynamic range
|
||||
* @param r roi
|
||||
* @param fi pointer to file index
|
||||
* @param fd flipped data enable for x dimension
|
||||
* @param nd pointer to number of detectors in each dimension
|
||||
* @param qe pointer to quad Enable
|
||||
* @param tot pointer to total number of frames
|
||||
*/
|
||||
DataStreamer(int ind, Fifo *f, uint32_t *dr, ROI *r, uint64_t *fi, int fd,
|
||||
int *nd, bool *qe, uint64_t *tot);
|
||||
|
||||
/**
|
||||
* Destructor
|
||||
* Calls Base Class DestroyThread() and decrements NumberofDataStreamers
|
||||
*/
|
||||
~DataStreamer();
|
||||
/**
|
||||
* Destructor
|
||||
* Calls Base Class DestroyThread() and decrements NumberofDataStreamers
|
||||
*/
|
||||
~DataStreamer();
|
||||
|
||||
/**
|
||||
* Set Fifo pointer to the one given
|
||||
* @param f address of Fifo pointer
|
||||
*/
|
||||
void SetFifo(Fifo* f);
|
||||
/**
|
||||
* Set Fifo pointer to the one given
|
||||
* @param f address of Fifo pointer
|
||||
*/
|
||||
void SetFifo(Fifo *f);
|
||||
|
||||
/**
|
||||
* Reset parameters for new acquisition
|
||||
*/
|
||||
void ResetParametersforNewAcquisition(const std::string& fname);
|
||||
/**
|
||||
* Reset parameters for new acquisition
|
||||
*/
|
||||
void ResetParametersforNewAcquisition(const std::string &fname);
|
||||
|
||||
/**
|
||||
* Set GeneralData pointer to the one given
|
||||
* @param g address of GeneralData (Detector Data) pointer
|
||||
*/
|
||||
void SetGeneralData(GeneralData* g);
|
||||
/**
|
||||
* Set GeneralData pointer to the one given
|
||||
* @param g address of GeneralData (Detector Data) pointer
|
||||
*/
|
||||
void SetGeneralData(GeneralData *g);
|
||||
|
||||
/**
|
||||
* Set number of detectors
|
||||
* @param number of detectors in both dimensions
|
||||
*/
|
||||
void SetNumberofDetectors(int* nd);
|
||||
/**
|
||||
* Set number of detectors
|
||||
* @param number of detectors in both dimensions
|
||||
*/
|
||||
void SetNumberofDetectors(int *nd);
|
||||
|
||||
/**
|
||||
* Set Flipped data enable across x dimension
|
||||
* @param flipped data enable in x dimension
|
||||
*/
|
||||
void SetFlippedDataX(int fd);
|
||||
/**
|
||||
* Set Flipped data enable across x dimension
|
||||
* @param flipped data enable in x dimension
|
||||
*/
|
||||
void SetFlippedDataX(int fd);
|
||||
|
||||
/**
|
||||
* Set additional json header
|
||||
* @param json additional json header
|
||||
*/
|
||||
void SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
||||
|
||||
/**
|
||||
* Creates Zmq Sockets
|
||||
* (throws an exception if it couldnt create zmq sockets)
|
||||
* @param nunits pointer to number of theads/ units per detector
|
||||
* @param port streaming port start index
|
||||
* @param ip streaming source ip
|
||||
*/
|
||||
void CreateZmqSockets(int* nunits, uint32_t port, const sls::IpAddr ip);
|
||||
/**
|
||||
* Set additional json header
|
||||
* @param json additional json header
|
||||
*/
|
||||
void
|
||||
SetAdditionalJsonHeader(const std::map<std::string, std::string> &json);
|
||||
|
||||
/**
|
||||
* Shuts down and deletes Zmq Sockets
|
||||
*/
|
||||
void CloseZmqSocket();
|
||||
/**
|
||||
* Creates Zmq Sockets
|
||||
* (throws an exception if it couldnt create zmq sockets)
|
||||
* @param nunits pointer to number of theads/ units per detector
|
||||
* @param port streaming port start index
|
||||
* @param ip streaming source ip
|
||||
*/
|
||||
void CreateZmqSockets(int *nunits, uint32_t port, const sls::IpAddr ip);
|
||||
|
||||
/**
|
||||
* Restream stop dummy packet
|
||||
*/
|
||||
void RestreamStop();
|
||||
/**
|
||||
* Shuts down and deletes Zmq Sockets
|
||||
*/
|
||||
void CloseZmqSocket();
|
||||
|
||||
/**
|
||||
* Restream stop dummy packet
|
||||
*/
|
||||
void RestreamStop();
|
||||
|
||||
private:
|
||||
private:
|
||||
/**
|
||||
* Record First Index
|
||||
* @param fnum frame index to record
|
||||
*/
|
||||
void RecordFirstIndex(uint64_t fnum);
|
||||
|
||||
/**
|
||||
* Record First Index
|
||||
* @param fnum frame index to record
|
||||
*/
|
||||
void RecordFirstIndex(uint64_t fnum);
|
||||
/**
|
||||
* Thread Exeution for DataStreamer Class
|
||||
* Stream an image via zmq
|
||||
*/
|
||||
void ThreadExecution();
|
||||
|
||||
/**
|
||||
* Thread Exeution for DataStreamer Class
|
||||
* Stream an image via zmq
|
||||
*/
|
||||
void ThreadExecution();
|
||||
/**
|
||||
* Frees dummy buffer,
|
||||
* reset running mask by calling StopRunning()
|
||||
* @param buf address of pointer
|
||||
*/
|
||||
void StopProcessing(char *buf);
|
||||
|
||||
/**
|
||||
* Frees dummy buffer,
|
||||
* reset running mask by calling StopRunning()
|
||||
* @param buf address of pointer
|
||||
*/
|
||||
void StopProcessing(char* buf);
|
||||
/**
|
||||
* Process an image popped from fifo,
|
||||
* write to file if fw enabled & update parameters
|
||||
* @param buffer
|
||||
*/
|
||||
void ProcessAnImage(char *buf);
|
||||
|
||||
/**
|
||||
* Process an image popped from fifo,
|
||||
* write to file if fw enabled & update parameters
|
||||
* @param buffer
|
||||
*/
|
||||
void ProcessAnImage(char* buf);
|
||||
/**
|
||||
* Create and send Json Header
|
||||
* @param rheader 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_receiver_header *rheader, uint32_t size = 0,
|
||||
uint32_t nx = 0, uint32_t ny = 0, bool dummy = true);
|
||||
|
||||
/**
|
||||
* Create and send Json Header
|
||||
* @param rheader 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_receiver_header* rheader, uint32_t size = 0, uint32_t nx = 0, uint32_t ny = 0, bool dummy = true);
|
||||
/** type of thread */
|
||||
static const std::string TypeName;
|
||||
|
||||
/** type of thread */
|
||||
static const std::string TypeName;
|
||||
/** GeneralData (Detector Data) object */
|
||||
const GeneralData *generalData{nullptr};
|
||||
|
||||
/** GeneralData (Detector Data) object */
|
||||
const GeneralData* generalData{nullptr};
|
||||
/** Fifo structure */
|
||||
Fifo *fifo;
|
||||
|
||||
/** Fifo structure */
|
||||
Fifo* fifo;
|
||||
/** ZMQ Socket - Receiver to Client */
|
||||
ZmqSocket *zmqSocket{nullptr};
|
||||
|
||||
/** ZMQ Socket - Receiver to Client */
|
||||
ZmqSocket* zmqSocket{nullptr};
|
||||
/** Pointer to dynamic range */
|
||||
uint32_t *dynamicRange;
|
||||
|
||||
/** Pointer to dynamic range */
|
||||
uint32_t* dynamicRange;
|
||||
/** ROI */
|
||||
ROI *roi;
|
||||
|
||||
/** ROI */
|
||||
ROI* roi;
|
||||
/** adc Configured */
|
||||
int adcConfigured{-1};
|
||||
|
||||
/** adc Configured */
|
||||
int adcConfigured{-1};
|
||||
/** Pointer to file index */
|
||||
uint64_t *fileIndex;
|
||||
|
||||
/** Pointer to file index */
|
||||
uint64_t* fileIndex;
|
||||
/** flipped data across x axis */
|
||||
int flippedDataX;
|
||||
|
||||
/** flipped data across x axis */
|
||||
int flippedDataX;
|
||||
/** additional json header */
|
||||
std::map<std::string, std::string> additionJsonHeader;
|
||||
|
||||
/** additional json header */
|
||||
std::map<std::string, std::string> additionJsonHeader;
|
||||
/** Aquisition Started flag */
|
||||
bool startedFlag{nullptr};
|
||||
|
||||
/** Aquisition Started flag */
|
||||
bool startedFlag{nullptr};
|
||||
/** Frame Number of First Frame */
|
||||
uint64_t firstIndex{0};
|
||||
|
||||
/** Frame Number of First Frame */
|
||||
uint64_t firstIndex{0};
|
||||
/* File name to stream */
|
||||
std::string fileNametoStream;
|
||||
|
||||
/* File name to stream */
|
||||
std::string fileNametoStream;
|
||||
/** Complete buffer used for roi, eg. shortGotthard */
|
||||
char *completeBuffer{nullptr};
|
||||
|
||||
/** Complete buffer used for roi, eg. shortGotthard */
|
||||
char* completeBuffer{nullptr};
|
||||
/** Number of Detectors in X and Y dimension */
|
||||
int numDet[2];
|
||||
|
||||
/** Number of Detectors in X and Y dimension */
|
||||
int numDet[2];
|
||||
|
||||
/** Quad Enable */
|
||||
bool* quadEnable;
|
||||
|
||||
/** Total number of frames */
|
||||
uint64_t* totalNumFrames;
|
||||
/** Quad Enable */
|
||||
bool *quadEnable;
|
||||
|
||||
/** Total number of frames */
|
||||
uint64_t *totalNumFrames;
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user