changing file name prefix orders, reset frames caught command from command line

This commit is contained in:
Dhanya Maliakal 2015-08-19 11:38:09 +02:00
parent 24dcc45f5b
commit c9a952a748
4 changed files with 30 additions and 13 deletions

View File

@ -880,6 +880,10 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++; i++;
descrToFuncMap[i].m_pFuncName="resetframescaught";
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++;
descrToFuncMap[i].m_pFuncName="frameindex"; descrToFuncMap[i].m_pFuncName="frameindex";
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver; descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdReceiver;
i++; i++;
@ -4274,6 +4278,18 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
} }
} }
else if(cmd=="resetframescaught"){
if (action==GET_ACTION)
return string("cannot get");
else{
if(myDet->resetFramesCaught() == FAIL)
strcpy(answer,"failed");
else
strcpy(answer,"successful");
return string(answer);
}
}
else if(cmd=="frameindex"){ else if(cmd=="frameindex"){
if (action==PUT_ACTION) if (action==PUT_ACTION)
return string("cannot put"); return string("cannot put");
@ -4328,6 +4344,7 @@ string slsDetectorCommand::helpReceiver(int narg, char *args[], int action) {
ostringstream os; ostringstream os;
if (action==PUT_ACTION || action==HELP_ACTION) { if (action==PUT_ACTION || action==HELP_ACTION) {
os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start or stop" << std::endl; os << "receiver [status] \t starts/stops the receiver to listen to detector packets. - can be start or stop" << std::endl;
os << "resetframescaught [any value] \t resets frames caught by receiver" << std::endl;
os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl; os << "r_readfreq \t sets the gui read frequency of the receiver, 0 if gui requests frame, >0 if receiver sends every nth frame to gui" << std::endl;
os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl; os << "tengiga \t sets system to be configure for 10Gbe if set to 1, else 1Gbe if set to 0" << std::endl;
} }

View File

@ -59,11 +59,11 @@ class fileIOStatic {
static string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \ static string createFileName(char *filepath, char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos, int findex, int frameindex=-1, int detindex=-1){ \
ostringstream osfn; \ ostringstream osfn; \
osfn << filepath << "/" << filename; \ osfn << filepath << "/" << filename; \
if(detindex>=0) osfn << "_d"<< detindex; \
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \ if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \ if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \ if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
if(frameindex>=0) osfn << "_f" << frameindex; \ if(frameindex>=0) osfn << "_f" << frameindex; \
if(detindex>=0) osfn << "_d"<< detindex; \
osfn << "_" << findex; \ osfn << "_" << findex; \
return osfn.str(); \ return osfn.str(); \
}; };
@ -89,10 +89,10 @@ class fileIOStatic {
static string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \ static string createReceiverFilePrefix(char *filename, int aMask, double sv0, int prec0, double sv1, int prec1, int pindex, int npos,int detindex=-1){ \
ostringstream osfn; \ ostringstream osfn; \
osfn << filename; \ osfn << filename; \
if(detindex!=-1) osfn << "_d"<< detindex; \
if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \ if ( aMask& (1 << (slsDetectorDefs::MAX_ACTIONS))) osfn << "_S" << fixed << setprecision(prec0) << sv0; \
if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \ if (aMask & (1 << (slsDetectorDefs::MAX_ACTIONS+1))) osfn << "_s" << fixed << setprecision(prec1) << sv1; \
if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \ if (pindex>0 && pindex<=npos) osfn << "_p" << pindex; \
if(detindex!=-1) osfn << "_d"<< detindex; \
return osfn.str(); \ return osfn.str(); \
}; };
@ -218,6 +218,11 @@ class fileIOStatic {
} \ } \
else cout << "******************************** cannot parse frame index" << endl; \ else cout << "******************************** cannot parse frame index" << endl; \
uscore=s.rfind("_"); \ uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) { \
detindex=i; \
} \
else cout << "******************************** cannot parse detector id" << endl; \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \ if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) { \
p_index=i; \ p_index=i; \
s=fname.substr(0,uscore); \ s=fname.substr(0,uscore); \
@ -235,11 +240,6 @@ class fileIOStatic {
s=fname.substr(0,uscore); \ s=fname.substr(0,uscore); \
} \ } \
else cout << "******************************** cannot parse scan varable 0" << endl; \ else cout << "******************************** cannot parse scan varable 0" << endl; \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) { \
detindex=i; \
} \
else cout << "******************************** cannot parse detector id" << endl; \
return index; \ return index; \
}; };
@ -254,6 +254,9 @@ class fileIOStatic {
double f; \ double f; \
string s; \ string s; \
s=fname; \ s=fname; \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
s=fname.substr(0,uscore); \
size_t uscore=s.rfind("_"); \ size_t uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) \ if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"p%d",&i)) \
s=fname.substr(0,uscore); \ s=fname.substr(0,uscore); \
@ -263,9 +266,6 @@ class fileIOStatic {
uscore=s.rfind("_"); \ uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) \ if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"S%lf",&f)) \
s=fname.substr(0,uscore); \ s=fname.substr(0,uscore); \
uscore=s.rfind("_"); \
if (sscanf( s.substr(uscore+1,s.size()-uscore-1).c_str(),"d%d",&i)) \
s=fname.substr(0,uscore); \
return s; \ return s; \
}; };

View File

@ -563,7 +563,7 @@ void* postProcessing::processData(int delflag) {
#endif #endif
pthread_mutex_unlock(&mg); pthread_mutex_unlock(&mg);
//go through once more to get last nth frame data //go through once more to get last nth frame data
if (acquiringDone >= 4){ if (acquiringDone >= 5){cout<<"acquiringdone:"<<acquiringDone<<endl;
if((!nthframe) ||(!newData)){ if((!nthframe) ||(!newData)){
#ifdef VERY_VERY_DEBUG #ifdef VERY_VERY_DEBUG
cout << "gonna post for it to end" << endl; cout << "gonna post for it to end" << endl;
@ -596,9 +596,9 @@ void* postProcessing::processData(int delflag) {
} }
if(newData){ if(newData){
#ifdef VERY_VERY_DEBUG //#ifdef VERY_VERY_DEBUG
cout << "new data" << endl; cout << "new data" << endl;
#endif //#endif
if(setReceiverOnline()==ONLINE_FLAG){ if(setReceiverOnline()==ONLINE_FLAG){
//get data //get data
strcpy(currentfName,""); strcpy(currentfName,"");