added error mask properly inherited by base; mask exist only for cannot connect to detector, receiver and could not configure mac

git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@452 951219d9-93cf-4727-9268-0efd64621fa3
This commit is contained in:
l_maliakal_d 2013-02-06 15:22:45 +00:00
parent 7a55ed9a74
commit 1d03be832f
7 changed files with 82 additions and 72 deletions

View File

@ -17,6 +17,16 @@ using namespace std;
/** Error flags */
#define NUM_ERROR_FLAGS 32
#define CRITICAL_ERROR_MASK 0xFFFFFFFF
#define CANNOT_CONNECT_TO_DETECTOR 0x8000000000000000ULL
#define CANNOT_CONNECT_TO_RECEIVER 0x4000000000000000ULL
#define COULD_NOT_CONFIGURE_MAC 0x0000000000000001ULL
/** @short class returning all error messages for error mask */ /** @short class returning all error messages for error mask */
class errorDefs { class errorDefs {
@ -24,13 +34,13 @@ class errorDefs {
public: public:
/** Constructor */ /** Constructor */
errorDefs(){}; errorDefs():errorMask(0){};
/** Gets the error message /** Gets the error message
* param errorMask error mask * param errorMask error mask
/returns error message from error mask /returns error message from error mask
*/ */
static string getErrorMessage(int slsErrorMask){ static string getErrorMessage(int64_t slsErrorMask){
string retval = ""; string retval = "";
@ -48,6 +58,26 @@ public:
} }
/** Sets multi error mask
@param multi error mask to be set to
/returns multi error mask
*/
int64_t setErrorMask(int64_t i){errorMask=i;return getErrorMask();};
/**returns multi error mask */
int64_t getErrorMask(){return errorMask;};
/** Clears error mask
/returns error mask
*/
int64_t clearErrorMask(){errorMask=0;return errorMask;};
protected:
/** Error Mask */
int64_t errorMask;
}; };
#endif /* ERROR_DEFS_H_ */ #endif /* ERROR_DEFS_H_ */

View File

@ -520,13 +520,6 @@ enum angleConversionParameter {
/** Error flags */
#define NUM_ERROR_FLAGS 32
#define CANNOT_CONNECT_TO_DETECTOR 0x80000000
#define CANNOT_CONNECT_TO_RECEIVER 0x40000000
#define COULD_NOT_CONFIGURE_MAC 0x00008000
//typedef struct { //typedef struct {
//float center; /**< center of the module (channel at which the radius is perpendicular to the module surface) */ //float center; /**< center of the module (channel at which the radius is perpendicular to the module surface) */
//float ecenter; /**< error in the center determination */ //float ecenter; /**< error in the center determination */

View File

@ -93,7 +93,7 @@ int multiSlsDetector::initSharedMemory(int id=0) {
multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1),errorMask(0) multiSlsDetector::multiSlsDetector(int id) : slsDetectorUtils(), shmId(-1)
{ {
while (shmId<0) { while (shmId<0) {
shmId=initSharedMemory(id); shmId=initSharedMemory(id);
@ -3869,3 +3869,41 @@ int multiSlsDetector::setFrameIndex(int index){
return ret; return ret;
} }
string multiSlsDetector::getErrorMessage(int &critical){
int64_t multiMask,slsMask=0;
string retval="";
char sNumber[100];
critical=0;
multiMask = getErrorMask();
if(multiMask){
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
if (detectors[idet]) {
//if the detector has error
if(multiMask&(1<<idet)){
//append detector id
sprintf(sNumber,"%d",idet);
retval.append("Detector " + string(sNumber)+string(":\n"));
//get sls det error mask
slsMask=detectors[idet]->getErrorMask();
#ifdef VERYVERBOSE
//append sls det error mask
sprintf(sNumber,"0x%x",slsMask);
retval.append("Error Mask " + string(sNumber)+string("\n"));
#endif
//get the error critical level
if((slsMask>0xFFFFFFFF)|critical)
critical = 1;
//append error message
retval.append(errorDefs::getErrorMessage(slsMask));
}
}
}
}
return retval;
}

View File

@ -1134,22 +1134,13 @@ class multiSlsDetector : public slsDetectorUtils {
int fillModuleMask(int *mM); int fillModuleMask(int *mM);
/**checks error mask and returns error message if it exists
/** * @param myDet is the multidetector object
Sets multi error mask * @param critical is 1 if any of the messages is critical
@param multi error mask to be set to /returns error message else an empty string
/returns multi error mask
*/
int setErrorMask(int i=-1){errorMask=i;return getErrorMask();}
/**returns multi error mask */
int getErrorMask(){return errorMask;}
/**
clears error mask
/returns error mask
*/ */
int clearErrorMask(){errorMask=0;return errorMask;} string getErrorMessage(int &critical);
protected: protected:
@ -1163,9 +1154,6 @@ class multiSlsDetector : public slsDetectorUtils {
/** Shared memory structure */ /** Shared memory structure */
sharedMultiSlsDetector *thisMultiDetector; sharedMultiSlsDetector *thisMultiDetector;
/** Error Mask for each detector*/
int errorMask;
}; };

View File

@ -126,8 +126,7 @@ slsDetector::slsDetector(int id,multiSlsDetector *p) :slsDetectorUtils(),
adcs(NULL), adcs(NULL),
chipregs(NULL), chipregs(NULL),
chanregs(NULL), chanregs(NULL),
thisReceiver(NULL), thisReceiver(NULL)
errorMask(0)
{ {
@ -177,8 +176,7 @@ slsDetector::slsDetector(detectorType type, int id,multiSlsDetector *p): slsDete
adcs(NULL), adcs(NULL),
chipregs(NULL), chipregs(NULL),
chanregs(NULL), chanregs(NULL),
thisReceiver(NULL), thisReceiver(NULL)
errorMask(0)
{ {
while (shmId<0) { while (shmId<0) {
@ -232,8 +230,7 @@ slsDetector::slsDetector(char *name, int id, int cport,multiSlsDetector *p) : sl
adcs(NULL), adcs(NULL),
chipregs(NULL), chipregs(NULL),
chanregs(NULL), chanregs(NULL),
thisReceiver(NULL), thisReceiver(NULL)
errorMask(0)
{ {

View File

@ -1523,23 +1523,6 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
int fillModuleMask(int *mM); int fillModuleMask(int *mM);
/**
Sets error mask
@param error mask to be set to
/returns error mask
*/
int setErrorMask(int i=-1){errorMask=i;return errorMask;}
/**returns error mask */
int getErrorMask(){return errorMask;}
/**
clears error mask
/returns error mask
*/
int clearErrorMask(){errorMask=0;return errorMask;}
protected: protected:
@ -1601,9 +1584,6 @@ class slsDetector : public slsDetectorUtils, public energyConversion {
receiverInterface *thisReceiver; receiverInterface *thisReceiver;
/** Error Mask*/
int errorMask;
/** Initializes the shared memory /** Initializes the shared memory
\param type is needed to define the size of the shared memory \param type is needed to define the size of the shared memory

View File

@ -48,6 +48,7 @@
#include "sls_detector_defs.h" #include "sls_detector_defs.h"
#include "error_defs.h"
#include <string> #include <string>
@ -63,7 +64,7 @@ using namespace std;
*/ */
//public virtual slsDetectorUsers, //public virtual slsDetectorUsers,
class slsDetectorBase : public virtual slsDetectorDefs { class slsDetectorBase : public virtual slsDetectorDefs, public virtual errorDefs {
public: public:
@ -473,23 +474,6 @@ class slsDetectorBase : public virtual slsDetectorDefs {
virtual int* readFrameFromReceiver(char* fName, int &fIndex)=0; virtual int* readFrameFromReceiver(char* fName, int &fIndex)=0;
/** Gets error mask
/returns error mask
*/
virtual int getErrorMask()=0;
/**
Sets error mask
@param error mask to be set to
/returns error mask
*/
virtual int setErrorMask(int i=-1)=0;
/**
clears error mask
/returns error mask
*/
virtual int clearErrorMask()=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