This commit is contained in:
l_msdetect
2015-10-28 17:40:55 +01:00
parent 5f3de2057c
commit 58bfa296be
11 changed files with 182 additions and 133 deletions

View File

@ -33,6 +33,10 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
*/
virtual ~UDPBaseImplementation();
/*
* Initialize class members
*/
void initializeMembers();
/*************************************************************************
* Getters ***************************************************************
@ -180,7 +184,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* Get Listening Status of Receiver
* @return can be idle, listening or error depending on if the receiver is listening or not
*/
slsReceiverDefs::runStatus getStatus() const;
runStatus getStatus() const;
@ -334,7 +338,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* @param d detector type
* @return OK or FAIL
*/
int setDetectorType(const slsReceiverDefs::detectorType d);
int setDetectorType(const detectorType d);
/**
* Sets detector hostname (and corresponding detector variables in derived REST class)
@ -413,14 +417,14 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* 1 callback writes file, we have to open, close it
* 2 we open, close, write file, callback does not do anything
*/
void registerCallBackStartAcquisition(int (*func)(char*, char*,uint64_t, uint32_t, void*),void *arg);
void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
/**
* Call back for acquisition finished
* callback argument is
* total frames caught
*/
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg);
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
/**
* Call back for raw data
@ -431,7 +435,7 @@ class UDPBaseImplementation : protected virtual slsReceiverDefs, public UDPInter
* file descriptor
* guidatapointer (NULL, no data required)
*/
void registerCallBackRawDataReady(void (*func)(uint64_t, char*, uint32_t, FILE*, char*, void*),void *arg);
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg);

View File

@ -407,7 +407,7 @@ class UDPInterface {
/**
* Reset acquisition parameters such as total frames caught for an entire acquisition (including all scans)
*/
void resetAcquisitionCount();
virtual void resetAcquisitionCount() = 0;
/**
* Start Listening for Packets by activating all configuration settings to receiver
@ -471,14 +471,14 @@ class UDPInterface {
* 1 callback writes file, we have to open, close it
* 2 we open, close, write file, callback does not do anything
*/
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*,uint64_t, uint32_t, void*),void *arg) = 0;
virtual void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg) = 0;
/**
* Call back for acquisition finished
* callback argument is
* total frames caught
*/
virtual void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg) = 0;
virtual void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg) = 0;
/**
* Call back for raw data
@ -489,7 +489,7 @@ class UDPInterface {
* file descriptor
* guidatapointer (NULL, no data required)
*/
virtual void registerCallBackRawDataReady(void (*func)(uint64_t, char*, uint32_t, FILE*, char*, void*),void *arg) = 0;
virtual void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg) = 0;
protected:

View File

@ -136,7 +136,7 @@ class UDPStandardImplementation: private virtual slsReceiverDefs, public UDPBase
* @param d detector type
* @return OK or FAIL
*/
int setDetectorType(const slsReceiverDefs::detectorType d);
int setDetectorType(const detectorType d);
//***acquisition functions***
/**
@ -214,11 +214,6 @@ private:
//**initial parameters***
/**
* Delete and free base member parameters
*/
void deleteBaseMembers();
/**
* Delete and free member parameters
*/
@ -409,7 +404,7 @@ private:
* @param wbuffer writing buffer popped out from FIFO
* @param npackets number of packets
*/
void handleWithoutDataCompression(int ithread, char* wbuffer[],int npackets);
void handleWithoutDataCompression(int ithread, char* wbuffer[],uint32_t npackets);
/**
* Calle by handleWithoutDataCompression
@ -417,7 +412,7 @@ private:
* @param wbuffer is the address of buffer popped out of FIFO
* @param numpackets is the number of packets
*/
void writeFileWithoutCompression(char* wbuffer[],int numpackets);
void writeFileWithoutCompression(char* wbuffer[],uint32_t numpackets);
/**
* Called by writeToFileWithoutCompression
@ -449,7 +444,7 @@ private:
* @param wbuffer writer buffer
* @param nf number of frames
*/
void handleDataCompression(int ithread, char* wbuffer[], int &nf);
void handleDataCompression(int ithread, char* wbuffer[], uint64_t &nf);

