CameraBind.h 3.1 KB

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