mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-11 12:27:14 +02:00
Universal client for both slsDetector and multiSlsDetector, depending on the syntax
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@393 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -1,137 +1,50 @@
|
|||||||
CFLAGS= -DC_ONLY
|
CFLAGS= -DC_ONLY
|
||||||
#FLAGS=-DVERBOSE
|
FLAGS=-DVERBOSE
|
||||||
INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/usersFunctions
|
INCLUDES= -I../slsDetectorSoftware/commonFiles -I../slsDetectorSoftware/slsDetector -I ../slsDetectorSoftware/MySocketTCP -I../slsDetectorSoftware/mythenDetector -I../slsDetectorSoftware/gotthardDetector -I../slsDetectorSoftware/usersFunctions -I../slsDetectorSoftware/multiSlsDetector
|
||||||
#-I../slsDetectorSoftware/mythenDetector -I../slsDetectorSoftware/gotthardDetector
|
|
||||||
#LIBS=-L../TMythenDetector/bin/ -L$(QTDIR)/lib
|
#LIBS=-L../TMythenDetector/bin/ -L$(QTDIR)/lib
|
||||||
LIBS= -L$(QTDIR)/lib -L../slsDetectorSoftware/
|
LIBS= -L../slsDetectorSoftware/
|
||||||
LDFLAG=-lSlsDetector -lpthread
|
LDFLAG= -lSlsDetector -lpthread
|
||||||
|
|
||||||
MYTHEN = mythen_put mythen_get mythen_acquire
|
|
||||||
PICASSO = picasso_put picasso_get picasso_acquire
|
|
||||||
GOTTHARD = gotthard_put gotthard_get gotthard_acquire
|
|
||||||
|
|
||||||
BIN=bin
|
BIN=bin
|
||||||
|
|
||||||
SRC_CLNT=sls_detector_client.cpp
|
SRC_CLNT=multi_sls_detector_client.cpp
|
||||||
|
|
||||||
gotthard: lib $(GOTTHARD)
|
all: lib sls_detector_put sls_detector_get sls_detector_acquire sls_detector_help
|
||||||
mythen: lib $(MYTHEN)
|
|
||||||
picasso: lib $(PICASSO)
|
|
||||||
|
|
||||||
lib:
|
lib:
|
||||||
# cd ../TMythenDetector && $(MAKE)
|
|
||||||
cd ../slsDetectorSoftware && $(MAKE) lib
|
cd ../slsDetectorSoftware && $(MAKE) lib
|
||||||
|
|
||||||
all: mythen gotthard picasso
|
|
||||||
|
|
||||||
|
|
||||||
|
sls_detector_put: $(SRC_CLNT)
|
||||||
|
|
||||||
mythen_put: $(SRC_CLNT)
|
|
||||||
mkdir -p $(BIN)
|
mkdir -p $(BIN)
|
||||||
$(CXX) -static -o $(BIN)/mythen_put $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DPUT -DMYTHEN_DET $(LIBS) $(LDFLAG)
|
$(CXX) -static -o $(BIN)/sls_detector_put $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DPUT $(LIBS) $(LDFLAG)
|
||||||
|
|
||||||
mythen_get: $(SRC_CLNT)
|
sls_detector_get: $(SRC_CLNT)
|
||||||
mkdir -p $(BIN)
|
mkdir -p $(BIN)
|
||||||
$(CXX) -static -o $(BIN)/mythen_get $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DGET -DMYTHEN_DET $(LIBS) $(LDFLAG)
|
$(CXX) -static -o $(BIN)/sls_detector_get $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DGET $(LIBS) $(LDFLAG)
|
||||||
|
|
||||||
mythen_acquire: $(SRC_CLNT)
|
sls_detector_acquire: $(SRC_CLNT)
|
||||||
mkdir -p $(BIN)
|
mkdir -p $(BIN)
|
||||||
$(CXX) -static -o $(BIN)/mythen_acquire $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DREADOUT -DMYTHEN_DET $(LIBS) $(LDFLAG)
|
$(CXX) -static -o $(BIN)/sls_detector_acquire $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DREADOUT $(LIBS) $(LDFLAG)
|
||||||
|
|
||||||
|
sls_detector_help: $(SRC_CLNT)
|
||||||
mythen_clean:
|
|
||||||
rm -rf $(BIN)/$(MYTHEN)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
gotthard_put: $(SRC_CLNT)
|
|
||||||
mkdir -p $(BIN)
|
mkdir -p $(BIN)
|
||||||
$(CXX) -static -o $(BIN)/gotthard_put $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DPUT -DGOTTHARD_DET $(LIBS) $(LDFLAG)
|
$(CXX) -static -o $(BIN)/sls_detector_help $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DHELP $(LIBS) $(LDFLAG)
|
||||||
|
|
||||||
gotthard_get: $(SRC_CLNT)
|
|
||||||
mkdir -p $(BIN)
|
|
||||||
$(CXX) -static -o $(BIN)/gotthard_get $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DGET -DGOTTHARD_DET $(LIBS) $(LDFLAG)
|
|
||||||
|
|
||||||
gotthard_acquire: $(SRC_CLNT)
|
|
||||||
mkdir -p $(BIN)
|
|
||||||
$(CXX) -static -o $(BIN)/gotthard_acquire $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DREADOUT -DGOTTHARD_DET $(LIBS) $(LDFLAG)
|
|
||||||
|
|
||||||
|
|
||||||
|
clean:
|
||||||
gotthard_clean:
|
rm -rf $(BIN)/sls_detector_put sls_detector_get sls_detector_acquire sls_detector_help
|
||||||
rm -rf $(BIN)/$(GOTTHARD)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
install_sls_detector: all
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
picasso_put: $(SRC_CLNT)
|
|
||||||
mkdir -p $(BIN)
|
|
||||||
$(CXX) -static -o $(BIN)/picasso_put $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DPUT -DPICASSOD -DMYTHEN_DET $(LIBS) $(LDFLAG)
|
|
||||||
|
|
||||||
picasso_get: $(SRC_CLNT)
|
|
||||||
mkdir -p $(BIN)
|
|
||||||
$(CXX) -static -o $(BIN)/picasso_get $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DGET -DPICASSOD -DMYTHEN_DET $(LIBS) $(LDFLAG)
|
|
||||||
|
|
||||||
picasso_acquire: $(SRC_CLNT)
|
|
||||||
mkdir -p $(BIN)
|
|
||||||
$(CXX) -static -o $(BIN)/picasso_acquire $(SRC_CLNT) $(FLAGS) -lpthread $(INCLUDES) -DREADOUT -DGET -DPICASSOD -DMYTHEN_DET $(LIBS) $(LDFLAG)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
picasso_clean:
|
|
||||||
rm -rf $(BIN)/$(PICASSO)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
clean: picasso_clean mythen_clean gotthard_clean
|
|
||||||
|
|
||||||
|
|
||||||
install_mythen: mythen
|
|
||||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
||||||
cp -P $(BIN)/mythen_put $(DESTDIR)
|
cp -P $(BIN)/sls_detector_put $(DESTDIR)
|
||||||
cp -P $(BIN)/mythen_get $(DESTDIR)
|
cp -P $(BIN)/sls_detector_get $(DESTDIR)
|
||||||
cp -P $(BIN)/mythen_acquire $(DESTDIR)
|
cp -P $(BIN)/sls_detector_acquire $(DESTDIR)
|
||||||
|
|
||||||
install_gotthard: gotthard
|
|
||||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
|
||||||
cp -P $(BIN)/gotthard_put $(DESTDIR)
|
|
||||||
cp -P $(BIN)/gotthard_get $(DESTDIR)
|
|
||||||
cp -P $(BIN)/gotthard_acquire $(DESTDIR)
|
|
||||||
|
|
||||||
install_picasso: picasso
|
|
||||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
|
||||||
cp -P $(BIN)/picassoPut $(DESTDIR)
|
|
||||||
cp -P $(BIN)/picassoGet $(DESTDIR)
|
|
||||||
cp -P $(BIN)/picassoData $(DESTDIR)
|
|
||||||
|
|
||||||
install_doc:
|
|
||||||
$(shell test -d $(DESTDIR) || mkdir -p $(DESTDIR))
|
|
||||||
cp -P docs/* $(DESTDIR)
|
|
||||||
|
|
||||||
install: install_mythen install_picasso install_gotthard
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
|
||||||
|
#include "multiSlsDetector.h"
|
||||||
#include "slsDetector.h"
|
#include "slsDetector.h"
|
||||||
|
|
||||||
|
|
||||||
@ -12,12 +14,13 @@ int main(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
int id=0;
|
int id=-1, iv=0;
|
||||||
char *c;
|
char *c;
|
||||||
string answer;
|
string answer;
|
||||||
|
char cmd[100];
|
||||||
int action;
|
int action;
|
||||||
slsDetector *myDetector;
|
slsDetectorCommand *myDetector;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef READOUT
|
#ifdef READOUT
|
||||||
@ -26,63 +29,90 @@ int main(int argc, char *argv[])
|
|||||||
action=PUT_ACTION;
|
action=PUT_ACTION;
|
||||||
#elif GET
|
#elif GET
|
||||||
action=GET_ACTION;
|
action=GET_ACTION;
|
||||||
#endif
|
#elif HELP
|
||||||
|
action=HELP_ACTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (argc>1){
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
detectorType t;
|
iv=sscanf(argv[1],"%d%s",&id, cmd);
|
||||||
|
if (id>=0) {
|
||||||
#ifdef MYTHEN_DET
|
if (iv==2) {
|
||||||
#ifndef PICASSOD
|
if (cmd[0]=='-') {
|
||||||
t=MYTHEN;
|
#ifdef VERBOSE
|
||||||
#else
|
cout << "Using multiSlsDetector id=" << id << endl;
|
||||||
t=PICASSO;
|
|
||||||
#endif;
|
|
||||||
#elif GOTTHARD_DET
|
|
||||||
t=GOTTHARD;
|
|
||||||
#else
|
|
||||||
t=GENERIC;
|
|
||||||
#endif
|
#endif
|
||||||
|
myDetector=new multiSlsDetector(id);
|
||||||
|
argv[1]=cmd+1;
|
||||||
|
} else if (cmd[0]==':') {
|
||||||
|
#ifdef VERBOSE
|
||||||
if (argc>1 && sscanf(argv[1],"%d",&id)){
|
cout << "Using slsDetector id=" << id << endl;
|
||||||
|
#endif
|
||||||
|
myDetector=new slsDetector(id);
|
||||||
myDetector=new slsDetector(t,id);
|
argv[1]=cmd+1;
|
||||||
|
} else {
|
||||||
|
cout << "Wrong syntax: no channels starts with integer number "<<id <<". Bhould be " << argv[0] << endl;
|
||||||
} else {
|
cout << id << ":channel for single detector" ;
|
||||||
cout << "Wrong usage - should be: "<< argv[0] << " id";
|
cout << " or " << id << "-channel for multiple detectors" << endl;
|
||||||
cout << "(:channel arg)" << endl;
|
return -1;
|
||||||
|
}
|
||||||
cout << slsDetector::helpLine(argc-1, argv+1, action);
|
} else {
|
||||||
|
#ifdef VERBOSE
|
||||||
cout << endl;
|
cout << "Using slsDetector id=" << id << endl;
|
||||||
return -1;
|
#endif
|
||||||
|
myDetector=new slsDetector(id);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Using default multiSlsDetector" << id << endl;
|
||||||
|
#endif
|
||||||
|
myDetector=new multiSlsDetector();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
#ifndef READOUT
|
#ifdef GET
|
||||||
string s(argv[1]);
|
cout << "Wrong usage - should be: "<< argv[0] << "[id:/id-]channel" << endl;
|
||||||
#ifdef PUT
|
cout << myDetector->helpLine(argc-1, argv, action);
|
||||||
if (argc<3) {
|
|
||||||
cout << "Wrong usage - should be: "<< argv[0] << " id";
|
|
||||||
cout << ":channel arg" << endl;
|
|
||||||
|
|
||||||
cout << slsDetector::helpLine(argc-1, argv+1, action);
|
|
||||||
|
|
||||||
cout << endl;
|
cout << endl;
|
||||||
return -1;
|
return -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PUT
|
||||||
|
if (argc<3) {
|
||||||
|
cout << "Wrong usage - should be: "<< argv[0] << "[id:/id-]channel arg" << endl;
|
||||||
|
cout << myDetector->helpLine(argc-1, argv+1, action);
|
||||||
|
cout << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << "Using default multiSlsDetector" << id << endl;
|
||||||
|
#endif
|
||||||
|
myDetector=new multiSlsDetector();
|
||||||
|
answer=myDetector->executeLine(argc-1, argv, action);
|
||||||
|
cout << answer<< endl;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef PUT
|
||||||
|
if (argc<3) {
|
||||||
|
cout << "Wrong usage - should be: "<< argv[0] <<" " << argv[1]<< " arg" << endl;
|
||||||
|
cout << myDetector->helpLine(argc-1, argv+1, action);
|
||||||
|
cout << endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
if ((c=strchr(argv[1],':')))
|
|
||||||
argv[1]=c+1;
|
|
||||||
#endif
|
if (argc<2) {
|
||||||
answer=myDetector->executeLine(argc-1, argv+1, action);
|
answer=myDetector->executeLine(argc-1, argv, action);
|
||||||
#ifndef READOUT
|
} else {
|
||||||
cout << s << " " << answer<< endl;
|
answer=myDetector->executeLine(argc-1, argv+1, action);
|
||||||
#endif
|
}
|
||||||
|
cout << answer<< endl;
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user