123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119 |
- #include "stdafx.h"
- #include "FPDErrorWarningProcess.h"
- extern Log4CPP::Logger* gLogger;
- FPDErrorWarning::FPDErrorWarning(std::shared_ptr <CCOS::Dev::IOEventCenter> EventCenter, std::string DevInstance, std::string strAppPath)
- {
- m_MSGUnit.reset(new nDetail::MSGUnit(EventCenter, DevInstance));
- m_EventCenter = EventCenter;
- std::string strPath = strAppPath + "\\OEMDrivers\\Detector\\CareRay\\CareRayDRDetector\\ErrorInfo.xml";
- m_ErrRes.setFileName(strPath.c_str());
- strPath = strAppPath + "\\OEMDrivers\\Detector\\CareRay\\CareRayDRDetector\\WarnInfo.xml";
- m_WarnRes.setFileName(strPath);
- }
- FPDErrorWarning::~FPDErrorWarning()
- {
- }
- void FPDErrorWarning::AddErrMsg(std::string code, std::string info)
- {
- FINFO( "AddErrMsg {$}: {$}", code.c_str(), info.c_str());
- int level = 1;
- m_MSGUnit->AddErrorMessage(code.c_str(), level, info.c_str());
- }
- void FPDErrorWarning::DelErrMsg(std::string code)
- {
- int level = 1;
- FINFO( "DelErrMsg {$}", code.c_str());
- m_MSGUnit->DelErrorMessage(code.c_str(), level, "");
- }
- void FPDErrorWarning::AddWarnMsg(std::string code, std::string info)
- {
- FINFO( "AddWarnMsg {$}: {$}", code.c_str(), info.c_str());
- int level = 1;
- m_MSGUnit->AddWarnMessage(code.c_str(), level, info.c_str());
- }
- void FPDErrorWarning::DelWarnMsg(std::string code)
- {
- int level = 1;
- FINFO( "DelWarnMsg {$}", code.c_str());
- m_MSGUnit->DelWarnMessage(code.c_str(), level, "");
- }
- void FPDErrorWarning::ClearAllError()
- {
- //ÏÈÇå³ýÔÓÐ̽²âÆ÷µÄERROR
- FINFO("Clear All Error");
- if (0 == m_ErrList.size())
- {
- FINFO("There is no error in list. Omit Clear All Error");
- return;
- }
- for (int i = 0; i < m_ErrList.size(); i++)
- {
- DeviceError stError;
- stError = m_ErrList.item(i);
- if (ERR_FPD_MAX_NUMBER == stError.getCode() || ERR_FPD_SN_NOT_LIST == stError.getCode())
- {
- }
- }
- }
- bool FPDErrorWarning::IsErrorExist(std::string code)
- {
- return m_ErrList.isExist(code);
- }
- int FPDErrorWarning::GetExistErrorNum()
- {
- return m_ErrList.size();
- }
- void FPDErrorWarning::OnError(std::string strErrCode, std::string strErr)
- {
- if (IsErrorExist(strErrCode))
- {
- FINFO("Same Error,Omit");
- return;
- }
- DeviceError stErr;
- if (!m_ErrRes.getDeviceError(strErrCode, stErr))
- {
- FERROR("Get Error Code:{$}", strErrCode);
- }
- m_ErrList.add(stErr);
- std::string strDesc = stErr.getDescription() + strErr;
- stErr.setDescription(strDesc);
- AddErrMsg(stErr.getCode(), stErr.getDescription());
- }
- void FPDErrorWarning::OnWarn(std::string strWarnCode, std::string strWarn)
- {
- DeviceError stWar;
- if (!m_WarnRes.getDeviceWarn(strWarnCode, stWar))
- {
- FINFO("Get Warn Code:{$}", strWarnCode);
- }
- std::string strDesc = stWar.getDescription() + strWarn;
- stWar.setDescription(strDesc);
- AddWarnMsg(stWar.getCode(), stWar.getDescription());
- }
|