CMessageBox.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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. WriteSerialError,
  52. SetAxisParamError,
  53. //IO
  54. GetIOStatusError,
  55. SetIOError,
  56. //坐标系
  57. CoordMoveError,
  58. CoordTimeOut,
  59. //模组
  60. DieLose, //晶粒丢失
  61. NozzleBlocked, //吸嘴堵塞
  62. ExceedEjectorMaxLifeTime,
  63. ExceedNozzleMaxLifeTime,
  64. WaitTemperatureTimeOut,
  65. NozzleNotExist,
  66. NozzleHavedExist,
  67. UnloadNozzleFail,
  68. LoadNozzleFail,
  69. WaferZAtUpPos,
  70. WaferRingNotInPos,
  71. WaferRunOut,
  72. //视觉
  73. CameraGrabFail,
  74. TempIdWrong,
  75. PRCameraIdWrong,
  76. CreateTempError,
  77. SearchTempError,
  78. SearchTempWithoutXResult,
  79. SearchTempWithoutYResult,
  80. SearchTempWithoutAngleResult,
  81. AlnExceedDeviation,
  82. // 标定
  83. RCalibError,
  84. HandEyeCalibError,
  85. FindForceTimeOut,
  86. //提示
  87. PleasePlaceCalss,
  88. CalibHalfStop,
  89. //其他
  90. LightCtrlConnectError,
  91. SetLightError,
  92. GetLightError,
  93. SetTemperatureError,
  94. GetTemperatureError,
  95. TemperatureCtrlConnectError,
  96. TemperatureCtrlTypeError,
  97. };
  98. struct MixAlarmMessge
  99. {
  100. AlarmID id;
  101. std::string chineseInfo;
  102. std::string EnglishInfo;
  103. };
  104. //报警弹框回调函数
  105. typedef BUTTON_TYPE(*CallMessageBox) (MESSAGE_INFO stMsgInfo);
  106. class __declspec(dllexport) CMessageBox
  107. {
  108. private:
  109. static std::mutex m_Mutex;
  110. static CMessageBox* m_pMessageBox;
  111. std::vector<MESSAGE_INFO> m_vecMessageBox;
  112. CallMessageBox m_funCallMessageBox = nullptr;
  113. std::mutex m_PopBoxMutex;
  114. //用于消息发布
  115. //void* m_pPubSocket;
  116. //void* m_pSubscriberSocket;
  117. long Init();
  118. void AddPopMassage(MESSAGE_INFO stMsgInfo);
  119. void ErasePopMassage(int iId);
  120. public:
  121. // 获取单实例对象
  122. static CMessageBox* GetInstance();
  123. //static CMessageBox* GetInstance();
  124. void SetCallMessageBoxFunc(CallMessageBox func);
  125. void ClearAllPopMassage();
  126. BUTTON_TYPE PopMassageBox(long iId, std::string strDescribe,
  127. LogStream::LogLevel iLevel = LogStream::LogLevel::Error, int eViewButton = BUTTON_TYPE::CLOSE_BUTTON, std::string strTip="", std::string strHelp = "");
  128. };