View File

@ -62,14 +62,14 @@ class slsReceiver : private virtual slsReceiverDefs {
@param func callback to be called when starting the acquisition. Its arguments are filepath filename fileindex data size
\returns 0 callback takes care of open,close,write file; 1 callback writes file, we have to open, close it; 2 we open, close, write file, callback does not do anything
*/
void registerCallBackStartAcquisition(int (*func)(char*, char*,uint64_t, uint32_t, void*),void *arg);
void registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
/**
callback argument is
toatal farmes caught
*/
void registerCallBackAcquisitionFinished(void (*func)(uint64_t, void*),void *arg);
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
/**
args to raw data ready callback are
@ -79,7 +79,7 @@ class slsReceiver : private virtual slsReceiverDefs {
file descriptor
guidatapointer (NULL, no data required)
*/
void registerCallBackRawDataReady(void (*func)(uint64_t, char*, uint32_t, FILE*, char*, void*),void *arg);
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg);
private:

View File

@ -61,7 +61,7 @@ public:
*/
void registerCallBackStartAcquisition(int (*func)(char* filepath, char* filename,uint64_t fileindex, uint32_t datasize, void*),void *arg);
void registerCallBackStartAcquisition(int (*func)(char* filepath, char* filename,int fileindex, int datasize, void*),void *arg);
/**
@ -71,7 +71,7 @@ public:
*/
void registerCallBackAcquisitionFinished(void (*func)(uint64_t nf, void*),void *arg);
void registerCallBackAcquisitionFinished(void (*func)(int nf, void*),void *arg);
@ -81,7 +81,7 @@ public:
\returns nothing
*/
void registerCallBackRawDataReady(void (*func)(uint64_t framenumber, char* datapointer, uint32_t datasize, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
void registerCallBackRawDataReady(void (*func)(int framenumber, char* datapointer, int datasize, FILE* filedescriptor, char* guidatapointer, void*),void *arg);
// made static to close thread files with ctrl+c
static slsReceiver* receiver;

View File

@ -122,6 +122,55 @@ public:
else return std::string("disabled"); \
};
/** returns detector type string from detector type index
\param t string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
\returns MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, MÖNCH, GENERIC
*/
static std::string getDetectorType(detectorType t){ \
switch (t) { \
case MYTHEN: return std::string("Mythen"); \
case PILATUS: return std::string("Pilatus"); \
case EIGER: return std::string("Eiger"); \
case GOTTHARD: return std::string("Gotthard"); \
case AGIPD: return std::string("Agipd"); \
case MOENCH: return std::string("Moench"); \
case JUNGFRAU: return std::string("Jungfrau"); \
case JUNGFRAUCTB: return std::string("JungfrauCTB"); \
case PROPIX: return std::string("Propix"); \
default: return std::string("Unknown"); \
}};
/** returns detector type index from detector type string
\param type can be MYTHEN, PILATUS, EIGER, GOTTHARD, AGIPD, GENERIC
\returns Mythen, Pilatus, Eiger, Gotthard, Agipd, Mönch, Unknown
*/
static detectorType getDetectorType(std::string const type){\
if (type=="Mythen") return MYTHEN; \
if (type=="Pilatus") return PILATUS; \
if (type=="Eiger") return EIGER; \
if (type=="Gotthard") return GOTTHARD; \
if (type=="Agipd") return AGIPD; \
if (type=="Moench") return MOENCH; \
if (type=="Jungfrau") return JUNGFRAU; \
if (type=="JungfrauCTB") return JUNGFRAUCTB; \
if (type=="Propix") return PROPIX; \
return GENERIC; \
};
/** returns string from run status index
\param s can be ERROR, WAITING, RUNNING, TRANSMITTING, RUN_FINISHED
\returns string error, waiting, running, data, finished
*/
static std::string runStatusType(runStatus s){\
switch (s) { \
case ERROR: return std::string("error"); \
case WAITING: return std::string("waiting"); \
case RUNNING: return std::string("running"); \
case TRANSMITTING: return std::string("data"); \
case RUN_FINISHED: return std::string("finished"); \
default: return std::string("idle"); \
}};
#ifdef __cplusplus