更新PLC-tcp部分;更新加密lib文件(适配开机自启动软件)

CigaretteSH
CJ980606 9 months ago
parent 17bb01c5be
commit 1f0d18b37c

File diff suppressed because it is too large Load Diff

@ -41,33 +41,12 @@
<ClCompile Include="cigarette.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_cigarette.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_cigarette.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\qrc_cigarette.cpp">
<Filter>Generated Files</Filter>
</ClCompile>
<ClCompile Include="dialogsetuppasswd.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_dialogsetuppasswd.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_dialogsetuppasswd.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="dialogsetup.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_dialogsetup.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_dialogsetup.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="basecamera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -83,42 +62,18 @@
<ClCompile Include="plcsetup.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_plcsetup.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_plcsetup.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="CaptureThread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_CaptureThread.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_CaptureThread.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="plc_item.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="db_label.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_db_label.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_db_label.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="alarmdialog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_alarmdialog.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_alarmdialog.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="AlarmInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -128,60 +83,24 @@
<ClCompile Include="debugthread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_debugthread.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_debugthread.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="dialogin.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_dialogin.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_dialogin.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="ASyncQueue.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="baslercamera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_workthread.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_workthread.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="workthread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_CaptureThreadBasler.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_CaptureThreadBasler.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="CaptureThreadBasler.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_savethread.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_savethread.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="hikcamera.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_CaptureThreadHIK.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_CaptureThreadHIK.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="CaptureThreadHIK.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -191,66 +110,24 @@
<ClCompile Include="threadSend.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_camera_glue.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_camera_glue.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="camera_glue.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_change_shift.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_change_shift.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="change_shift.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_output_statistic.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_output_statistic.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="output_statistic.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_Logthread.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_Logthread.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="Logthread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_Cleanthread.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_Cleanthread.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="Cleanthread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="threadReceive.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_threadReceive.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_threadReceive.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Debug\moc_exportData.cpp">
<Filter>Generated Files\Debug</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_exportData.cpp">
<Filter>Generated Files\Release</Filter>
</ClCompile>
<ClCompile Include="exportData.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -263,118 +140,106 @@
<ClCompile Include="SyncWorkThread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GeneratedFiles\Release\moc_SyncWorkThread.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<CustomBuild Include="cigarette.h">
<QtMoc Include="cigarette.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="cigarette.ui">
</QtMoc>
<QtUic Include="cigarette.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="cigarette.qrc">
</QtUic>
<QtRcc Include="cigarette.qrc">
<Filter>Resource Files</Filter>
</CustomBuild>
<CustomBuild Include="dialogsetuppasswd.hpp">
</QtRcc>
<QtMoc Include="dialogsetuppasswd.hpp">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="dialogsetuppasswd.ui">
</QtMoc>
<QtUic Include="dialogsetuppasswd.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="dialogsetup.hpp">
</QtUic>
<QtMoc Include="dialogsetup.hpp">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="dialogsetup.ui">
</QtMoc>
<QtUic Include="dialogsetup.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="plcsetup.hpp">
</QtUic>
<QtMoc Include="plcsetup.hpp">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="plcsetup.ui">
</QtMoc>
<QtUic Include="plcsetup.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="CaptureThread.h">
</QtUic>
<QtMoc Include="CaptureThread.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="db_label.h">
</QtMoc>
<QtMoc Include="db_label.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="alarmdialog.hpp">
</QtMoc>
<QtMoc Include="alarmdialog.hpp">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="alarmdialog.ui">
</QtMoc>
<QtUic Include="alarmdialog.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="debugthread.h">
</QtUic>
<QtMoc Include="debugthread.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="dialogin.hpp">
</QtMoc>
<QtMoc Include="dialogin.hpp">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="dialogin.ui">
</QtMoc>
<QtUic Include="dialogin.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="workthread.h">
</QtUic>
<QtMoc Include="workthread.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="CaptureThreadBasler.h">
</QtMoc>
<QtMoc Include="CaptureThreadBasler.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="savethread.h">
</QtMoc>
<QtMoc Include="savethread.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="CaptureThreadHIK.h">
</QtMoc>
<QtMoc Include="CaptureThreadHIK.h">
<Filter>Header Files</Filter>
</CustomBuild>
</QtMoc>
<CustomBuild Include="threadSend.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="camera_glue.h">
<QtMoc Include="camera_glue.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="camera_glue.ui">
</QtMoc>
<QtUic Include="camera_glue.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="change_shift.h">
</QtUic>
<QtMoc Include="change_shift.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="change_shift.ui">
</QtMoc>
<QtUic Include="change_shift.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="output_statistic.h">
</QtUic>
<QtMoc Include="output_statistic.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="output_statistic.ui">
</QtMoc>
<QtUic Include="output_statistic.ui">
<Filter>Form Files</Filter>
</CustomBuild>
<CustomBuild Include="Logthread.h">
</QtUic>
<QtMoc Include="Logthread.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="Cleanthread.h">
</QtMoc>
<QtMoc Include="Cleanthread.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="threadReceive.h">
</QtMoc>
<QtMoc Include="threadReceive.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="exportData.h">
</QtMoc>
<QtMoc Include="exportData.h">
<Filter>Header Files</Filter>
</CustomBuild>
<CustomBuild Include="SyncWorkThread.h">
</QtMoc>
<QtMoc Include="SyncWorkThread.h">
<Filter>Header Files</Filter>
</CustomBuild>
</QtMoc>
</ItemGroup>
<ItemGroup>
<ClInclude Include="GeneratedFiles\ui_cigarette.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_dialogsetuppasswd.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_dialogsetup.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="basecamera.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -390,21 +255,12 @@
<ClInclude Include="common.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_plcsetup.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="plc_item.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_alarmdialog.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="AlarmInfo.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_dialogin.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="ASyncQueue.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -417,15 +273,6 @@
<ClInclude Include="PLC\PLCDevice.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_camera_glue.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_change_shift.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="GeneratedFiles\ui_output_statistic.h">
<Filter>Generated Files</Filter>
</ClInclude>
<ClInclude Include="tinyxml2.h">
<Filter>Header Files</Filter>
</ClInclude>

