修改内存泄漏等问题

This commit is contained in:
wangxx1809 2025-10-22 17:02:20 +08:00
parent 5a027124a7
commit 7d94a0331c
15 changed files with 71 additions and 671 deletions

View File

@ -110,7 +110,7 @@
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;WIN32_LEAN_AND_MEAN;ELPP_THREAD_SAFE;ELPP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
</ClCompile>
@ -126,7 +126,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_LEAN_AND_MEAN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;WIN32_LEAN_AND_MEAN;ELPP_THREAD_SAFE;ELPP_UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
@ -142,10 +142,7 @@
<ClCompile Include="include\SocketHandle\SocketHandle.cpp" />
<ClCompile Include="main.cpp" />
<ClCompile Include="src\InfraredTemp.cpp" />
<ClCompile Include="src\InfraredTempCfg.cpp" />
<ClCompile Include="src\LayerTempPointConfig.cpp" />
<ClCompile Include="src\SocketServer.cpp" />
<ClCompile Include="src\TempRegion.cpp" />
<ClCompile Include="utils\StringHelper.cpp" />
</ItemGroup>
<ItemGroup>
@ -155,12 +152,9 @@
<ClInclude Include="include\vl\include\GL\khronos_glxext.h" />
<ClInclude Include="include\vl\include\GL\khronos_wglext.h" />
<ClInclude Include="include\vl\include\GL\mesa_gl.h" />
<ClInclude Include="src\CommonStructs.h" />
<ClInclude Include="src\InfraredTemp.h" />
<ClInclude Include="src\InfraredTempCfg.h" />
<ClInclude Include="src\LayerTempPointConfig.h" />
<ClInclude Include="src\SocketServer.h" />
<ClInclude Include="src\TempRegion.h" />
<ClInclude Include="utils\Average.h" />
<ClInclude Include="utils\StringHelper.h" />
</ItemGroup>

View File

@ -21,18 +21,9 @@
<ClCompile Include="src\InfraredTemp.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="src\TempRegion.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="src\LayerTempPointConfig.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="utils\StringHelper.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="src\InfraredTempCfg.cpp">
<Filter>源文件</Filter>
</ClCompile>
<ClCompile Include="include\easylog\easylogging++.cc">
<Filter>源文件</Filter>
</ClCompile>
@ -47,24 +38,15 @@
<ClInclude Include="src\InfraredTemp.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="src\TempRegion.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="utils\Average.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="src\LayerTempPointConfig.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="utils\StringHelper.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="src\InfraredTempCfg.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="src\CommonStructs.h">
<Filter>头文件</Filter>
</ClInclude>
<ClInclude Include="include\easylog\easylogging++.h">
<Filter>头文件</Filter>
</ClInclude>

View File

View File

