CMessageBox.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. #pragma once
  2. //#pragma warning(disable:4251)
  3. #include <vector>
  4. #include <mutex>
  5. #include <map>
  6. #include "string.h"
  7. #include "dt.h"
  8. #include "CLog.h"
  9. enum BUTTON_TYPE
  10. {
  11. CLOSE_BUTTON = 0x1, //关闭
  12. STOP_BUTTON = 0x2, //终止
  13. REPEAT_BUTTON = 0x4,//重复
  14. IGNORE_BUTTON = 0x8,//忽略
  15. };
  16. typedef struct
  17. {
  18. int eViewButton; //弹框需显示的按钮(BUTTON_TYPE)的组合
  19. LogStream::LogLevel iLevel; //报警级别
  20. long iId; //报警Id
  21. std::string strDescribe; //报警描述
  22. std::string strTip; //报警提示
  23. std::string strHelp; //报警帮助信息
  24. }MESSAGE_INFO;
  25. enum AlarmID
  26. {
  27. //初始化错误
  28. SoftWareInitError,
  29. ReadDBError,
  30. GetAxisError,
  31. CardInitError,
  32. ModuleInitError,
  33. //轴
  34. ZHotZone,
  35. XHotZone,
  36. YHotZone,
  37. AxisMoveError,
  38. AxisStopError,
  39. GetAxisPosError,
  40. GetCurrentError,
  41. ChangeForceCurrentError,
  42. AxisOnError,
  43. AxisOffError,
  44. AxisHomeError,
  45. AxisTimeOut,
  46. RunAcsBufferError,
  47. StopAcsBufferError,
  48. WriteAcsBufferError,
  49. GetAcsBufferError,
  50. WriteSocketError,
  51. GetSocketError,
  52. WriteSerialError,
  53. SetAxisParamError,
  54. //IO
  55. GetIOStatusError,
  56. SetIOError,
  57. //坐标系
  58. CoordMoveError,
  59. CoordTimeOut,
  60. //模组
  61. DieLose, //晶粒丢失
  62. NozzleBlocked, //吸嘴堵塞
  63. ExceedEjectorMaxLifeTime,
  64. ExceedNozzleMaxLifeTime,
  65. WaitTemperatureTimeOut,
  66. NozzleNotExist,
  67. NozzleHavedExist,
  68. UnloadNozzleFail,
  69. LoadNozzleFail,
  70. WaferZAtUpPos,
  71. WaferRingNotInPos,
  72. WaferRunOut,
  73. //视觉
  74. CameraGrabFail,
  75. TempIdWrong,
  76. PRCameraIdWrong,
  77. CreateTempError,
  78. SearchTempError,
  79. SearchTempWithoutXResult,
  80. SearchTempWithoutYResult,
  81. SearchTempWithoutAngleResult,
  82. AlnExceedDeviation,
  83. // 标定
  84. RCalibError,
  85. HandEyeCalibError,
  86. FindForceTimeOut,
  87. ExceedMaxPressDis,//超出最大压合距离
  88. //提示
  89. PleasePlaceCalss,
  90. CalibHalfStop,
  91. //其他
  92. LightCtrlConnectError,
  93. SetLightError,
  94. GetLightError,
  95. SetTemperatureError,
  96. GetTemperatureError,
  97. TemperatureCtrlConnectError,
  98. TemperatureCtrlTypeError,
  99. };
  100. struct MixAlarmMessge
  101. {
  102. AlarmID id;
  103. std::string chineseInfo;
  104. std::string EnglishInfo;
  105. };
  106. //报警弹框回调函数
  107. typedef BUTTON_TYPE(*CallMessageBox) (MESSAGE_INFO stMsgInfo);
  108. class __declspec(dllexport) CMessageBox
  109. {
  110. private:
  111. static std::mutex m_Mutex;
  112. static CMessageBox* m_pMessageBox;
  113. std::vector<MESSAGE_INFO> m_vecMessageBox;
  114. CallMessageBox m_funCallMessageBox = nullptr;
  115. std::mutex m_PopBoxMutex;
  116. //用于消息发布
  117. //void* m_pPubSocket;
  118. //void* m_pSubscriberSocket;
  119. long Init();
  120. void AddPopMassage(MESSAGE_INFO stMsgInfo);
  121. void ErasePopMassage(int iId);
  122. public:
  123. // 获取单实例对象
  124. static CMessageBox* GetInstance();
  125. //static CMessageBox* GetInstance();
  126. void SetCallMessageBoxFunc(CallMessageBox func);
  127. void ClearAllPopMassage();
  128. BUTTON_TYPE PopMassageBox(long iId, std::string strDescribe,
  129. LogStream::LogLevel iLevel = LogStream::LogLevel::Error, int eViewButton = BUTTON_TYPE::CLOSE_BUTTON, std::string strTip="", std::string strHelp = "");
  130. };