EventManager.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. #ifndef _EVENTMANAGER_H_
  2. #define _EVENTMANAGER_H_
  3. #define YK 0 // 遥控
  4. #define BACK 1 // 恢复正常
  5. #define UPALARM 2 // 上限告警
  6. #define LOWALARM 3 // 下限告警
  7. #define ALARM 4 // 告警
  8. #define UPPER_LIMIT_ID 1000 // 上限告警
  9. #define LOWER_LIMIT_ID 1001 // 下限告警
  10. #define MAX_EQUIP_DESC 255
  11. static char* EVENTTYPE[] =
  12. {
  13. "遥控",
  14. "恢复正常",
  15. "上限告警",
  16. "下限告警",
  17. "告警",
  18. };
  19. class USCADADLLEXPORT CAlarmEvent: public CObject
  20. {
  21. public:
  22. CAlarmEvent();
  23. SYSTEMTIME time;
  24. CString strContent;
  25. CString strUid;
  26. int nVarID;
  27. double dbParaValue;
  28. int nUpperLimit;
  29. int nLowerLimit;
  30. int nNormalState;
  31. int nAlarmState;
  32. int nStatus;//0:报警 1:恢复正常
  33. int nAlarmIndex;//报警索引
  34. int nDealStatus;//处理状态 0:未处理 1:处理过时 2:不处理 3:确认
  35. int nGet;//0:没有从列表取出 1:已经取出
  36. int nIsSound;//0:没播放语音 1:已经播放过
  37. int nColor;//1:颜色变红 2:颜色恢复正常
  38. };
  39. typedef CTypedPtrList<CObList, CAlarmEvent*> CEventList;
  40. class USCADADLLEXPORT CEventServer
  41. {
  42. public:
  43. CEventServer();
  44. ~CEventServer();
  45. void AddNewEvent(CAlarmEvent* event);
  46. CAlarmEvent* GetNewEvent( );
  47. CAlarmEvent* GetUnconfirmEvent();
  48. void DeleteOneEvent( CString strUid, int nVarID,int nStatus );
  49. void DeleteOneEvent( int iIndex );
  50. void ClearAllEvent();
  51. void Validate(bool valid);
  52. void GetOneEventInfo( int iIndex,CString &strUid, int &nVarID, int &nStatus,int &nAlarmIndex,int &nIsSound,int &nColor );
  53. void SetOneEventInfo( int iIndex,int nIsSound,int nColor );
  54. void AddAlarmEvent( CString strDevUid, int nVarID,int nStatus,CString strContent,double dbParaValue, int nUpperLimit,int nLowerLimit, int nNormalState,int nAlarmState,int nAlarmIndex );
  55. CAlarmEvent* GetUnconfirmEventForLoopPlaySound( CAlarmEvent *pEvent );
  56. public:
  57. CEventList eventList;
  58. bool m_bValid;
  59. private:
  60. CRITICAL_SECTION m_cs;
  61. };
  62. #endif