mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
bug fix for receiver call back
This commit is contained in:
parent
83f3ab145e
commit
d88b104aa8
@ -57,45 +57,39 @@ class slsReceiverTCPIPInterface : private virtual slsReceiverDefs {
|
||||
/** gets version */
|
||||
int64_t getReceiverVersion();
|
||||
|
||||
/* /\** */
|
||||
/* callback arguments are */
|
||||
/* filepath */
|
||||
/* filename */
|
||||
/* fileindex */
|
||||
/* data size */
|
||||
//***callback functions***
|
||||
/**
|
||||
* Call back for start acquisition
|
||||
* callback arguments are
|
||||
* filepath
|
||||
* filename
|
||||
* fileindex
|
||||
* datasize
|
||||
*
|
||||
* return value is the action which decides what the user and default responsibilities to save data are
|
||||
* 0 callback takes care of open,close,wrie 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*,int, int, void*),void *arg);
|
||||
|
||||
/* return value is */
|
||||
/* 0 callback takes care of open,close,wrie 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*,int, int, void*),void *arg){receiverBase->registerCallBackStartAcquisition(func,arg);};; */
|
||||
|
||||
|
||||
/* /\** */
|
||||
/* callback argument is */
|
||||
/* toatal farmes caught */
|
||||
|
||||
/* *\/ */
|
||||
|
||||
|
||||
/* void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){receiverBase->registerCallBackAcquisitionFinished(func,arg);}; */
|
||||
|
||||
|
||||
|
||||
/* /\** */
|
||||
/* args to raw data ready callback are */
|
||||
/* framenum */
|
||||
/* datapointer */
|
||||
/* datasize in bytes */
|
||||
/* file descriptor */
|
||||
/* guidatapointer (NULL, no data required) */
|
||||
/* *\/ */
|
||||
|
||||
/* void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){receiverBase->registerCallBackRawDataReady(func,arg);}; */
|
||||
/**
|
||||
* Call back for acquisition finished
|
||||
* callback argument is
|
||||
* total frames caught
|
||||
*/
|
||||
void registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
|
||||
|
||||
/**
|
||||
* Call back for raw data
|
||||
* args to raw data ready callback are
|
||||
* framenum
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* guidatapointer (NULL, no data required)
|
||||
*/
|
||||
void registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg);
|
||||
|
||||
private:
|
||||
|
||||
@ -284,6 +278,45 @@ private:
|
||||
bool bottom;
|
||||
|
||||
|
||||
//***callback parameters***
|
||||
/**
|
||||
* function being called back for start acquisition
|
||||
* callback arguments are
|
||||
* filepath
|
||||
* filename
|
||||
* fileindex
|
||||
* datasize
|
||||
*
|
||||
* return value is
|
||||
* 0 callback takes care of open,close,wrie file
|
||||
* 1 callback writes file, we have to open, close it
|
||||
* 2 we open, close, write file, callback does not do anything
|
||||
*/
|
||||
int (*startAcquisitionCallBack)(char*, char*,int, int, void*);
|
||||
void *pStartAcquisition;
|
||||
|
||||
/**
|
||||
* function being called back for acquisition finished
|
||||
* callback argument is
|
||||
* total frames caught
|
||||
*/
|
||||
void (*acquisitionFinishedCallBack)(int, void*);
|
||||
void *pAcquisitionFinished;
|
||||
|
||||
|
||||
/**
|
||||
* function being called back for raw data
|
||||
* args to raw data ready callback are
|
||||
* framenum
|
||||
* datapointer
|
||||
* datasize in bytes
|
||||
* file descriptor
|
||||
* guidatapointer (NULL, no data required)
|
||||
*/
|
||||
void (*rawDataReadyCallBack)(int, char*, int, FILE*, char*, void*);
|
||||
void *pRawDataReady;
|
||||
|
||||
|
||||
protected:
|
||||
/** Socket */
|
||||
MySocketTCP* socket;
|
||||
|
@ -22,6 +22,28 @@ void closeFile(int p){
|
||||
deleteReceiver(receiver);
|
||||
}
|
||||
|
||||
/*
|
||||
int startAcquisitionCallBack(char* filePath, char* fileName, int fileIndex, int bufferSize, void* context) {
|
||||
cout << "#### startAcquisitionCallBack ####" << endl;
|
||||
cout << "* filePath: " << filePath << endl;
|
||||
cout << "* fileName: " << fileName << endl;
|
||||
cout << "* fileIndex: " << fileIndex << endl;
|
||||
cout << "* bufferSize: " << bufferSize << endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void acquisitionFinishedCallBack(int totalFramesCaught, void* context) {
|
||||
cout << "#### acquisitionFinishedCallBack ####" << endl;
|
||||
cout << "* totalFramesCaught: " << totalFramesCaught << endl;
|
||||
}
|
||||
|
||||
void rawDataReadyCallBack(int currFrameNum, char* dataPointer, int dataSize, FILE* file, char* guiDataPointer, void* context) {
|
||||
cout << "#### rawDataReadyCallBack ####" << endl;
|
||||
cout << "* currFrameNum: " << currFrameNum << endl;
|
||||
cout << "* dataSize: " << dataSize << endl;
|
||||
}
|
||||
*/
|
||||
|
||||
int main(int argc, char *argv[]) {
|
||||
|
||||
//Catch signal SIGINT to close files properly
|
||||
@ -52,7 +74,7 @@ int main(int argc, char *argv[]) {
|
||||
|
||||
registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg);
|
||||
*/
|
||||
//receiver->registerCallBackStartAcquisition(func,arg);
|
||||
//receiver->registerCallBackStartAcquisition(startAcquisitionCallBack,NULL);
|
||||
|
||||
|
||||
/**
|
||||
@ -60,7 +82,7 @@ int main(int argc, char *argv[]) {
|
||||
total farmes caught
|
||||
registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg);
|
||||
*/
|
||||
//receiver->registerCallBackAcquisitionFinished(func,arg);
|
||||
//receiver->registerCallBackAcquisitionFinished(acquisitionFinishedCallBack,NULL);
|
||||
|
||||
|
||||
/**
|
||||
@ -73,7 +95,7 @@ int main(int argc, char *argv[]) {
|
||||
REMEMBER THAT THE CALLBACK IS BLOCKING
|
||||
registerCallBackRawDataReady(void (*func)(int, char*, FILE*, char*, void*),void *arg);
|
||||
*/
|
||||
//receiver->registerCallBackRawDataReady(func,arg);
|
||||
//receiver->registerCallBackRawDataReady(rawDataReadyCallBack,NULL);
|
||||
|
||||
|
||||
|
||||
|
@ -172,20 +172,29 @@ int64_t slsReceiver::getReceiverVersion(){
|
||||
|
||||
void slsReceiver::registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg){
|
||||
//tcpipInterface
|
||||
udp_interface->registerCallBackStartAcquisition(func,arg);
|
||||
if(udp_interface)
|
||||
udp_interface->registerCallBackStartAcquisition(func,arg);
|
||||
else
|
||||
tcpipInterface->registerCallBackStartAcquisition(func,arg);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void slsReceiver::registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){
|
||||
//tcpipInterface
|
||||
udp_interface->registerCallBackAcquisitionFinished(func,arg);
|
||||
if(udp_interface)
|
||||
udp_interface->registerCallBackAcquisitionFinished(func,arg);
|
||||
else
|
||||
tcpipInterface->registerCallBackAcquisitionFinished(func,arg);
|
||||
}
|
||||
|
||||
|
||||
void slsReceiver::registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){
|
||||
//tcpipInterface
|
||||
udp_interface->registerCallBackRawDataReady(func,arg);
|
||||
if(udp_interface)
|
||||
udp_interface->registerCallBackRawDataReady(func,arg);
|
||||
else
|
||||
tcpipInterface->registerCallBackRawDataReady(func,arg);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,6 +42,14 @@ slsReceiverTCPIPInterface::slsReceiverTCPIPInterface(int &success, UDPInterface*
|
||||
bottom(bot),
|
||||
socket(NULL){
|
||||
|
||||
//***callback parameters***
|
||||
startAcquisitionCallBack = NULL;
|
||||
pStartAcquisition = NULL;
|
||||
acquisitionFinishedCallBack = NULL;
|
||||
pAcquisitionFinished = NULL;
|
||||
rawDataReadyCallBack = NULL;
|
||||
pRawDataReady = NULL;
|
||||
|
||||
int port_no=portNumber;
|
||||
if(receiverBase == NULL) receiverBase = 0;
|
||||
|
||||
@ -362,6 +370,12 @@ int slsReceiverTCPIPInterface::set_detector_type(){
|
||||
if(ret != FAIL){
|
||||
#ifndef REST
|
||||
receiverBase = UDPInterface::create("standard");
|
||||
if(startAcquisitionCallBack)
|
||||
receiverBase->registerCallBackStartAcquisition(startAcquisitionCallBack,pStartAcquisition);
|
||||
if(acquisitionFinishedCallBack)
|
||||
receiverBase->registerCallBackAcquisitionFinished(acquisitionFinishedCallBack,pAcquisitionFinished);
|
||||
if(rawDataReadyCallBack)
|
||||
receiverBase->registerCallBackRawDataReady(rawDataReadyCallBack,pRawDataReady);
|
||||
#endif
|
||||
myDetectorType = dr;
|
||||
ret=receiverBase->setDetectorType(myDetectorType);
|
||||
@ -3012,5 +3026,23 @@ int slsReceiverTCPIPInterface::exec_command() {
|
||||
|
||||
|
||||
|
||||
/***callback functions***/
|
||||
void slsReceiverTCPIPInterface::registerCallBackStartAcquisition(int (*func)(char*, char*,int, int, void*),void *arg){
|
||||
startAcquisitionCallBack=func;
|
||||
pStartAcquisition=arg;
|
||||
}
|
||||
|
||||
void slsReceiverTCPIPInterface::registerCallBackAcquisitionFinished(void (*func)(int, void*),void *arg){
|
||||
acquisitionFinishedCallBack=func;
|
||||
pAcquisitionFinished=arg;
|
||||
}
|
||||
|
||||
void slsReceiverTCPIPInterface::registerCallBackRawDataReady(void (*func)(int, char*, int, FILE*, char*, void*),void *arg){
|
||||
rawDataReadyCallBack=func;
|
||||
pRawDataReady=arg;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user