mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-29 17:40:01 +02:00
Based on the multiSlsDetectorClient class
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@400 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
2448d4ee45
commit
e19ca7f777
@ -1,10 +1,4 @@
|
|||||||
#include <iostream>
|
#include "multiSlsDetectorClient.h"
|
||||||
#include <string>
|
|
||||||
|
|
||||||
|
|
||||||
#include "multiSlsDetector.h"
|
|
||||||
#include "slsDetector.h"
|
|
||||||
#include "slsDetectorCommand.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@ -13,110 +7,31 @@ using namespace std;
|
|||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
||||||
{
|
{
|
||||||
|
#ifdef PUT
|
||||||
|
int action=slsDetectorDefs::PUT_ACTION;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GET
|
||||||
int id=-1, iv=0;
|
int action=slsDetectorDefs::GET_ACTION;
|
||||||
char *c;
|
#endif
|
||||||
string answer;
|
|
||||||
char cmd[100];
|
|
||||||
int action;
|
|
||||||
slsDetectorUtils *myDetector;
|
|
||||||
slsDetectorCommand *myCmd;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef READOUT
|
#ifdef READOUT
|
||||||
action=slsDetectorDefs::READOUT_ACTION;
|
int action=slsDetectorDefs::READOUT_ACTION;
|
||||||
#elif PUT
|
|
||||||
action=slsDetectorDefs::PUT_ACTION;
|
|
||||||
#elif GET
|
|
||||||
action=slsDetectorDefs::GET_ACTION;
|
|
||||||
#elif HELP
|
|
||||||
action=slsDetectorDefs::HELP_ACTION;
|
|
||||||
#endif
|
|
||||||
#ifdef VERBOSE
|
|
||||||
for (int ia=0; ia<argc; ia++)
|
|
||||||
cout << argv[ia] << endl;
|
|
||||||
#endif
|
|
||||||
if (argc>1){
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
iv=sscanf(argv[1],"%d%s",&id, cmd);
|
|
||||||
if (id>=0) {
|
|
||||||
if (iv==2) {
|
|
||||||
if (cmd[0]=='-') {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Using multiSlsDetector id=" << id << endl;
|
|
||||||
#endif
|
|
||||||
myDetector=new multiSlsDetector(id);
|
|
||||||
argv[1]=cmd+1;
|
|
||||||
} else if (cmd[0]==':') {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Using slsDetector id=" << id << endl;
|
|
||||||
#endif
|
|
||||||
myDetector=new slsDetector(id);
|
|
||||||
argv[1]=cmd+1;
|
|
||||||
} else {
|
|
||||||
cout << "Wrong syntax: no channels starts with integer number "<<id <<". Bhould be " << argv[0] << endl;
|
|
||||||
cout << id << ":channel for single detector" ;
|
|
||||||
cout << " or " << id << "-channel for multiple detectors" << endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Using slsDetector id=" << id << endl;
|
|
||||||
#endif
|
|
||||||
myDetector=new slsDetector(id);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Using default multiSlsDetector" << id << endl;
|
|
||||||
#endif
|
|
||||||
myDetector=new multiSlsDetector();
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
#ifdef GET
|
|
||||||
cout << "Wrong usage - should be: "<< argv[0] << "[id:/id-]channel" << endl;
|
|
||||||
// cout << slsDetectorCommand::helpLine(argc-1, argv, action);
|
|
||||||
cout << endl;
|
|
||||||
return -1;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PUT
|
|
||||||
if (argc<3) {
|
#ifdef HELP
|
||||||
cout << "Wrong usage - should be: "<< argv[0] << "[id:/id-]channel arg" << endl;
|
int action=slsDetectorDefs::HELP_ACTION;
|
||||||
// cout << slsDetectorCommand::helpLine(argc-1, argv+1, action);
|
|
||||||
cout << endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#ifdef VERBOSE
|
|
||||||
cout << "Using default multiSlsDetector" << id << endl;
|
multiSlsDetectorClient *cl;
|
||||||
#endif
|
if (argc>1)
|
||||||
myDetector=new multiSlsDetector();
|
cl=new multiSlsDetectorClient(argc-1, argv+1, action);
|
||||||
|
else
|
||||||
|
cl=new multiSlsDetectorClient(argc-1, argv, action);
|
||||||
|
|
||||||
|
delete cl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef PUT
|
|
||||||
if (argc<3) {
|
|
||||||
cout << "Wrong usage - should be: "<< argv[0] <<" " << argv[1]<< " arg" << endl;
|
|
||||||
//cout << slsDetectorCommand::helpLine(argc-1, argv+1, action);
|
|
||||||
cout << endl;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
myCmd=new slsDetectorCommand(myDetector);
|
|
||||||
|
|
||||||
if (argc<2) {
|
|
||||||
answer=myCmd->executeLine(argc-1, argv, action);
|
|
||||||
} else {
|
|
||||||
answer=myCmd->executeLine(argc-1, argv+1, action);
|
|
||||||
cout << argv[1] << " " ;
|
|
||||||
}
|
|
||||||
cout << answer<< endl;
|
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user