getRunStatus becomes purely virtual in slsDetector and returns already the runStatus type variable

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@14 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi 2010-04-19 14:46:34 +00:00
parent 26765a30b7
commit 2dd7b2c67b
5 changed files with 58 additions and 25 deletions

View File

@ -67,20 +67,21 @@ string mythenDetector::executeLine(int narg, char *args[], int action) {
else
return string("unknown action");
}
int s=getRunStatus();
if (s&0x8000)
return string("error");
else if (s&0x00000001)
if (s&0x00010000)
return string("data");
else
return string("running");
else if (s&0x00010000)
runStatus s=getRunStatus();
switch (s) {
case ERROR:
return string("error");
case WAITING:
return string("waiting");
case RUNNING:
return string("running");
case TRANSMITTING:
return string("data");
case RUN_FINISHED:
return string("finished");
else if (s&0x00000008)
return string("waiting");
else
return string("idle");
default:
return string("idle");
}
}
@ -2346,12 +2347,12 @@ void* startProcessDataNoDelete(void *n) {
pthread_exit(NULL);
}
int mythenDetector::getRunStatus(){
runStatus mythenDetector::getRunStatus(){
int fnum=F_GET_RUN_STATUS;
int retval;
int ret=FAIL;
char mess[100];
runStatus retval=ERROR;
#ifdef VERBOSE
std::cout<< "MYTHEN Getting status "<< std::endl;
#endif
@ -2363,15 +2364,16 @@ int mythenDetector::getRunStatus(){
if (ret!=OK) {
stopSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
} else
stopSocket->ReceiveDataOnly(&retval,sizeof(retval));
} else {
stopSocket->ReceiveDataOnly(&retval,sizeof(retval));
}
stopSocket->Disconnect();
}
}
}
return retval;
};
int64_t mythenDetector::getTimeLeft(timerIndex index){
@ -2406,5 +2408,4 @@ int64_t mythenDetector::getTimeLeft(timerIndex index){
std::cout<< "Time left is "<< retval << std::endl;
#endif
return retval;
};

View File

@ -303,6 +303,21 @@ enum {GET_ACTION, PUT_ACTION, READOUT_ACTION};
void acquire(int delflag);
/**
get current timer value on the stop socket
\param index timer index
\returns elapsed time value in ns or number of...(e.g. frames, gates, probes)
*/
int64_t getTimeLeft(timerIndex index);
/**
/**
get run status on the stop socket
\returns status mask
*/
runStatus getRunStatus();
private:
/**
start data processing thread

View File

@ -1594,7 +1594,7 @@ int get_run_status(int fnum) {
int n;
int retval;
enum runStatus s;
sprintf(mess,"getting run status\n");
#ifdef VERBOSE
@ -1603,6 +1603,22 @@ int get_run_status(int fnum) {
retval= runState();
if (retval&0x8000)
s=ERROR;
else if (retval&0x00000001)
if (retval&0x00010000)
s=TRANSMITTING;
else
s=RUNNING;
else if (retval&0x00010000)
s=RUN_FINISHED;
else if (retval&0x00000008)
s=WAITING;
else
s=IDLE;
if (ret!=OK) {
printf("get status failed\n");
}
@ -1611,7 +1627,7 @@ int get_run_status(int fnum) {
if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1);
} else {
n += sendDataOnly(&retval,sizeof(retval));
n += sendDataOnly(&s,sizeof(s));
}
return ret;

View File

@ -2231,7 +2231,7 @@ int slsDetector::startReadOut(){
int slsDetector::getRunStatus(){
/*int slsDetector::getRunStatus(){
int fnum=F_GET_RUN_STATUS;
int retval;
int ret=FAIL;
@ -2257,6 +2257,7 @@ int slsDetector::getRunStatus(){
};
*/
int* slsDetector::readFrame(){
@ -2598,7 +2599,7 @@ int64_t slsDetector::getTimeLeft(timerIndex index){
std::cout<< "Detector returned error: " << mess << std::endl;
} else {
controlSocket->ReceiveDataOnly(&retval,sizeof(retval));
thisDetector->timerValue[index]=retval;
// thisDetector->timerValue[index]=retval;
}
controlSocket->Disconnect();
}

View File

@ -896,7 +896,7 @@ typedef struct sharedSlsDetector {
get run status
\returns status mask
*/
int getRunStatus();
virtual runStatus getRunStatus()=0;
/**
start detector acquisition and read all data putting them a data queue