|
@@ -2,6 +2,11 @@
|
|
#include "ui_mainwindow.h"
|
|
#include "ui_mainwindow.h"
|
|
|
|
|
|
#include <memory>
|
|
#include <memory>
|
|
|
|
+#include <QInputDialog>
|
|
|
|
+#include <QMessageBox>
|
|
|
|
+
|
|
|
|
+extern std::string gstrserverip;
|
|
|
|
+extern void SaveServerIP();
|
|
|
|
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
MainWindow::MainWindow(QWidget *parent) :
|
|
QMainWindow(parent),
|
|
QMainWindow(parent),
|
|
@@ -23,6 +28,8 @@ MainWindow::MainWindow(QWidget *parent) :
|
|
ui->plainTextEdit->setGeometry(100,800,600,600);
|
|
ui->plainTextEdit->setGeometry(100,800,600,600);
|
|
#endif
|
|
#endif
|
|
|
|
|
|
|
|
+ setWindowTitle("Service MainTain Tool");
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
MainWindow::~MainWindow()
|
|
MainWindow::~MainWindow()
|
|
@@ -36,8 +43,8 @@ void MainWindow::on_pushButton_Start_clicked()
|
|
int nCode = 1;
|
|
int nCode = 1;
|
|
char strout[100];
|
|
char strout[100];
|
|
memcpy(strout,&nCode,sizeof(int));
|
|
memcpy(strout,&nCode,sizeof(int));
|
|
- mpSocket->writeDatagram(strout,sizeof(int),QHostAddress::Broadcast,60009);
|
|
|
|
- mpSocket->writeDatagram(strout,sizeof(int),QHostAddress("10.16.0.107"),60009);
|
|
|
|
|
|
+// mpSocket->writeDatagram(strout,sizeof(int),QHostAddress::Broadcast,60009);
|
|
|
|
+ mpSocket->writeDatagram(strout,sizeof(int),QHostAddress(gstrserverip.data()),60009);
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_pushButton_Stop_clicked()
|
|
void MainWindow::on_pushButton_Stop_clicked()
|
|
@@ -46,8 +53,8 @@ void MainWindow::on_pushButton_Stop_clicked()
|
|
int nCode = 0;
|
|
int nCode = 0;
|
|
char strout[100];
|
|
char strout[100];
|
|
memcpy(strout,&nCode,sizeof(int));
|
|
memcpy(strout,&nCode,sizeof(int));
|
|
- mpSocket->writeDatagram(strout,sizeof(int),QHostAddress::Broadcast,60009);
|
|
|
|
- mpSocket->writeDatagram(strout,sizeof(int),QHostAddress("10.16.0.107"),60009);
|
|
|
|
|
|
+// mpSocket->writeDatagram(strout,sizeof(int),QHostAddress::Broadcast,60009);
|
|
|
|
+ mpSocket->writeDatagram(strout,sizeof(int),QHostAddress(gstrserverip.data()),60009);
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::on_pushButton_Query_clicked()
|
|
void MainWindow::on_pushButton_Query_clicked()
|
|
@@ -56,8 +63,8 @@ void MainWindow::on_pushButton_Query_clicked()
|
|
int nCode = 2;
|
|
int nCode = 2;
|
|
char strout[100];
|
|
char strout[100];
|
|
memcpy(strout,&nCode,sizeof(int));
|
|
memcpy(strout,&nCode,sizeof(int));
|
|
- mpSocket->writeDatagram(strout,sizeof(int),QHostAddress::Broadcast,60009);
|
|
|
|
- mpSocket->writeDatagram(strout,sizeof(int),QHostAddress("10.16.0.107"),60009);
|
|
|
|
|
|
+// mpSocket->writeDatagram(strout,sizeof(int),QHostAddress::Broadcast,60009);
|
|
|
|
+ mpSocket->writeDatagram(strout,sizeof(int),QHostAddress(gstrserverip.data()),60009);
|
|
}
|
|
}
|
|
|
|
|
|
void MainWindow::onRecvData()
|
|
void MainWindow::onRecvData()
|
|
@@ -110,3 +117,35 @@ void MainWindow::onRecvData()
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+void MainWindow::on_actionSet_Device_IP_triggered()
|
|
|
|
+{
|
|
|
|
+ bool ok;
|
|
|
|
+ QString strpass = QInputDialog::getText(this,tr("Check PassWord"),tr("password:"),QLineEdit::Password,
|
|
|
|
+ tr(""), &ok);
|
|
|
|
+ if(ok == false)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if(strpass != "adc")
|
|
|
|
+ {
|
|
|
|
+ QMessageBox::warning(this,tr("Warning"),tr("Password Error."),QMessageBox::YesAll);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ QString strstationname = QInputDialog::getText(this,tr("SetServerIP"),tr("Device IP:"),QLineEdit::Normal,
|
|
|
|
+ gstrserverip.data(), &ok);
|
|
|
|
+ if(ok == false)
|
|
|
|
+ {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ gstrserverip = strstationname.toStdString();
|
|
|
|
+ SaveServerIP();
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void MainWindow::on_actionExit_triggered()
|
|
|
|
+{
|
|
|
|
+ this->close();
|
|
|
|
+}
|