import sys
import serial
+import time
import serial.tools.list_ports
from PyQt5.QtWidgets import (QApplication, QMainWindow, QWidget, QVBoxLayout, QHBoxLayout,
QLabel, QLineEdit, QPushButton, QComboBox, QMessageBox, QGroupBox)
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
- self.setWindowTitle("设备参数读写工具")
+ self.setWindowTitle("设备参数读写工具_V1.0")
# 设置窗口为固定大小,禁用调整大小功能
self.setFixedSize(400, 500)
self.setWindowFlags(self.windowFlags() & ~Qt.WindowMaximizeButtonHint)
if new_ssid != self.params['ssid']:
if new_ssid:
self.serial_thread.send_data(f'W2{new_ssid}')
+ time.sleep(0.5)
if new_password != self.params['password']:
if new_password:
self.serial_thread.send_data(f'W3{new_password}')
+ time.sleep(0.5)
# 检查IP地址是否修改
new_ip = '.'.join([part.text().strip() for part in self.ip_parts])
# 转换为W4格式: W4001002003004
ip_str = ''.join(f'{int(part.text()):03d}' for part in self.ip_parts)
self.serial_thread.send_data(f'W4{ip_str}')
+ time.sleep(0.5)
else:
QMessageBox.warning(self, "警告", "IP地址格式不正确")
if new_port != self.params['srv_port']:
if new_port.isdigit():
self.serial_thread.send_data(f'W5{new_port}')
+ time.sleep(0.5)
else:
QMessageBox.warning(self, "警告", "端口号必须是数字")
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
- self.setWindowTitle("老化车测试服务端")
+ self.setWindowTitle("测试服务端工具_V1.0")
self.setFixedSize(900, 600)
self.setWindowFlags(self.windowFlags() & ~Qt.WindowMaximizeButtonHint)