76 lines
2.5 KiB
C++
76 lines
2.5 KiB
C++
#ifndef WORKPIECESPLICEPRESENTER_H
|
||
#define WORKPIECESPLICEPRESENTER_H
|
||
|
||
#include <QTimer>
|
||
#include <mutex>
|
||
#include "BasePresenter.h"
|
||
#include "IYWorkpieceSpliceStatus.h"
|
||
#include "IBinocularMarkReceiver.h"
|
||
#include "IVrConfig.h"
|
||
|
||
/**
|
||
* @brief 工件拼接Presenter
|
||
*
|
||
* 继承自BasePresenter,使用BinocularMark设备进行工件拼接检测
|
||
* 不使用BasePresenter的激光相机功能,而是使用自己的BinocularMark设备管理
|
||
*/
|
||
class WorkpieceSplicePresenter : public BasePresenter
|
||
{
|
||
Q_OBJECT
|
||
|
||
public:
|
||
explicit WorkpieceSplicePresenter(QObject *parent = nullptr);
|
||
~WorkpieceSplicePresenter();
|
||
|
||
// 获取配置管理器
|
||
IVrConfig* GetConfigManager() { return m_pConfig; }
|
||
|
||
// ============ 重写 BasePresenter 的检测方法 ============
|
||
int StartDetection(int cameraIndex = -1, bool isAuto = true) override;
|
||
int StopDetection() override;
|
||
|
||
protected:
|
||
// ============ 实现 BasePresenter 纯虚函数 ============
|
||
int InitApp() override;
|
||
int InitAlgoParams() override;
|
||
int ProcessAlgoDetection(std::vector<std::pair<EVzResultDataType, SVzLaserLineData>>& detectionDataCache) override;
|
||
EVzResultDataType GetDetectionDataType() override;
|
||
void OnCameraStatusChanged(int cameraIndex, bool isConnected) override;
|
||
|
||
// ============ 重写 BasePresenter 虚函数 ============
|
||
void OnWorkStatusChanged(WorkStatus status) override;
|
||
void OnStatusUpdate(const std::string& statusMessage) override;
|
||
|
||
private slots:
|
||
void onMarkReconnectTimeout();
|
||
|
||
private:
|
||
// 初始化方法
|
||
int InitConfig();
|
||
int InitBinocularMarkReceiver();
|
||
|
||
// 回调处理
|
||
void OnMarkResult(const std::vector<VrMark3D>& marks, qint64 timestamp, int errorCode);
|
||
void OnMarkConnectionChanged(bool connected);
|
||
|
||
// 连接方法
|
||
int ConnectToBinocularMark();
|
||
|
||
private:
|
||
// 配置相关
|
||
IVrConfig* m_pConfig = nullptr;
|
||
ConfigResult m_configResult;
|
||
|
||
// BinocularMark 设备
|
||
IBinocularMarkReceiver* m_pMarkReceiver = nullptr;
|
||
std::string m_binocularMarkIp;
|
||
quint16 m_binocularMarkPort = 0;
|
||
bool m_bMarkConnected = false;
|
||
QTimer* m_pMarkReconnectTimer = nullptr;
|
||
|
||
// 检测相关
|
||
std::mutex m_mutex;
|
||
};
|
||
|
||
#endif // WORKPIECESPLICEPRESENTER_H
|