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

View File

@ -303,6 +303,21 @@ enum {GET_ACTION, PUT_ACTION, READOUT_ACTION};
void acquire(int delflag); 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: private:
/** /**
start data processing thread start data processing thread

View File

@ -1594,7 +1594,7 @@ int get_run_status(int fnum) {
int n; int n;
int retval; int retval;
enum runStatus s;
sprintf(mess,"getting run status\n"); sprintf(mess,"getting run status\n");
#ifdef VERBOSE #ifdef VERBOSE
@ -1603,6 +1603,22 @@ int get_run_status(int fnum) {
retval= runState(); 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) { if (ret!=OK) {
printf("get status failed\n"); printf("get status failed\n");
} }
@ -1611,7 +1627,7 @@ int get_run_status(int fnum) {
if (ret!=OK) { if (ret!=OK) {
n += sendDataOnly(mess,strlen(mess)+1); n += sendDataOnly(mess,strlen(mess)+1);
} else { } else {
n += sendDataOnly(&retval,sizeof(retval)); n += sendDataOnly(&s,sizeof(s));
} }
return ret; return ret;

View File

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

View File

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