mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-21 19:30:03 +02:00
receiver read frequency from gui can be set now
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@567 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
parent
3afbf35e0f
commit
0e73372cf8
@ -33,7 +33,7 @@ using namespace std;
|
|||||||
#define COULDNOT_SET_NETWORK_PARAMETER 0x0000000000000002ULL
|
#define COULDNOT_SET_NETWORK_PARAMETER 0x0000000000000002ULL
|
||||||
#define COULDNOT_SET_ROI 0x0000000000000004ULL
|
#define COULDNOT_SET_ROI 0x0000000000000004ULL
|
||||||
#define FILE_PATH_DOES_NOT_EXIST 0x0000000000000008ULL
|
#define FILE_PATH_DOES_NOT_EXIST 0x0000000000000008ULL
|
||||||
|
#define RECEIVER_READ_FREQUENCY 0x0000000000000010ULL
|
||||||
|
|
||||||
/** @short class returning all error messages for error mask */
|
/** @short class returning all error messages for error mask */
|
||||||
class errorDefs {
|
class errorDefs {
|
||||||
@ -81,6 +81,10 @@ public:
|
|||||||
if(slsErrorMask&FILE_PATH_DOES_NOT_EXIST)
|
if(slsErrorMask&FILE_PATH_DOES_NOT_EXIST)
|
||||||
retval.append("File Path does not exist.\n");
|
retval.append("File Path does not exist.\n");
|
||||||
|
|
||||||
|
if(slsErrorMask&RECEIVER_READ_FREQUENCY)
|
||||||
|
retval.append("Could not set receiver read frequency.\n");
|
||||||
|
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,7 @@ multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
|
|||||||
thisMultiDetector->scanPrecision[iscan]=0;
|
thisMultiDetector->scanPrecision[iscan]=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thisMultiDetector->receiver_read_freq = 0;
|
||||||
|
|
||||||
thisMultiDetector->alreadyExisting=1;
|
thisMultiDetector->alreadyExisting=1;
|
||||||
}
|
}
|
||||||
@ -4658,12 +4659,15 @@ int multiSlsDetector::calibratePedestal(int frames){
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
int multiSlsDetector::setReadReceiverFrequency(int i){
|
int multiSlsDetector::setReadReceiverFrequency(int getFromReceiver,int i){
|
||||||
int ret=-100, ret1;
|
int ret=-100, ret1;
|
||||||
|
|
||||||
|
if(!getFromReceiver)
|
||||||
|
return thisMultiDetector->receiver_read_freq;
|
||||||
|
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||||
if (detectors[idet]) {
|
if (detectors[idet]) {
|
||||||
ret1=detectors[idet]->setReadReceiverFrequency(i);
|
ret1=detectors[idet]->setReadReceiverFrequency(getFromReceiver,i);
|
||||||
if(detectors[idet]->getErrorMask())
|
if(detectors[idet]->getErrorMask())
|
||||||
setErrorMask(getErrorMask()|(1<<idet));
|
setErrorMask(getErrorMask()|(1<<idet));
|
||||||
if (ret==-100)
|
if (ret==-100)
|
||||||
@ -4673,6 +4677,8 @@ int multiSlsDetector::setReadReceiverFrequency(int i){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
thisMultiDetector->receiver_read_freq = ret;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,6 +191,9 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
mysteps scanSteps[MAX_SCAN_LEVELS];
|
mysteps scanSteps[MAX_SCAN_LEVELS];
|
||||||
int scanPrecision[MAX_SCAN_LEVELS];
|
int scanPrecision[MAX_SCAN_LEVELS];
|
||||||
|
|
||||||
|
/* Receiver read frequency */
|
||||||
|
int receiver_read_freq;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@ -1190,9 +1193,12 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
/** Sets the read receiver frequency
|
/** Sets the read receiver frequency
|
||||||
if Receiver read upon gui request, readRxrFrequency=0,
|
if Receiver read upon gui request, readRxrFrequency=0,
|
||||||
else every nth frame to be sent to gui
|
else every nth frame to be sent to gui
|
||||||
|
@param getFromReceiver is 1 if it should ask the receiver,
|
||||||
|
0 if it can get it from multislsdetecter
|
||||||
|
@param i is the receiver read frequency
|
||||||
/returns read receiver frequency
|
/returns read receiver frequency
|
||||||
*/
|
*/
|
||||||
int setReadReceiverFrequency(int i=-1);
|
int setReadReceiverFrequency(int getFromReceiver, int i=-1);
|
||||||
|
|
||||||
/** updates the multidetector offsets */
|
/** updates the multidetector offsets */
|
||||||
void updateOffsets();
|
void updateOffsets();
|
||||||
@ -1202,6 +1208,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
*/
|
*/
|
||||||
void waitForReceiverReadToFinish();
|
void waitForReceiverReadToFinish();
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
|
||||||
@ -1216,6 +1223,7 @@ class multiSlsDetector : public slsDetectorUtils {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -6095,8 +6095,6 @@ int* slsDetector::readFrameFromReceiver(char* fName, int &fIndex){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
cout << "Acquisition stopped" << endl;
|
|
||||||
|
|
||||||
dataSocket->Disconnect();
|
dataSocket->Disconnect();
|
||||||
}
|
}
|
||||||
@ -6333,12 +6331,15 @@ int64_t slsDetector::clearAllErrorMask(){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
int slsDetector::setReadReceiverFrequency(int i){
|
int slsDetector::setReadReceiverFrequency(int getFromReceiver,int i){
|
||||||
int fnum=F_READ_RECEIVER_FREQUENCY;
|
int fnum=F_READ_RECEIVER_FREQUENCY;
|
||||||
int ret = FAIL;
|
int ret = FAIL;
|
||||||
int retval=-1;
|
int retval=-1;
|
||||||
int arg = i;
|
int arg = i;
|
||||||
|
|
||||||
|
if(!getFromReceiver)
|
||||||
|
return retval;
|
||||||
|
|
||||||
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
if(setReceiverOnline(ONLINE_FLAG)==ONLINE_FLAG){
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
std::cout << "Sending read frequency to receiver " << arg << std::endl;
|
std::cout << "Sending read frequency to receiver " << arg << std::endl;
|
||||||
@ -6350,6 +6351,11 @@ int slsDetector::setReadReceiverFrequency(int i){
|
|||||||
if(ret==FORCE_UPDATE)
|
if(ret==FORCE_UPDATE)
|
||||||
updateReceiver();
|
updateReceiver();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((i > 0) && (retval != i)){
|
||||||
|
cout << "could not set receiver read frequency:" << retval << endl;
|
||||||
|
setErrorMask((getErrorMask())|(RECEIVER_READ_FREQUENCY));
|
||||||
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1593,12 +1593,15 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
|
|||||||
/** sets the receiver udp port \sa sharedSlsDetector */
|
/** sets the receiver udp port \sa sharedSlsDetector */
|
||||||
int setReceiverUDPPort(int udpport);
|
int setReceiverUDPPort(int udpport);
|
||||||
|
|
||||||
/** Sets the variable readRxrFrequency.
|
/** Sets the read receiver frequency
|
||||||
if Receiver read upon gui request, readRxrFrequency=0,
|
if Receiver read upon gui request, readRxrFrequency=0,
|
||||||
else every nth frame to be sent to gui
|
else every nth frame to be sent to gui
|
||||||
|
@param getFromReceiver is 1 if it should ask the receiver,
|
||||||
|
0 if it can get it from multislsdetecter
|
||||||
|
@param i is the receiver read frequency
|
||||||
/returns read receiver frequency
|
/returns read receiver frequency
|
||||||
*/
|
*/
|
||||||
int setReadReceiverFrequency(int i=-1);
|
int setReadReceiverFrequency(int getFromReceiver, int i=-1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Waits for receiver read to finish after stopping acquisition
|
* Waits for receiver read to finish after stopping acquisition
|
||||||
|
@ -232,7 +232,8 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
virtual string createFileName()=0;
|
virtual string createFileName()=0;
|
||||||
|
|
||||||
|
|
||||||
virtual void incrementProgress(int i=1)=0;
|
virtual void incrementProgress()=0;
|
||||||
|
virtual void setCurrentProgress(int i=0)=0;
|
||||||
virtual double getCurrentProgress()=0;
|
virtual double getCurrentProgress()=0;
|
||||||
virtual void incrementFileIndex()=0;
|
virtual void incrementFileIndex()=0;
|
||||||
virtual int setTotalProgress()=0;
|
virtual int setTotalProgress()=0;
|
||||||
@ -474,6 +475,16 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
|
|||||||
virtual int* readFrameFromReceiver(char* fName, int &fIndex)=0;
|
virtual int* readFrameFromReceiver(char* fName, int &fIndex)=0;
|
||||||
|
|
||||||
|
|
||||||
|
/** Sets the read receiver frequency
|
||||||
|
if Receiver read upon gui request, readRxrFrequency=0,
|
||||||
|
else every nth frame to be sent to gui
|
||||||
|
@param getFromReceiver is 1 if it should ask the receiver,
|
||||||
|
0 if it can get it from multislsdetecter
|
||||||
|
@param i is the receiver read frequency
|
||||||
|
/returns read receiver frequency
|
||||||
|
*/
|
||||||
|
virtual int setReadReceiverFrequency(int getFromReceiver, int i=-1)=0;
|
||||||
|
|
||||||
|
|
||||||
/** returns detector type string from detector type index
|
/** returns detector type string from detector type index
|
||||||
\param t string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
|
\param t string can be Mythen, Pilatus, Eiger, Gotthard, Agipd, Unknown
|
||||||
|
@ -3766,9 +3766,9 @@ string slsDetectorCommand::cmdReceiver(int narg, char *args[], int action) {
|
|||||||
if (!sscanf(args[1],"%d",&ival))
|
if (!sscanf(args[1],"%d",&ival))
|
||||||
return string("Could not scan read frequency mode ")+string(args[1]);
|
return string("Could not scan read frequency mode ")+string(args[1]);
|
||||||
if(ival>=0)
|
if(ival>=0)
|
||||||
myDet->setReadReceiverFrequency(ival);
|
myDet->setReadReceiverFrequency(1,ival);
|
||||||
}
|
}
|
||||||
sprintf(answer,"%d",myDet->setReadReceiverFrequency());
|
sprintf(answer,"%d",myDet->setReadReceiverFrequency(1));
|
||||||
return string(answer);
|
return string(answer);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -71,8 +71,6 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
void *status;
|
void *status;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)) || getActionMode(angCalLog) || (getScanMode(0)==positionScan)|| (getScanMode(1)==positionScan)) {
|
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)) || getActionMode(angCalLog) || (getScanMode(0)==positionScan)|| (getScanMode(1)==positionScan)) {
|
||||||
if (connectChannels==0)
|
if (connectChannels==0)
|
||||||
if (connect_channels) {
|
if (connect_channels) {
|
||||||
@ -127,6 +125,11 @@ void slsDetectorUtils::acquire(int delflag){
|
|||||||
if(setReceiverOnline()==OFFLINE_FLAG)
|
if(setReceiverOnline()==OFFLINE_FLAG)
|
||||||
*stoppedFlag=1;
|
*stoppedFlag=1;
|
||||||
|
|
||||||
|
//multi detectors shouldnt have different receiver read frequencies enabled/disabled
|
||||||
|
if(setReadReceiverFrequency(0) < 0){
|
||||||
|
std::cout << "Error: The receiver read frequency is invalid:" << setReadReceiverFrequency(0) << std::endl;
|
||||||
|
*stoppedFlag=1;
|
||||||
|
}
|
||||||
|
|
||||||
//resets frames caught in receiver
|
//resets frames caught in receiver
|
||||||
resetFramesCaught();
|
resetFramesCaught();
|
||||||
@ -619,9 +622,9 @@ double slsDetectorUtils::getCurrentProgress() {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void slsDetectorUtils::incrementProgress(int i) {
|
void slsDetectorUtils::incrementProgress() {
|
||||||
pthread_mutex_lock(&mp);
|
pthread_mutex_lock(&mp);
|
||||||
progressIndex+=i;
|
progressIndex++;
|
||||||
cout << fixed << setprecision(2) << setw (6) << 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
cout << fixed << setprecision(2) << setw (6) << 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
||||||
pthread_mutex_unlock(&mp);
|
pthread_mutex_unlock(&mp);
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -633,7 +636,18 @@ void slsDetectorUtils::incrementProgress(int i) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
void slsDetectorUtils::setCurrentProgress(int i){
|
||||||
|
pthread_mutex_lock(&mp);
|
||||||
|
progressIndex++;
|
||||||
|
progressIndex=i;
|
||||||
|
cout << fixed << setprecision(2) << setw (6) << 100.*((double)progressIndex)/((double)totalProgress) << " \%";
|
||||||
|
pthread_mutex_unlock(&mp);
|
||||||
|
#ifdef VERBOSE
|
||||||
|
cout << endl;
|
||||||
|
#else
|
||||||
|
cout << "\r" << flush;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
|
int slsDetectorUtils::retrieveDetectorSetup(string const fname1, int level){
|
||||||
|
@ -444,8 +444,8 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
|||||||
double getCurrentProgress();
|
double getCurrentProgress();
|
||||||
|
|
||||||
|
|
||||||
void incrementProgress(int i=1);
|
void incrementProgress();
|
||||||
|
void setCurrentProgress(int i=0);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -672,12 +672,15 @@ virtual int setROI(int n=-1,ROI roiLimits[]=NULL)=0;
|
|||||||
*/
|
*/
|
||||||
virtual ROI* getROI(int &n)=0;
|
virtual ROI* getROI(int &n)=0;
|
||||||
|
|
||||||
/** Sets the variable readRxrFrequency.
|
/** Sets the read receiver frequency
|
||||||
if Receiver read upon gui request, readRxrFrequency=0,
|
if Receiver read upon gui request, readRxrFrequency=0,
|
||||||
else every nth frame to be sent to gui
|
else every nth frame to be sent to gui
|
||||||
|
@param getFromReceiver is 1 if it should ask the receiver,
|
||||||
|
0 if it can get it from multislsdetecter
|
||||||
|
@param i is the receiver read frequency
|
||||||
/returns read receiver frequency
|
/returns read receiver frequency
|
||||||
*/
|
*/
|
||||||
virtual int setReadReceiverFrequency(int i=-1)=0;
|
virtual int setReadReceiverFrequency(int getFromReceiver, int i=-1)=0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -420,37 +420,61 @@ void* postProcessing::processData(int delflag) {
|
|||||||
* else
|
* else
|
||||||
*/
|
*/
|
||||||
|
|
||||||
pthread_mutex_lock(&mg);
|
|
||||||
int prevCaught=getReceiverCurrentFrameIndex();
|
|
||||||
pthread_mutex_unlock(&mg);
|
|
||||||
|
|
||||||
|
int prevCaught=0;
|
||||||
int caught=0;
|
int caught=0;
|
||||||
bool newData=false;
|
bool newData=false;
|
||||||
char currentfName[MAX_STR_LENGTH]="";
|
char currentfName[MAX_STR_LENGTH]="";
|
||||||
int currentfIndex=0;
|
int currentfIndex=0;
|
||||||
|
int read_freq = setReadReceiverFrequency(0);
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "receiver read freq:" << read_freq << std::endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
//always read nth data
|
||||||
|
if (read_freq != 0)
|
||||||
|
newData = true;
|
||||||
|
|
||||||
while(1){
|
while(1){
|
||||||
|
|
||||||
cout.flush();
|
cout.flush();
|
||||||
cout<<flush;
|
cout<<flush;
|
||||||
usleep(20000);
|
usleep(20000);
|
||||||
|
|
||||||
|
|
||||||
//get progress
|
//get progress
|
||||||
pthread_mutex_lock(&mg);
|
pthread_mutex_lock(&mg);
|
||||||
|
if(setReceiverOnline()==ONLINE_FLAG)
|
||||||
caught=getReceiverCurrentFrameIndex();
|
caught=getReceiverCurrentFrameIndex();
|
||||||
pthread_mutex_unlock(&mg);
|
pthread_mutex_unlock(&mg);
|
||||||
if(setReceiverOnline()==OFFLINE_FLAG)
|
if(setReceiverOnline()==OFFLINE_FLAG)
|
||||||
caught=prevCaught;
|
caught=prevCaught;
|
||||||
incrementProgress(caught-prevCaught);
|
setCurrentProgress(caught);
|
||||||
|
|
||||||
|
|
||||||
if (checkJoinThread()) break;
|
if (checkJoinThread()) break;
|
||||||
|
|
||||||
|
|
||||||
if (dataReady){
|
if (dataReady){
|
||||||
|
|
||||||
if(caught-prevCaught) newData=true;
|
// determine if new Data for random read
|
||||||
else newData=false;
|
if (!read_freq){
|
||||||
|
if (caught > prevCaught)
|
||||||
|
newData=true;
|
||||||
|
else
|
||||||
|
newData=false;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "caught:" << caught << " prevcaught:" << prevCaught << " newData:" << newData << std::endl;
|
||||||
|
#endif
|
||||||
prevCaught=caught;
|
prevCaught=caught;
|
||||||
|
}
|
||||||
|
|
||||||
//read frame if new data
|
//read frame if new data or nth frame reading
|
||||||
if (newData){
|
if (newData){
|
||||||
|
|
||||||
|
if(setReceiverOnline()==ONLINE_FLAG){
|
||||||
|
|
||||||
|
//get data
|
||||||
strcpy(currentfName,"");
|
strcpy(currentfName,"");
|
||||||
pthread_mutex_lock(&mg);
|
pthread_mutex_lock(&mg);
|
||||||
int* receiverData = readFrameFromReceiver(currentfName,currentfIndex);
|
int* receiverData = readFrameFromReceiver(currentfName,currentfIndex);
|
||||||
@ -461,26 +485,37 @@ void* postProcessing::processData(int delflag) {
|
|||||||
currentfIndex = -1;
|
currentfIndex = -1;
|
||||||
cout<<"****Detector Data returned is NULL***"<<endl;
|
cout<<"****Detector Data returned is NULL***"<<endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// determine if new Data for nth frame read
|
||||||
|
if (read_freq){
|
||||||
|
//delete if not new data
|
||||||
|
if (caught <= prevCaught)
|
||||||
|
currentfIndex = -1;
|
||||||
|
#ifdef VERBOSE
|
||||||
|
std::cout << "caught:" << caught << " prevcaught:" << prevCaught << std::endl;
|
||||||
|
#endif
|
||||||
|
prevCaught=caught;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
//not garbage frame
|
//not garbage frame
|
||||||
if (currentfIndex >= 0) {
|
if (currentfIndex >= 0) {
|
||||||
fdata = decodeData(receiverData);
|
fdata = decodeData(receiverData);
|
||||||
delete [] receiverData;
|
delete [] receiverData;
|
||||||
if(fdata){
|
if ((fdata) && (dataReady)){
|
||||||
if (dataReady) {
|
|
||||||
thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
|
thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
|
||||||
dataReady(thisData, currentfIndex, pCallbackArg);
|
dataReady(thisData, currentfIndex, pCallbackArg);
|
||||||
delete thisData;
|
delete thisData;
|
||||||
fdata = NULL;
|
fdata = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else{
|
else{
|
||||||
;//cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
|
;//cout<<"****Detector returned mismatched indices/garbage or acquisition is over. Trying again.***"<<endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -439,6 +439,7 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
|
|
||||||
//reset this before each acq or you send old data
|
//reset this before each acq or you send old data
|
||||||
guiData = NULL;
|
guiData = NULL;
|
||||||
|
guiDataReady=0;
|
||||||
strcpy(guiFileName,"");
|
strcpy(guiFileName,"");
|
||||||
|
|
||||||
cout << "Max Frames Per File:" << maxFramesPerFile << endl;
|
cout << "Max Frames Per File:" << maxFramesPerFile << endl;
|
||||||
@ -507,8 +508,6 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
else
|
else
|
||||||
currframenum = (((int)(*((int*)wbuf))) & (frameIndexMask)) >> frameIndexOffset;
|
currframenum = (((int)(*((int*)wbuf))) & (frameIndexMask)) >> frameIndexOffset;
|
||||||
|
|
||||||
|
|
||||||
//currframenum = (int)(*((int*)wbuf));
|
|
||||||
//cout<<"**************curreframenm:"<<currframenum<<endl;
|
//cout<<"**************curreframenm:"<<currframenum<<endl;
|
||||||
|
|
||||||
//write data call back
|
//write data call back
|
||||||
@ -529,25 +528,42 @@ int slsReceiverFunctionList::startWriting(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
//does not read every frame
|
||||||
//wait for gui data for 100ms
|
if(!nFrameToGui){
|
||||||
if(nFrameToGui){
|
|
||||||
for(int i=0;i<10;i++)
|
|
||||||
if(guiData)
|
|
||||||
break;
|
|
||||||
else
|
|
||||||
usleep(10000);//10ms
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//copies gui data and sets/resets guiDataReady
|
|
||||||
if(guiData){
|
if(guiData){
|
||||||
memcpy(latestData,wbuf,bufferSize);
|
memcpy(latestData,wbuf,bufferSize);
|
||||||
strcpy(guiFileName,savefilename);
|
strcpy(guiFileName,savefilename);
|
||||||
guiDataReady=1;
|
guiDataReady=1;
|
||||||
}else
|
}else
|
||||||
guiDataReady=0;
|
guiDataReady=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//reads every nth frame
|
||||||
|
else{
|
||||||
|
|
||||||
|
//catch nth frame: gui ready to copy data
|
||||||
|
while(guiData==NULL){
|
||||||
|
if(!listening_thread_running)
|
||||||
|
break;
|
||||||
|
usleep(10000);
|
||||||
|
guiDataReady=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
//copies gui data and sets/resets guiDataReady
|
||||||
|
memcpy(latestData,wbuf,bufferSize);
|
||||||
|
strcpy(guiFileName,savefilename);
|
||||||
|
guiDataReady=1;
|
||||||
|
|
||||||
|
//catch nth frame: wait for gui to take data
|
||||||
|
while(guiData==latestData){
|
||||||
|
if(!listening_thread_running)
|
||||||
|
break;
|
||||||
|
usleep(100000);
|
||||||
|
}
|
||||||
|
guiDataReady=0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
framesInFile++;
|
framesInFile++;
|
||||||
fifofree->push(wbuf);
|
fifofree->push(wbuf);
|
||||||
@ -592,8 +608,9 @@ void slsReceiverFunctionList::readFrame(char* c,char** raw){
|
|||||||
strcpy(c,guiFileName);
|
strcpy(c,guiFileName);
|
||||||
|
|
||||||
//could not get gui data
|
//could not get gui data
|
||||||
if(!guiDataReady)
|
if(!guiDataReady){
|
||||||
*raw = NULL;
|
*raw = NULL;
|
||||||
|
}
|
||||||
//data ready, set guidata to receive new data
|
//data ready, set guidata to receive new data
|
||||||
else{
|
else{
|
||||||
*raw = guiData;
|
*raw = guiData;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user