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)
*/
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*/
enum {GET_ONLINE_FLAG=-1, /**< returns wether the detector is in online or offline state */

View File

@ -8,10 +8,14 @@
#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 dummyCallback(detectorData* d, int p,void*) {
cout << "got data " << p << endl;
//int (*)(detectorData*, int, int, void*)
int dummyCallback(detectorData*, int p , int p1, void*) {
cout << p << endl;
return 0;
};
@ -25,7 +29,8 @@ public:
bool verify = true, update = true; \
int del = 0; \
char cmd[100] = ""; \
if (action==slsDetectorDefs::PUT_ACTION && argc<2) { \
cout << "Wrong usage - should be: "<< argv[0] << \
"[id-][pos:]channel arg" << endl; \
@ -41,7 +46,9 @@ public:
return; \
}; \
if (action==slsDetectorDefs::READOUT_ACTION) { \
if (action==slsDetectorDefs::READOUT_ACTION || action==slsDetectorDefs::PROCESS_ACTION) { \
id = 0; \
pos = -1; \
if (argc) { \
@ -125,6 +132,18 @@ public:
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
myCmd=new multiSlsDetectorCommand(myDetector); \
try { \
@ -142,9 +161,9 @@ public:
} \
if (action!=slsDetectorDefs::READOUT_ACTION) { \
cout << argv[0] << " " ; \
} \
} \
cout << answer<< endl; \
delete myCmd; \
delete myCmd; \
if (del) delete myDetector; \
};

View File

@ -54,6 +54,21 @@ set_target_properties(sls_detector_acquire PROPERTIES
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
${SOURCES}
)

View File

@ -24,7 +24,7 @@ all: 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
@ -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)
$(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
$(call colorecho,"#######################################")
$(call colorecho,"# Compiling sls_detector_help #")

View File

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