@ -3,12 +3,14 @@
#include "utils/StringHelper.h"
#include "src/InfraredTemp.h"
#include "src/SocketServer.h"
#include <memory>
#define ELPP_THREAD_SAFE
#include "easylogging++.h"
using namespace std;
INITIALIZE_EASYLOGGINGPP
//easylogging++ 多线程可能有问题
void EasyLogConf()
{
string confPath = StringHelper::GetAppPath() + "\\log.conf";
@ -25,13 +27,13 @@ int main(int argc,char** argv) {
return -1;
}
SocketServer* server = new SocketServer();
server->Init();
server->StartRun();
unique_ptr<SocketServer> serverptr(new SocketServer());
serverptr->Init();
serverptr->StartRun();
Sleep(1000);
server->WaitStop();
serverptr->WaitStop();
return 0;

View File

@ -1,103 +0,0 @@
#pragma once
#include <string>
#include <vector>
#include "InfraredTempCfg.h"
class CfgData {
public:
InfraredTempCfg ifCfg;
};
class MousePointInfo {
public:
int x;
int y;
float temp;
};
//struct IFConfig {
// MessageHeader header;
// InfraredTempCfg ifCfg;
//};
//
//struct MOUSEPOINTINFO {
// MessageHeader header;
// int x;
// int y;
// float temp;
//};
//// 温度数据消息
//struct TemperatureData {
// MessageHeader header;
// int imageWidth;
// int imageHeight;
// float minTemperature;
// float maxTemperature;
// float averageTemperature;
// // 温度数据数组(动态数据)
//};
//
//// 图像数据消息
//struct ImageData {
// MessageHeader header;
// int width;
// int height;
// int channels;
// int imageSize; // 图像数据大小
// // 图像数据数组(动态数据)
//};
//
//// 完整的红外数据消息
//struct InfraredData {
// MessageHeader header;
// int imageWidth;
// int imageHeight;
// float* temperatureData; // 温度数据
// unsigned char* imageData; // JPEG图像数据
// int imageDataLength;
//
// InfraredData() : temperatureData(nullptr), imageData(nullptr), imageDataLength(0) {
// header.messageType = 1;
// header.dataSize = sizeof(InfraredData) - sizeof(MessageHeader);
// }
//};
//
//// 命令消息
//struct CommandMessage {
// MessageHeader header;
// uint32_t command;
// uint32_t parameter;
//
// CommandMessage() {
// header.messageType = 100;
// header.dataSize = sizeof(CommandMessage) - sizeof(MessageHeader);
// }
//};
//
//// 响应消息
//struct ResponseMessage {
// MessageHeader header;
// uint32_t resultCode;
// char message[256];
//
// ResponseMessage() {
// header.messageType = 200;
// header.dataSize = sizeof(ResponseMessage) - sizeof(MessageHeader);
// }
//};

View File

@ -176,8 +176,6 @@ void InfraredTemp::Connect()
//GetGain();
//UpdateAutoFocus();
SendCfgInfo(); //发送一次配置
}
void InfraredTemp::Startup()
@ -218,35 +216,47 @@ void InfraredTemp::Run()
{
while (m_RunFlag) {
#if _DEBUG
SendCfgInfo(); //发送一次配置 test
unique_lock<mutex> lck(m_RunMtx);
if (!m_FunQue.empty()) {
string funNameStr = m_FunQue.front();
m_FunQue.pop();
if ("UpdateEnv" == funNameStr) {
if ("Connect" == funNameStr) { //配置信息收到后,才进行设备连接
LOG(DEBUG) << "Connect function is called";
Connect();
SendCfgInfo(); //发送一次配置
}
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();
}
}
@ -280,29 +290,42 @@ void InfraredTemp::Run()
if (!m_FunQue.empty()) {
string funNameStr = m_FunQue.front();
m_FunQue.pop();
if ("UpdateEnv" == funNameStr) {
if ("Connect" == funNameStr) { //配置信息收到后,才进行设备连接
LOG(DEBUG) << "Connect function is called";
Connect();
SendCfgInfo(); //发送一次配置
}
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();
}
}
@ -413,14 +436,12 @@ void InfraredTemp::MessageCallBackHandle(IRNETHANDLE hHandle, WPARAM wParam, LPA
case 0: {
//连接成功
it->SetConnect(true);
//g_log->TraceKeyInfo(u8"热成像连接成功");
LOG(DEBUG) << u8"热成像连接成功";
}break;
case 1: {
//用户停止连接
it->SetConnect(false);
//g_log->TraceKeyInfo(u8"热成像用户停止连接");
LOG(DEBUG) << u8"热成像用户停止连接";
}break;
case 2: {

View File

@ -6,7 +6,6 @@
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2\imgproc\types_c.h>
#include "TempRegion.h"
#include <sstream>
#include <condition_variable>
@ -14,7 +13,7 @@ struct HEADER {
uchar flag[2]{};
uchar funCode{};
uchar funName[30]{};
int32_t dataLen;
int32_t dataLen{0};
};
struct SendData {
@ -72,29 +71,29 @@ public:
int ymax;
};
struct InfraredTempAssist {
unsigned int layerStartIndex;
unsigned int layerEndIndex;
int trSelectIndex;
int layerSelect;
TempRegion* selectTR;
LayerTempPointConfig::LayerRegion* selectLR;
//struct InfraredTempAssist {
// unsigned int layerStartIndex;
// unsigned int layerEndIndex;
// int trSelectIndex;
// int layerSelect;
// TempRegion* selectTR;
// LayerTempPointConfig::LayerRegion* selectLR;
int pointAddX;
int pointAddY;
bool addPointClick;
InfraredTempAssist() {
layerStartIndex = 1;
layerEndIndex = 2;
trSelectIndex = -1;
layerSelect = -1;
selectTR = NULL;
selectLR = NULL;
pointAddX = 0;
pointAddY = 0;
addPointClick = false;
}
};
// int pointAddX;
// int pointAddY;
// bool addPointClick;
// InfraredTempAssist() {
// layerStartIndex = 1;
// layerEndIndex = 2;
// trSelectIndex = -1;
// layerSelect = -1;
// selectTR = NULL;
// selectLR = NULL;
// pointAddX = 0;
// pointAddY = 0;
// addPointClick = false;
// }
//};
InfraredTemp();
~InfraredTemp();

View File

@ -1,310 +0,0 @@
//#include "InfraredTempCfg.h"
////#include "BaseConfig.h"
//
//
//InfraredTempCfg::InfraredTempCfg()
//{
// m_Emissivity=9500;
// m_AirTemp=250000;
// m_ReflectTemp=250000;
// m_Humidity=10000;
// m_Distance = 7000;
// m_ColorPalette = 0;
//
// /*m_PlatformStartX = 50;
// m_PlatformStartY = 50;
// m_PlatformEndX = 600;
// m_PlatformEndY = 450;*/
//
// m_PlatformAX=0;
// m_PlatformAY=0;
//
// m_PlatformBX=630;
// m_PlatformBY=0;
//
// m_PlatformCX=630;
// m_PlatformCY=510;
//
// m_PlatformDX=0;
// m_PlatformDY=510;
//
// m_ChillDowmTemp = 200.0f;
// m_TempCtrlType = WAIT_TEMP;
//
// m_DeltaTemp = 5.0f;
// m_DeltaPower = 0.5f;
//
// m_LayerWaitMil = 0;
// m_OverTurn = 0;
//
// m_IsAvgCalcValue = true;
// m_AvgCalcValueType = AVG_5;
//
// m_IsForceConnect = false;
// m_IsEnable = false;
// m_UseManualPoints = false;
//
// //m_ForceConnectIP = "192.168.1.29";
// memset(m_szIpAssist, '\0', sizeof(m_szIpAssist));
//
// m_IsConnect = false;
//}
//
//
//InfraredTempCfg::~InfraredTempCfg()
//{
//}
//
//
////void InfraredTempCfg::GetUpdateSql(vector<string>& ups)
////{
//// char buffer[512];
//// sprintf_s(buffer, sizeof(buffer), "UPDATE %s set %s=",
//// BaseConfig::TABLE_NAME.c_str(),
//// BaseConfig::FIELD_CONFIG_VALUE.c_str()
//// );
//// string strhead(buffer);
//// sprintf_s(buffer, sizeof(buffer), " WHERE %s='%s' AND %s=",
//// BaseConfig::FIELD_CONFIG_NAME.c_str(),
//// CONFIG_NAME.c_str(),
//// BaseConfig::FIELD_CONFIG_CODE.c_str()
//// );
//// string strtail(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_IsEnable?"1":"0",
//// strtail.c_str(), FIELD_IS_ENABLE.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_Emissivity).c_str(),
//// strtail.c_str(), FIELD_EMISSIVITY.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_AirTemp).c_str(),
//// strtail.c_str(), FIELD_AIR_TEMP.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_ReflectTemp).c_str(),
//// strtail.c_str(), FIELD_REFLECT_TEMP.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_Humidity).c_str(),
//// strtail.c_str(), FIELD_HUMIDITY.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_Distance).c_str(),
//// strtail.c_str(), FIELD_DISTANCE.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_OSDSwitch?"1":"0",
//// strtail.c_str(), FIELD_OSD_SWITCH.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_GlobalTempAdd ? "1" : "0",
//// strtail.c_str(), FIELD_GLOBAL_TEMP_ADD.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_GlobalTempParamAdd ? "1" : "0",
//// strtail.c_str(), FIELD_GLOBAL_TEMP_PARAM_ADD.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_PseudoColorBarsAdd ? "1" : "0",
//// strtail.c_str(), FIELD_PSEUDO_COLOR_BAR_ADD.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_HighLowTempCursorAdd ? "1" : "0",
//// strtail.c_str(), FIELD_HIGH_LOW_TEMP_CURSOR_ADD.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_ColorPalette).c_str(),
//// strtail.c_str(), FIELD_COLOR_PALETTE.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_GainType).c_str(),
//// strtail.c_str(), FIELD_GAIN_TYPE.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_TempUnit).c_str(),
//// strtail.c_str(), FIELD_TEMP_UNIT.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_ChillDowmTemp).c_str(),
//// strtail.c_str(), FIELD_CHILL_DOWN_TEMP.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_TempCtrlType).c_str(),
//// strtail.c_str(), FIELD_SURFACE_TEMP_CTRL_TYPE.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_PlatformAX).c_str(),
//// strtail.c_str(), FIELD_PLATFORM_A_X.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_PlatformAY).c_str(),
//// strtail.c_str(), FIELD_PLATFORM_A_Y.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_PlatformBX).c_str(),
//// strtail.c_str(), FIELD_PLATFORM_B_X.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_PlatformBY).c_str(),
//// strtail.c_str(), FIELD_PLATFORM_B_Y.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_PlatformCX).c_str(),
//// strtail.c_str(), FIELD_PLATFORM_C_X.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_PlatformCY).c_str(),
//// strtail.c_str(), FIELD_PLATFORM_C_Y.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_PlatformDX).c_str(),
//// strtail.c_str(), FIELD_PLATFORM_D_X.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_PlatformDY).c_str(),
//// strtail.c_str(), FIELD_PLATFORM_D_Y.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_DeltaTemp).c_str(),
//// strtail.c_str(), FIELD_DELTA_TEMP.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_DeltaPower).c_str(),
//// strtail.c_str(), FIELD_DELTA_POWER.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_LayerWaitMil).c_str(),
//// strtail.c_str(), FIELD_LAYER_WAIT_MIL.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_IsAvgCalcValue?"1":"0",
//// strtail.c_str(), FIELD_IS_AVG_CALC_VALUE.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_AvgCalcValueType).c_str(),
//// strtail.c_str(), FIELD_AVG_CALC_VALUE.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_IsForceConnect?"1":"0",
//// strtail.c_str(), FIELD_IS_FORCE_CONNECT.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_UseManualPoints ? "1" : "0",
//// strtail.c_str(), FIELD_USE_MANUAL_POINTS.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// m_ForceConnectIP.c_str(),
//// strtail.c_str(), FIELD_FORCE_CONNECT_IP.c_str());
//// ups.push_back(buffer);
////
//// sprintf_s(buffer, sizeof(buffer), "%s'%s'%s'%s'",
//// strhead.c_str(),
//// to_string(m_OverTurn).c_str(),
//// strtail.c_str(), FIELD_OVER_TURN.c_str());
//// ups.push_back(buffer);
////}
//
////string InfraredTempCfg::CONFIG_NAME="InfraredTempCfg";
////string InfraredTempCfg::FIELD_IS_ENABLE = "IsEnable";
////string InfraredTempCfg::FIELD_EMISSIVITY = "Emissivity";
////string InfraredTempCfg::FIELD_AIR_TEMP = "AirTemp";
////string InfraredTempCfg::FIELD_REFLECT_TEMP = "ReflectTemp";
////string InfraredTempCfg::FIELD_HUMIDITY = "Humidity";
////string InfraredTempCfg::FIELD_DISTANCE = "Distance";
////string InfraredTempCfg::FIELD_OSD_SWITCH="OSDSwitch";
////string InfraredTempCfg::FIELD_GLOBAL_TEMP_ADD="GlobalTempAdd";
////string InfraredTempCfg::FIELD_GLOBAL_TEMP_PARAM_ADD="GlobalTempParamAdd";
////string InfraredTempCfg::FIELD_PSEUDO_COLOR_BAR_ADD="PseudoColorBarAdd";
////string InfraredTempCfg::FIELD_HIGH_LOW_TEMP_CURSOR_ADD="HighLowTempCursorAdd";
////string InfraredTempCfg::FIELD_COLOR_PALETTE="ColorPalette";
////string InfraredTempCfg::FIELD_GAIN_TYPE="GainType";
////string InfraredTempCfg::FIELD_TEMP_UNIT="TempUnit";
/////*string InfraredTempCfg::FIELD_PLATFORM_START_X="PlatformStartX";
////string InfraredTempCfg::FIELD_PLATFORM_START_Y="PlatformStartY";
////string InfraredTempCfg::FIELD_PLATFORM_END_X="PlatformEndX";
////string InfraredTempCfg::FIELD_PLATFORM_END_Y="PlatformEndY";*/
////string InfraredTempCfg::FIELD_CHILL_DOWN_TEMP = "ChilleDownTemp";
////string InfraredTempCfg::FIELD_SURFACE_TEMP_CTRL_TYPE = "SurfaceTempCtrlType";
////string InfraredTempCfg::FIELD_PLATFORM_A_X="PlatFormAX";
////string InfraredTempCfg::FIELD_PLATFORM_A_Y = "PlatFormAY";
////string InfraredTempCfg::FIELD_PLATFORM_B_X = "PlatFormBX";
////string InfraredTempCfg::FIELD_PLATFORM_B_Y = "PlatFormBY";
////string InfraredTempCfg::FIELD_PLATFORM_C_X = "PlatFormCX";
////string InfraredTempCfg::FIELD_PLATFORM_C_Y = "PlatFormCY";
////string InfraredTempCfg::FIELD_PLATFORM_D_X = "PlatFormDX";
////string InfraredTempCfg::FIELD_PLATFORM_D_Y = "PlatFormDY";
////string InfraredTempCfg::FIELD_DELTA_TEMP="DeltaTemp";
////string InfraredTempCfg::FIELD_DELTA_POWER="DeltaPower";
////string InfraredTempCfg::FIELD_LAYER_WAIT_MIL="LayerWaitMil";
////string InfraredTempCfg::FIELD_IS_AVG_CALC_VALUE = "IsAvgCalcValue";
////string InfraredTempCfg::FIELD_AVG_CALC_VALUE = "AvgCalcValue";
////string InfraredTempCfg::FIELD_IS_FORCE_CONNECT = "IsForceConnect";
////string InfraredTempCfg::FIELD_USE_MANUAL_POINTS="UseManualPoints";
////string InfraredTempCfg::FIELD_FORCE_CONNECT_IP = "ForceConnectIP";
////string InfraredTempCfg::FIELD_OVER_TURN = "OverTurn";

View File

@ -20,13 +20,6 @@ enum AvgCalcType {
struct InfraredTempCfg
{
//public:
//InfraredTempCfg();
//~InfraredTempCfg();
//public:
bool m_IsEnable;
int m_Emissivity; //发射率
int m_AirTemp; //空气温度
@ -81,40 +74,6 @@ struct InfraredTempCfg
char m_szIpAssist[16];
bool m_IsConnect; //是否连接
//public:
//static string CONFIG_NAME;
//static string FIELD_IS_ENABLE;
//static string FIELD_EMISSIVITY;
//static string FIELD_AIR_TEMP;
//static string FIELD_REFLECT_TEMP;
//static string FIELD_HUMIDITY;
//static string FIELD_DISTANCE;
//static string FIELD_OSD_SWITCH;
//static string FIELD_GLOBAL_TEMP_ADD;
//static string FIELD_GLOBAL_TEMP_PARAM_ADD;
//static string FIELD_PSEUDO_COLOR_BAR_ADD;
//static string FIELD_HIGH_LOW_TEMP_CURSOR_ADD;
//static string FIELD_COLOR_PALETTE;
//static string FIELD_GAIN_TYPE;
//static string FIELD_TEMP_UNIT;
//static string FIELD_CHILL_DOWN_TEMP;
//static string FIELD_SURFACE_TEMP_CTRL_TYPE;
//static string FIELD_PLATFORM_A_X;
//static string FIELD_PLATFORM_A_Y;
//static string FIELD_PLATFORM_B_X;
//static string FIELD_PLATFORM_B_Y;
//static string FIELD_PLATFORM_C_X;
//static string FIELD_PLATFORM_C_Y;
//static string FIELD_PLATFORM_D_X;
//static string FIELD_PLATFORM_D_Y;
//static string FIELD_DELTA_TEMP;
//static string FIELD_DELTA_POWER;
//static string FIELD_LAYER_WAIT_MIL;
//static string FIELD_IS_AVG_CALC_VALUE;
//static string FIELD_AVG_CALC_VALUE;
//static string FIELD_IS_FORCE_CONNECT;
//static string FIELD_USE_MANUAL_POINTS;
//static string FIELD_FORCE_CONNECT_IP;
//static string FIELD_OVER_TURN;
};

View File

@ -1,31 +0,0 @@
#include "LayerTempPointConfig.h"
LayerTempPointConfig::LayerTempPointConfig()
{
}
LayerTempPointConfig::~LayerTempPointConfig()
{
for (map<LayerRegion*, list<TempPoint*>*>::iterator it = m_LayerTempPoints.begin(); it != m_LayerTempPoints.end();it++) {
list<TempPoint*>* tps = it->second;
for (list<TempPoint*>::iterator it2 = tps->begin(); it2 != tps->end();it2++) {
TempPoint* tp = (*it2);
delete tp;
tp = NULL;
}
tps->clear();
delete tps;
tps = NULL;
}
m_LayerTempPoints.clear();
for (map<unsigned int,LayerRegion*>::iterator it = m_LayerRegions.begin(); it != m_LayerRegions.end();it++) {
LayerRegion* lr = it->second;
delete lr;
lr = NULL;
}
m_LayerRegions.clear();
}

View File

@ -1,29 +0,0 @@
#pragma once
#include <list>
#include <map>
#include <vector>
using namespace std;
class LayerTempPointConfig
{
public:
struct LayerRegion
{
unsigned int startIndex=0;
unsigned int endIndex=0;
};
struct TempPoint {
int x=0;
int y=0;
};
LayerTempPointConfig();
~LayerTempPointConfig();
map<unsigned int,LayerRegion*> m_LayerRegions;
map<LayerRegion*, list<TempPoint*>*> m_LayerTempPoints;
};

View File

@ -145,6 +145,10 @@ void SocketServer::run() {
closeSocketSet.insert(client);
}
}
if (sendData.data) {
delete[] sendData.data;
sendData.data = nullptr;
}
}
}
@ -205,6 +209,8 @@ void SocketServer::CallFun(const HEADER& header, const string& data) {
InfraredTempCfg cfgData;
memcpy_s(&cfgData, sizeof(InfraredTempCfg), data.c_str(), data.size());
m_InfraredTemp->SetInfraredTempCfg(cfgData);
m_InfraredTemp->AddFunQue("Connect");
}
else if ("SetVideoFlag" == funNameStr) {
bool flag = false;
@ -213,7 +219,7 @@ void SocketServer::CallFun(const HEADER& header, const string& data) {
m_InfraredTemp->SetVideoFlag(flag);
}
else {
LOG(DEBUG) << "recv "<< funNameStr<<" function";
//LOG(DEBUG) << "recv "<< funNameStr<<" function";
m_InfraredTemp->AddFunQue(funNameStr);
}

View File

@ -3,7 +3,6 @@
#include <iostream>
#include <string>
#include <fstream>
#include "CommonStructs.h"
#include <atomic>
#include <thread>
#include "InfraredTemp.h"

View File

@ -1,33 +0,0 @@
#include "TempRegion.h"
TempRegion::TempRegion(int id)
:m_Id(id)
{
m_Pa.x = 0;
m_Pa.y = 0;
m_Pb.x = 0;
m_Pb.y = 0;
m_Pc.x = 0;
m_Pc.y = 0;
m_Pd.x = 0;
m_Pd.y = 0;
m_MinTemp = 0.0f;
m_MaxTemp = 0.0f;
m_AvgTemp = 0.0f;
m_PartMinX = 0.0f;
m_PartMaxX = 0.0f;
m_PartMinY = 0.0f;
m_PartMaxY = 0.0f;
m_LastWaitTemp = 0.0f;
m_DifPower = 0.0f;
m_DifTemp = 0.0f;
m_HadWait = false;
m_LayerTempPointConfig = new LayerTempPointConfig();
}
TempRegion::~TempRegion()
{
delete m_LayerTempPointConfig;
}

View File

@ -1,56 +0,0 @@
#pragma once
#include <vector>
#include "../utils/Average.h"
#include <opencv2/core/types.hpp>
#include "LayerTempPointConfig.h"
using namespace std;
class TempRegion
{
public:
TempRegion(int id);
~TempRegion();
void SetAvgSize(int isize) {
int avgSize = (isize + 1) * 5;
m_AvgMinTemp.SetValueSize(avgSize);
m_AvgMaxTemp.SetValueSize(avgSize);
m_AvgAvgTemp.SetValueSize(avgSize);
}
public:
int m_Id;
//int m_Pid;
cv::Point m_Pa;
cv::Point m_Pb;
cv::Point m_Pc;
cv::Point m_Pd;
vector<cv::Point> m_RegionPoints;
float m_MinTemp;
float m_MaxTemp;
float m_AvgTemp;
float m_PartMinX;
float m_PartMaxX;
float m_PartMinY;
float m_PartMaxY;
bool m_IsRecorderMaxTemp;
float m_PrintMaxTemp;
float m_DifPower;
float m_DifTemp;
float m_LastWaitTemp;
bool m_HadWait;
Average2<float> m_AvgMinTemp;
Average2<float> m_AvgMaxTemp;
Average2<float> m_AvgAvgTemp;
LayerTempPointConfig* m_LayerTempPointConfig;
};