mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-23 18:17:59 +02:00
added callbacks (but should still implement them in the base classes)
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@182 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
@ -5147,7 +5147,7 @@ int slsDetector::dumpDetectorSetup(string const fname, int level){
|
||||
|
||||
string fname1;
|
||||
ofstream outfile;
|
||||
|
||||
int iv;
|
||||
if (level==2) {
|
||||
fname1=fname+string(".det");
|
||||
} else
|
||||
@ -5156,7 +5156,7 @@ int slsDetector::dumpDetectorSetup(string const fname, int level){
|
||||
outfile.open(fname1.c_str(),ios_base::out);
|
||||
if (outfile.is_open()) {
|
||||
|
||||
dumpDetectorSetup(fname, outfile, level);
|
||||
iv=dumpDetectorSetup(fname, outfile, level);
|
||||
|
||||
outfile.close();
|
||||
} else {
|
||||
|
@ -702,7 +702,7 @@ string slsDetectorCommand::cmdAcquire(int narg, char *args[], int action) {
|
||||
cout << string("Executing command ")+string(args[0])+string(" ( ")+cmd+string(" )\n");
|
||||
#endif
|
||||
myDet->setOnline(ONLINE_FLAG);
|
||||
myDet->acquire(1);
|
||||
myDet->acquire();
|
||||
return string("");
|
||||
|
||||
}
|
||||
|
@ -5,7 +5,17 @@
|
||||
#include <sys/shm.h>
|
||||
|
||||
|
||||
slsDetectorUtils::slsDetectorUtils() {};
|
||||
slsDetectorUtils::slsDetectorUtils() {
|
||||
cout << "setting callbacks" << endl;
|
||||
registerGetPositionCallback(&defaultGetPosition);
|
||||
registerConnectChannelsCallback(&defaultConnectChannels);
|
||||
registerDisconnectChannelsCallback(&defaultDisconnectChannels);
|
||||
registerGoToPositionCallback(&defaultGoToPosition);
|
||||
registerGoToPositionNoWaitCallback(&defaultGoToPositionNoWait);
|
||||
registerGetI0Callback(&defaultGetI0);
|
||||
cout << "done " << endl;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
@ -28,8 +38,10 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
// int lastindex=startindex, nowindex=startindex;
|
||||
|
||||
|
||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)))
|
||||
connect_channels();
|
||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION))) {
|
||||
if (connect_channels())
|
||||
connect_channels();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -114,7 +126,8 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
// cout << "positions " << endl;
|
||||
if (*stoppedFlag==0) {
|
||||
if (*numberOfPositions>0) {
|
||||
go_to_position (detPositions[ip]);
|
||||
if (go_to_position)
|
||||
go_to_position (detPositions[ip]);
|
||||
currentPositionIndex=ip+1;
|
||||
#ifdef VERBOSE
|
||||
std::cout<< "moving to position" << std::endl;
|
||||
@ -137,18 +150,23 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
|
||||
if (*correctionMask&(1<< ANGULAR_CONVERSION)) {
|
||||
pthread_mutex_lock(&mp);
|
||||
currentPosition=get_position();
|
||||
if (get_position)
|
||||
currentPosition=get_position();
|
||||
posfinished=0;
|
||||
pthread_mutex_unlock(&mp);
|
||||
}
|
||||
|
||||
if (*correctionMask&(1<< I0_NORMALIZATION))
|
||||
get_i0(0);
|
||||
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||
if (get_i0)
|
||||
get_i0(0);
|
||||
}
|
||||
|
||||
startAndReadAll();
|
||||
|
||||
if (*correctionMask&(1<< I0_NORMALIZATION))
|
||||
if (*correctionMask&(1<< I0_NORMALIZATION)) {
|
||||
if (get_i0)
|
||||
currentI0=get_i0(1); // this is the correct i0!!!!!
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&mp);
|
||||
posfinished=1;
|
||||
@ -242,9 +260,10 @@ void slsDetectorUtils::acquire(int delflag){
|
||||
}
|
||||
|
||||
|
||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION)))
|
||||
disconnect_channels();
|
||||
|
||||
if ((*correctionMask&(1<< ANGULAR_CONVERSION)) || (*correctionMask&(1<< I0_NORMALIZATION))) {
|
||||
if (disconnect_channels)
|
||||
disconnect_channels();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -512,11 +512,23 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
*/
|
||||
virtual int writeConfigurationFile(string const fname)=0;
|
||||
|
||||
|
||||
|
||||
|
||||
void registerGetPositionCallback( float (*func)(void)){get_position=func;};
|
||||
void registerConnectChannelsCallback( int (*func)(void)){connect_channels=func;};
|
||||
void registerDisconnectChannelsCallback( int (*func)(void)){disconnect_channels=func;};
|
||||
|
||||
void registerGoToPositionCallback( int (*func)(float)){go_to_position=func;};
|
||||
void registerGoToPositionNoWaitCallback( int (*func)(float)){go_to_position_no_wait=func;};
|
||||
void registerGetI0Callback( float (*func)(int)){get_i0=func;};
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
static const int64_t thisSoftwareVersion=0x20120124;
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
//protected:
|
||||
int *stoppedFlag;
|
||||
@ -530,6 +542,13 @@ class slsDetectorUtils : public slsDetectorActions, public postProcessing {
|
||||
|
||||
int progressIndex;
|
||||
|
||||
float (*get_position)(void);
|
||||
int (*go_to_position)(float);
|
||||
int (*go_to_position_no_wait)(float);
|
||||
int (*connect_channels)(void);
|
||||
int (*disconnect_channels)(void);
|
||||
float (*get_i0)(int);
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
Reference in New Issue
Block a user