l_maliakal_d 9fe499e20c made ports reusable and added cannot connect to these ports in error class
git-svn-id: file:///afs/psi.ch/project/sls_det_software/svn/slsDetectorSoftware@453 951219d9-93cf-4727-9268-0efd64621fa3
2013-02-06 17:36:03 +00:00

101 lines
2.0 KiB
C++

/*
* error_defs.h
*
* Created on: Jan 18, 2013
* Author: l_maliakal_d
*/
#ifndef ERROR_DEFS_H_
#define ERROR_DEFS_H_
#include <string>
using namespace std;
#include "sls_detector_defs.h"
/** 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 COULDNOT_SET_CONTROL_PORT 0x2000000000000000ULL
#define COULDNOT_SET_STOP_PORT 0x1000000000000000ULL
#define COULDNOT_SET_DATA_PORT 0x0800000000000000ULL
#define COULD_NOT_CONFIGURE_MAC 0x0000000000000001ULL
/** @short class returning all error messages for error mask */
class errorDefs {
public:
/** Constructor */
errorDefs():errorMask(0){};
/** Gets the error message
* param errorMask error mask
/returns error message from error mask
*/
static string getErrorMessage(int64_t slsErrorMask){
string retval = "";
if(slsErrorMask&CANNOT_CONNECT_TO_DETECTOR)
retval.append("Cannot connect to Detector\n");
if(slsErrorMask&CANNOT_CONNECT_TO_RECEIVER)
retval.append("Cannot connect to Receiver\n");
if(slsErrorMask&COULDNOT_SET_CONTROL_PORT)
retval.append("Could not set control port\n");
if(slsErrorMask&COULDNOT_SET_STOP_PORT)
retval.append("Could not set stop port\n");
if(slsErrorMask&COULDNOT_SET_DATA_PORT)
retval.append("Could not set receiver port\n");
if(slsErrorMask&COULD_NOT_CONFIGURE_MAC)
retval.append("Could not configure mac\n");
return retval;
}
/** 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_ */