You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.5 KiB
C++
40 lines
1.5 KiB
C++
#include "mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
#include <QImage>
|
|
#include "workthread.h"
|
|
|
|
MainWindow::MainWindow(QWidget *parent)
|
|
: QMainWindow(parent)
|
|
, ui(new Ui::MainWindow)
|
|
{
|
|
ui->setupUi(this);
|
|
}
|
|
|
|
MainWindow::~MainWindow()
|
|
{
|
|
delete ui;
|
|
}
|
|
WorkThread wo[4];
|
|
|
|
|
|
void MainWindow::on_pushButton_clicked()
|
|
{
|
|
// mSocket.writeDatagram(QString("Time,%1").arg(QString::number(5)).toUtf8(), QHostAddress("192.168.10.168"), 8081);
|
|
|
|
for(int i=0;i<10000;++i)
|
|
{
|
|
for (int port = 1; port < 5; port++)
|
|
{
|
|
_sleep(10);
|
|
mSocket.writeDatagram(QString("Time,%1").arg(QString::number(i % 35)).toUtf8(), QHostAddress("192.168.10.168"), 8080 + port);
|
|
mSocket.writeDatagram(QString("Speed,10%1").arg(QString::number(i)).toUtf8(), QHostAddress("192.168.10.168"), 8080 + port);
|
|
if (port % 5 == 0)
|
|
mSocket.writeDatagram(QString("Ok,0%1").arg(QString::number(i % 35)).toUtf8(), QHostAddress("192.168.10.168"), 8080 + port);
|
|
else
|
|
mSocket.writeDatagram(QString("Ng,0%1").arg(QString::number(i % 35)).toUtf8(), QHostAddress("192.168.10.168"), 8080 + port);
|
|
mSocket.writeDatagram(QString("Total,%1").arg(QString::number(i % 35)).toUtf8(), QHostAddress("192.168.10.168"), 8080 + port);
|
|
mSocket.writeDatagram(QString("Kick,%1").arg(QString::number(i % 35)).toUtf8(), QHostAddress("192.168.10.168"), 8080 + port);
|
|
mSocket.writeDatagram(QString("Jd,%1").arg(QString::number(i % 35)).toUtf8(), QHostAddress("192.168.10.168"), 8080 + port);
|
|
}
|
|
}}
|