CameraBind.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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. /**回零
  55. */
  56. void JToHome();
  57. /**获取XY
  58. */
  59. CXYCalib* YGetCalibXY(int iCameraId);
  60. /**设置灯光
  61. */
  62. void JSetRedLight(int iCameraId, EN_LIGHT_INDEX nLightIndex, int LightValue);
  63. /**获取灯光值
  64. */
  65. ST_LIGHT_VAL JGetLight(int iCameraId);
  66. /**
  67. */
  68. long YGetAxisPosition(std::string ModuleType, std::string AxisType, double& pos);
  69. /**执行函数
  70. */
  71. long JRunButton(const ns_module::ST_BUTTON_FUN stInfo);
  72. //停止
  73. long JRunStop();
  74. //自动固晶
  75. long JRunAutoBond();
  76. /**退出通知
  77. */
  78. long JViewExit();
  79. /**移动相机轴
  80. */
  81. long JCameraMove(int iCameraId, double x, double y);
  82. signals:
  83. /**通用图像传输
  84. * 哪里需要绑哪里
  85. *@pImageBuffer 图像缓冲区BYTE
  86. *@nWidth 宽
  87. *@nHeight 高
  88. */
  89. void SendImageDispSignal(int iCameraId, ImageInfo imageData);
  90. private:
  91. /**相机回调命名规则 0,1,2,3,4
  92. */
  93. static long OnFrameCallbackFun0(int iCameraId, JVision::ImageInfo imageData);
  94. static long OnFrameCallbackFun1(int iCameraId, JVision::ImageInfo imageData);
  95. static long OnFrameCallbackFun2(int iCameraId, JVision::ImageInfo imageData);
  96. static long OnFrameCallbackFun3(int iCameraId, JVision::ImageInfo imageData);
  97. static long OnFrameCallbackFun4(int iCameraId, JVision::ImageInfo imageData);
  98. //static long OnFrameCallbackFun2(int iCameraId, ImageInfo imageData);
  99. void SendImage(int iCameraId, ImageInfo imageData);
  100. public:
  101. /**相机图像接口
  102. */
  103. ns_module::CViewInterface* m_pCViewInterface;
  104. /**当前相机列表
  105. */
  106. std::vector<CameraInfo> m_vecCamera;
  107. std::vector<CAxis*> m_vecCAxis;
  108. };
  109. #endif //__CAMERABIND_H__