done showing error when detectors not added in sharedmemory due to connect failure

This commit is contained in:
Dhanya Maliakal
2016-10-19 08:10:42 +02:00
parent f535e11bba
commit e49f97a03c
2 changed files with 39 additions and 4 deletions

View File

@ -655,7 +655,6 @@ int multiSlsDetector::setDetectorId(int ival, int pos){
int multiSlsDetector::addSlsDetector(const char *name, int pos) {
detectorType t=getDetectorType(string(name));
int online=0;
slsDetector *s=NULL;
@ -695,6 +694,8 @@ int multiSlsDetector::addSlsDetector(const char *name, int pos) {
t=slsDetector::getDetectorType(name, DEFAULT_PORTNO);
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;
setErrorMask(getErrorMask()|MULTI_DETECTORS_NOT_ADDED);
appendNotAddedList(name);
return -1;
}
#ifdef VERBOSE
@ -4367,8 +4368,12 @@ int multiSlsDetector::readConfigurationFile(string const fname){
setNumberOfModules(-1);
getMaxNumberOfModules();
if (getErrorMask())
if (getErrorMask()){
int c;
cprintf(RED,"\n----------------\n Error Messages\n----------------\n%s\n",
getErrorMessage(c).c_str());
return FAIL;
}
return OK;
@ -5472,6 +5477,9 @@ string multiSlsDetector::getErrorMessage(int &critical){
multiMask = getErrorMask();
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++) {
if (detectors[idet]) {
//if the detector has error
@ -5502,6 +5510,7 @@ string multiSlsDetector::getErrorMessage(int &critical){
int64_t multiSlsDetector::clearAllErrorMask(){
clearErrorMask();
clearNotAddedList();
for (int idet=0; idet<thisMultiDetector->numberOfDetectors; idet++)
if (detectors[idet])
detectors[idet]->clearErrorMask();