CameraBind.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. // *****************************************************************************
  2. // 版权所有(C)2023~2099 上海骄成超声波技术有限公司
  3. // 保留所有权利
  4. // *****************************************************************************
  5. // 作者 : 杨坚
  6. // 版本 : 1.0
  7. // 功能说明:
  8. // 绑定相机接口类,为了和ui 区分开,以后也需要
  9. // *****************************************************************************
  10. #ifndef __CAMERABIND_H__
  11. #define __CAMERABIND_H__ 1
  12. #include <QObject>
  13. #include "Machine.h"
  14. #include "CViewInterface.h"
  15. // 灯光类型
  16. enum EN_LIGHT_INDEX
  17. {
  18. Red,//红
  19. Green,
  20. Blue,
  21. Point
  22. };
  23. struct ST_LIGHT_VAL
  24. {
  25. int redLightValue;
  26. int greenLightValue;
  27. int blueLightValue;
  28. int pointLightValue;
  29. };
  30. //移动轴
  31. struct ST_MOVE_AXIS
  32. {
  33. bool isSwitch;
  34. std::string ModuleType;
  35. std::string AxisType;
  36. double pos;
  37. };
  38. // 悬浮等待时间
  39. const unsigned int g_unnSuspensionWaitingTime = 1000 * 60 * 10; //60秒
  40. class CameraBind: public QObject
  41. {
  42. Q_OBJECT
  43. public:
  44. CameraBind();
  45. ~CameraBind();
  46. /**设置画面窗口
  47. */
  48. void SetImageWnd(QWidget* pImageWnd);
  49. void InitAllCamera();
  50. /**移动轴
  51. */
  52. void SetModuleMove(const std::string& strModuleType, const std::string& enAxisType, double pos, bool bMoveTo);
  53. /**回零
  54. */
  55. void JToHome();
  56. /**获取XY
  57. */
  58. CXYCalib* YGetCalibXY(int iCameraId);
  59. /**设置灯光
  60. */
  61. void JSetRedLight(int iCameraId, EN_LIGHT_INDEX nLightIndex, int LightValue);
  62. /**获取灯光值
  63. */
  64. ST_LIGHT_VAL JGetLight(int iCameraId);
  65. /**
  66. */
  67. long YGetAxisPosition(std::string ModuleType, std::string AxisType, double& pos);
  68. /**执行函数
  69. */
  70. long JRunButton(const ns_module::ST_BUTTON_FUN stInfo);
  71. //停止
  72. long JRunStop();
  73. //自动固晶
  74. long JRunAutoBond();
  75. /**退出通知
  76. */
  77. long JViewExit();
  78. /**移动相机轴
  79. */
  80. long JCameraMove(int iCameraId, double x, double y);
  81. signals:
  82. /**通用图像传输
  83. * 哪里需要绑哪里
  84. *@pImageBuffer 图像缓冲区BYTE
  85. *@nWidth 宽
  86. *@nHeight 高
  87. */
  88. void SendImageDispSignal(int iCameraId, ImageInfo imageData);
  89. private:
  90. /**相机回调命名规则 0,1,2,3,4
  91. */
  92. static long OnFrameCallbackFun0(int iCameraId, JVision::ImageInfo imageData);
  93. static long OnFrameCallbackFun1(int iCameraId, JVision::ImageInfo imageData);
  94. static long OnFrameCallbackFun2(int iCameraId, JVision::ImageInfo imageData);
  95. static long OnFrameCallbackFun3(int iCameraId, JVision::ImageInfo imageData);
  96. static long OnFrameCallbackFun4(int iCameraId, JVision::ImageInfo imageData);
  97. //static long OnFrameCallbackFun2(int iCameraId, ImageInfo imageData);
  98. void SendImage(int iCameraId, ImageInfo imageData);
  99. public:
  100. /**相机图像接口
  101. */
  102. std::unique_ptr<ns_module::CViewInterface> m_pCViewInterface;
  103. /**当前相机列表
  104. */
  105. std::vector<CameraInfo> m_vecCamera;
  106. std::vector<CAxis*> m_vecCAxis;
  107. };
  108. #endif //__CAMERABIND_H__