really merged after the mess...

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@163 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
bergamaschi
2012-03-23 15:58:03 +00:00
parent 13344152aa
commit 2463c9841c
7 changed files with 187 additions and 162 deletions

View File

@@ -4613,10 +4613,6 @@ int slsDetector:: writeAngularConversion(ofstream &ofs) {
int slsDetector::loadImageToDetector(imageType index,string const fname){
int ret=FAIL;
@@ -4640,13 +4636,6 @@ int slsDetector::loadImageToDetector(imageType index,string const fname){
}
int slsDetector::sendImageToDetector(imageType index,short int imageVals[]){
int ret=FAIL;
@@ -4681,6 +4670,89 @@ int slsDetector::sendImageToDetector(imageType index,short int imageVals[]){
return ret;
}
int slsDetector::getCounterBlock(short int arg[],int startACQ){
int ret=FAIL;
int fnum=F_READ_COUNTER_BLOCK;
char mess[100];
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (controlSocket) {
if (controlSocket->Connect()>=0) {
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&startACQ,sizeof(startACQ));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret!=FAIL)
controlSocket->ReceiveDataOnly(arg,thisDetector->dataBytes);
else {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
}
controlSocket->Disconnect();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
}
return ret;
}
int slsDetector::writeCounterBlockFile(string const fname,int startACQ){
int ret=FAIL;
short int counterVals[thisDetector->nChans*thisDetector->nChips];
#ifdef VERBOSE
std::cout<< std::endl<< "Reading Counter to \""<<fname;
if(startACQ==1)
std::cout<<"\" and Restarting Acquisition";
std::cout<<std::endl;
#endif
ret=getCounterBlock(counterVals,startACQ);
if(ret==OK)
ret=writeDataFile(fname,counterVals);
return ret;
}
int slsDetector::resetCounterBlock(int startACQ){
int ret=FAIL;
int fnum=F_RESET_COUNTER_BLOCK;
char mess[100];
#ifdef VERBOSE
std::cout<< std::endl<< "Resetting Counter";
if(startACQ==1)
std::cout<<" and Restarting Acquisition";
std::cout<<std::endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (controlSocket) {
if (controlSocket->Connect()>=0) {
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&startACQ,sizeof(startACQ));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL){
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
}
controlSocket->Disconnect();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
}
return ret;
}
@@ -5551,86 +5623,3 @@ slsDetectorDefs::synchronizationMode slsDetector::setSynchronization(synchroniza
return retval;
}
int slsDetector::getCounterBlock(short int arg[],int startACQ){
int ret=FAIL;
int fnum=F_READ_COUNTER_BLOCK;
char mess[100];
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (controlSocket) {
if (controlSocket->Connect()>=0) {
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&startACQ,sizeof(startACQ));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret!=FAIL)
controlSocket->ReceiveDataOnly(arg,thisDetector->dataBytes);
else {
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
}
controlSocket->Disconnect();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
}
return ret;
}
int slsDetector::writeCounterBlockFile(string const fname,int startACQ){
int ret=FAIL;
short int counterVals[thisDetector->nChans*thisDetector->nChips];
#ifdef VERBOSE
std::cout<< std::endl<< "Reading Counter to \""<<fname;
if(startACQ==1)
std::cout<<"\" and Restarting Acquisition";
std::cout<<std::endl;
#endif
ret=getCounterBlock(counterVals,startACQ);
if(ret==OK)
ret=writeDataFile(fname,counterVals);
return ret;
}
int slsDetector::resetCounterBlock(int startACQ){
int ret=FAIL;
int fnum=F_RESET_COUNTER_BLOCK;
char mess[100];
#ifdef VERBOSE
std::cout<< std::endl<< "Resetting Counter";
if(startACQ==1)
std::cout<<" and Restarting Acquisition";
std::cout<<std::endl;
#endif
if (thisDetector->onlineFlag==ONLINE_FLAG) {
if (controlSocket) {
if (controlSocket->Connect()>=0) {
controlSocket->SendDataOnly(&fnum,sizeof(fnum));
controlSocket->SendDataOnly(&startACQ,sizeof(startACQ));
controlSocket->ReceiveDataOnly(&ret,sizeof(ret));
if (ret==FAIL){
controlSocket->ReceiveDataOnly(mess,sizeof(mess));
std::cout<< "Detector returned error: " << mess << std::endl;
}
controlSocket->Disconnect();
if (ret==FORCE_UPDATE)
updateDetector();
}
}
}
return ret;
}

