mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 12:57:13 +02:00
done showing error when detectors not added in sharedmemory due to connect failure
This commit is contained in:
@ -10,6 +10,7 @@
|
|||||||
|
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <cstring>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
@ -18,8 +19,12 @@ using namespace std;
|
|||||||
|
|
||||||
|
|
||||||
/** Error flags */
|
/** Error flags */
|
||||||
|
/*Assumption: Only upto 63 detectors */
|
||||||
#define CRITICAL_ERROR_MASK 0xFFFFFFFF
|
#define CRITICAL_ERROR_MASK 0xFFFFFFFF
|
||||||
|
|
||||||
|
#define MULTI_DETECTORS_NOT_ADDED 0x8000000000000000ULL
|
||||||
|
|
||||||
|
|
||||||
#define CANNOT_CONNECT_TO_DETECTOR 0x8000000000000000ULL
|
#define CANNOT_CONNECT_TO_DETECTOR 0x8000000000000000ULL
|
||||||
#define CANNOT_CONNECT_TO_RECEIVER 0x4000000000000000ULL
|
#define CANNOT_CONNECT_TO_RECEIVER 0x4000000000000000ULL
|
||||||
#define COULDNOT_SET_CONTROL_PORT 0x2000000000000000ULL
|
#define COULDNOT_SET_CONTROL_PORT 0x2000000000000000ULL
|
||||||
@ -71,7 +76,9 @@ class errorDefs {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
errorDefs():errorMask(0){};
|
errorDefs():errorMask(0){
|
||||||
|
strcpy(notAddedList,"");
|
||||||
|
};
|
||||||
|
|
||||||
/** Gets the error message
|
/** Gets the error message
|
||||||
* param errorMask error mask
|
* param errorMask error mask
|
||||||
@ -226,12 +233,29 @@ public:
|
|||||||
*/
|
*/
|
||||||
int64_t clearErrorMask(){errorMask=0;return errorMask;};
|
int64_t clearErrorMask(){errorMask=0;return errorMask;};
|
||||||
|
|
||||||
|
/** Gets the not added detector list
|
||||||
|
/returns list
|
||||||
|
*/
|
||||||
|
char* getNotAddedList(){return notAddedList;};
|
||||||
|
|
||||||
|
/** Append the detector to not added detector list
|
||||||
|
* @param name append to the list
|
||||||
|
/returns list
|
||||||
|
*/
|
||||||
|
void appendNotAddedList(const char* name){strcat(notAddedList,name);strcat(notAddedList,"+");};
|
||||||
|
|
||||||
|
/** Clears not added detector list
|
||||||
|
/returns error mask
|
||||||
|
*/
|
||||||
|
void clearNotAddedList(){strcpy(notAddedList,"");};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
/** Error Mask */
|
/** Error Mask */
|
||||||
int64_t errorMask;
|
int64_t errorMask;
|
||||||
|
|
||||||
|
/** Detectors Not added List */
|
||||||
|
char notAddedList[MAX_STR_LENGTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ERROR_DEFS_H_ */
|
#endif /* ERROR_DEFS_H_ */
|
||||||
|
@ -694,6 +694,8 @@ int multiSlsDetector::addSlsDetector(const char *name, int pos) {
|
|||||||
t=slsDetector::getDetectorType(name, DEFAULT_PORTNO);
|
t=slsDetector::getDetectorType(name, DEFAULT_PORTNO);
|
||||||
if (t==GENERIC) {
|
if (t==GENERIC) {
|
||||||
cout << "Detector " << name << "does not exist in shared memory and could not connect to it to determine the type (which is not specified)!" << endl;
|
cout << "Detector " << name << "does not exist in shared memory and could not connect to it to determine the type (which is not specified)!" << endl;
|
||||||
|
setErrorMask(getErrorMask()|MULTI_DETECTORS_NOT_ADDED);
|
||||||
|
appendNotAddedList(name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
#ifdef VERBOSE
|
#ifdef VERBOSE
|
||||||
@ -4343,8 +4345,12 @@ int multiSlsDetector::readConfigurationFile(string const fname){
|
|||||||
setNumberOfModules(-1);
|
setNumberOfModules(-1);
|
||||||
getMaxNumberOfModules();
|
getMaxNumberOfModules();
|
||||||
|
|
||||||
if (getErrorMask())
|
if (getErrorMask()){
|
||||||
|
int c;
|
||||||
|
cprintf(RED,"\n----------------\n Error Messages\n----------------\n%s\n",
|
||||||
|
getErrorMessage(c).c_str());
|
||||||
return FAIL;
|
return FAIL;
|
||||||
|
}
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
|
|
||||||
@ -5192,6 +5198,9 @@ string multiSlsDetector::getErrorMessage(int &critical){
|
|||||||
|
|
||||||
multiMask = getErrorMask();
|
multiMask = getErrorMask();
|
||||||
if(multiMask){
|
if(multiMask){
|
||||||
|
if(multiMask & MULTI_DETECTORS_NOT_ADDED)
|
||||||
|
retval.append("Detectors not added:\n"+string(getNotAddedList())+string("\n"));
|
||||||
|
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++) {
|
||||||
if (detectors[idet]) {
|
if (detectors[idet]) {
|
||||||
//if the detector has error
|
//if the detector has error
|
||||||
@ -5222,6 +5231,7 @@ string multiSlsDetector::getErrorMessage(int &critical){
|
|||||||
|
|
||||||
int64_t multiSlsDetector::clearAllErrorMask(){
|
int64_t multiSlsDetector::clearAllErrorMask(){
|
||||||
clearErrorMask();
|
clearErrorMask();
|
||||||
|
clearNotAddedList();
|
||||||
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
|
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
|
||||||
if (detectors[idet])
|
if (detectors[idet])
|
||||||
detectors[idet]->clearErrorMask();
|
detectors[idet]->clearErrorMask();
|
||||||
|
Reference in New Issue
Block a user