@ -9,4 +9,16 @@
<QTDIR>C:\Qt\5.15.2\msvc2019_64</QTDIR>
<LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3bD:\Qt\5.15.2\msvc2019_64\bin%3b$(PATH)</LocalDebuggerEnvironment>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtLastBackgroundBuild>2024-04-28T07:53:26.8147850Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2024-04-28T07:53:26.8795721Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2024-04-28T07:53:26.9413622Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2024-04-28T07:53:26.9872078Z</QtLastBackgroundBuild>
</PropertyGroup>
</Project>

Binary file not shown.

@ -54,8 +54,9 @@ bool PLCDevice::init_plc_tcp(PLCDevice* PLCptr)
else
{
PLCptr->g_plc_ok = true;
qDebug("TCP connect successful ");
}
qDebug("TCP connect successful ");
return true;
}
@ -105,9 +106,9 @@ int PLCDevice::write_short_2_plc(int addr, int nb, uint16_t* value)
{
if (g_plc_ok)
{
g_mutex.lock();
//g_mutex.lock();
int ret = modbus_write_registers(g_modbus, addr, nb, value);
g_mutex.unlock();
//g_mutex.unlock();
//printf("modbus_write_registers:addr=%d,nb=%d,value=%d,ret=%d\n", addr, nb, *value, ret);
return ret;
}

@ -2,7 +2,7 @@
#include <opencv2/opencv.hpp>
#define NumberOfSupportedCameras 2
#define NumberOfSupportedCameras 3
//双软件
#define NumberOfIdentityCameras 8
#define EdgeEvent 1

@ -8,11 +8,11 @@
//#define __DEBUG //debug信息输出功能
//#define __UDPSend //网络发送功能
#define __TCPSend // TCP发送
//#define __TCPServer // TCP服务器
#define __ExportData // FTP发送
//#define __TCPServer // TCP服务器
#define __ExportData // FTP发送
#define USB_BASLER_NEW_FW //使用basler定制固件
//#define IMM_PROCESS //拍照后立马处理,不等校验信号
//#define IMM_FEED_BACK //处理完后立马反馈,不等校验信号
//#define IMM_PROCESS //拍照后立马处理,不等校验信号
//#define IMM_FEED_BACK //处理完后立马反馈,不等校验信号
#define ONE_TIME_SHIFT //错开一拍发送反馈(默认错开两次)
#define AI_WARM_UP //AI识别开始前的热身动作
#define LICENSE_VERIFY //开启license文件校验
@ -40,7 +40,8 @@
#define DEFAULT_CONFPATH_PATH "D:/conf"
#define DEFAULT_PIC_SAVE_PATH "D:/image"
// 主界面基本参数配置文件
#define CONFPATH "conf_path3.txt"
//#define CONFPATH "D:/Release/conf_path2.txt"//小盒
#define CONFPATH "D:/Release/conf_path3.txt"//条盒
// 相机旋转角度配置文件
#define ROTATE_FILE "rotate.txt"
#define MODBUS_CONFIGURE_FILE "modbus.txt"

@ -339,14 +339,15 @@ void ExportDataThread::run()
QString remotePath;
QStringList zipFilePaths;
QStringList fileList;
QString okStr = "OK";
QString okStr = "1";
QProcess process(0);
//QDateTime now_ts = QDateTime::currentDateTime();
QStringList argsNg;
QStringList argsOk;
zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-00_" + zipTimeStamp[0] + "-59_0.zip");
zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_BJ_" + zipTimeStamp[0] + "-00_" + zipTimeStamp[0] + "-59_1.zip");
//条盒TJ 小盒BJ
zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_TJ_" + zipTimeStamp[0] + "-00_" + zipTimeStamp[0] + "-59_0.zip");
zipFilePaths.append(g_conf_path.save_pics_path + "/" + "416_TJ_" + zipTimeStamp[0] + "-00_" + zipTimeStamp[0] + "-59_1.zip");
fileList.append(g_conf_path.save_pics_path + "/" + zipTimeStamp[0] + "ng.txt");
fileList.append(g_conf_path.save_pics_path + "/" + zipTimeStamp[0] + "ok.txt");

@ -25,8 +25,8 @@ int main(int argc, char* argv[])
splash.show();
a.processEvents();
Cigarette w;
//w.show();
w.showFullScreen();
w.show();
//w.showFullScreen();
splash.finish(&w);
return a.exec();
}

