CameraBind.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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. std::string ModuleType;
  34. std::string AxisType;
  35. double pos;
  36. };
  37. // 悬浮等待时间
  38. const unsigned int g_unnSuspensionWaitingTime = 1000 * 60; //60秒
  39. class CameraBind: public QObject
  40. {
  41. Q_OBJECT
  42. public:
  43. CameraBind();
  44. ~CameraBind();
  45. /**设置画面窗口
  46. */
  47. void SetImageWnd(QWidget* pImageWnd);
  48. void InitAllCamera();
  49. /**移动轴
  50. */
  51. void SetModuleMove(const std::string& strModuleType, const std::string& enAxisType, double pos, bool bMoveTo);
  52. /**回零
  53. */
  54. void JToHome();
  55. /**获取XY
  56. */
  57. CXYCalib* YGetCalibXY(int iCameraId);
  58. /**设置灯光
  59. */
  60. void JSetRedLight(int iCameraId, EN_LIGHT_INDEX nLightIndex, int LightValue);
  61. /**获取灯光值
  62. */
  63. ST_LIGHT_VAL JGetLight(int iCameraId);
  64. /**
  65. */
  66. long YGetAxisPosition(std::string ModuleType, std::string AxisType, double& pos);
  67. /**执行函数
  68. */
  69. long JRunButton(const ns_module::ST_BUTTON_FUN stInfo);
  70. //停止
  71. long JRunStop();
  72. //自动固晶
  73. long JRunAutoBond();
  74. /**退出通知
  75. */
  76. long JViewExit();
  77. /**移动相机轴
  78. */
  79. long JCameraMove(int iCameraId, double x, double y);
  80. signals:
  81. /**通用图像传输
  82. * 哪里需要绑哪里
  83. *@pImageBuffer 图像缓冲区BYTE
  84. *@nWidth 宽
  85. *@nHeight 高
  86. */
  87. void SendImageDispSignal(int iCameraId, ImageInfo imageData);
  88. private:
  89. /**相机回调命名规则 0,1,2,3,4
  90. */
  91. static long OnFrameCallbackFun0(int iCameraId, JVision::ImageInfo imageData);
  92. static long OnFrameCallbackFun1(int iCameraId, JVision::ImageInfo imageData);
  93. static long OnFrameCallbackFun2(int iCameraId, JVision::ImageInfo imageData);
  94. static long OnFrameCallbackFun3(int iCameraId, JVision::ImageInfo imageData);
  95. static long OnFrameCallbackFun4(int iCameraId, JVision::ImageInfo imageData);
  96. //static long OnFrameCallbackFun2(int iCameraId, ImageInfo imageData);
  97. void SendImage(int iCameraId, ImageInfo imageData);
  98. public:
  99. /**相机图像接口
  100. */
  101. std::unique_ptr<ns_module::CViewInterface> m_pCViewInterface;
  102. /**当前相机列表
  103. */
  104. std::vector<CameraInfo> m_vecCamera;
  105. std::vector<CAxis*> m_vecCAxis;
  106. };
  107. #endif //__CAMERABIND_H__