Added sls_detector_process executable for acquire blocking on zmq

This commit is contained in:
2019-09-27 10:12:21 +02:00
parent db2742495a
commit c654ac7f1f
5 changed files with 61 additions and 10 deletions

View File

@ -195,7 +195,7 @@ enum networkParameter {
/** /**
type of action performed (for text client) type of action performed (for text client)
*/ */
enum {GET_ACTION, PUT_ACTION, READOUT_ACTION, HELP_ACTION}; enum {GET_ACTION, PUT_ACTION, READOUT_ACTION, HELP_ACTION, PROCESS_ACTION};
/** online flags enum \sa setOnline*/ /** online flags enum \sa setOnline*/
enum {GET_ONLINE_FLAG=-1, /**< returns wether the detector is in online or offline state */ enum {GET_ONLINE_FLAG=-1, /**< returns wether the detector is in online or offline state */

View File

@ -8,10 +8,14 @@
#include <stdlib.h> #include <stdlib.h>
int progressCallback(double f,void* arg) { cout << f << "%"<< endl; return 0;};
int dummyAcquisitionFinished(double prog,int status,void* p){cout <<"Acquisition finished callback! " << prog << " " << status << endl; return 0;};
int dummyMeasurementFinished(int im,int findex,void* p){cout <<"Measurement finished callback! " << im << " " << findex << endl; return 0;};
//int (*)(detectorData*, int, int, void*)
int dummyCallback(detectorData*, int p , int p1, void*) {
cout << p << endl;
int dummyCallback(detectorData* d, int p,void*) {
cout << "got data " << p << endl;
return 0; return 0;
}; };
@ -26,6 +30,7 @@ public:
int del = 0; \ int del = 0; \
char cmd[100] = ""; \ char cmd[100] = ""; \
if (action==slsDetectorDefs::PUT_ACTION && argc<2) { \ if (action==slsDetectorDefs::PUT_ACTION && argc<2) { \
cout << "Wrong usage - should be: "<< argv[0] << \ cout << "Wrong usage - should be: "<< argv[0] << \
"[id-][pos:]channel arg" << endl; \ "[id-][pos:]channel arg" << endl; \
@ -41,7 +46,9 @@ public:
return; \ return; \
}; \ }; \
if (action==slsDetectorDefs::READOUT_ACTION) { \
if (action==slsDetectorDefs::READOUT_ACTION || action==slsDetectorDefs::PROCESS_ACTION) { \
id = 0; \ id = 0; \
pos = -1; \ pos = -1; \
if (argc) { \ if (argc) { \
@ -125,6 +132,18 @@ public:
del=1; \ del=1; \
} \ } \
if (action==slsDetectorDefs::PROCESS_ACTION) {
/* myDetector->registerAcquisitionFinishedCallback(&dummyAcquisitionFinished,NULL); */
/* myDetector->registerMeasurementFinishedCallback(&dummyMeasurementFinished,NULL); */
action=slsDetectorDefs::READOUT_ACTION;
myDetector->registerDataCallback(&dummyCallback, NULL);
// myDetector->registerProgressCallback(&progressCallback, NULL);
}
// call multi detector command line // call multi detector command line
myCmd=new multiSlsDetectorCommand(myDetector); \ myCmd=new multiSlsDetectorCommand(myDetector); \
try { \ try { \

View File

@ -54,6 +54,21 @@ set_target_properties(sls_detector_acquire PROPERTIES
COMPILE_DEFINITIONS READOUT=1 COMPILE_DEFINITIONS READOUT=1
) )
add_executable(sls_detector_process
${SOURCES}
)
target_link_libraries(sls_detector_process
slsDetectorShared
pthread
zmq
rt
)
set_target_properties(sls_detector_process PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
COMPILE_DEFINITIONS READOUT=1
COMPILE_DEFINITIONS PROCESS=1
)
add_executable(sls_detector_help add_executable(sls_detector_help
${SOURCES} ${SOURCES}
) )

View File

@ -24,7 +24,7 @@ all: clients
nonstatic: clients nonstatic: clients
clients: builddir lib $(DESTDIR)/sls_detector_put $(DESTDIR)/sls_detector_get $(DESTDIR)/sls_detector_acquire $(DESTDIR)/sls_detector_help clients: builddir lib $(DESTDIR)/sls_detector_put $(DESTDIR)/sls_detector_get $(DESTDIR)/sls_detector_acquire $(DESTDIR)/sls_detector_help $(DESTDIR)/sls_detector_process
static_clients: builddir lib $(DESTDIR)/ssls_detector_put $(DESTDIR)/ssls_detector_get $(DESTDIR)/ssls_detector_acquire $(DESTDIR)/ssls_detector_help static_clients: builddir lib $(DESTDIR)/ssls_detector_put $(DESTDIR)/ssls_detector_get $(DESTDIR)/ssls_detector_acquire $(DESTDIR)/ssls_detector_help
@ -89,6 +89,13 @@ $(DESTDIR)/sls_detector_acquire: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DEST
$(CXX) -o $(BIN)/sls_detector_acquire $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DREADOUT $(LIBS) $(LDFLAG) $(CXX) -o $(BIN)/sls_detector_acquire $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DREADOUT $(LIBS) $(LDFLAG)
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR)) $(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
$(DESTDIR)/sls_detector_process: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling sls_detector_process #")
$(call colorecho,"#######################################")
$(CXX) -o $(BIN)/sls_detector_process $(SRC_CLNT) $(FLAGS) $(INCLUDES) -DREADOUT $(LIBS) $(LDFLAG) -DPROCESS
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
$(DESTDIR)/sls_detector_help: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a $(DESTDIR)/sls_detector_help: $(SRC_CLNT) $(DESTDIR)/libSlsDetector.so $(DESTDIR)/libSlsDetector.a
$(call colorecho,"#######################################") $(call colorecho,"#######################################")
$(call colorecho,"# Compiling sls_detector_help #") $(call colorecho,"# Compiling sls_detector_help #")

View File

@ -4,6 +4,10 @@
#include <stdlib.h> #include <stdlib.h>
using namespace std; using namespace std;
#ifdef PROCESS
#endif
int main(int argc, char *argv[]) int main(int argc, char *argv[])
@ -29,6 +33,10 @@ int main(int argc, char *argv[])
int action=slsDetectorDefs::READOUT_ACTION; int action=slsDetectorDefs::READOUT_ACTION;
#endif #endif
#ifdef PROCESS
int action=slsDetectorDefs::PROCESS_ACTION;
#endif
#ifdef HELP #ifdef HELP
int action=slsDetectorDefs::HELP_ACTION; int action=slsDetectorDefs::HELP_ACTION;
@ -37,9 +45,11 @@ int main(int argc, char *argv[])
multiSlsDetectorClient *cl; multiSlsDetectorClient *cl;
if (argc>1) if (argc>1)
cl=new multiSlsDetectorClient(argc-1, argv+1, action); cl=new multiSlsDetectorClient(argc-1, argv+1, action);
else else {
cl=new multiSlsDetectorClient(argc-1, argv, action); cl=new multiSlsDetectorClient(argc-1, argv, action);
}
delete cl; delete cl;
} }