将TCP连接的IP与Port改为可配置,修改TCP只传送全存的图片名。

main
seiyu 10 months ago
parent b2cba2ee05
commit ca135833a0

Binary file not shown.

@ -275,8 +275,8 @@ Cigarette::Cigarette(QWidget* parent)
#endif
#ifdef __TCPSend
std::string serverIp = "192.168.1.120";
int serverPort = 8888;
std::string serverIp = g_sys_conf.TcpIP;
int serverPort = g_sys_conf.TcpPort;
tcpSendThread.init(TCP_Info_queue, serverIp, serverPort);
tcpSendThread.start_work();
#endif
@ -2558,6 +2558,14 @@ bool Cigarette::read_sys_config(SysConf& conf, QString conf_path)
conf.FeedbackPort = conf.MonitorPort + NumberOfSupportedCameras * 2;
conf.FilePort = conf.MonitorPort + NumberOfSupportedCameras * 2 + 2;
}
else if (tmp_key == "TcpIP")
{
conf.TcpIP = line.substr(pos + 1);
}
else if (tmp_key == "TcpPort")
{
conf.TcpPort = atoi(line.substr(pos + 1).c_str());
}
}
}

@ -1,4 +1,4 @@
#pragma once
#pragma once
#include <iostream>
#include <vector>
#include <mutex>
@ -13,7 +13,7 @@
//#define IMM_FEED_BACK //处理完后立马反馈,不等校验信号
#define ONE_TIME_SHIFT //错开一拍发送反馈(默认错开两次)
#define AI_WARM_UP //AI识别开始前的热身动作
//#define LICENSE_VERIFY //开启license文件校验
#define LICENSE_VERIFY //开启license文件校验
//CAP_FEED_BACK和DOUBLE_FEED_BACK不要一起开
#if defined (ONE_TIME_SHIFT)
//#define CAP_FEED_BACK //拍照时也检测有没有测试结果,有的话就反馈
@ -78,31 +78,31 @@ class SysConf
{
public:
std::mutex lock;
int save; //图片是否保存0不保存1保存NG, 2全部保存
int MisMatchAct; //错位行为1NG,0ok
int save_days; ///照片保存天数
int freesize; /// 设定清理图片最小空间
std::string ComPort; ///COM口
int ConfThreshold; //识别率
int auto_open; //是否自动打开相机0否1是
int auto_work; //是否自动开始工作0否1是
int auto_shift; //是否自动换班0否1是
int shift_byhand; // 是否手动换班0否1是
QTime shiftA; //A换班时间
QTime shiftB; //B换班时间
QTime shiftC; //C换班时间
QString location; // 所在地
QString model_path; // 模型文件夹路径
QString model_name; // 模型名
QString model_jpg_path; // 模型图片路径
int timing_shift; //是否定时换班0否1是
int expo[NumberOfSupportedCameras]; //相机曝光时间,单位微秒
int gain[NumberOfSupportedCameras]; //相机模拟增益范围0~64
int filter[NumberOfSupportedCameras];//相机滤波时间
int save; // 图片是否保存0不保存1保存NG, 2全部保存
int MisMatchAct; // 错位行为1NG,0ok
int save_days; // 照片保存天数
int freesize; // 设定清理图片最小空间
std::string ComPort; // COM口
int ConfThreshold; // 识别率
int auto_open; // 是否自动打开相机0否1是
int auto_work; // 是否自动开始工作0否1是
int auto_shift; // 是否自动换班0否1是
int shift_byhand; // 是否手动换班0否1是
QTime shiftA; // A换班时间
QTime shiftB; // B换班时间
QTime shiftC; // C换班时间
QString location; // 所在地
QString model_path; // 模型文件夹路径
QString model_name; // 模型名
QString model_jpg_path; // 模型图片路径
int timing_shift; // 是否定时换班0否1是
int expo[NumberOfSupportedCameras]; // 相机曝光时间,单位微秒
int gain[NumberOfSupportedCameras]; // 相机模拟增益范围0~64
int filter[NumberOfSupportedCameras]; // 相机滤波时间
int UserID[NumberOfSupportedCameras];
int no[NumberOfSupportedCameras][3];//拍摄图片最少合格胶点数
int shoot[NumberOfSupportedCameras];//拍摄次数
std::string MonitorIP; //远程监控端的IP
int no[NumberOfSupportedCameras][3]; // 拍摄图片最少合格胶点数
int shoot[NumberOfSupportedCameras]; // 拍摄次数
std::string MonitorIP; // 远程监控端的IP
int MonitorPort;
int FeedbackPort;
int FilePort;
@ -110,6 +110,8 @@ public:
//MonitorPort+NumberOfSupportedCameras为图像端口
//MonitorPort+NumberOfSupportedCameras*2为发送命令端口,也就是FeedbackPort
//MonitorPort+NumberOfSupportedCameras*2+1为接受命令端口
std::string TcpIP; // TCP服务器端ip地址
int TcpPort; // TCP服务器端端口号
SysConf()
{
@ -144,6 +146,8 @@ public:
}
MonitorIP = "192.168.10.1";
FeedbackPort = MonitorPort + NumberOfSupportedCameras * 2;
TcpIP = "192.168.1.126";
TcpPort = 8888;
}
};

@ -761,6 +761,14 @@ void DialogSetup::write_config()
cfg_file.write(buf, strlen(buf));
sprintf(buf, "MonitorPort=%d\n", g_sys_conf.MonitorPort);
cfg_file.write(buf, strlen(buf));
memset(buf, 0, 256);
sprintf(buf, "TcpIP=%s\n", g_sys_conf.TcpIP.c_str());
cfg_file.write(buf, strlen(buf));
memset(buf, 0, 256);
cfg_file.write(buf, strlen(buf));
sprintf(buf, "TcpPort=%d\n", g_sys_conf.TcpPort);
cfg_file.write(buf, strlen(buf));
}
cfg_file.close();
}

@ -206,15 +206,14 @@ void SyncWorkThread::run()
+ now_ts.toString("yyyy-MM-dd") + "/"
+ now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + ".jpg";
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), merge_image));
#ifdef __TCPSend
TCPSendInfo.pics_name = file_name.toLocal8Bit().constData();
QString sendName = now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + ".jpg";
TCPSendInfo.pics_name = sendName.toLocal8Bit().constData();
TCP_Info_queue->put(TCPSendInfo);
#endif
}
}
}
if (unit_count >= 2) {
image1 = vec_out[(result_index[i]) % 2].clone();
#ifdef DRAW_RECT
@ -285,7 +284,7 @@ void SyncWorkThread::run()
now_ts.toString("yyyy-MM-dd_HH-mm-ss_zzz_") + QString::number(local_camera_number + 1) +
"#" + "_" + QString::number(index + 1) + "_" + ng_reason_maps[ngReason] +
".jpg";
//g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
m = vec_out[index].clone();
file_name = g_conf_path.save_pics_path + "/ng_result/" +
@ -299,7 +298,7 @@ void SyncWorkThread::run()
"#" + "_" + QString::number(index + 1) + "_" + ng_reason_maps[ngReason] +
".jpg";
//g_save_queue->put(std::make_pair(file_name.toStdString(), m));
//g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
g_save_queue->put(std::make_pair(file_name.toLocal8Bit().constData(), m));
}
}
}

Loading…
Cancel
Save