|
|
|
@ -395,6 +395,9 @@ Cigarette::Cigarette(QWidget *parent)
|
|
|
|
|
m_delay = new QTimer(this);//换班防连击
|
|
|
|
|
connect(m_delay, SIGNAL(timeout()), this, SLOT(enable_shift()));
|
|
|
|
|
|
|
|
|
|
m_sendMsg_delay = new QTimer(this);
|
|
|
|
|
connect(m_sendMsg_delay, SIGNAL(timeout()), this, SLOT(sendLatestData()));
|
|
|
|
|
|
|
|
|
|
m_op_delay = new QTimer(this);
|
|
|
|
|
connect(m_op_delay, SIGNAL(timeout()), this, SLOT(op_timeout()));
|
|
|
|
|
|
|
|
|
@ -499,6 +502,7 @@ Cigarette::Cigarette(QWidget *parent)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//connect(ui.btn_pause, SIGNAL(clicked()), this, SLOT(sendLatestData()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Cigarette::~Cigarette()
|
|
|
|
@ -613,6 +617,9 @@ void Cigarette::pause_work()
|
|
|
|
|
//显示OK/NG按钮
|
|
|
|
|
label_reslut_mat[i]->setVisible(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_sendMsg_delay->setSingleShot(true);
|
|
|
|
|
m_sendMsg_delay->start(1000);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::Exit()
|
|
|
|
@ -686,6 +693,7 @@ void Cigarette::on_btn_pause_released()
|
|
|
|
|
}
|
|
|
|
|
g_op_time = OP_TIME;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//锁定/解锁按钮
|
|
|
|
|
void Cigarette::on_btn_lock_released()
|
|
|
|
|
{
|
|
|
|
@ -770,7 +778,7 @@ void Cigarette::TestImgs()
|
|
|
|
|
std::cout << "srcDirPath=" << srcDirPath.toStdString() << std::endl;
|
|
|
|
|
srcDirPath += "/";
|
|
|
|
|
//获取该路径下的所有文件
|
|
|
|
|
getFiles(srcDirPath.toStdString() + "*.jpg", files);
|
|
|
|
|
getFiles(srcDirPath.toStdString() + "*.bmp", files);
|
|
|
|
|
if (files.size() == 0)
|
|
|
|
|
{
|
|
|
|
|
QMessageBox::StandardButton result = QMessageBox::information(NULL, QStringLiteral("提示"), QStringLiteral("没有找到图片"));
|
|
|
|
@ -847,6 +855,67 @@ void Cigarette::enable_shift()
|
|
|
|
|
ui.pushButton_clear->setEnabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::sendLatestData() {
|
|
|
|
|
// Á¬½ÓUDP·¢ËÍ×îеÄÊý¾Ý
|
|
|
|
|
int dataport = g_sys_conf.MonitorPort;
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
//UDP_Info_queue->take(UDPSendInfo);
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < NumberOfSupportedCameras; i++)
|
|
|
|
|
{
|
|
|
|
|
UDPSendInfo.index = i;
|
|
|
|
|
|
|
|
|
|
UDPSendInfo.FrameID = ok_frame;
|
|
|
|
|
UDPSendInfo.ok[i] = ok[i];
|
|
|
|
|
//sThread.sendData("4_999", dataport + UDPSendInfo.index);
|
|
|
|
|
sThread.sendData(("4_" + to_string(ok[i])).c_str(), dataport + UDPSendInfo.index);
|
|
|
|
|
//std::cout << "ok[" << i << "] is " << to_string(ok[i]) << std::endl;
|
|
|
|
|
//std::cout << ("4_" + to_string(ok[i])).c_str() << std::endl;
|
|
|
|
|
//UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
|
|
|
|
|
UDPSendInfo.FrameID = ng_frame;
|
|
|
|
|
UDPSendInfo.ng[i] = ng[i];
|
|
|
|
|
sThread.sendData(("5_" + to_string(ng[i])).c_str(), dataport + UDPSendInfo.index);
|
|
|
|
|
|
|
|
|
|
UDPSendInfo.FrameID = total_frame;
|
|
|
|
|
UDPSendInfo.Total = production_number[i];
|
|
|
|
|
sThread.sendData(("7_" + to_string(production_number[i])).c_str(), dataport + UDPSendInfo.index);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//while (isLoop) {
|
|
|
|
|
//switch (UDPSendInfo.FrameID) {
|
|
|
|
|
// case info_frame: {
|
|
|
|
|
// sThread.sendData(&UDPSendInfo, dataport);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case speed_frame: {
|
|
|
|
|
// sThread.sendSpeed(&UDPSendInfo, dataport);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case kick_frame: {
|
|
|
|
|
// sThread.sendKick(&UDPSendInfo, dataport);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case ok_frame: {
|
|
|
|
|
// sThread.sendOK(&UDPSendInfo, dataport);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case ng_frame: {
|
|
|
|
|
// sThread.sendNG(&UDPSendInfo, dataport);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case total_frame: {
|
|
|
|
|
// sThread.sendTotal(&UDPSendInfo, dataport);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
// case image_frame: {
|
|
|
|
|
// //sThread.sendImage(&UDPSendInfo, imageport);
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
//}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Cigarette::OnRotateReleasedHub(int Num)//旋转按钮
|
|
|
|
|
{
|
|
|
|
|
QString str = "Start to rotate picture " + QString::number(90 * ((rotationAngle[Num] + 1) % 4)) + " degrees of camera " + QString::number(Num) + ".";
|
|
|
|
@ -856,7 +925,6 @@ void Cigarette::OnRotateReleasedHub(int Num)//
|
|
|
|
|
rotationAngle[Num] = (rotationAngle[Num] + 1) % 4;
|
|
|
|
|
save_rotate_message();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//打开/关闭相机
|
|
|
|
@ -1220,7 +1288,7 @@ void Cigarette::OnOKHub(int Num)
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = ok_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
|
UDPSendInfo.ok = ok[Num];
|
|
|
|
|
UDPSendInfo.ok[Num] = ok[Num];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
@ -1235,7 +1303,7 @@ void Cigarette::OnNGHub(int Num)
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = ng_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
|
UDPSendInfo.ng = ng[Num];
|
|
|
|
|
UDPSendInfo.ng[Num] = ng[Num];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
@ -1247,7 +1315,6 @@ void Cigarette::OnNGHub(int Num)
|
|
|
|
|
void Cigarette::updateStatisticsHub(const QString& statisticalData, int Num)
|
|
|
|
|
{
|
|
|
|
|
label_cap_speed_mat[Num]->setText(statisticalData + QStringLiteral("个/秒"));
|
|
|
|
|
|
|
|
|
|
_UDPSendInfo UDPSendInfo;
|
|
|
|
|
UDPSendInfo.FrameID = speed_frame;
|
|
|
|
|
UDPSendInfo.index = Num;
|
|
|
|
@ -1972,12 +2039,12 @@ void Cigarette::on_pushButton_clear_released()//
|
|
|
|
|
UDPSendInfo.index = i;
|
|
|
|
|
|
|
|
|
|
UDPSendInfo.FrameID = ok_frame;
|
|
|
|
|
UDPSendInfo.ok = ok[i];
|
|
|
|
|
UDPSendInfo.ok[i] = ok[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
|
UDPSendInfo.FrameID = ng_frame;
|
|
|
|
|
UDPSendInfo.ok = ng[i];
|
|
|
|
|
UDPSendInfo.ng[i] = ng[i];
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
UDP_Info_queue->put(UDPSendInfo);
|
|
|
|
|
#endif
|
|
|
|
@ -3443,7 +3510,6 @@ void Cigarette::EnableDebugMode()
|
|
|
|
|
else if(SingleCamInfo[i].CamClass == BaslerClassID)
|
|
|
|
|
{
|
|
|
|
|
bool nRet = false;
|
|
|
|
|
|
|
|
|
|
nRet = BaslerCamHandle[i]->AcquisitionFrameRate.TrySetValue(10);
|
|
|
|
|
if (!nRet) { std::cout << "can not set Basler's AcquisitionFrameRate" << std::endl; }
|
|
|
|
|
nRet = BaslerCamHandle[i]->AcquisitionFrameRateEnable.TrySetValue(true);
|
|
|
|
@ -3676,6 +3742,7 @@ void Cigarette::record_output_statistic(qint64 quantity, int shift)
|
|
|
|
|
|
|
|
|
|
void Cigarette::recMsgFromUdp(QString data)
|
|
|
|
|
{
|
|
|
|
|
//std::cout << data.toStdString() << std::endl;
|
|
|
|
|
#ifdef __UDPSend
|
|
|
|
|
if (data == "START")
|
|
|
|
|
{
|
|
|
|
@ -3743,8 +3810,6 @@ void Cigarette::recMsgFromUdp(QString data)
|
|
|
|
|
{
|
|
|
|
|
OnRotateReleasedHub(7);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else if (data == "LOCK")
|
|
|
|
|
{
|
|
|
|
|
if (!g_admin_mode)
|
|
|
|
@ -4012,6 +4077,7 @@ void Cigarette::recMsgFromUdp(QString data)
|
|
|
|
|
str += QString::number(g_sys_conf.no[i][0]) + '_' + QString::number(g_sys_conf.no[i][1]) + '_' + QString::number(g_sys_conf.no[i][2]) + '_';
|
|
|
|
|
}
|
|
|
|
|
sThread.sendData(str, g_sys_conf.FeedbackPort);
|
|
|
|
|
//std::cout << "=> to UDP: " << str.toStdString() << std::endl;
|
|
|
|
|
}
|
|
|
|
|
else if (dataList[0] == "UPDSETTING")
|
|
|
|
|
{
|
|
|
|
|