including subframe index from receiver to client and also sending this to gui

This commit is contained in:
Dhanya Maliakal 2015-09-23 11:50:02 +02:00
parent 271838b2b5
commit a770389c90
10 changed files with 23 additions and 16 deletions

View File

@ -4584,7 +4584,7 @@ int multiSlsDetector::resetFramesCaught() {
int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex){
int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex, int &subFrameIndex){
int nel=(thisMultiDetector->dataBytes)/sizeof(int);
if(nel <= 0){
cout << "Multislsdetector databytes not valid :" << thisMultiDetector->dataBytes << endl;
@ -4610,7 +4610,7 @@ int* multiSlsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex
for (int id=0; id<thisMultiDetector->numberOfDetectors; id++) {
if (detectors[id]) {
n=detectors[id]->getDataBytes();
retdet=detectors[id]->readFrameFromReceiver(fName, acquisitionIndex, frameIndex);
retdet=detectors[id]->readFrameFromReceiver(fName, acquisitionIndex, frameIndex, subFrameIndex);
if(detectors[id]->getErrorMask())
setErrorMask(getErrorMask()|(1<<id));
if (retdet){

View File

@ -1160,9 +1160,10 @@ class multiSlsDetector : public slsDetectorUtils {
* @param fName file name of current frame()
* @param acquisitionIndex current acquisition index
* @param frameIndex current frame index (for each scan)
* @param subFrameIndex current sub frame index (for 32 bit mode for eiger)
/returns a frame read from recever
*/
int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex);
int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex, int &subFrameIndex);
/** Locks/Unlocks the connection to the receiver
/param lock sets (1), usets (0), gets (-1) the lock

View File

@ -6705,7 +6705,7 @@ int slsDetector::resetFramesCaught(){
int* slsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex){
int* slsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex, int &subFrameIndex){
int fnum=F_READ_RECEIVER_FRAME;
int nel=thisDetector->dataBytes/sizeof(int);
int* retval=new int[nel];
@ -6732,6 +6732,8 @@ int* slsDetector::readFrameFromReceiver(char* fName, int &acquisitionIndex, int
n=dataSocket->ReceiveDataOnly(fName,MAX_STR_LENGTH);
n=dataSocket->ReceiveDataOnly(&acquisitionIndex,sizeof(acquisitionIndex));
n=dataSocket->ReceiveDataOnly(&frameIndex,sizeof(frameIndex));
if(thisDetector->myDetectorType == EIGER)
n=dataSocket->ReceiveDataOnly(&subFrameIndex,sizeof(subFrameIndex));
n=dataSocket->ReceiveDataOnly(retval,thisDetector->dataBytes);
#ifdef VERBOSE

View File

@ -1554,9 +1554,10 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
* @param fName file name of current frame()
* @param acquisitionIndex current acquisition index
* @param frameIndex current frame index (for each scan)
* @param subFrameIndex current sub frame index (for 32 bit mode for eiger)
/returns a frame read from recever
*/
int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex);
int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex, int &subFrameIndex);
/** Locks/Unlocks the connection to the receiver
/param lock sets (1), usets (0), gets (-1) the lock

View File

@ -499,9 +499,10 @@ class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDef
* @param fName file name of current frame()
* @param acquisitionIndex current acquisition index
* @param frameIndex current frame index (for each scan)
* @param subFrameIndex current sub frame index (for 32 bit mode for eiger)
/returns a frame read from recever
*/
virtual int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex)=0;
virtual int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex, int &subFrameIndex)=0;
/** Sets the read receiver frequency

View File

@ -268,7 +268,7 @@ int64_t slsDetectorUsers::getThisSoftwareVersion(){
void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, int, void*), void *pArg){
void slsDetectorUsers::registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg){
myDetector->registerDataCallback(userCallback,pArg);
}

View File

@ -408,10 +408,10 @@ class slsDetectorUsers
/**
@short register calbback for accessing detector final data
\param userCallback function for plotting/analyzing the data. Its arguments are the data structure d and the frame number f.
\param userCallback function for plotting/analyzing the data. Its arguments are the data structure d and the frame number f, s is for subframe number for eiger for 32 bit mode
*/
void registerDataCallback(int( *userCallback)(detectorData* d, int f, void*), void *pArg);
void registerDataCallback(int( *userCallback)(detectorData* d, int f, int s, void*), void *pArg);
/**
@short register callback for accessing raw data - if the rawDataCallback is registered, no filewriting/postprocessing will be carried on automatically by the software - the raw data are deleted by the software

View File

@ -641,9 +641,10 @@ virtual int resetFramesCaught()=0;
* @param fName file name of current frame()
* @param acquisitionIndex current acquisition index
* @param frameIndex current frame index (for each scan)
* @param subFrameIndex current sub frame index (for 32 bit mode for eiger)
/returns a frame read from recever
*/
virtual int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex)=0;
virtual int* readFrameFromReceiver(char* fName, int &acquisitionIndex, int &frameIndex, int &subFrameIndex)=0;
/**

View File

@ -138,7 +138,7 @@ void postProcessing::processFrame(int *myData, int delflag, int jctb) {
// cout << "callback arg "<< getCurrentProgress()<< " " << (fname+string(".raw")).c_str() << " " << getTotalNumberOfChannels() << endl;
// cout << "DATAREADY 1" <<endl;
thisData=new detectorData(fdata,NULL,NULL,getCurrentProgress(),(fname+string(".raw")).c_str(),getTotalNumberOfChannels());
dataReady(thisData, currentFrameIndex, pCallbackArg);
dataReady(thisData, currentFrameIndex, -1, pCallbackArg);
delete thisData;
fdata=NULL;
}
@ -281,7 +281,7 @@ data queue size unlock
// cout << "callback arg "<< getCurrentProgress()<< " " << (fname+ext).c_str() << " " << np << endl;
//cout << "ADATREADY 2 " << endl;
thisData=new detectorData(val,err,ang,getCurrentProgress(),(fname+ext).c_str(),np);
dataReady(thisData, currentFrameIndex, pCallbackArg);
dataReady(thisData, currentFrameIndex, -1, pCallbackArg);
delete thisData;
ang=NULL;
val=NULL;
@ -500,6 +500,7 @@ void* postProcessing::processData(int delflag) {
int caught = -1;
int currentAcquisitionIndex = -1;
int currentFrameIndex = -1;
int currentSubFrameIndex = -1;
bool newData = false;
int nthframe = setReadReceiverFrequency(0);
@ -633,7 +634,7 @@ void* postProcessing::processData(int delflag) {
strcpy(currentfName,"");
pthread_mutex_lock(&mg);
//int* receiverData = new int [getTotalNumberOfChannels()];
int* receiverData = readFrameFromReceiver(currentfName,currentAcquisitionIndex,currentFrameIndex);
int* receiverData = readFrameFromReceiver(currentfName,currentAcquisitionIndex,currentFrameIndex,currentSubFrameIndex);
pthread_mutex_unlock(&mg);
//if detector returned null
@ -664,7 +665,7 @@ void* postProcessing::processData(int delflag) {
if ((fdata) && (dataReady)){
// cout << "DATAREADY 3" << endl;
thisData = new detectorData(fdata,NULL,NULL,getCurrentProgress(),currentfName,getTotalNumberOfChannels());
dataReady(thisData, currentFrameIndex, pCallbackArg);
dataReady(thisData, currentFrameIndex, currentSubFrameIndex, pCallbackArg);
delete thisData;
fdata = NULL;
progress = caught;

View File

@ -238,7 +238,7 @@ s
void ResetPositionIndex(){pthread_mutex_lock(&mp); resetPositionIndex(); pthread_mutex_unlock(&mp);};
void registerDataCallback(int( *userCallback)(detectorData*, int, void*), void *pArg) {dataReady = userCallback; pCallbackArg = pArg;};
void registerDataCallback(int( *userCallback)(detectorData*, int, int, void*), void *pArg) {dataReady = userCallback; pCallbackArg = pArg;};
void registerRawDataCallback(int( *userCallback)(double*, int, void*), void *pArg) {rawDataReady = userCallback; pRawDataArg = pArg;};
@ -335,7 +335,7 @@ s
private:
double *fdata;
int (*dataReady)(detectorData*,int, void*);
int (*dataReady)(detectorData*,int, int,void*);
void *pCallbackArg;
int (*rawDataReady)(double*,int,void*);