@ -258,7 +258,7 @@ void SyncWorkThread::run()
#ifdef SYNC_CAMERA
emit event_ok(local_camera_number);
#endif
local_g_result_queue->put(true);
// local_g_result_queue->put(true);
}
}
else
@ -269,7 +269,7 @@ void SyncWorkThread::run()
#ifdef SYNC_CAMERA
emit event_ng(local_camera_number);
#endif
local_g_result_queue->put(false);
//local_g_result_queue->put(false);
IsNGForAll = TRUE;
}
@ -337,13 +337,13 @@ void SyncWorkThread::run()
{
ngReason = 0;
}
//条盒TJ 小盒BJ
file_name = g_conf_path.save_pics_path + "/"
+ now_ts.toString("yyyy-MM-dd") + "/"+"416_BJ_01_"
+ now_ts.toString("yyyy-MM-dd") + "/"+"416_TJ_01_"
+ now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz_") + ng_reason_maps[ngReason] + ".jpg";
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), merge_image));
#ifdef __TCPSend
QString sendName = "416_BJ_01_" + now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz_") + ng_reason_maps[ngReason];
QString sendName = "416_TJ_01_" + now_ts.toString("yyyy-MM-dd_HH-mm-ss.zzz_") + ng_reason_maps[ngReason];
TCPSendInfo.pics_name = sendName.toLocal8Bit().constData();
TCP_Info_queue->put(TCPSendInfo);
#endif
@ -362,7 +362,7 @@ void SyncWorkThread::run()
emit event_ng(local_camera_number);
else if (local_SysConf.MisMatchAct == 0)//as ok
emit event_ok(local_camera_number);
emit display_check_total(local_camera_number, ++(frame_total[local_camera_number]));
//emit display_check_total(local_camera_number, ++(frame_total[local_camera_number]));
qDebug() << local_camera_number << "#camera# " << now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") << "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx " << unit_count;
}
#endif

@ -82,17 +82,10 @@ void threadSendTCP::run()
#endif
//mySocket->write("Hello! here is tcp client!\n");
//mySocket->flush();
}
}
//字符串转ASCII
std::vector<int> stringToAscii(const std::string& str)
{
std::vector<int> asciiValues;
for (char c : str) {
asciiValues.push_back(static_cast<int>(c));
}
return asciiValues;
}
void threadSendTCP::sendData(_TCPSendInfo* TCPSendInfo, int Num) {
std::string fileName = TCPSendInfo->pics_name;
@ -104,12 +97,28 @@ void threadSendTCP::sendData(_TCPSendInfo* TCPSendInfo, int Num) {
//mySocket->flush();
//
//遍历发送
int i = 0;
for (int val:asciiVals)
{
m_PLCTCPDevice->write_short_2_plc(40000 + i, 1, (uint16_t*)&val);
i++;
int val_[35] = {};
QDateTime now_ts = QDateTime::currentDateTime();
qDebug() << "now_ts=" << now_ts;
for (int i = 0; i < asciiVals.size(); i++)
{
val_[i] = asciiVals[i];
}
//m_PLCTCPDevice->write_short_2_plc(40000, 70, (uint16_t*)&val_);//小盒
m_PLCTCPDevice->write_short_2_plc(40070, 70, (uint16_t*)&val_);//条盒
now_ts = QDateTime::currentDateTime();
qDebug() << "end-now_ts=" << now_ts;
}
//字符串转ASCII
std::vector<int> threadSendTCP::stringToAscii(const std::string& str)
{
std::vector<int> asciiValues;
for (char c : str) {
asciiValues.push_back(static_cast<int>(c));
}
return asciiValues;
}
#ifdef __TCPServer

@ -55,6 +55,7 @@ public:
void init(SyncQueue<_TCPSendInfo>* p_TCP_Info_queue, std::string ip_, int port_);
void start_work();
void sendData(_TCPSendInfo* TCPSendInfo, int Num);
std::vector<int> stringToAscii(const std::string& str);
#ifdef __TCPServer
private slots:
void onNewConnection();

Loading…
Cancel
Save