测试问题修改

This commit is contained in:
wangxx1809 2025-10-28 20:32:10 +08:00
parent ac08846aba
commit 12a0a0be3e
3 changed files with 76 additions and 68 deletions

View File

@ -39,11 +39,9 @@ InfraredTemp::~InfraredTemp()
delete[] m_TempSrcTraData;
delete m_InfraredTempCfg;
int res = sdk_logoutDevice(m_Handle);
if (res == -1)
{
LOG(DEBUG) << u8"热成像登出失败";
}
Disconnect();
sdk_release();
}
@ -83,6 +81,15 @@ void InfraredTemp::SetConnect(bool bvalue)
else AddFunQue("SendCfgToClient");
}
void InfraredTemp::Disconnect() {
int res = sdk_logoutDevice(m_Handle);
if (res == -1)
{
LOG(ERROR) << u8"exit Thermal imaging fail";
}
m_IsConnect = false;
}
void InfraredTemp::Connect()
{
@ -220,67 +227,67 @@ DWORD WINAPI InfraredTemp::RunPorc(InfraredTemp* _this)
void InfraredTemp::Run()
{
while (m_RunFlag) {
#if _DEBUG
// unique_lock<mutex> lck(m_RunMtx);
// if (!m_FunQue.empty()) {
// string funNameStr = m_FunQue.front();
// m_FunQue.pop();
//
// if ("Connect" == funNameStr) { //配置信息收到后,才进行设备连接
// LOG(DEBUG) << "Connect function is called";
// Connect();
// SendCfgInfo(); //发送一次配置
// int count = 0;
// while (count < 15 && m_RunFlag) {
// Sleep(200);
// count++;
// if (m_IsConnect) {
// break;
// }
// }
// }
// else if ("UpdateEnv" == funNameStr) {
// LOG(DEBUG) << "UpdateEnv function is called";
// UpdateEnv();
// }
// else if ("SetOSD" == funNameStr) {
// LOG(DEBUG) << "SetOSD function is called";
// SetOSD();
// }
// else if ("UpdateOSD" == funNameStr) {
// LOG(DEBUG) << "UpdateOSD function is called";
// UpdateOSD();
// }
// else if ("UpdateColorPalette" == funNameStr) {
// LOG(DEBUG) << "UpdateColorPalette function is called";
// UpdateColorPalette();
// }
// else if ("UpdateOverTurn" == funNameStr) {
// LOG(DEBUG) << "UpdateOverTurn function is called";
// UpdateOverTurn();
// }
// else if ("UpdateAutoFocus" == funNameStr) {
// LOG(DEBUG) << "UpdateAutoFocus function is called";
// UpdateAutoFocus();
// }
// else if ("UpdateTempUnit" == funNameStr) {
// LOG(DEBUG) << "UpdateTempUnit function is called";
// UpdateTempUnit();
// }
// else if ("SaveTempData" == funNameStr) {
// LOG(DEBUG) << "SaveTempData function is called";
// SaveTempData();
// }
// }
// lck.unlock();
//
//
m_IsConnect = true;
SendCfgInfo();
VideoCallBackHandle(g_VideoVec.data(), g_VideoVec.size(), m_ImageWidth, m_ImageHeight, this);
TempCallBackHandle(g_vec.data(), g_vec.size(), this);
Sleep(1000);
#else
//#if _DEBUG
//// unique_lock<mutex> lck(m_RunMtx);
//// if (!m_FunQue.empty()) {
//// string funNameStr = m_FunQue.front();
//// m_FunQue.pop();
////
//// if ("Connect" == funNameStr) { //配置信息收到后,才进行设备连接
//// LOG(DEBUG) << "Connect function is called";
//// Connect();
//// SendCfgInfo(); //发送一次配置
//// int count = 0;
//// while (count < 15 && m_RunFlag) {
//// Sleep(200);
//// count++;
//// if (m_IsConnect) {
//// break;
//// }
//// }
//// }
//// else if ("UpdateEnv" == funNameStr) {
//// LOG(DEBUG) << "UpdateEnv function is called";
//// UpdateEnv();
//// }
//// else if ("SetOSD" == funNameStr) {
//// LOG(DEBUG) << "SetOSD function is called";
//// SetOSD();
//// }
//// else if ("UpdateOSD" == funNameStr) {
//// LOG(DEBUG) << "UpdateOSD function is called";
//// UpdateOSD();
//// }
//// else if ("UpdateColorPalette" == funNameStr) {
//// LOG(DEBUG) << "UpdateColorPalette function is called";
//// UpdateColorPalette();
//// }
//// else if ("UpdateOverTurn" == funNameStr) {
//// LOG(DEBUG) << "UpdateOverTurn function is called";
//// UpdateOverTurn();
//// }
//// else if ("UpdateAutoFocus" == funNameStr) {
//// LOG(DEBUG) << "UpdateAutoFocus function is called";
//// UpdateAutoFocus();
//// }
//// else if ("UpdateTempUnit" == funNameStr) {
//// LOG(DEBUG) << "UpdateTempUnit function is called";
//// UpdateTempUnit();
//// }
//// else if ("SaveTempData" == funNameStr) {
//// LOG(DEBUG) << "SaveTempData function is called";
//// SaveTempData();
//// }
//// }
//// lck.unlock();
////
////
// m_IsConnect = true;
// SendCfgInfo();
// VideoCallBackHandle(g_VideoVec.data(), g_VideoVec.size(), m_ImageWidth, m_ImageHeight, this);
// TempCallBackHandle(g_vec.data(), g_vec.size(), this);
// Sleep(10);
//#else
string funNameStr; //功能名称
{
@ -300,7 +307,6 @@ void InfraredTemp::Run()
LOG(DEBUG) << "Connect function is called,IsConnect:" << m_IsConnect;
if (m_IsConnect) continue;
Connect();
//m_IsConnect = true;
SendCfgInfo();
int count = 0;
while (count < 15 && m_RunFlag) {
@ -348,7 +354,7 @@ void InfraredTemp::Run()
SendCfgInfo();
}
}
#endif
//#endif
}
}

View File

@ -131,6 +131,7 @@ public:
}
void Connect();
void Disconnect();
bool GetSendData(SendData& sd) {
bool ret = false;

View File

@ -222,6 +222,7 @@ void SocketServer::CallFun(const HEADER& header, const string& data) {
}
else {
m_InfraredTemp->Shutdown();
m_InfraredTemp->Disconnect();
}
}
else if ("SetVideoFlag" == funNameStr) {