View File

@@ -768,13 +768,13 @@ class slsDetectorBase : public slsDetectorDefs
virtual int retrieveDetectorSetup(string const fname, int level=0)=0;
/**
Loads dark image or gain image to the detector
\param index can be DARK_IMAGE or GAIN_IMAGE
\param fname file name to load data from
\returns OK or FAIL
*/
virtual int loadImageToDetector(imageType index,string const fname)=0;
/* /\** */
/* Loads dark image or gain image to the detector */
/* \param index can be DARK_IMAGE or GAIN_IMAGE */
/* \param fname file name to load data from */
/* \returns OK or FAIL */
/* *\/ */
/* virtual int loadImageToDetector(imageType index,string const fname)=0; */
/************************************************************************

View File

@@ -6,7 +6,7 @@
#include <iomanip>
slsDetectorCommand::slsDetectorCommand(slsDetectorBase *det) {
slsDetectorCommand::slsDetectorCommand(slsDetectorUtils *det) {
myDet=det;
@@ -134,6 +134,7 @@ slsDetectorCommand::slsDetectorCommand(slsDetectorBase *det) {
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdCounter;
i++;
/* trim/cal directories */
descrToFuncMap[i].m_pFuncName="trimdir"; //OK
descrToFuncMap[i].m_pFuncPtr=&slsDetectorCommand::cmdSettingsDir;
@@ -1636,7 +1637,6 @@ string slsDetectorCommand::helpThreaded(int narg, char *args[], int action){
}
string slsDetectorCommand::cmdImage(int narg, char *args[], int action){
string sval;
int retval;
@@ -1676,7 +1676,6 @@ string slsDetectorCommand::helpImage(int narg, char *args[], int action){
}
string slsDetectorCommand::cmdCounter(int narg, char *args[], int action){
int ival;
string sval;
@@ -1728,6 +1727,7 @@ string slsDetectorCommand::helpCounter(int narg, char *args[], int action){
string slsDetectorCommand::cmdPositions(int narg, char *args[], int action){
int ival;
int ip;

View File

@@ -113,6 +113,8 @@ class slsDetectorUtils : public slsDetectorBase {
using slsDetectorBase::setBadChannelCorrection;
using slsDetectorBase::getAngularConversion;
/** Frees the shared memory - should not be used except for debugging*/
virtual int freeSharedMemory()=0;
/** adds the detector with ID id in postion pos
@@ -375,6 +377,11 @@ class slsDetectorUtils : public slsDetectorBase {
\sa angleConversionConstant mythenDetector::writeAngularConversion
*/
static int writeAngularConversion(ofstream& ofs, int nmod, angleConversionConstant *angOff);
virtual int writeAngularConversion(const char *fname)=0;
/**
set bad channels correction
\param fname file with bad channel list ("" disable)
@@ -650,6 +657,31 @@ s
/**
Loads dark image or gain image to the detector
\param index can be DARK_IMAGE or GAIN_IMAGE
\fname file name to load data from
\returns OK or FAIL
*/
virtual int loadImageToDetector(imageType index,string const fname)=0;
/**
writes the counter memory block from the detector
\param startACQ is 1 to start acquisition after reading counter
\fname file fname to load data from
\returns OK or FAIL
*/
virtual int writeCounterBlockFile(string const fname,int startACQ=0)=0;
/**
Resets counter memory block in detector
\param startACQ is 1 to start acquisition after resetting counter
\returns OK or FAIL
*/
virtual int resetCounterBlock(int startACQ=0)=0;