添加 初始化失败的重试功能

This commit is contained in:
2024-05-23 15:06:03 +08:00
parent 3eb8d67f3a
commit 38f8a56275
17 changed files with 250 additions and 156 deletions
@@ -1,6 +1,6 @@
#include "hd_mvcamera_module.h"
std::mutex moduleMutex;//掉线锁
unsigned int nRet;
QByteArray MV_CC_DeviceInfoListToQByteArray(const MV_CC_DEVICE_INFO_LIST& deviceInfoList) {
QByteArray byteArray;
byteArray.resize(sizeof(MV_CC_DEVICE_INFO_LIST));
@@ -235,7 +235,7 @@ bool Hd_MvCamera_module::sendData(std::vector<cv::Mat>& mat, QByteArray& data)
{
QString inputString = QString::fromUtf8(data);
if (data == "connect")
if (data == "getStatus")
{
data = mv_Status;
return true;
@@ -292,12 +292,16 @@ bool Hd_MvCamera_module::initParas(QByteArray&)
MV_CC_StopGrabbing(handle);
MV_CC_CloseDevice(handle);
MV_CC_DestroyHandle(handle);
return false;
//return false;
}
//打开相机
unsigned int nRet = MV_CC_CreateHandle(&handle, m_stDevList.pDeviceInfo[index]);
nRet = MV_CC_CreateHandle(&handle, m_stDevList.pDeviceInfo[index]);
if (nRet != 0)
mv_Status = u8"句柄创建失败MV_CC_CreateHandle"+ QByteArray::number(nRet, 16).toUpper();
nRet = MV_CC_OpenDevice(handle);
if (nRet != 0)
mv_Status = u8"打开设备失败MV_CC_OpenDevice"+ QByteArray::number(nRet, 16).toUpper();
////触发模式
nRet = MV_CC_SetEnumValue(handle, "TriggerSource", MV_TRIGGER_SOURCE_SOFTWARE);
nRet = MV_CC_SetEnumValue(handle, "TriggerMode", MV_TRIGGER_MODE_ON);