GrabBag/Device/VrEyeDevice/_Inc/VrEyeDevice.h
2026-03-17 22:27:58 +08:00

187 lines
4.3 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#ifndef CVREYEDEVICE_H
#define CVREYEDEVICE_H
#ifdef _WIN32
// Debug模式开关 - 修改此处开启/关闭debug功能
#define VR_EYE_DEBUG_MODE
#endif
#include "IVrEyeDevice.h"
#include "VrEyeCommon.h"
#include "VZNL_Common.h"
#include "VZNL_DetectConfig.h"
#include "VZNL_DetectLaser.h"
#include "VZNL_SwingMotor.h"
#include "VZNL_Internal.h"
#include "VZNL_RGBConfig.h"
#include "VZNL_DetectLaser.h"
#include <cstring>
#include <thread>
#include <atomic>
#include <mutex>
#include <vector>
class CVrEyeDevice : public IVrEyeDevice
{
public:
CVrEyeDevice();
~CVrEyeDevice();
// 初始化设备
int InitDevice() override;
/**
* 设置状态回调函数
*/
int SetStatusCallback(VzNL_OnNotifyStatusCBEx fNotify, void *param) override;
/**
* Open设备
*/
int OpenDevice(const char* sIP, bool bRGBD = false, bool bSwing = true, bool bFillLaser = true) override;
/**
* 获取版本信息
* @return 版本信息
*/
int GetVersion(SVzNLVersionInfo& sVersionInfo) override;
/**
* 获取设备信息
* @return
*/
int GetDevInfo(SVzNLEyeDeviceInfoEx& sDeviceInfo) override;
/**
* Close设备
*/
int CloseDevice() override;
/**
* 开始自动检测
* @return 错误代码 0表示成功
*/
int StartDetect(VzNL_AutoOutputLaserLineExCB fCallFunc, EVzResultDataType eDataType, void *param) override;
/**
* 是否正在检测
* @return
*/
bool IsDetectIng() override;
/**
* 停止自动检测
* @return 错误代码 0表示成功
*/
int StopDetect() override;
int StartCapture(VzNL_OutputImageCB fCallback, void* param) override;
int StopCapture() override;
bool IsCapturing() override;
int GetEyeImage(SVzNLImageData** ppLeftImage, SVzNLImageData** ppRightImage, unsigned int nTimeOut = 3000) override;
int ReleaseImage(SVzNLImageData** ppImageData) override;
/**
* ROI设置
* @param leftROI
* @param rightROI
* @return
*/
int SetDetectROI(SVzNLRect& leftROI, SVzNLRect& rightROI) override;
int GetDetectROI(SVzNLRect& leftROI, SVzNLRect& rightROI) override;
/**
* 曝光设置&获取
* @return
*/
int SetEyeExpose(unsigned int& exposeTime) override;
int GetEyeExpose(unsigned int& exposeTime) override;
/**
* 增益设置&获取
* @param gain
* @return
*/
int SetEyeGain(unsigned int& gain) override;
int GetEyeGain(unsigned int& gain) override;
/**
* 帧率设置&获取
* @param frame
* @return
*/
int SetFrame(int& frame) override;
int GetFrame(int& frame) override;
/**
* 是否支持RGBD
* @return
*/
bool IsSupport() override;
/**
* 设置彩色Sensor期望值
* @param value
* @return
*/
int SetRGBDExposeThres(float& value) override;
int GetRGBDExposeThres(float& value) override;
/**
* 设置过滤高度
* @param dHeight
* @return
*/
int SetFilterHeight(double& dHeight) override;
int GetFilterHeight(double& dHeight) override;
/**
* 配置摆动机构速度
* @return
*/
int GetSwingSpeed(float& fSpeed) override;
int SetSwingSpeed(float& fSpeed) override;
/**
* 设置工作角度
* @param nMin
* @param nMax
* @return
*/
int SetSwingAngle(float& fMin, float& fMax) override;
int GetSwingAngle(float& fMin, float& fMax) override;
/**
* 设置工作距离
* @param nMin
* @param nMax
* @return
*/
int SetWorkRange(double& dMin, double& dMax) override;
int GetWorkRange(double& dMin, double& dMax) override;
private:
VZNLHANDLE m_pHandle = nullptr;
SVzNLEyeDeviceInfoEx m_sEeyCBDeviceInfo;
#ifdef VR_EYE_DEBUG_MODE
// Debug模式相关成员
VzNL_AutoOutputLaserLineExCB m_debugCallback = nullptr;
void* m_debugCallbackParam = nullptr;
EVzResultDataType m_debugDataType;
std::thread m_debugThread;
std::mutex m_debugMutex;
VzNL_OnNotifyStatusCBEx m_debugStatusCallback = nullptr;
void* m_debugStatusCallbackParam = nullptr;
void DebugThreadFunc();
#endif
};
#endif // CVREYEDEVICE_H