|
|
|
@ -243,49 +243,23 @@ void deviceStateDlg::startNetDetn() {
|
|
|
|
|
m_workerThread[i]->start();
|
|
|
|
|
connect(m_networkDetection[i], SIGNAL(resultReady(int,QString,QString)), this,
|
|
|
|
|
SLOT(receiveResult(int,QString,QString))); // 接收线程运行结果
|
|
|
|
|
connect(this, &deviceStateDlg::stopThread, m_networkDetection[i],
|
|
|
|
|
&networkDetection::stop); // 结束线程
|
|
|
|
|
connect(this, &deviceStateDlg::startThread, m_networkDetection[i],
|
|
|
|
|
&networkDetection::dowork); // 开始线程
|
|
|
|
|
connect(this, &deviceStateDlg::stopMyThread, m_networkDetection[i],
|
|
|
|
|
&networkDetection::stopwork); // 结束线程
|
|
|
|
|
emit startThread(i, cmdlist[i]); // 启用线程信号
|
|
|
|
|
// switch (i) {
|
|
|
|
|
// case 0:
|
|
|
|
|
// connect(this, &deviceStateDlg::startThread0, m_networkDetection[i],
|
|
|
|
|
// &networkDetection::dowork); // 光电吊舱 线程开始处理数据
|
|
|
|
|
// emit startThread0(i, cmdlist[i]); // 启用线程信号
|
|
|
|
|
// break;
|
|
|
|
|
// case 1:
|
|
|
|
|
// connect(this, &deviceStateDlg::startThread1, m_networkDetection[i],
|
|
|
|
|
// &networkDetection::dowork); // L链路 线程开始处理数据
|
|
|
|
|
// emit startThread1(i, cmdlist[i]); // 启用线程信号
|
|
|
|
|
// break;
|
|
|
|
|
// case 2:
|
|
|
|
|
// connect(this, &deviceStateDlg::startThread2, m_networkDetection[i],
|
|
|
|
|
// &networkDetection::dowork); // 自组网 线程开始处理数据
|
|
|
|
|
// emit startThread2(i, cmdlist[i]); // 启用线程信号
|
|
|
|
|
// break;
|
|
|
|
|
// case 3:
|
|
|
|
|
// connect(this, &deviceStateDlg::startThread3, m_networkDetection[i],
|
|
|
|
|
// &networkDetection::dowork); // ku卫通 线程开始处理数据
|
|
|
|
|
// emit startThread3(i, cmdlist[i]); // 启用线程信号
|
|
|
|
|
// break;
|
|
|
|
|
// case 4:
|
|
|
|
|
// connect(this, &deviceStateDlg::startThread4, m_networkDetection[i],
|
|
|
|
|
// &networkDetection::dowork); // 线程开始处理数据
|
|
|
|
|
// emit startThread4(i, cmdlist[i]); // 启用线程信号
|
|
|
|
|
// break;
|
|
|
|
|
// default:
|
|
|
|
|
// break;
|
|
|
|
|
// }
|
|
|
|
|
qDebug("网络监测线程启动,线程id:%d",i);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 停止网络监测
|
|
|
|
|
void deviceStateDlg::stopNetDetn() {
|
|
|
|
|
for (int i = 0; i < deviceNum; ++i) {
|
|
|
|
|
m_networkDetection[i]->stop(i); // 线程退出循环
|
|
|
|
|
m_networkDetection[i]->stopwork(i);
|
|
|
|
|
//emit stopMyThread(i);//信号不起作用
|
|
|
|
|
m_workerThread[i]->quit(); // 退出线程请求
|
|
|
|
|
m_workerThread[i]->wait(); // 使线程正常退出。
|
|
|
|
|
qDebug("网络监测线程结束,线程id:%d",i);
|
|
|
|
|
m_workerThread[i]->deleteLater();
|
|
|
|
|
m_workerThread[i] = nullptr;
|
|
|
|
|
m_networkDetection[i]->deleteLater();
|
|
|
|
|