mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-21 09:08:00 +02:00
merged to developer
This commit is contained in:
@ -1,11 +1,11 @@
|
||||
//#define SVNPATH ""
|
||||
#define SVNURLLIB "git@git.psi.ch:sls_detectors_software/sls_detector_software.git"
|
||||
//#define SVNREPPATH ""
|
||||
#define SVNREPUUIDLIB "a10faa8aa60e206c4a0a25ae366e9c1e6f024cbc"
|
||||
//#define SVNREV 0x1297
|
||||
#define SVNREPUUIDLIB "230d6b36e9852214f4ba5ae7c92647f35000b24d"
|
||||
//#define SVNREV 0x1313
|
||||
//#define SVNKIND ""
|
||||
//#define SVNSCHED ""
|
||||
#define SVNAUTHLIB "Dhanya_Maliakal"
|
||||
#define SVNREVLIB 0x1297
|
||||
#define SVNDATELIB 0x20161108
|
||||
#define SVNREVLIB 0x1313
|
||||
#define SVNDATELIB 0x20161130
|
||||
//
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -267,6 +267,8 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
|
||||
/** flag for acquiring */
|
||||
bool acquiringFlag;
|
||||
/** flipped data across x or y axis */
|
||||
int flippedData[2];
|
||||
|
||||
} sharedSlsDetector;
|
||||
|
||||
@ -295,20 +297,22 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
/** (default) constructor
|
||||
\param type is needed to define the size of the detector shared memory 9defaults to GENERIC i.e. the largest shared memory needed by any slsDetector is allocated
|
||||
\param id is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently
|
||||
\param pos is the index of object in the parent multislsdet array
|
||||
\param p is the parent multislsdet to access filename ,path etc
|
||||
|
||||
*/
|
||||
|
||||
slsDetector(detectorType type=GENERIC, int id=0, multiSlsDetector *p=NULL);
|
||||
slsDetector(int pos, detectorType type=GENERIC, int id=0, multiSlsDetector *p=NULL);
|
||||
|
||||
/** constructor
|
||||
\param id is the detector index which is needed to define the shared memory id. Different physical detectors should have different IDs in order to work independently
|
||||
\param pos is the index of object in the parent multislsdet array
|
||||
\param p is the parent multislsdet to access filename ,path etc
|
||||
*/
|
||||
slsDetector(int id, multiSlsDetector *p=NULL);
|
||||
slsDetector(int pos, int id, multiSlsDetector *p=NULL);
|
||||
|
||||
|
||||
slsDetector(char *name, int id=0, int cport=DEFAULT_PORTNO, multiSlsDetector *p=NULL);
|
||||
slsDetector(int pos, char *name, int id=0, int cport=DEFAULT_PORTNO, multiSlsDetector *p=NULL);
|
||||
//slsDetector(string const fname);
|
||||
// ~slsDetector(){while(dataQueue.size()>0){}};
|
||||
/** destructor */
|
||||
@ -668,6 +672,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
|
||||
int getMaxNumberOfChannels(dimension d);//{return thisDetector->nChan[d]*thisDetector->nChip[d]*thisDetector->nModMax[d];};
|
||||
|
||||
/** returns the enable if data will be flipped across x or y axis
|
||||
* \param d axis across which data is flipped
|
||||
* returns 1 or 0
|
||||
*/
|
||||
int getFlippedData(dimension d=X){return thisDetector->flippedData[d];};
|
||||
|
||||
/** Returns number of rois */
|
||||
int getNRoi(){return thisDetector->nROI;};
|
||||
|
||||
@ -733,6 +743,12 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
int setNumberOfModules(int n=GET_FLAG, dimension d=X); // if n=GET_FLAG returns the number of installed modules
|
||||
|
||||
|
||||
/** sets the enable which determines if data will be flipped across x or y axis
|
||||
* \param d axis across which data is flipped
|
||||
* \param value 0 or 1 to reset/set or -1 to get value
|
||||
* \return enable flipped data across x or y axis
|
||||
*/
|
||||
int setFlippedData(dimension d=X, int value=-1);
|
||||
|
||||
|
||||
/*
|
||||
@ -1412,6 +1428,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
|
||||
int getDetectorId(int i=-1) {return detId;};
|
||||
|
||||
/**
|
||||
Receives a data frame from the detector socket
|
||||
\returns pointer to the data (or NULL if failed)
|
||||
@ -1596,19 +1613,7 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int resetFramesCaught();
|
||||
|
||||
/**
|
||||
* Create Receiving Data Threads
|
||||
* @param destroy is true to destroy all the threads
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
int createReceivingDataThreads(bool destroy = false){return 0;};
|
||||
|
||||
|
||||
/** Reads frames from receiver through a constant socket
|
||||
*/
|
||||
//void readFrameFromReceiver(){};
|
||||
|
||||
int* readFrameFromReceiver(char*, int&, int&, int&);
|
||||
/** Locks/Unlocks the connection to the receiver
|
||||
/param lock sets (1), usets (0), gets (-1) the lock
|
||||
/returns lock status of the receiver
|
||||
@ -1717,6 +1722,14 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int setReadReceiverFrequency(int getFromReceiver, int freq=-1);
|
||||
|
||||
/** Sets the read receiver timer
|
||||
if data required from receiver randomly readRxrFrequency=0,
|
||||
then the timer between each data stream is set with time_in_ms
|
||||
@param time_in_ms timer between frames
|
||||
/returns read receiver timer
|
||||
*/
|
||||
int setReceiverReadTimer(int time_in_ms=500);
|
||||
|
||||
/** Enable or disable streaming data from receiver to client
|
||||
* @param enable 0 to disable 1 to enable -1 to only get the value
|
||||
* @returns data streaming
|
||||
@ -1838,6 +1851,11 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
||||
*/
|
||||
int detId;
|
||||
|
||||
/**
|
||||
position ID
|
||||
*/
|
||||
int posId;
|
||||
|
||||
|
||||
/**
|
||||
* parent multi detector
|
||||
|
@ -432,7 +432,13 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="flippeddatax"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
descrToFuncMap[i].m_pFuncName="flippeddatay"; //
|
||||
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdDetectorSize;
|
||||
i++;
|
||||
|
||||
/* flags */
|
||||
|
||||
@ -1251,12 +1257,13 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if(myDet->acquire() == FAIL)
|
||||
return string("acquire unsuccessful");
|
||||
if(myDet->setReceiverOnline()==ONLINE_FLAG){
|
||||
char answer[100];
|
||||
sprintf(answer,"\n%d",myDet->getFramesCaughtByReceiver());
|
||||
sprintf(answer,"\nAcquired %d",myDet->getFramesCaughtByReceiver());
|
||||
return string(answer);
|
||||
}
|
||||
|
||||
@ -1295,6 +1302,7 @@ string slsDetectorCommand::cmdData(int narg, char *args[], int action) {
|
||||
b=myDet->setThreadedProcessing(-1);
|
||||
myDet->setThreadedProcessing(0);
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->readAll();
|
||||
//processdata in receiver is useful only for gui purposes
|
||||
if(myDet->setReceiverOnline()==OFFLINE_FLAG)
|
||||
@ -1329,6 +1337,7 @@ string slsDetectorCommand::cmdFrame(int narg, char *args[], int action) {
|
||||
b=myDet->setThreadedProcessing(-1);
|
||||
myDet->setThreadedProcessing(0);
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->readFrame();
|
||||
//processdata in receiver is useful only for gui purposes
|
||||
if(myDet->setReceiverOnline()==OFFLINE_FLAG)
|
||||
@ -1737,6 +1746,7 @@ string slsDetectorCommand::cmdExitServer(int narg, char *args[], int action){
|
||||
return string("Error closing server\n");
|
||||
}
|
||||
else if (cmd=="exitreceiver"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if(myDet->exitReceiver()!=OK)
|
||||
return string("Receiver shut down\n");
|
||||
else
|
||||
@ -1858,6 +1868,7 @@ string slsDetectorCommand::helpTrimEn(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdOutDir(int narg, char *args[], int action){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION)
|
||||
return helpOutDir(narg, args, action);
|
||||
|
||||
@ -1882,6 +1893,7 @@ string slsDetectorCommand::helpOutDir(int narg, char *args[], int action){
|
||||
|
||||
|
||||
string slsDetectorCommand::cmdFileName(int narg, char *args[], int action){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION)
|
||||
return helpFileName(narg, args, action);
|
||||
if (cmd=="fname") {
|
||||
@ -1911,7 +1923,7 @@ string slsDetectorCommand::cmdEnablefwrite(int narg, char *args[], int action){
|
||||
|
||||
int i;
|
||||
char ans[100];
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION) {
|
||||
return helpEnablefwrite(narg, args, action);
|
||||
}
|
||||
@ -1943,7 +1955,7 @@ string slsDetectorCommand::cmdOverwrite(int narg, char *args[], int action){
|
||||
|
||||
int i;
|
||||
char ans[100];
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION) {
|
||||
return helpOverwrite(narg, args, action);
|
||||
}
|
||||
@ -1975,7 +1987,7 @@ string slsDetectorCommand::helpOverwrite(int narg, char *args[], int action){
|
||||
string slsDetectorCommand::cmdFileIndex(int narg, char *args[], int action){
|
||||
char ans[100];
|
||||
int i;
|
||||
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==HELP_ACTION) {
|
||||
return helpFileName(narg, args, action);
|
||||
}
|
||||
@ -2088,6 +2100,8 @@ string slsDetectorCommand::cmdRateCorr(int narg, char *args[], int action){
|
||||
double fval;
|
||||
char answer[1000];
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
if (action==PUT_ACTION) {
|
||||
sscanf(args[1],"%lf",&fval);
|
||||
myDet->setRateCorrection(fval);
|
||||
@ -2785,6 +2799,7 @@ string slsDetectorCommand::cmdNetworkParameter(int narg, char *args[], int actio
|
||||
return helpNetworkParameter(narg,args,action);
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if (cmd=="detectormac") {
|
||||
t=DETECTOR_MAC;
|
||||
@ -2954,6 +2969,7 @@ string slsDetectorCommand::cmdLock(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
else if(cmd=="r_lock"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
if (sscanf(args[1],"%d",&val))
|
||||
myDet->lockReceiver(val);
|
||||
@ -3004,8 +3020,10 @@ string slsDetectorCommand::cmdLastClient(int narg, char *args[], int action) {
|
||||
return myDet->getLastClientIP();
|
||||
}
|
||||
|
||||
else if(cmd=="r_lastclient")
|
||||
else if(cmd=="r_lastclient"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
return myDet->getReceiverLastClientIP();
|
||||
}
|
||||
|
||||
return string("cannot decode command");
|
||||
}
|
||||
@ -3051,6 +3069,7 @@ string slsDetectorCommand::cmdOnline(int narg, char *args[], int action) {
|
||||
}
|
||||
else if(cmd=="activate"){
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
if (!sscanf(args[1],"%d",&ival))
|
||||
return string("Could not scan activate mode ")+string(args[1]);
|
||||
@ -3072,11 +3091,12 @@ string slsDetectorCommand::cmdOnline(int narg, char *args[], int action) {
|
||||
else{
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot set");
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
strcpy(ans,myDet->checkReceiverOnline().c_str());
|
||||
if(!strlen(ans))
|
||||
strcpy(ans,"All receiver online");
|
||||
else
|
||||
strcat(ans," :Not receiver online");
|
||||
strcat(ans," :Not all receiver online");
|
||||
}
|
||||
|
||||
return ans;
|
||||
@ -3113,6 +3133,7 @@ string slsDetectorCommand::cmdConfigureMac(int narg, char *args[], int action) {
|
||||
|
||||
if (action==PUT_ACTION){
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
ret=myDet->configureMAC();
|
||||
}
|
||||
else
|
||||
@ -3139,7 +3160,7 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
if (action==HELP_ACTION)
|
||||
return helpDetectorSize(narg,args,action);
|
||||
int ret, val=-1, pos=-1,i;
|
||||
char ans[1000], temp[100];
|
||||
char ans[1000];
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
|
||||
@ -3176,6 +3197,21 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
myDet->setMaxNumberOfChannelsPerDetector(Y,val);
|
||||
}
|
||||
|
||||
if(cmd=="flippeddatax"){
|
||||
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1))
|
||||
return string ("cannot scan flippeddata x mode: must be 0 or 1");
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->setFlippedData(X,val);
|
||||
}
|
||||
|
||||
if(cmd=="flippeddatay"){
|
||||
return string("Not required for this detector\n");
|
||||
if ((!sscanf(args[1],"%d",&val)) || (val!=0 && val != 1))
|
||||
return string ("cannot scan flippeddata y mode: must be 0 or 1");
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
myDet->setFlippedData(Y,val);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (cmd=="nmod" || cmd=="roimask") {
|
||||
@ -3183,14 +3219,23 @@ string slsDetectorCommand::cmdDetectorSize(int narg, char *args[], int action) {
|
||||
} else if (cmd=="maxmod") {
|
||||
ret=myDet->getMaxNumberOfModules();
|
||||
} else if (cmd=="dr") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
ret=myDet->setDynamicRange(val);
|
||||
} else if (cmd=="roi") {
|
||||
myDet->getROI(ret);
|
||||
} else if (cmd=="detsizechan") {
|
||||
sprintf(ans,"%d",myDet->getMaxNumberOfChannelsPerDetector(X));
|
||||
sprintf(temp,"%d",myDet->getMaxNumberOfChannelsPerDetector(Y));
|
||||
strcat(ans," ");
|
||||
strcat(ans,temp);
|
||||
sprintf(ans,"%d %d",myDet->getMaxNumberOfChannelsPerDetector(X),myDet->getMaxNumberOfChannelsPerDetector(Y));
|
||||
return string(ans);
|
||||
}
|
||||
else if(cmd=="flippeddatax"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
sprintf(ans,"%d",myDet->getFlippedData(X));
|
||||
return string(ans);
|
||||
}
|
||||
else if(cmd=="flippeddatay"){
|
||||
return string("Not required for this detector\n");
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
sprintf(ans,"%d",myDet->getFlippedData(Y));
|
||||
return string(ans);
|
||||
}
|
||||
else
|
||||
@ -3214,6 +3259,8 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
|
||||
os << "dr i \n sets the dynamic range of the detector"<< std::endl;
|
||||
os << "roi i xmin xmax ymin ymax \n sets region of interest where i is number of rois;i=0 to clear rois"<< std::endl;
|
||||
os << "detsizechan x y \n sets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl;
|
||||
os << "flippeddatax x \n sets if the data should be flipped on the x axis"<< std::endl;
|
||||
os << "flippeddatay y \n sets if the data should be flipped on the y axis"<< std::endl;
|
||||
}
|
||||
if (action==GET_ACTION || action==HELP_ACTION) {
|
||||
os << "nmod \n gets the number of modules of the detector"<< std::endl;
|
||||
@ -3221,7 +3268,8 @@ string slsDetectorCommand::helpDetectorSize(int narg, char *args[], int action)
|
||||
os << "dr \n gets the dynamic range of the detector"<< std::endl;
|
||||
os << "roi \n gets region of interest"<< std::endl;
|
||||
os << "detsizechan \n gets the maximum number of channels for complete detector set in both directions; -1 is no limit"<< std::endl;
|
||||
|
||||
os << "flippeddatax\n gets if the data will be flipped on the x axis respectively"<< std::endl;
|
||||
os << "flippeddatay\n gets if the data will be flipped on the y axis respectively"<< std::endl;
|
||||
}
|
||||
return os.str();
|
||||
|
||||
@ -3422,6 +3470,7 @@ string slsDetectorCommand::cmdSN(int narg, char *args[], int action) {
|
||||
}
|
||||
|
||||
if (cmd=="receiverversion") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
sprintf(answer,"%llx",myDet->getId(RECEIVER_VERSION));
|
||||
return string(answer);
|
||||
}
|
||||
@ -4102,6 +4151,7 @@ string slsDetectorCommand::cmdTimer(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
ret=myDet->setTimer(index,t);
|
||||
if (index==ACQUISITION_TIME || index==SUBFRAME_ACQUISITION_TIME || index==FRAME_PERIOD || index==DELAY_AFTER_TRIGGER)
|
||||
@ -4547,10 +4597,12 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action)
|
||||
}
|
||||
return sval;
|
||||
} else if (cmd=="rx_printconfig"){
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION)
|
||||
return string("cannot put");
|
||||
return string(""+myDet->printReceiverConfiguration());
|
||||
}else if (cmd=="parameters") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
sval=string(args[1]);
|
||||
myDet->retrieveDetectorSetup(sval);
|
||||
@ -4560,6 +4612,7 @@ string slsDetectorCommand::cmdConfiguration(int narg, char *args[], int action)
|
||||
}
|
||||
return sval;
|
||||
} else if (cmd=="setup") {
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
if (action==PUT_ACTION) {
|
||||
sval=string(args[1]);
|
||||
myDet->retrieveDetectorSetup(sval,2);
|
||||
@ -4614,6 +4667,7 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
||||
|
||||
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->setReceiverOnline(ONLINE_FLAG);
|
||||
|
||||
if(cmd=="receiver"){
|
||||
if (action==PUT_ACTION) {
|
||||
|
@ -45,6 +45,7 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
struct timespec begin,end;
|
||||
clock_gettime(CLOCK_REALTIME, &begin);
|
||||
|
||||
|
||||
//ensure acquire isnt started multiple times by same client
|
||||
if(getAcquiringFlag() == false)
|
||||
setAcquiringFlag(true);
|
||||
@ -53,6 +54,10 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
//not in the loop for real time acqusition yet,
|
||||
//in the real time acquisition loop, processing thread will wait for a post each time
|
||||
sem_init(&sem_newRTAcquisition,1,0);
|
||||
|
||||
|
||||
bool receiver = (setReceiverOnline()==ONLINE_FLAG);
|
||||
if(!receiver){
|
||||
@ -220,6 +225,10 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
ResetPositionIndex();
|
||||
|
||||
for (int ip=0; ip<np; ip++) {
|
||||
|
||||
//let processing thread listen to these packets
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
|
||||
// cout << "positions " << endl;
|
||||
if (*stoppedFlag==0) {
|
||||
if (getNumberOfPositions()>0) {
|
||||
@ -286,12 +295,7 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
//send receiver file name
|
||||
pthread_mutex_lock(&mg); //cout << "lock"<< endl;
|
||||
setFileName(fileIO::getFileName());
|
||||
if(setReceiverOnline()==OFFLINE_FLAG){
|
||||
stopReceiver();
|
||||
*stoppedFlag=1;
|
||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||
break;
|
||||
}
|
||||
|
||||
//start receiver
|
||||
if(startReceiver() == FAIL) {
|
||||
cout << "Start receiver failed " << endl;
|
||||
@ -353,9 +357,15 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
}
|
||||
//online
|
||||
else{
|
||||
cout << "Stopping receiver " << endl;;
|
||||
|
||||
if(setReceiverOnline(ONLINE_FLAG)!=ONLINE_FLAG){
|
||||
stopAcquisition();
|
||||
stopReceiver();
|
||||
pthread_mutex_unlock(&mg);
|
||||
break;
|
||||
}
|
||||
stopReceiver();
|
||||
cout<<"***********receiver stopped"<<endl;
|
||||
// cout<<"***********receiver stopped"<<endl;
|
||||
}
|
||||
pthread_mutex_unlock(&mg);//cout << "unlock"<< endl;
|
||||
|
||||
@ -467,12 +477,17 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
}
|
||||
|
||||
|
||||
|
||||
// waiting for the data processing thread to finish!
|
||||
if (*threadedProcessing) {
|
||||
#ifdef VERBOSE
|
||||
cout << "wait for data processing thread" << endl;
|
||||
#endif
|
||||
setJoinThread(1);
|
||||
|
||||
//let processing thread continue and checkjointhread
|
||||
sem_post(&sem_newRTAcquisition);
|
||||
|
||||
pthread_join(dataProcessingThread, &status);
|
||||
#ifdef VERBOSE
|
||||
cout << "data processing thread joined" << endl;
|
||||
@ -504,6 +519,7 @@ int slsDetectorUtils::acquire(int delflag){
|
||||
#endif
|
||||
|
||||
setAcquiringFlag(false);
|
||||
sem_destroy(&sem_newRTAcquisition);
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &end);
|
||||
cout << "Elapsed time for acquisition:" << (( end.tv_sec - begin.tv_sec ) + ( end.tv_nsec - begin.tv_nsec ) / 1000000000.0) << " seconds" << endl;
|
||||
|
@ -70,6 +70,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
|
||||
virtual int setMaxNumberOfChannelsPerDetector(dimension d,int i){return -1;};
|
||||
|
||||
/** sets the enable which determines if data will be flipped across x or y axis
|
||||
* \param d axis across which data is flipped
|
||||
* \param value 0 or 1 to reset/set or -1 to get value
|
||||
* \return enable flipped data across x or y axis
|
||||
*/
|
||||
virtual int setFlippedData(dimension d=X, int value=-1)=0;
|
||||
|
||||
//int setPositions(int nPos, double *pos){return angularConversion::setPositions(nPos, pos);};
|
||||
|
||||
// int getPositions(double *pos=NULL){return angularConversion::getPositions(pos);};
|
||||
@ -425,6 +432,12 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
virtual int getMaxNumberOfChannels()=0;
|
||||
virtual int getMaxNumberOfChannels(dimension d)=0;
|
||||
|
||||
/** returns the enable if data will be flipped across x or y axis
|
||||
* \param d axis across which data is flipped
|
||||
* returns 1 or 0
|
||||
*/
|
||||
virtual int getFlippedData(dimension d=X)=0;
|
||||
|
||||
// virtual int getParameters();
|
||||
|
||||
|
||||
@ -656,17 +669,18 @@ virtual int getReceiverCurrentFrameIndex()=0;
|
||||
virtual int resetFramesCaught()=0;
|
||||
|
||||
/**
|
||||
* Create Receiving Data Threads
|
||||
* @param destroy is true to destroy all the threads
|
||||
* Create Receiving Data Sockets
|
||||
* @param destroy is true to destroy all the sockets
|
||||
* @return OK or FAIL
|
||||
*/
|
||||
virtual int createReceivingDataThreads(bool destroy = false)=0;
|
||||
virtual int createReceivingDataSockets(const bool destroy = false){return -1;};
|
||||
|
||||
|
||||
/** Reads frames from receiver through a constant socket
|
||||
*/
|
||||
//virtual void readFrameFromReceiver()=0;
|
||||
virtual int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex, int &subFrameIndex)=0;
|
||||
|
||||
virtual void readFrameFromReceiver(){};
|
||||
|
||||
/**
|
||||
Turns off the receiver server!
|
||||
*/
|
||||
@ -865,12 +879,10 @@ virtual int setReceiverFifoDepth(int i = -1)=0;
|
||||
int (*acquisition_finished)(double,int,void*);
|
||||
int (*measurement_finished)(int,int,void*);
|
||||
void *acqFinished_p, *measFinished_p;
|
||||
|
||||
|
||||
|
||||
int (*progress_call)(double,void*);
|
||||
void *pProgressCallArg;
|
||||
|
||||
sem_t sem_newRTAcquisition;
|
||||
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user