CameraBind.h 3.0 KB

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