From ada7b40da88974c6f4596c7c9d1317eb19095a0e Mon Sep 17 00:00:00 2001
From: tao_z <tzj0429@163.com>
Date: Sun, 29 May 2022 23:26:03 +0800
Subject: [PATCH] 新增bootloader界面以及函数

---
 widgets/ShifterTool.py     |  523 ++++++-
 Shifter.py                 |   50 
 test.py                    |  264 ++-
 .qt_for_python/uic/main.py |  589 ++++++++
 dbc.py                     |  621 +++++++++
 USBCAN.py                  |   40 
 mainwindows.py             |  793 +++++++++--
 DBC/SX7H.dbc               |  110 +
 ShifterDefine.py           |   36 
 main.ui                    |  821 +++++++++++
 10 files changed, 3,312 insertions(+), 535 deletions(-)

diff --git a/.qt_for_python/uic/main.py b/.qt_for_python/uic/main.py
index 2df6f5e..1b0c42c 100644
--- a/.qt_for_python/uic/main.py
+++ b/.qt_for_python/uic/main.py
@@ -17,8 +17,8 @@
     def setupUi(self, MainWindow):
         if not MainWindow.objectName():
             MainWindow.setObjectName(u"MainWindow")
-        MainWindow.resize(800, 575)
-        MainWindow.setMinimumSize(QSize(800, 575))
+        MainWindow.resize(1050, 800)
+        MainWindow.setMinimumSize(QSize(1050, 800))
         self.centralwidget = QWidget(MainWindow)
         self.centralwidget.setObjectName(u"centralwidget")
         sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
@@ -26,7 +26,7 @@
         sizePolicy.setVerticalStretch(0)
         sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth())
         self.centralwidget.setSizePolicy(sizePolicy)
-        self.centralwidget.setMinimumSize(QSize(800, 575))
+        self.centralwidget.setMinimumSize(QSize(1050, 800))
         self.verticalLayout = QVBoxLayout(self.centralwidget)
         self.verticalLayout.setObjectName(u"verticalLayout")
         self.verticalLayout_5 = QVBoxLayout()
@@ -145,26 +145,36 @@
         self.verticalLayout_6 = QVBoxLayout()
         self.verticalLayout_6.setSpacing(1)
         self.verticalLayout_6.setObjectName(u"verticalLayout_6")
-        self.horizontalLayout_8 = QHBoxLayout()
-        self.horizontalLayout_8.setObjectName(u"horizontalLayout_8")
-        self.label_2 = QLabel(self.groupBox_2)
-        self.label_2.setObjectName(u"label_2")
-        sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
-        sizePolicy3.setHorizontalStretch(0)
-        sizePolicy3.setVerticalStretch(0)
-        sizePolicy3.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
-        self.label_2.setSizePolicy(sizePolicy3)
-        self.label_2.setAlignment(Qt.AlignCenter)
-
-        self.horizontalLayout_8.addWidget(self.label_2)
-
+        self.horizontalLayout_9 = QHBoxLayout()
+        self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
         self.label_4 = QLabel(self.groupBox_2)
         self.label_4.setObjectName(u"label_4")
+        sizePolicy3 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
+        sizePolicy3.setHorizontalStretch(0)
+        sizePolicy3.setVerticalStretch(0)
         sizePolicy3.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
         self.label_4.setSizePolicy(sizePolicy3)
         self.label_4.setAlignment(Qt.AlignCenter)
 
-        self.horizontalLayout_8.addWidget(self.label_4)
+        self.horizontalLayout_9.addWidget(self.label_4)
+
+        self.comboBox_6 = QComboBox(self.groupBox_2)
+        self.comboBox_6.setObjectName(u"comboBox_6")
+
+        self.horizontalLayout_9.addWidget(self.comboBox_6)
+
+        self.label_2 = QLabel(self.groupBox_2)
+        self.label_2.setObjectName(u"label_2")
+        sizePolicy3.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
+        self.label_2.setSizePolicy(sizePolicy3)
+        self.label_2.setAlignment(Qt.AlignCenter)
+
+        self.horizontalLayout_9.addWidget(self.label_2)
+
+        self.lineEdit = QLineEdit(self.groupBox_2)
+        self.lineEdit.setObjectName(u"lineEdit")
+
+        self.horizontalLayout_9.addWidget(self.lineEdit)
 
         self.label_5 = QLabel(self.groupBox_2)
         self.label_5.setObjectName(u"label_5")
@@ -172,31 +182,7 @@
         self.label_5.setSizePolicy(sizePolicy3)
         self.label_5.setAlignment(Qt.AlignCenter)
 
-        self.horizontalLayout_8.addWidget(self.label_5)
-
-        self.label_6 = QLabel(self.groupBox_2)
-        self.label_6.setObjectName(u"label_6")
-
-        self.horizontalLayout_8.addWidget(self.label_6)
-
-        self.horizontalLayout_8.setStretch(0, 1)
-        self.horizontalLayout_8.setStretch(1, 4)
-        self.horizontalLayout_8.setStretch(2, 2)
-        self.horizontalLayout_8.setStretch(3, 2)
-
-        self.verticalLayout_6.addLayout(self.horizontalLayout_8)
-
-        self.horizontalLayout_9 = QHBoxLayout()
-        self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
-        self.comboBox_6 = QComboBox(self.groupBox_2)
-        self.comboBox_6.setObjectName(u"comboBox_6")
-
-        self.horizontalLayout_9.addWidget(self.comboBox_6)
-
-        self.lineEdit = QLineEdit(self.groupBox_2)
-        self.lineEdit.setObjectName(u"lineEdit")
-
-        self.horizontalLayout_9.addWidget(self.lineEdit)
+        self.horizontalLayout_9.addWidget(self.label_5)
 
         self.lineEdit_2 = QLineEdit(self.groupBox_2)
         self.lineEdit_2.setObjectName(u"lineEdit_2")
@@ -213,11 +199,11 @@
 
         self.horizontalLayout_9.addWidget(self.pushButton_3)
 
-        self.horizontalLayout_9.setStretch(0, 1)
-        self.horizontalLayout_9.setStretch(1, 4)
-        self.horizontalLayout_9.setStretch(2, 2)
+        self.horizontalLayout_9.setStretch(1, 3)
         self.horizontalLayout_9.setStretch(3, 1)
-        self.horizontalLayout_9.setStretch(4, 1)
+        self.horizontalLayout_9.setStretch(5, 3)
+        self.horizontalLayout_9.setStretch(6, 1)
+        self.horizontalLayout_9.setStretch(7, 1)
 
         self.verticalLayout_6.addLayout(self.horizontalLayout_9)
 
@@ -283,11 +269,8 @@
 
         self.pushButton_4 = QPushButton(self.groupBox_2)
         self.pushButton_4.setObjectName(u"pushButton_4")
-        sizePolicy4 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
-        sizePolicy4.setHorizontalStretch(0)
-        sizePolicy4.setVerticalStretch(0)
-        sizePolicy4.setHeightForWidth(self.pushButton_4.sizePolicy().hasHeightForWidth())
-        self.pushButton_4.setSizePolicy(sizePolicy4)
+        sizePolicy3.setHeightForWidth(self.pushButton_4.sizePolicy().hasHeightForWidth())
+        self.pushButton_4.setSizePolicy(sizePolicy3)
         self.pushButton_4.setMinimumSize(QSize(45, 23))
 
         self.gridLayout.addWidget(self.pushButton_4, 0, 2, 1, 1)
@@ -445,6 +428,10 @@
 
         self.verticalLayout_2.addLayout(self.gridLayout)
 
+        self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+
+        self.verticalLayout_2.addItem(self.verticalSpacer_2)
+
         self.verticalLayout_2.setStretch(0, 1)
         self.verticalLayout_2.setStretch(1, 5)
 
@@ -527,16 +514,442 @@
 
         self.verticalLayout_9.addLayout(self.horizontalLayout_5)
 
-        self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+        self.groupBox_3 = QGroupBox(self.tab)
+        self.groupBox_3.setObjectName(u"groupBox_3")
+        self.horizontalLayout_10 = QHBoxLayout(self.groupBox_3)
+        self.horizontalLayout_10.setObjectName(u"horizontalLayout_10")
+        self.pushButton_31 = QPushButton(self.groupBox_3)
+        self.pushButton_31.setObjectName(u"pushButton_31")
 
-        self.verticalLayout_9.addItem(self.verticalSpacer_2)
+        self.horizontalLayout_10.addWidget(self.pushButton_31)
 
+        self.pushButton_32 = QPushButton(self.groupBox_3)
+        self.pushButton_32.setObjectName(u"pushButton_32")
+
+        self.horizontalLayout_10.addWidget(self.pushButton_32)
+
+
+        self.verticalLayout_9.addWidget(self.groupBox_3)
+
+        self.verticalLayout_9.setStretch(0, 6)
+        self.verticalLayout_9.setStretch(1, 1)
+        self.verticalLayout_9.setStretch(2, 1)
         self.tabWidget.addTab(self.tab, "")
+        self.tab_2 = QWidget()
+        self.tab_2.setObjectName(u"tab_2")
+        self.verticalLayout_10 = QVBoxLayout(self.tab_2)
+        self.verticalLayout_10.setObjectName(u"verticalLayout_10")
+        self.verticalLayout_11 = QVBoxLayout()
+        self.verticalLayout_11.setObjectName(u"verticalLayout_11")
+        self.pushButton_9 = QPushButton(self.tab_2)
+        self.pushButton_9.setObjectName(u"pushButton_9")
+
+        self.verticalLayout_11.addWidget(self.pushButton_9)
+
+        self.pushButton_11 = QPushButton(self.tab_2)
+        self.pushButton_11.setObjectName(u"pushButton_11")
+
+        self.verticalLayout_11.addWidget(self.pushButton_11)
+
+        self.pushButton_13 = QPushButton(self.tab_2)
+        self.pushButton_13.setObjectName(u"pushButton_13")
+
+        self.verticalLayout_11.addWidget(self.pushButton_13)
+
+        self.pushButton_18 = QPushButton(self.tab_2)
+        self.pushButton_18.setObjectName(u"pushButton_18")
+
+        self.verticalLayout_11.addWidget(self.pushButton_18)
+
+        self.pushButton_22 = QPushButton(self.tab_2)
+        self.pushButton_22.setObjectName(u"pushButton_22")
+
+        self.verticalLayout_11.addWidget(self.pushButton_22)
+
+        self.pushButton_24 = QPushButton(self.tab_2)
+        self.pushButton_24.setObjectName(u"pushButton_24")
+
+        self.verticalLayout_11.addWidget(self.pushButton_24)
+
+        self.pushButton_26 = QPushButton(self.tab_2)
+        self.pushButton_26.setObjectName(u"pushButton_26")
+
+        self.verticalLayout_11.addWidget(self.pushButton_26)
+
+        self.pushButton_27 = QPushButton(self.tab_2)
+        self.pushButton_27.setObjectName(u"pushButton_27")
+
+        self.verticalLayout_11.addWidget(self.pushButton_27)
+
+        self.pushButton_28 = QPushButton(self.tab_2)
+        self.pushButton_28.setObjectName(u"pushButton_28")
+
+        self.verticalLayout_11.addWidget(self.pushButton_28)
+
+        self.pushButton_29 = QPushButton(self.tab_2)
+        self.pushButton_29.setObjectName(u"pushButton_29")
+
+        self.verticalLayout_11.addWidget(self.pushButton_29)
+
+
+        self.verticalLayout_10.addLayout(self.verticalLayout_11)
+
+        self.tabWidget.addTab(self.tab_2, "")
+        self.tab_3 = QWidget()
+        self.tab_3.setObjectName(u"tab_3")
+        self.horizontalLayout_14 = QHBoxLayout(self.tab_3)
+        self.horizontalLayout_14.setObjectName(u"horizontalLayout_14")
+        self.verticalLayout_15 = QVBoxLayout()
+        self.verticalLayout_15.setObjectName(u"verticalLayout_15")
+        self.groupBox_6 = QGroupBox(self.tab_3)
+        self.groupBox_6.setObjectName(u"groupBox_6")
+        self.horizontalLayout_8 = QHBoxLayout(self.groupBox_6)
+        self.horizontalLayout_8.setObjectName(u"horizontalLayout_8")
+        self.verticalLayout_13 = QVBoxLayout()
+        self.verticalLayout_13.setObjectName(u"verticalLayout_13")
+        self.pushButton_35 = QPushButton(self.groupBox_6)
+        self.pushButton_35.setObjectName(u"pushButton_35")
+        sizePolicy3.setHeightForWidth(self.pushButton_35.sizePolicy().hasHeightForWidth())
+        self.pushButton_35.setSizePolicy(sizePolicy3)
+        self.pushButton_35.setMinimumSize(QSize(60, 60))
+        self.pushButton_35.setMaximumSize(QSize(60, 60))
+        self.pushButton_35.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_13.addWidget(self.pushButton_35)
+
+        self.pushButton_39 = QPushButton(self.groupBox_6)
+        self.pushButton_39.setObjectName(u"pushButton_39")
+        sizePolicy3.setHeightForWidth(self.pushButton_39.sizePolicy().hasHeightForWidth())
+        self.pushButton_39.setSizePolicy(sizePolicy3)
+        self.pushButton_39.setMinimumSize(QSize(60, 60))
+        self.pushButton_39.setMaximumSize(QSize(60, 60))
+        self.pushButton_39.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_13.addWidget(self.pushButton_39)
+
+        self.pushButton_36 = QPushButton(self.groupBox_6)
+        self.pushButton_36.setObjectName(u"pushButton_36")
+        sizePolicy3.setHeightForWidth(self.pushButton_36.sizePolicy().hasHeightForWidth())
+        self.pushButton_36.setSizePolicy(sizePolicy3)
+        self.pushButton_36.setMinimumSize(QSize(60, 60))
+        self.pushButton_36.setMaximumSize(QSize(60, 60))
+        self.pushButton_36.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_13.addWidget(self.pushButton_36)
+
+        self.verticalLayout_13.setStretch(0, 2)
+        self.verticalLayout_13.setStretch(1, 2)
+        self.verticalLayout_13.setStretch(2, 2)
+
+        self.horizontalLayout_8.addLayout(self.verticalLayout_13)
+
+        self.verticalLayout_12 = QVBoxLayout()
+        self.verticalLayout_12.setObjectName(u"verticalLayout_12")
+        self.pushButton_37 = QPushButton(self.groupBox_6)
+        self.pushButton_37.setObjectName(u"pushButton_37")
+        sizePolicy3.setHeightForWidth(self.pushButton_37.sizePolicy().hasHeightForWidth())
+        self.pushButton_37.setSizePolicy(sizePolicy3)
+        self.pushButton_37.setMinimumSize(QSize(60, 60))
+        self.pushButton_37.setMaximumSize(QSize(60, 60))
+        self.pushButton_37.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;\n"
+"")
+
+        self.verticalLayout_12.addWidget(self.pushButton_37)
+
+        self.pushButton_38 = QPushButton(self.groupBox_6)
+        self.pushButton_38.setObjectName(u"pushButton_38")
+        sizePolicy3.setHeightForWidth(self.pushButton_38.sizePolicy().hasHeightForWidth())
+        self.pushButton_38.setSizePolicy(sizePolicy3)
+        self.pushButton_38.setMinimumSize(QSize(60, 60))
+        self.pushButton_38.setMaximumSize(QSize(60, 60))
+        self.pushButton_38.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;\n"
+"")
+
+        self.verticalLayout_12.addWidget(self.pushButton_38)
+
+        self.pushButton_30 = QPushButton(self.groupBox_6)
+        self.pushButton_30.setObjectName(u"pushButton_30")
+        sizePolicy3.setHeightForWidth(self.pushButton_30.sizePolicy().hasHeightForWidth())
+        self.pushButton_30.setSizePolicy(sizePolicy3)
+        self.pushButton_30.setMinimumSize(QSize(60, 60))
+        self.pushButton_30.setMaximumSize(QSize(60, 60))
+        self.pushButton_30.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_12.addWidget(self.pushButton_30)
+
+        self.pushButton_33 = QPushButton(self.groupBox_6)
+        self.pushButton_33.setObjectName(u"pushButton_33")
+        sizePolicy3.setHeightForWidth(self.pushButton_33.sizePolicy().hasHeightForWidth())
+        self.pushButton_33.setSizePolicy(sizePolicy3)
+        self.pushButton_33.setMinimumSize(QSize(60, 60))
+        self.pushButton_33.setMaximumSize(QSize(60, 60))
+        self.pushButton_33.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_12.addWidget(self.pushButton_33)
+
+        self.pushButton_34 = QPushButton(self.groupBox_6)
+        self.pushButton_34.setObjectName(u"pushButton_34")
+        self.pushButton_34.setMinimumSize(QSize(60, 60))
+        self.pushButton_34.setMaximumSize(QSize(60, 60))
+        self.pushButton_34.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_12.addWidget(self.pushButton_34)
+
+        self.verticalLayout_12.setStretch(0, 1)
+        self.verticalLayout_12.setStretch(1, 1)
+        self.verticalLayout_12.setStretch(2, 1)
+        self.verticalLayout_12.setStretch(3, 1)
+        self.verticalLayout_12.setStretch(4, 1)
+
+        self.horizontalLayout_8.addLayout(self.verticalLayout_12)
+
+        self.verticalLayout_14 = QVBoxLayout()
+        self.verticalLayout_14.setObjectName(u"verticalLayout_14")
+        self.pushButton_41 = QPushButton(self.groupBox_6)
+        self.pushButton_41.setObjectName(u"pushButton_41")
+        sizePolicy3.setHeightForWidth(self.pushButton_41.sizePolicy().hasHeightForWidth())
+        self.pushButton_41.setSizePolicy(sizePolicy3)
+        self.pushButton_41.setMinimumSize(QSize(60, 60))
+        self.pushButton_41.setMaximumSize(QSize(60, 60))
+        self.pushButton_41.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_14.addWidget(self.pushButton_41)
+
+        self.pushButton_40 = QPushButton(self.groupBox_6)
+        self.pushButton_40.setObjectName(u"pushButton_40")
+        sizePolicy3.setHeightForWidth(self.pushButton_40.sizePolicy().hasHeightForWidth())
+        self.pushButton_40.setSizePolicy(sizePolicy3)
+        self.pushButton_40.setMinimumSize(QSize(60, 60))
+        self.pushButton_40.setMaximumSize(QSize(60, 60))
+        self.pushButton_40.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_14.addWidget(self.pushButton_40)
+
+        self.verticalLayout_14.setStretch(0, 1)
+        self.verticalLayout_14.setStretch(1, 1)
+
+        self.horizontalLayout_8.addLayout(self.verticalLayout_14)
+
+
+        self.verticalLayout_15.addWidget(self.groupBox_6)
+
+        self.horizontalLayout_11 = QHBoxLayout()
+        self.horizontalLayout_11.setObjectName(u"horizontalLayout_11")
+        self.groupBox_5 = QGroupBox(self.tab_3)
+        self.groupBox_5.setObjectName(u"groupBox_5")
+        self.horizontalLayout_13 = QHBoxLayout(self.groupBox_5)
+        self.horizontalLayout_13.setObjectName(u"horizontalLayout_13")
+        self.label_6 = QLabel(self.groupBox_5)
+        self.label_6.setObjectName(u"label_6")
+        sizePolicy3.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth())
+        self.label_6.setSizePolicy(sizePolicy3)
+        self.label_6.setMinimumSize(QSize(60, 10))
+        self.label_6.setMaximumSize(QSize(60, 60))
+
+        self.horizontalLayout_13.addWidget(self.label_6)
+
+        self.lineEdit_17 = QLineEdit(self.groupBox_5)
+        self.lineEdit_17.setObjectName(u"lineEdit_17")
+        sizePolicy3.setHeightForWidth(self.lineEdit_17.sizePolicy().hasHeightForWidth())
+        self.lineEdit_17.setSizePolicy(sizePolicy3)
+        self.lineEdit_17.setMinimumSize(QSize(60, 0))
+        self.lineEdit_17.setMaximumSize(QSize(60, 16777215))
+
+        self.horizontalLayout_13.addWidget(self.lineEdit_17)
+
+
+        self.horizontalLayout_11.addWidget(self.groupBox_5)
+
+        self.groupBox_4 = QGroupBox(self.tab_3)
+        self.groupBox_4.setObjectName(u"groupBox_4")
+        self.horizontalLayout_12 = QHBoxLayout(self.groupBox_4)
+        self.horizontalLayout_12.setObjectName(u"horizontalLayout_12")
+        self.pushButton_42 = QPushButton(self.groupBox_4)
+        self.pushButton_42.setObjectName(u"pushButton_42")
+
+        self.horizontalLayout_12.addWidget(self.pushButton_42)
+
+        self.pushButton_45 = QPushButton(self.groupBox_4)
+        self.pushButton_45.setObjectName(u"pushButton_45")
+
+        self.horizontalLayout_12.addWidget(self.pushButton_45)
+
+        self.pushButton_44 = QPushButton(self.groupBox_4)
+        self.pushButton_44.setObjectName(u"pushButton_44")
+
+        self.horizontalLayout_12.addWidget(self.pushButton_44)
+
+        self.pushButton_43 = QPushButton(self.groupBox_4)
+        self.pushButton_43.setObjectName(u"pushButton_43")
+
+        self.horizontalLayout_12.addWidget(self.pushButton_43)
+
+
+        self.horizontalLayout_11.addWidget(self.groupBox_4)
+
+        self.horizontalLayout_11.setStretch(0, 2)
+        self.horizontalLayout_11.setStretch(1, 5)
+
+        self.verticalLayout_15.addLayout(self.horizontalLayout_11)
+
+        self.verticalLayout_15.setStretch(0, 5)
+        self.verticalLayout_15.setStretch(1, 1)
+
+        self.horizontalLayout_14.addLayout(self.verticalLayout_15)
+
+        self.tabWidget.addTab(self.tab_3, "")
+        self.tab_4 = QWidget()
+        self.tab_4.setObjectName(u"tab_4")
+        self.verticalLayout_18 = QVBoxLayout(self.tab_4)
+        self.verticalLayout_18.setObjectName(u"verticalLayout_18")
+        self.groupBox_7 = QGroupBox(self.tab_4)
+        self.groupBox_7.setObjectName(u"groupBox_7")
+        self.verticalLayout_17 = QVBoxLayout(self.groupBox_7)
+        self.verticalLayout_17.setObjectName(u"verticalLayout_17")
+        self.horizontalLayout_17 = QHBoxLayout()
+        self.horizontalLayout_17.setObjectName(u"horizontalLayout_17")
+        self.label_22 = QLabel(self.groupBox_7)
+        self.label_22.setObjectName(u"label_22")
+        sizePolicy3.setHeightForWidth(self.label_22.sizePolicy().hasHeightForWidth())
+        self.label_22.setSizePolicy(sizePolicy3)
+        self.label_22.setMinimumSize(QSize(60, 12))
+
+        self.horizontalLayout_17.addWidget(self.label_22)
+
+        self.comboBox_4 = QComboBox(self.groupBox_7)
+        self.comboBox_4.setObjectName(u"comboBox_4")
+
+        self.horizontalLayout_17.addWidget(self.comboBox_4)
+
+        self.pushButton_46 = QPushButton(self.groupBox_7)
+        self.pushButton_46.setObjectName(u"pushButton_46")
+
+        self.horizontalLayout_17.addWidget(self.pushButton_46)
+
+        self.horizontalLayout_17.setStretch(0, 1)
+        self.horizontalLayout_17.setStretch(1, 6)
+        self.horizontalLayout_17.setStretch(2, 1)
+
+        self.verticalLayout_17.addLayout(self.horizontalLayout_17)
+
+        self.horizontalLayout_16 = QHBoxLayout()
+        self.horizontalLayout_16.setObjectName(u"horizontalLayout_16")
+        self.label_23 = QLabel(self.groupBox_7)
+        self.label_23.setObjectName(u"label_23")
+        sizePolicy3.setHeightForWidth(self.label_23.sizePolicy().hasHeightForWidth())
+        self.label_23.setSizePolicy(sizePolicy3)
+        self.label_23.setMinimumSize(QSize(60, 12))
+
+        self.horizontalLayout_16.addWidget(self.label_23)
+
+        self.comboBox_10 = QComboBox(self.groupBox_7)
+        self.comboBox_10.setObjectName(u"comboBox_10")
+
+        self.horizontalLayout_16.addWidget(self.comboBox_10)
+
+        self.pushButton_47 = QPushButton(self.groupBox_7)
+        self.pushButton_47.setObjectName(u"pushButton_47")
+
+        self.horizontalLayout_16.addWidget(self.pushButton_47)
+
+        self.horizontalLayout_16.setStretch(0, 1)
+        self.horizontalLayout_16.setStretch(1, 6)
+        self.horizontalLayout_16.setStretch(2, 1)
+
+        self.verticalLayout_17.addLayout(self.horizontalLayout_16)
+
+        self.radioButton_2 = QRadioButton(self.groupBox_7)
+        self.radioButton_2.setObjectName(u"radioButton_2")
+
+        self.verticalLayout_17.addWidget(self.radioButton_2)
+
+
+        self.verticalLayout_18.addWidget(self.groupBox_7)
+
+        self.groupBox_8 = QGroupBox(self.tab_4)
+        self.groupBox_8.setObjectName(u"groupBox_8")
+        self.horizontalLayout_18 = QHBoxLayout(self.groupBox_8)
+        self.horizontalLayout_18.setObjectName(u"horizontalLayout_18")
+        self.horizontalLayout_15 = QHBoxLayout()
+        self.horizontalLayout_15.setObjectName(u"horizontalLayout_15")
+        self.label_24 = QLabel(self.groupBox_8)
+        self.label_24.setObjectName(u"label_24")
+        sizePolicy3.setHeightForWidth(self.label_24.sizePolicy().hasHeightForWidth())
+        self.label_24.setSizePolicy(sizePolicy3)
+        self.label_24.setMinimumSize(QSize(60, 12))
+
+        self.horizontalLayout_15.addWidget(self.label_24)
+
+        self.progressBar = QProgressBar(self.groupBox_8)
+        self.progressBar.setObjectName(u"progressBar")
+        self.progressBar.setValue(24)
+
+        self.horizontalLayout_15.addWidget(self.progressBar)
+
+        self.pushButton_48 = QPushButton(self.groupBox_8)
+        self.pushButton_48.setObjectName(u"pushButton_48")
+
+        self.horizontalLayout_15.addWidget(self.pushButton_48)
+
+        self.horizontalLayout_15.setStretch(0, 1)
+        self.horizontalLayout_15.setStretch(1, 6)
+        self.horizontalLayout_15.setStretch(2, 1)
+
+        self.horizontalLayout_18.addLayout(self.horizontalLayout_15)
+
+
+        self.verticalLayout_18.addWidget(self.groupBox_8)
+
+        self.verticalSpacer_3 = QSpacerItem(20, 282, QSizePolicy.Minimum, QSizePolicy.Expanding)
+
+        self.verticalLayout_18.addItem(self.verticalSpacer_3)
+
+        self.tabWidget.addTab(self.tab_4, "")
 
         self.horizontalLayout_4.addWidget(self.tabWidget)
 
         self.horizontalLayout_4.setStretch(0, 2)
-        self.horizontalLayout_4.setStretch(1, 8)
+        self.horizontalLayout_4.setStretch(1, 6)
 
         self.verticalLayout_5.addLayout(self.horizontalLayout_4)
 
@@ -597,6 +1010,17 @@
         self.horizontalLayout_3.addWidget(self.textEdit)
 
         self.tabWidget_2.addTab(self.tab_6, "")
+        self.tab_Consloe = QWidget()
+        self.tab_Consloe.setObjectName(u"tab_Consloe")
+        self.tab_Consloe.setLocale(QLocale(QLocale.Chinese, QLocale.China))
+        self.verticalLayout_16 = QVBoxLayout(self.tab_Consloe)
+        self.verticalLayout_16.setObjectName(u"verticalLayout_16")
+        self.textEdit_2 = QTextEdit(self.tab_Consloe)
+        self.textEdit_2.setObjectName(u"textEdit_2")
+
+        self.verticalLayout_16.addWidget(self.textEdit_2)
+
+        self.tabWidget_2.addTab(self.tab_Consloe, "")
 
         self.verticalLayout_5.addWidget(self.tabWidget_2)
 
@@ -609,8 +1033,8 @@
 
         self.retranslateUi(MainWindow)
 
-        self.tabWidget.setCurrentIndex(0)
-        self.tabWidget_2.setCurrentIndex(0)
+        self.tabWidget.setCurrentIndex(3)
+        self.tabWidget_2.setCurrentIndex(2)
 
 
         QMetaObject.connectSlotsByName(MainWindow)
@@ -625,10 +1049,9 @@
         self.pushButton_2.setText(QCoreApplication.translate("MainWindow", u"Refresh Port", None))
         self.pushButton.setText(QCoreApplication.translate("MainWindow", u"OPEN CAN", None))
         self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow", u"DataIdentifier", None))
-        self.label_2.setText(QCoreApplication.translate("MainWindow", u"DID", None))
-        self.label_4.setText(QCoreApplication.translate("MainWindow", u"Description", None))
-        self.label_5.setText(QCoreApplication.translate("MainWindow", u"Value", None))
-        self.label_6.setText("")
+        self.label_4.setText(QCoreApplication.translate("MainWindow", u"Name:", None))
+        self.label_2.setText(QCoreApplication.translate("MainWindow", u"DID:", None))
+        self.label_5.setText(QCoreApplication.translate("MainWindow", u"Value:", None))
         self.pushButton_14.setText(QCoreApplication.translate("MainWindow", u"Read", None))
         self.pushButton_3.setText(QCoreApplication.translate("MainWindow", u"Write", None))
         self.label_8.setText(QCoreApplication.translate("MainWindow", u"M SWVer.", None))
@@ -660,13 +1083,56 @@
         self.label_21.setText(QCoreApplication.translate("MainWindow", u"HW Ver.", None))
         self.pushButton_21.setText(QCoreApplication.translate("MainWindow", u"Read", None))
         self.SessionContrl_gbx.setTitle(QCoreApplication.translate("MainWindow", u"SessionControl(0x10)", None))
-        self.SessionContrl_gbx_3.setTitle(QCoreApplication.translate("MainWindow", u" ECUReset(0x11)", None))
+        self.SessionContrl_gbx_3.setTitle(QCoreApplication.translate("MainWindow", u"Security(0x27)", None))
         self.SessionContrl_gbx_4.setTitle(QCoreApplication.translate("MainWindow", u"CommControl(0x28)", None))
         self.SessionContrl_gbx_2.setTitle(QCoreApplication.translate("MainWindow", u"ClearDiag(0x14)", None))
         self.SessionContrl_gbx_5.setTitle(QCoreApplication.translate("MainWindow", u"TesterPresent(0x3E)", None))
         self.radioButton.setText("")
         self.pushButton_7.setText(QCoreApplication.translate("MainWindow", u"TesterPresent", None))
+        self.groupBox_3.setTitle(QCoreApplication.translate("MainWindow", u"Security Access", None))
+        self.pushButton_31.setText(QCoreApplication.translate("MainWindow", u"Unlock Level 1", None))
+        self.pushButton_32.setText(QCoreApplication.translate("MainWindow", u"Unlock Level 3", None))
         self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("MainWindow", u"UDS", None))
+        self.pushButton_9.setText(QCoreApplication.translate("MainWindow", u"Start Calibration", None))
+        self.pushButton_11.setText(QCoreApplication.translate("MainWindow", u"Calibration Z", None))
+        self.pushButton_13.setText(QCoreApplication.translate("MainWindow", u"Calibration M", None))
+        self.pushButton_18.setText(QCoreApplication.translate("MainWindow", u"Calibration M+", None))
+        self.pushButton_22.setText(QCoreApplication.translate("MainWindow", u"Calibration M-", None))
+        self.pushButton_24.setText(QCoreApplication.translate("MainWindow", u"Calibration X2", None))
+        self.pushButton_26.setText(QCoreApplication.translate("MainWindow", u"Calibration X1", None))
+        self.pushButton_27.setText(QCoreApplication.translate("MainWindow", u"Calibration Y1", None))
+        self.pushButton_28.setText(QCoreApplication.translate("MainWindow", u"Calibration Y2", None))
+        self.pushButton_29.setText(QCoreApplication.translate("MainWindow", u"Calibration Gap", None))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("MainWindow", u"\u6821\u51c6", None))
+        self.groupBox_6.setTitle(QCoreApplication.translate("MainWindow", u"\u6362\u6321\u5668\u72b6\u6001", None))
+        self.pushButton_35.setText(QCoreApplication.translate("MainWindow", u"M+", None))
+        self.pushButton_39.setText(QCoreApplication.translate("MainWindow", u"M", None))
+        self.pushButton_36.setText(QCoreApplication.translate("MainWindow", u"M-", None))
+        self.pushButton_37.setText(QCoreApplication.translate("MainWindow", u"X2", None))
+        self.pushButton_38.setText(QCoreApplication.translate("MainWindow", u"X1", None))
+        self.pushButton_30.setText(QCoreApplication.translate("MainWindow", u"Z", None))
+        self.pushButton_33.setText(QCoreApplication.translate("MainWindow", u"Y1", None))
+        self.pushButton_34.setText(QCoreApplication.translate("MainWindow", u"Y2", None))
+        self.pushButton_41.setText(QCoreApplication.translate("MainWindow", u"Unlock", None))
+        self.pushButton_40.setText(QCoreApplication.translate("MainWindow", u"Park", None))
+        self.groupBox_5.setTitle(QCoreApplication.translate("MainWindow", u"\u6362\u6321\u5668CAN", None))
+        self.label_6.setText(QCoreApplication.translate("MainWindow", u"CAN error:", None))
+        self.groupBox_4.setTitle(QCoreApplication.translate("MainWindow", u"TCU Command", None))
+        self.pushButton_42.setText(QCoreApplication.translate("MainWindow", u"P", None))
+        self.pushButton_45.setText(QCoreApplication.translate("MainWindow", u"R", None))
+        self.pushButton_44.setText(QCoreApplication.translate("MainWindow", u"N", None))
+        self.pushButton_43.setText(QCoreApplication.translate("MainWindow", u"D", None))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QCoreApplication.translate("MainWindow", u"\u529f\u80fd\u6307\u793a", None))
+        self.groupBox_7.setTitle(QCoreApplication.translate("MainWindow", u"Set File", None))
+        self.label_22.setText(QCoreApplication.translate("MainWindow", u"Load APP:", None))
+        self.pushButton_46.setText(QCoreApplication.translate("MainWindow", u"Load APP", None))
+        self.label_23.setText(QCoreApplication.translate("MainWindow", u"Set Log:", None))
+        self.pushButton_47.setText(QCoreApplication.translate("MainWindow", u"Set Log", None))
+        self.radioButton_2.setText(QCoreApplication.translate("MainWindow", u"Start from boot", None))
+        self.groupBox_8.setTitle(QCoreApplication.translate("MainWindow", u"Progress", None))
+        self.label_24.setText(QCoreApplication.translate("MainWindow", u"Progress:", None))
+        self.pushButton_48.setText(QCoreApplication.translate("MainWindow", u"Program", None))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), QCoreApplication.translate("MainWindow", u"Bootloader", None))
         ___qtablewidgetitem = self.tableWidget.horizontalHeaderItem(0)
         ___qtablewidgetitem.setText(QCoreApplication.translate("MainWindow", u"\u5e8f\u53f7", None));
         ___qtablewidgetitem1 = self.tableWidget.horizontalHeaderItem(1)
@@ -683,5 +1149,6 @@
         ___qtablewidgetitem6.setText(QCoreApplication.translate("MainWindow", u"\u6570\u636e", None));
         self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_logger), QCoreApplication.translate("MainWindow", u"logging", None))
         self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_6), QCoreApplication.translate("MainWindow", u"Graphic", None))
+        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_Consloe), QCoreApplication.translate("MainWindow", u"Console", None))
     # retranslateUi
 
diff --git a/DBC/SX7H.dbc b/DBC/SX7H.dbc
new file mode 100644
index 0000000..b2931bd
--- /dev/null
+++ b/DBC/SX7H.dbc
@@ -0,0 +1,110 @@
+VERSION ""
+
+
+NS_ : 
+	NS_DESC_
+	CM_
+	BA_DEF_
+	BA_
+	VAL_
+	CAT_DEF_
+	CAT_
+	FILTER
+	BA_DEF_DEF_
+	EV_DATA_
+	ENVVAR_DATA_
+	SGTYPE_
+	SGTYPE_VAL_
+	BA_DEF_SGTYPE_
+	BA_SGTYPE_
+	SIG_TYPE_REF_
+	VAL_TABLE_
+	SIG_GROUP_
+	SIG_VALTYPE_
+	SIGTYPE_VALTYPE_
+	BO_TX_BU_
+	BA_DEF_REL_
+	BA_REL_
+	BA_DEF_DEF_REL_
+	BU_SG_REL_
+	BU_EV_REL_
+	BU_BO_REL_
+	SG_MUL_VAL_
+
+BS_:
+
+BU_: SA1
+VAL_TABLE_ SA1_Status_PRNDL_VT 7 "Invalid" 6 "Reserved" 5 "Reserved" 4 "Reserved" 3 "R" 2 "N" 1 "D" 0 "P" ;
+VAL_TABLE_ SA1_Status_RqGearPosInV_VT 15 "Zero" 14 "Reserved" 13 "X2" 12 "X1" 11 "Y1" 10 "Y2" 9 "Reserved" 8 "Reserved" 7 "Shifter not initialized" 6 "Reserved" 5 "Reserved" 4 "Reserved" 3 "M-" 2 "M+" 1 "M" 0 "Signal not available" ;
+VAL_TABLE_ ActualGear_VT 15 "Invalid" 14 "Reserved" 13 "Current_gear_P" 12 "Reserved" 11 "Current_gear_R" 10 "Reserved" 9 "Reserved" 8 "Reserved" 7 "Current_gear_7" 6 "Current_gear_6" 5 "Current_gear_5" 4 "Current_gear_4" 3 "Current_gear_3" 2 "Current_gear_2" 1 "Current_gear_1" 0 "Current_gear_N" ;
+VAL_TABLE_ TCUDrivingMode_VT 7 "Invalid" 6 "Reserved" 5 "Reserved" 4 "Sport" 3 "Reserved" 2 "Manual" 1 "Snow Mode" 0 "Standard" ;
+VAL_TABLE_ ShiftLeverPos_VT 7 "Invalid" 6 "M-" 5 "M+" 4 "M" 3 "R" 2 "N" 1 "D" 0 "P" ;
+VAL_TABLE_ SA1_Status_ShiftPosValidFlag_VT 1 "Invalid" 0 "Valid" ;
+VAL_TABLE_ SA1_Status_GearShftPosReq 15 "Signal not available" 14 "M" 13 "M+" 12 "M-" 11 "Reserved" 10 "Reserved" 9 "Reserved" 8 "Shifter not initialized" 7 "Reserved" 6 "Reserved" 5 "Y2 backward twice" 4 "Y1 backward once" 3 "X1 forward once" 2 "X2 forward twice" 1 "Reserved" 0 "Shifter position Zero" ;
+VAL_TABLE_ SA1_Status_ParkButtonReq_VT 3 "Reserved" 2 "Park button fault" 1 "Driver request park button" 0 "No request" ;
+VAL_TABLE_ SA1_Status_UnlockButtonReq_VT 1 "Driver request unlock button" 0 "No request" ;
+VAL_TABLE_ SA1_Status_EcoShifterModeReq_VT 1 "Request" 0 "No request" ;
+VAL_TABLE_ SA1_Status_ShftSensSng_Fault_VT 1 "Shift sensor single fault" 0 "Shift sensor single ok" ;
+VAL_TABLE_ SA1_IND_ShifterMisUsd_VT 7 "Reserved" 6 "Please make sure in Parkposition" 5 "Reserved" 4 "Press brake and unlock to change" 3 "Push unlockto change gear" 2 "Speed is too high to change gear" 1 "Press brake pedal to chage gear" 0 "Invalid" ;
+VAL_TABLE_ SA1_ShifterManualSignal_VT 7 "Invalid" 6 "Reserved" 5 "Reserved" 4 "Reserved" 3 "M- position" 2 "M+ position" 1 "Manual positon" 0 "Not Manual" ;
+VAL_TABLE_ SA1_ShifterModeSignal_VT 3 "Error" 2 "Winter mode" 1 "Sport Mode" 0 "Normal Mode" ;
+VAL_TABLE_ brake_pedal_status_VT 3 "Invalid" 2 "Not specified" 1 "Brake actuated" 0 "Brake not actuated" ;
+VAL_TABLE_ Shifter_Lever_Signals_VT 15 "Invalid" 11 "Z4(Between D and L)" 10 "Z3(Between N and D)" 9 "Z2(Between R and N)" 8 "Z1(Between P and R)" 7 "P" 6 "R" 5 "N" 4 "D" 3 "Sport mode,display PWR on IC" 0 "Unkown" ;
+
+
+BO_ 534 CVT1: 1 Vector__XXX
+ SG_ Shifter_Lever_Signals : 63|8@0+ (1,0) [0|0] "" Vector__XXX
+
+BO_ 329 IC1: 3 Vector__XXX
+ SG_ odometer_value : 47|24@0+ (1,0) [0|0] "" Vector__XXX
+
+BO_ 530 Engine2: 1 Vector__XXX
+ SG_ brake_pedal_status : 57|2@0+ (1,0) [0|0] "" Vector__XXX
+
+BO_ 512 ABS1: 3 Vector__XXX
+ SG_ vehicle_speed : 15|13@0+ (0.05625,0) [0|0] "" Vector__XXX
+
+BO_ 16 TCU2: 3 Vector__XXX
+ SG_ Calibartion : 23|8@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ ActualGear : 11|4@1+ (1,0) [0|0] "" Vector__XXX
+ SG_ TCUDrivingMode : 10|3@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ ShiftLeverPos : 2|3@0+ (1,0) [0|0] "" Vector__XXX
+
+BO_ 1056 SA1: 8 Vector__XXX
+ SG_ Angle2 : 55|16@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ Angle1 : 39|16@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Status_ShiftPosValidFlag : 27|1@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Status_RqGearPosInV : 31|4@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Status_GearShftPosReq : 23|4@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Status_ParkButtonReq : 19|2@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Status_UnlockButtonReq : 17|1@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Status_EcoShifterModeReq : 16|1@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Status_ShftSensSng_Fault : 15|1@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_IND_ShifterMisUsd : 14|3@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Live_counter : 11|4@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_Status_PRNDL : 7|3@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_ShifterManualSignal : 4|3@0+ (1,0) [0|0] "" Vector__XXX
+ SG_ SA1_ShifterModeSignal : 1|2@0+ (1,0) [0|0] "" Vector__XXX
+
+
+
+BA_DEF_  "BusType" STRING ;
+BA_DEF_DEF_  "BusType" "CAN";
+VAL_ 534 Shifter_Lever_Signals 15 "Invalid" 11 "Z4(Between D and L)" 10 "Z3(Between N and D)" 9 "Z2(Between R and N)" 8 "Z1(Between P and R)" 7 "P" 6 "R" 5 "N" 4 "D" 3 "Sport mode,display PWR on IC" 0 "Unkown" ;
+VAL_ 530 brake_pedal_status 3 "Invalid" 2 "Not specified" 1 "Brake actuated" 0 "Brake not actuated" ;
+VAL_ 16 Calibartion 10 "Finish" 9 "CAL_GAP" 8 "CAL_Y2" 7 "CAL_Y1" 6 "CAL_X1" 5 "CAL_X2" 4 "CAL_MN" 3 "CAL_MP" 2 "CAL_M" 1 "CAL_Z" 0 "start" ;
+VAL_ 16 ActualGear 15 "Invalid" 14 "Reserved" 13 "Current_gear_P" 12 "Reserved" 11 "Current_gear_R" 10 "Reserved" 9 "Reserved" 8 "Reserved" 7 "Current_gear_7" 6 "Current_gear_6" 5 "Current_gear_5" 4 "Current_gear_4" 3 "Current_gear_3" 2 "Current_gear_2" 1 "Current_gear_1" 0 "Current_gear_N" ;
+VAL_ 16 TCUDrivingMode 7 "Invalid" 6 "Reserved" 5 "Reserved" 4 "Sport" 3 "Reserved" 2 "Manual" 1 "Snow Mode" 0 "Standard" ;
+VAL_ 16 ShiftLeverPos 7 "Invalid" 6 "M-" 5 "M+" 4 "M" 3 "R" 2 "N" 1 "D" 0 "P" ;
+VAL_ 1056 SA1_Status_ShiftPosValidFlag 1 "Invalid" 0 "Valid" ;
+VAL_ 1056 SA1_Status_RqGearPosInV 15 "Zero" 14 "Reserved" 13 "X2" 12 "X1" 11 "Y1" 10 "Y2" 9 "Reserved" 8 "Reserved" 7 "Shifter not initialized" 6 "Reserved" 5 "Reserved" 4 "Reserved" 3 "M-" 2 "M+" 1 "M" 0 "Signal not available" ;
+VAL_ 1056 SA1_Status_GearShftPosReq 15 "Signal not available" 14 "M" 13 "M+" 12 "M-" 11 "Reserved" 10 "Reserved" 9 "Reserved" 8 "Shifter not initialized" 7 "Reserved" 6 "Reserved" 5 "Y2 backward twice" 4 "Y1 backward once" 3 "X1 forward once" 2 "X2 forward twice" 1 "Reserved" 0 "Shifter position Zero" ;
+VAL_ 1056 SA1_Status_ParkButtonReq 3 "Reserved" 2 "Park button fault" 1 "Driver request park button" 0 "No request" ;
+VAL_ 1056 SA1_Status_UnlockButtonReq 1 "Driver request unlock button" 0 "No request" ;
+VAL_ 1056 SA1_Status_EcoShifterModeReq 1 "Request" 0 "No request" ;
+VAL_ 1056 SA1_Status_ShftSensSng_Fault 1 "Shift sensor single fault" 0 "Shift sensor single ok" ;
+VAL_ 1056 SA1_IND_ShifterMisUsd 7 "Reserved" 6 "Please make sure in Parkposition" 5 "Reserved" 4 "Press brake and unlock to change" 3 "Push unlockto change gear" 2 "Speed is too high to change gear" 1 "Press brake pedal to chage gear" 0 "Invalid" ;
+VAL_ 1056 SA1_Status_PRNDL 7 "Invalid" 6 "Reserved" 5 "Reserved" 4 "Reserved" 3 "R" 2 "N" 1 "D" 0 "P" ;
+VAL_ 1056 SA1_ShifterManualSignal 7 "Invalid" 6 "Reserved" 5 "Reserved" 4 "Reserved" 3 "M- position" 2 "M+ position" 1 "Manual positon" 0 "Not Manual" ;
+VAL_ 1056 SA1_ShifterModeSignal 3 "Error" 2 "Winter mode" 1 "Sport Mode" 0 "Normal Mode" ;
+
diff --git a/Shifter.py b/Shifter.py
index fb8f852..c920bd0 100644
--- a/Shifter.py
+++ b/Shifter.py
@@ -4,6 +4,7 @@
 from udsoncan import DidCodec
 
 import configparser
+from dbc import *
 
 
 class AsciiCodec(DidCodec):
@@ -138,21 +139,36 @@
         self.UnlockButton = 0
         self.Voltage = 0
         self.canid = ShifterCANID()
+
         self.did_config = {
+            0x2100: PartNumberCodec(1),
+            0x2101: PartNumberCodec(1),
+            0x2103: AsciiCodec(8),
+            0x2104: AsciiCodec(4),
+            0x2105: AsciiCodec(16),
+            0x2106: PartNumberCodec(1),
+            0xF187: AsciiCodec(16),
+            0x2108: AsciiCodec(18),
+            0xF18A: AsciiCodec(10),
+            0x210B: BCDCodec(4),
+            0xF18C: AsciiCodec(14),
             0xF190: AsciiCodec(17),
-            0xF1B1: AsciiCodec(9),
-            0xF1B2: AsciiCodec(16),
+            0xF193: AsciiCodec(26),
+            0xF195: AsciiCodec(28),
+            0x2110: AsciiCodec(8),
+            0x2111: AsciiCodec(16),
+            0x2112: BCDCodec(4),
+            0x2113: BCDCodec(4),
+            0x2116: PartNumberCodec(2),
+            0x2118: PartNumberCodec(1),
+            0x2119: PartNumberCodec(1),
+            0x211A: PartNumberCodec(1),
+            0x211B: PartNumberCodec(1),
+            0x211c: PartNumberCodec(2),
+            0xF197: AsciiCodec(8),
 
-            0xF1D0: PartNumberCodec(4),
-            0xF1D1: PartNumberVersionCodec(2),
-            0xF1D2: PartNumberCodec(4),
-            0xF1D3: PartNumberVersionCodec(2),
-            0xF0DF: PartNumberVersionCodec(1),
-
-            0xF187: AsciiCodec(21),
-            0xF195: AsciiCodec(16),
-            0xF198: BCDCodec(8),
-            0xF199: BCDCodec(4),
+            0xF15a: AsciiCodec(10),
+            0xF15B: AsciiCodec(10),
         }
         try:
             config = configparser.ConfigParser()
@@ -166,3 +182,13 @@
             self.canid.phy_rxId = 0x742
             self.canid.fun_rxId = 0x7df
             self.canid.normalid = 0x420
+        self.dbc = DBC("DBC/SX7H.dbc")
+
+    def FramUnpack(self, id=0x420, frame=[]):
+        data = []
+        data.append(' '.join(['0x' +
+                              '{:0<2x}'.format(a).upper() for a in list(frame)]))
+        unpackframe = self.dbc.analyzer(msgid=0x420, data=data)
+        self.position = ShifterPosition(unpackframe[4]['value']['raw'])
+        self.Pbutton = unpackframe[5]['value']['raw']
+        self.UnlockButton = unpackframe[6]['value']['raw']
diff --git a/ShifterDefine.py b/ShifterDefine.py
index 0ea44fb..e2e3577 100644
--- a/ShifterDefine.py
+++ b/ShifterDefine.py
@@ -1,6 +1,7 @@
 
 
 from enum import Enum, IntEnum
+Security_dic = {"0x01请求种子": 1, "0x02发送密钥": 2}
 
 
 class ShifterCANID():
@@ -22,3 +23,38 @@
     ShiftPosM_Plus = 0xd
     ShiftPosM = 0xe
     ShiftNotAvailable = 0xF
+
+
+DID_dic = {
+    "ProgrammingCounter": 0x2100,
+    "ProAtpCounter": 0x2101,
+    "BackupConfig": 0x2102,
+    "VehicleName": 0x2103,
+    "DiagVersion": 0x2104,
+    "BootSoftId": 0x2105,
+    "DFLZMPartNum": 0xF187,
+    "VehiclEECUSoftwareVersion": 0x2108,
+    "SupplierID": 0xF18A,
+    "ECUManufacturingDate": 0x210B,
+    "ECUSerialNumID": 0xf18c,
+    "VINDataIdentifier": 0xF190,
+    "ECUHardwareVersion": 0xF193,
+    "ECUSoftwareVersion": 0xF195,
+    "SystemNameOrEngineType": 0x2110,
+    "RepairShopCodeOrTester": 0x2111,
+    "ECUProgtammingDate": 0x2111,
+    "InstallDate": 0x2113,
+    "NetConfig": 0xf019,
+    "FunctionConfig": 0xf010,
+    "ActiveDiagSession": 0x2106,
+    "EGSMSensorPositon": 0x2116,
+    "ReleaseButtonState": 0x2118,
+    "PButtionState": 0x2119,
+    "PaddleState": 0x211A,
+    "ECUPowerVoltage": 0x211B,
+    "VehicleSpeed": 0x211c,
+    "SystemName": 0xF197,
+    "WriteFingerPrint": 0xF15A,
+    "ReadFingerPrint": 0xf15b,
+    "IndicationLEDControl": 0x8101
+}
diff --git a/USBCAN.py b/USBCAN.py
index 70248b3..89eebe0 100644
--- a/USBCAN.py
+++ b/USBCAN.py
@@ -6,7 +6,7 @@
 import logging
 from can import BusABC, Message
 import time
-from multiprocessing import Queue, Value
+from multiprocessing import Queue, Value, Pipe
 
 USBCAN_DEVICE_TYPE = c_uint
 
@@ -412,26 +412,23 @@
             needClose {Value} -- disconnect when needed
             msgQueue {Queue} -- received data
         '''
-        loopCnt = 0
-        while connectRet.value == 1:
-            # print(connectRet.value, needClose.value, start.value)
-            if needClose.value == 1:
-                ret = self.CloseDevice()
-                if ret == 1:
-                    needClose.value = 0
-                    connectRet.value = 0
-                return
-            msgToSendCnt = sendQueue.qsize()
-            if msgToSendCnt > 0:
-                msg = Message()
-                for i in range(msgToSendCnt):
-                    msg = sendQueue.get()
-                    self.send(msg, 1)
-                    time.sleep(0.001)
-            loopCnt += 1
-            if loopCnt >= 15:
-                loopCnt = 0
-                # restNum = self.GetReceiveNum() if self.GetReceiveNum() <= 10 else 10
+        while True:
+            while connectRet.value == 1:
+                # print(connectRet.value, needClose.value, start.value)
+                if needClose.value == 1:
+                    ret = self.CloseDevice()
+                    if ret == 1:
+                        needClose.value = 0
+                        connectRet.value = 0
+                    return
+                # msgToSendCnt = sendQueue.qsize()
+                # if msgToSendCnt > 0:
+                #     msg = Message()
+                #     for i in range(msgToSendCnt):
+                #         msg = sendQueue.get()
+                #         self.send(msg, 1)
+                #         time.sleep(0.001)
+                # loopCnt += 1
                 revRet, num = self.Receive(len=10)
                 if num == 0:
                     pass
@@ -440,3 +437,4 @@
                         msgQueue.put(revRet[i])
                         self.logger.info(
                             "received can message.it't id is:{}".format(str(revRet[i].arbitration_id)))
+                time.sleep(0.05)
diff --git a/dbc.py b/dbc.py
new file mode 100644
index 0000000..9e7a470
--- /dev/null
+++ b/dbc.py
@@ -0,0 +1,621 @@
+# reference: https://github.com/ebroecker/canmatrix
+
+# this script translates dbc-files to list data
+import sys
+import os
+import logging
+import re
+import attr
+import math
+import decimal
+
+defaultFloatFactory = decimal.Decimal
+dbcImportEncoding = 'iso-8859-1'
+
+logging.basicConfig(
+    level=logging.DEBUG,
+    format=
+    '%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s')
+
+MOTOROLA = 0
+INTERL = 1
+UNSIGNED = 0
+SIGNED = 1
+
+def normalizeValueTable(table):
+    return {int(k): v for k, v in table.items()}
+
+@attr.s(cmp=False)
+class Frame:
+    """
+    Contains one CAN Frame.
+    The Frame has  following mandatory attributes
+    * id,
+    * name,
+    * transmitters (list of boardunits/ECU-names),
+    * size (= DLC),
+    * signals (list of signal-objects),
+    * attributes (list of attributes),
+    * receiver (list of boardunits/ECU-names),
+    * extended (Extended Frame = 1),
+    * comment
+    and any *custom* attributes in `attributes` dict.
+    Frame signals can be accessed using the iterator.
+    """
+
+    name = attr.ib(default="")
+    id = attr.ib(type=int, default=0)
+    size = attr.ib(default=0)
+    transmitters = attr.ib(default=attr.Factory(list))
+    extended = attr.ib(type=bool, default=False)
+    is_complex_multiplexed = attr.ib(type=bool, default=False)
+    is_fd = attr.ib(type=bool, default=False)
+    comment = attr.ib(default="")
+    signals = attr.ib(default=attr.Factory(list))
+    mux_names = attr.ib(type=dict, default=attr.Factory(dict))
+    attributes = attr.ib(type=dict, default=attr.Factory(dict))
+    receiver = attr.ib(default=attr.Factory(list))
+    signalGroups = attr.ib(default=attr.Factory(list))
+    cycle = attr.ib(type=int, default=0)
+
+    j1939_pgn = attr.ib(default=None)
+    j1939_source = attr.ib(default=0)
+    j1939_prio = attr.ib(default=0)
+    is_j1939 = attr.ib(type=bool, default=False)
+
+    def calcDLC(self):
+        """
+        Compute minimal Frame DLC (length) based on its Signals
+        :return: Message DLC
+        """
+        maxBit = 0
+        for sig in self.signals:
+            if sig.getStartbit() + int(sig.size) > maxBit:
+                maxBit = sig.getStartbit() + int(sig.size)
+        self.size = max(self.size, int(math.ceil(maxBit / 8)))
+    
+    def setFdType(self):
+        """Try to guess and set the CAN type for every frame.
+        If a Frame is longer than 8 bytes, it must be Flexible Data Rate frame (CAN-FD).
+        If not, the Frame type stays unchanged.
+        """
+        for frame in self.frames:
+            if frame.size > 8:
+                frame.is_fd = True
+
+    def findNotUsedBits(self):
+        """
+        Find unused bits in frame
+        :return: dict with position and length-tuples
+        """
+        bitfield = []
+        bitfieldLe = []
+        bitfieldBe = []
+
+        for i in range(0,64):
+            bitfieldBe.append(0)
+            bitfieldLe.append(0)
+            bitfield.append(0)
+        i = 0
+
+        for sig in self.signals:
+            i += 1
+            for bit in range(sig.getStartbit(),  sig.getStartbit() + int(sig.size)):
+                if sig.is_little_endian:
+                    bitfieldLe[bit] = i
+                else:
+                    bitfieldBe[bit] = i
+
+        for i in range(0,8):
+            for j in range(0,8):
+                bitfield[i*8+j] = bitfieldLe[i*8+(7-j)]
+
+        for i in range(0,8):
+            for j in range(0,8):
+                if bitfield[i*8+j] == 0:
+                    bitfield[i*8+j] = bitfieldBe[i*8+j]
+
+
+        return bitfield
+
+    def addSignal(self, signal):
+        """
+        Add Signal to Frame.
+        :param Signal signal: Signal to be added.
+        :return: the signal added.
+        """
+        self.signals.append(signal)
+        return self.signals[len(self.signals) - 1]
+
+
+@attr.s(cmp=False)
+class Signal(object):
+    """
+    Represents a Signal in CAN Matrix.
+    Signal has following attributes:
+    * name
+    * startBit, size (in Bits)
+    * is_little_endian (1: Intel, 0: Motorola)
+    * is_signed (bool)
+    * factor, offset, min, max
+    * receiver  (Boarunit/ECU-Name)
+    * attributes, _values, unit, comment
+    * _multiplex ('Multiplexor' or Number of Multiplex)
+    """
+
+    name = attr.ib(default = "")
+    #    float_factory = attr.ib(default=defaultFloatFactory)
+    float_factory = defaultFloatFactory
+    startBit = attr.ib(type=int, default=0)
+    size = attr.ib(type=int, default = 0)
+    is_little_endian = attr.ib(type=bool, default = True)
+    is_signed = attr.ib(type=bool, default = True)
+    offset = attr.ib(converter = float_factory, default = float_factory(0.0))
+    factor = attr.ib(converter = float_factory, default = float_factory(1.0))
+
+    #    offset = attr.ib(converter = float_factory, default = 0.0)
+
+    min  = attr.ib(converter=float_factory)
+    @min.default
+    def setDefaultMin(self):
+        return  self.calcMin()
+
+    max =  attr.ib(converter = float_factory)
+    @max.default
+    def setDefaultMax(self):
+        return  self.calcMax()
+
+    unit = attr.ib(type=str, default ="")
+    receiver = attr.ib(default = attr.Factory(list))
+    comment = attr.ib(default = None)
+    multiplex  = attr.ib(default = None)
+
+    mux_value = attr.ib(default = None)
+    is_float = attr.ib(type=bool, default=False)
+    enumeration = attr.ib(type=str, default = None)
+    comments = attr.ib(type=dict, default = attr.Factory(dict))
+    attributes = attr.ib(type=dict, default = attr.Factory(dict))
+    values = attr.ib(type=dict, converter=normalizeValueTable, default = attr.Factory(dict))
+    calc_min_for_none = attr.ib(type=bool, default = True)
+    calc_max_for_none = attr.ib(type=bool, default = True)
+    muxValMax = attr.ib(default = 0)
+    muxValMin = attr.ib(default = 0)
+    muxerForSignal= attr.ib(type=str, default = None)
+
+    def __attrs_post_init__(self):
+        self.multiplex = self.multiplexSetter(self.multiplex)
+
+
+    @property
+    def spn(self):
+        """Get signal J1939 SPN or None if not defined."""
+        return self.attributes.get("SPN", None)
+
+    def multiplexSetter(self, value):
+        self.mux_val = None
+        self.is_multiplexer = False
+        if value is not None and value != 'Multiplexor':
+            ret_multiplex = int(value)
+            self.mux_val = int(value)
+        else:  # is it valid for None too?
+            self.is_multiplexer = True
+            ret_multiplex = value
+        return ret_multiplex
+
+    def attribute(self, attributeName, db=None, default=None):
+        """Get any Signal attribute by its name.
+        :param str attributeName: attribute name, can be mandatory (ex: startBit, size) or optional (customer) attribute.
+        :param CanMatrix db: Optional database parameter to get global default attribute value.
+        :param default: Default value if attribute doesn't exist.
+        :return: Return the attribute value if found, else `default` or None
+        """
+        if attributeName in attr.fields_dict(type(self)):
+            return getattr(self, attributeName)
+        if attributeName in self.attributes:
+            return self.attributes[attributeName]
+        if db is not None:
+            if attributeName in db.signalDefines:
+                define = db.signalDefines[attributeName]
+                return define.defaultValue
+        return default
+
+    def setStartbit(self, startBit, bitNumbering=None, startLittle=None):
+        """
+        Set startBit.
+        bitNumbering is 1 for LSB0/LSBFirst, 0 for MSB0/MSBFirst.
+        If bit numbering is consistent with byte order (little=LSB0, big=MSB0)
+        (KCD, SYM), start bit unmodified.
+        Otherwise reverse bit numbering. For DBC, ArXML (OSEK),
+        both little endian and big endian use LSB0.
+        If bitNumbering is None, assume consistent with byte order.
+        If startLittle is set, given startBit is assumed start from lsb bit
+        rather than the start of the signal data in the message data.
+        """
+        # bit numbering not consistent with byte order. reverse
+        if bitNumbering is not None and bitNumbering != self.is_little_endian:
+            startBit = startBit - (startBit % 8) + 7 - (startBit % 8)
+        # if given startBit is for the end of signal data (lsbit),
+        # convert to start of signal data (msbit)
+        if startLittle is True and self.is_little_endian is False:
+            startBit = startBit + 1 - self.size
+        if startBit < 0:
+            print("wrong startBit found Signal: %s Startbit: %d" %
+                  (self.name, startBit))
+            raise Exception("startBit lower zero")
+        self.startBit = startBit
+
+    def getStartbit(self, bitNumbering=None, startLittle=None):
+        """Get signal start bit. Handle byte and bit order."""
+        startBitInternal = self.startBit
+        # convert from big endian start bit at
+        # start bit(msbit) to end bit(lsbit)
+        if startLittle is True and self.is_little_endian is False:
+            startBitInternal = startBitInternal + self.size - 1
+        # bit numbering not consistent with byte order. reverse
+        if bitNumbering is not None and bitNumbering != self.is_little_endian:
+            startBitInternal = startBitInternal - (startBitInternal % 8) + 7 - (startBitInternal % 8)
+        return int(startBitInternal)
+
+    def calculateRawRange(self):
+        """Compute raw signal range based on Signal bit width and whether the Signal is signed or not.
+        :return: Signal range, i.e. (0, 15) for unsigned 4 bit Signal or (-8, 7) for signed one.
+        :rtype: tuple
+        """
+        rawRange = 2 ** (self.size - (1 if self.is_signed else 0))
+        return (self.float_factory(-rawRange if self.is_signed else 0),
+                self.float_factory(rawRange - 1))
+
+    def calcMin(self):
+        """Compute minimal physical Signal value based on offset and factor and `calculateRawRange`."""
+        rawMin = self.calculateRawRange()[0]
+
+        return self.offset + (rawMin * self.factor)
+
+    def calcMax(self):
+        """Compute maximal physical Signal value based on offset, factor and `calculateRawRange`."""
+        rawMax = self.calculateRawRange()[1]
+
+        return self.offset + (rawMax * self.factor)
+
+    def bitstruct_format(self):
+        """Get the bit struct format for this signal.
+        :return: bitstruct representation of the Signal
+        :rtype: str
+        """
+        endian = '<' if self.is_little_endian else '>'
+        if self.is_float:
+            bit_type = 'f'
+        else:
+            bit_type = 's' if self.is_signed else 'u'
+
+        return endian + bit_type + str(self.size)
+
+    def phys2raw(self, value=None):
+        """Return the raw value (= as is on CAN).
+        :param value: (scaled) value or value choice to encode
+        :return: raw unscaled value as it appears on the bus
+        """
+        if value is None:
+            return int(self.attributes.get('GenSigStartValue', 0))
+
+        if isinstance(value, str):
+            for value_key, value_string in self.values.items():
+                if value_string == value:
+                    value = value_key
+                    break
+            else:
+                raise ValueError(
+                        "{} is invalid value choice for {}".format(value, self)
+                )
+
+        if not (self.min <= value <= self.max):
+            print(
+                "Value {} is not valid for {}. Min={} and Max={}".format(
+                    value, self, self.min, self.max)
+                )
+        raw_value = (value - self.offset) / self.factor
+
+        if not self.is_float:
+            raw_value = int(raw_value)
+        return raw_value
+
+    def raw2phys(self, value, decodeToStr=False):
+        """Decode the given raw value (= as is on CAN)
+        :param value: raw value
+        :param bool decodeToStr: If True, try to get value representation as *string* ('Init' etc.)
+        :return: physical value (scaled)
+        """
+
+        value = value * self.factor + self.offset
+        if decodeToStr:
+            for value_key, value_string in self.values.items():
+                if value_key == value:
+                    value = value_string
+                    break
+
+        return value
+
+    def __str__(self):
+        return self.name
+
+class DBC:
+    def __init__(self, dbcfile=None):
+        self.filePath = dbcfile
+        self.frames = self.__load()
+        self.__setFdType()
+        self.__setExtended()
+
+    def __load(self):
+        frameList = []
+        i = 0
+        frame = None
+        with open(self.filePath, mode='r', encoding='gb2312') as f:
+            for line in f.readlines():
+                i = i + 1
+                l = line.strip()
+                if len(l) == 0:
+                    continue
+                # logging.info(l)
+                if l.startswith('BO_ '):
+                    # frames
+                    regexp = re.compile("^BO\_ ([^\ ]+) ([^\ ]+) *: ([^\ ]+) ([^\ ]+)")
+                    temp = regexp.match(l)
+                    # name, id, dlc, transmitters
+                    frame = Frame(
+                        temp.group(2),
+                        id=int(temp.group(1)),
+                        size=int(temp.group(3)),
+                        transmitters=temp.group(4).split())
+                    frameList.append(frame)
+                    pass
+                elif l.startswith('SG_ '):
+                    # signals
+                    pattern = "^SG\_ +(\w+) *: *(\d+)\|(\d+)@(\d+)([\+|\-]) +\(([0-9.+\-eE]+),([0-9.+\-eE]+)\) +\[([0-9.+\-eE]+)\|([0-9.+\-eE]+)\] +\"(.*)\" +(.*)"
+                    regexp = re.compile(pattern)
+                    temp = regexp.match(l)
+                    if temp:
+                        extras = {}
+                        receiver = list(map(str.strip, temp.group(11).split(',')))
+                        tempSig = Signal(
+                            temp.group(1),
+                            startBit=int(temp.group(2)),
+                            size=int(temp.group(3)),
+                            is_little_endian=(int(temp.group(4)) == 1),
+                            is_signed=(temp.group(5) == '-'),
+                            factor=temp.group(6),
+                            offset=temp.group(7),
+                            min=temp.group(8),
+                            max=temp.group(9),
+                            unit=temp.group(10),
+                            receiver=receiver,
+                            **extras
+                        )
+                        if not tempSig.is_little_endian:
+                            # startbit of motorola coded signals are MSB in dbc
+                            tempSig.setStartbit(int(temp.group(2)), bitNumbering=1)
+                        frame.signals.append(tempSig)
+                    else:
+                        pattern = "^SG\_ +(\w+) +(\w+) *: *(\d+)\|(\d+)@(\d+)([\+|\-]) +\(([0-9.+\-eE]+),([0-9.+\-eE]+)\) +\[([0-9.+\-eE]+)\|([0-9.+\-eE]+)\] +\"(.*)\" +(.*)"
+                        regexp = re.compile(pattern)
+                        temp = regexp.match(l)
+                        receiver = list(map(str.strip, temp.group(12).split(',')))
+                        multiplex = temp.group(2)
+
+                        is_complex_multiplexed = False
+
+                        if multiplex == 'M':
+                            multiplex = 'Multiplexor'
+                        elif multiplex.endswith('M'):
+                            is_complex_multiplexed = True
+                            multiplex = multiplex[:-1]
+
+                        if multiplex != 'Multiplexor':
+                            try:
+                                multiplex = int(multiplex[1:])
+                            except:
+                                raise Exception('error decoding line',line)
+
+                        extras = {}
+
+                        tempSig = Signal(
+                            temp.group(1),
+                            startBit=int(temp.group(3)),
+                            size=int(temp.group(4)),
+                            is_little_endian=(int(temp.group(5)) == 1),
+                            is_signed=(temp.group(6) == '-'),
+                            factor=temp.group(7),
+                            offset=temp.group(8),
+                            min=temp.group(9),
+                            max=temp.group(10),
+                            unit=temp(11),
+                            receiver=receiver,
+                            multiplex=multiplex,
+                            **extras
+                        )
+
+                        if is_complex_multiplexed:
+                            tempSig.is_multiplexer = True
+                            tempSig.multiplex = 'Multiplexor'
+
+                        if not tempSig.is_little_endian:
+                            # startbit of motorola coded signals are MSB in dbc
+                            tempSig.setStartbit(int(temp.group(3)), bitNumbering=1)
+                        frame.addSignal(tempSig)
+
+                        if is_complex_multiplexed:
+                            frame.is_complex_multiplexed = True
+                elif l.startswith("BO_TX_BU_ "):
+                    regexp = re.compile("^BO_TX_BU_ ([0-9]+) *: *(.+);")
+                    temp = regexp.match(l)
+                elif l.startswith("CM_ SG_ "):
+                    pass
+                elif l.startswith("CM_ BO_ "):
+                    pattern = "^CM\_ +BO\_ +(\w+) +\"(.*)\";"
+                    regexp = re.compile(pattern)
+                elif l.startswith("CM_ BU_ "):
+                    pattern = "^CM\_ +BU\_ +(\w+) +\"(.*)\";"
+                    regexp = re.compile(pattern)
+                elif l.startswith("BU_:"):
+                    pattern = "^BU\_\:(.*)"
+                    regexp = re.compile(pattern)
+                elif l.startswith("VAL_ "):
+                    regexp = re.compile("^VAL\_ +(\w+) +(\w+) +(.*);")
+                    temp = regexp.match(l)
+                    tmpId = temp.group(1)
+                    signalName = temp.group(2)
+                    tempList = temp.group(3).split('"')
+                    for testF in frameList:
+                        if testF.id == int(tmpId):
+                            for signal in testF.signals:
+                                if signal.name == signalName:
+                                    for i in range(math.floor(len(tempList) / 2)):
+                                        signal.values[tempList[i * 2].strip()] = tempList[i * 2 + 1].strip()
+                                    break
+                            break
+                elif l.startswith("VAL_TABLE_ "):
+                    regexp = re.compile("^VAL\_TABLE\_ +(\w+) +(.*);")
+                    temp = regexp.match(l)
+                elif l.startswith("BA_DEF_ SG_ "):
+                    pattern = "^BA\_DEF\_ +SG\_ +\"([A-Za-z0-9\-_]+)\" +(.+);"
+                    regexp = re.compile(pattern)
+                elif l.startswith("BA_DEF_ BO_ "):
+                    pattern = "^BA\_DEF\_ +BO\_ +\"([A-Za-z0-9\-_]+)\" +(.+);"
+                    regexp = re.compile(pattern)
+                elif l.startswith("BA_DEF_ BU_ "):
+                    pattern = "^BA\_DEF\_ +BU\_ +\"([A-Za-z0-9\-_]+)\" +(.+);"
+                    regexp = re.compile(pattern)
+                elif l.startswith("BA_DEF_ "):
+                    pattern = "^BA\_DEF\_ +\"([A-Za-z0-9\-_]+)\" +(.+);"
+                    regexp = re.compile(pattern)
+                elif l.startswith("BA_ "):
+                    regexp = re.compile("^BA\_ +\"[A-Za-z0-9[\-_ .]+\" +(.+)")
+                    tempba = regexp.match(l)
+                    if tempba.group(1).strip().startswith("BO_ "):
+                        regexp = re.compile(r"^BA_ +\"(.*)\" +BO_ +(\w+) +(.+);")
+                        temp = regexp.match(l)
+                        tempId = temp.group(2)
+                        for testF in frameList:
+                            if testF.id == int(tempId):
+                                frame = testF
+                        if temp.group(0).find('GenMsgCycleTime') > -1:
+                            tempCys = temp.group(3)
+                            frame.cycle = int(tempCys)
+                elif l.startswith("SIG_GROUP_ "):
+                    regexp = re.compile("^SIG\_GROUP\_ +(\w+) +(\w+) +(\w+) +\:(.*);")
+                    temp = regexp.match(l)
+                elif l.startswith("SIG_VALTYPE_ "):
+                    regexp = re.compile("^SIG\_VALTYPE\_ +(\w+) +(\w+)\s*\:(.*);")
+                    temp = regexp.match(l)
+                elif l.startswith("BA_DEF_DEF_ "):
+                    pattern = "^BA\_DEF\_DEF\_ +\"([A-Za-z0-9\-_\.]+)\" +(.+)\;"
+                    regexp = re.compile(pattern)
+                elif l.startswith("SG_MUL_VAL_ "):
+                    pattern = "^SG\_MUL\_VAL\_ +([0-9]+) +([A-Za-z0-9\-_]+) +([A-Za-z0-9\-_]+) +([0-9]+)\-([0-9]+) *;"
+                    regexp = re.compile(pattern)
+                elif l.startswith("EV_ "):
+                    pattern = "^EV_ +([A-Za-z0-9\-_]+) *\: +([0-9]+) +\[([0-9.+\-eE]+)\|([0-9.+\-eE]+)\] +\"(\w*)\" +([0-9.+\-eE]+) +([0-9.+\-eE]+) +([A-Za-z0-9\-_]+) +(.*);"
+                    regexp = re.compile(pattern)
+                    temp = regexp.match(l)
+                
+        return frameList
+
+    def __setFdType(self):
+        """Try to guess and set the CAN type for every frame.
+        If a Frame is longer than 8 bytes, it must be Flexible Data Rate frame (CAN-FD).
+        If not, the Frame type stays unchanged.
+        """
+        for frame in self.frames:
+            # if frame.size == 0:
+            frame.calcDLC()
+            print(frame.id, frame.size)
+            if frame.size > 8:
+                frame.is_fd = True
+    
+    def __setExtended(self):
+        for frame in self.frames:
+        # extended-flag is implicite in canid, thus repair this:
+            if frame.id > 0x80000000:
+                frame.id -= 0x80000000
+                frame.extended = 1
+
+    def frameById(self, Id, extended=None):
+        """Get Frame by its arbitration id.
+        :param Id: Frame id as str or int
+        :param extended: is it an extended id? None means "doesn't matter"
+        :rtype: Frame or None
+        """
+        Id = int(Id)
+        extendedMarker = 0x80000000
+        for test in self.frames:
+            if test.id == Id:
+                if extended is None:
+                    # found ID while ignoring extended or standard
+                    return test
+                elif test.extended == extended:
+                    # found ID while checking extended or standard
+                    return test
+            else:
+                if extended is not None:
+                    # what to do if Id is not equal and extended is also provided ???
+                    pass
+                else:
+                    if test.extended and Id & extendedMarker:
+                        # check regarding common used extended Bit 31
+                        if test.id == Id - extendedMarker:
+                            return test
+        return None
+
+    def __getSignalVal(self, signal:Signal, data='00 01 02 03 04 05 06 07'):
+        dataList = data.strip().split(' ')
+        _startbit = signal.startBit
+        _bitsize = signal.size
+        _little = signal.is_little_endian # (1: Intel, 0: Motorola)
+        _byteSize = math.ceil((signal.size + _startbit%8)/8)
+        _startByte = math.floor(_startbit/8)
+        phyvalue = 0
+        rawvalue = ''
+        base = int('{0:0>8}'.format('1'*_bitsize+'0'*(_startbit%8)), 2)
+        _byteNum = 0
+        _byteList= []
+        while _byteNum < _byteSize:
+            # tmpbase = (base >> (8*_byteNum)) & 0xff
+            _byteList.append(dataList[_startByte+_byteNum])
+            _byteNum += 1
+        if _little == 1:
+            _byteList.reverse()
+        for _byte in _byteList:
+            rawvalue += _byte
+        rawvalue = ((int(rawvalue,16) & base) >> (_startbit%8))
+        return {"phy": signal.raw2phys(rawvalue), "raw": rawvalue}
+        # print(_startByte, _byteSize, _bitsize, int(dataList[_startByte], 16), int('{0:0>8}'.format('1'*_bitsize+'0'*(_startbit%8)), 2))
+        
+    def analyzer(self, msgid=None, data='00 01 02 03 04 05 06 07'):
+        '''analysis given data 
+        
+        Keyword Arguments:
+            msgid {int} -- msg id (base 10) (default: {None})
+            data {str} -- given data (default: {'00 01 02 03 04 05 06 07'})
+        
+        Returns:
+            dict -- key sorted by signal index
+        '''
+
+        ret = {}
+        if len(data.strip().split(' ')) != 8 or msgid is None:
+            logging.error('wrong data len')
+            return ret
+        for frame in self.frames:
+            if frame.id == int(msgid):
+                for i in range(len(frame.signals)):
+                    signal = frame.signals[i]
+                    ret[i] = {}
+                    ret[i]['name'] = signal.name
+                    ret[i]['unit'] = signal.unit
+                    ret[i]['value'] = self.__getSignalVal(signal, data)
+                break
+        return ret
+
+if __name__ == '__main__':
+    testDbc = DBC("data/SX7H.dbc")
+    abc=testDbc.analyzer(msgid=1056, data='40 01 C8 00 FF 00 00 00')
+    print(abc)
\ No newline at end of file
diff --git a/main.ui b/main.ui
index 5b944af..53c5e64 100644
--- a/main.ui
+++ b/main.ui
@@ -7,14 +7,14 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>800</width>
-    <height>575</height>
+    <width>1050</width>
+    <height>800</height>
    </rect>
   </property>
   <property name="minimumSize">
    <size>
-    <width>800</width>
-    <height>575</height>
+    <width>1050</width>
+    <height>800</height>
    </size>
   </property>
   <property name="windowTitle">
@@ -29,15 +29,15 @@
    </property>
    <property name="minimumSize">
     <size>
-     <width>800</width>
-     <height>575</height>
+     <width>1050</width>
+     <height>800</height>
     </size>
    </property>
    <layout class="QVBoxLayout" name="verticalLayout">
     <item>
      <layout class="QVBoxLayout" name="verticalLayout_5" stretch="4,0,2">
       <item>
-       <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="2,8">
+       <layout class="QHBoxLayout" name="horizontalLayout_4" stretch="2,6">
         <property name="spacing">
          <number>10</number>
         </property>
@@ -194,90 +194,79 @@
            <string notr="true"/>
           </property>
           <property name="currentIndex">
-           <number>0</number>
+           <number>3</number>
           </property>
           <widget class="QWidget" name="tab">
            <attribute name="title">
             <string>UDS</string>
            </attribute>
-           <layout class="QVBoxLayout" name="verticalLayout_9">
+           <layout class="QVBoxLayout" name="verticalLayout_9" stretch="6,1,1">
             <item>
              <widget class="QGroupBox" name="groupBox_2">
               <property name="title">
                <string>DataIdentifier</string>
               </property>
-              <layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,5">
+              <layout class="QVBoxLayout" name="verticalLayout_2" stretch="1,5,0">
                <item>
-                <layout class="QVBoxLayout" name="verticalLayout_6" stretch="0,0">
+                <layout class="QVBoxLayout" name="verticalLayout_6" stretch="0">
                  <property name="spacing">
                   <number>1</number>
                  </property>
                  <item>
-                  <layout class="QHBoxLayout" name="horizontalLayout_8" stretch="1,4,2,2">
-                   <item>
-                    <widget class="QLabel" name="label_2">
-                     <property name="sizePolicy">
-                      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-                       <horstretch>0</horstretch>
-                       <verstretch>0</verstretch>
-                      </sizepolicy>
-                     </property>
-                     <property name="text">
-                      <string>DID</string>
-                     </property>
-                     <property name="alignment">
-                      <set>Qt::AlignCenter</set>
-                     </property>
-                    </widget>
-                   </item>
+                  <layout class="QHBoxLayout" name="horizontalLayout_9" stretch="0,3,0,1,0,3,1,1">
                    <item>
                     <widget class="QLabel" name="label_4">
                      <property name="sizePolicy">
-                      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
                        <horstretch>0</horstretch>
                        <verstretch>0</verstretch>
                       </sizepolicy>
                      </property>
                      <property name="text">
-                      <string>Description</string>
+                      <string>Name:</string>
                      </property>
                      <property name="alignment">
                       <set>Qt::AlignCenter</set>
                      </property>
                     </widget>
                    </item>
-                   <item>
-                    <widget class="QLabel" name="label_5">
-                     <property name="sizePolicy">
-                      <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
-                       <horstretch>0</horstretch>
-                       <verstretch>0</verstretch>
-                      </sizepolicy>
-                     </property>
-                     <property name="text">
-                      <string>Value</string>
-                     </property>
-                     <property name="alignment">
-                      <set>Qt::AlignCenter</set>
-                     </property>
-                    </widget>
-                   </item>
-                   <item>
-                    <widget class="QLabel" name="label_6">
-                     <property name="text">
-                      <string/>
-                     </property>
-                    </widget>
-                   </item>
-                  </layout>
-                 </item>
-                 <item>
-                  <layout class="QHBoxLayout" name="horizontalLayout_9" stretch="1,4,2,1,1">
                    <item>
                     <widget class="QComboBox" name="comboBox_6"/>
                    </item>
                    <item>
+                    <widget class="QLabel" name="label_2">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="text">
+                      <string>DID:</string>
+                     </property>
+                     <property name="alignment">
+                      <set>Qt::AlignCenter</set>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
                     <widget class="QLineEdit" name="lineEdit"/>
+                   </item>
+                   <item>
+                    <widget class="QLabel" name="label_5">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="text">
+                      <string>Value:</string>
+                     </property>
+                     <property name="alignment">
+                      <set>Qt::AlignCenter</set>
+                     </property>
+                    </widget>
                    </item>
                    <item>
                     <widget class="QLineEdit" name="lineEdit_2"/>
@@ -554,6 +543,19 @@
                  </item>
                 </layout>
                </item>
+               <item>
+                <spacer name="verticalSpacer_2">
+                 <property name="orientation">
+                  <enum>Qt::Vertical</enum>
+                 </property>
+                 <property name="sizeHint" stdset="0">
+                  <size>
+                   <width>20</width>
+                   <height>40</height>
+                  </size>
+                 </property>
+                </spacer>
+               </item>
               </layout>
              </widget>
             </item>
@@ -574,7 +576,7 @@
               <item>
                <widget class="QGroupBox" name="SessionContrl_gbx_3">
                 <property name="title">
-                 <string> ECUReset(0x11)</string>
+                 <string>Security(0x27)</string>
                 </property>
                 <layout class="QVBoxLayout" name="verticalLayout_3">
                  <item>
@@ -633,14 +635,698 @@
              </layout>
             </item>
             <item>
-             <spacer name="verticalSpacer_2">
+             <widget class="QGroupBox" name="groupBox_3">
+              <property name="title">
+               <string>Security Access</string>
+              </property>
+              <layout class="QHBoxLayout" name="horizontalLayout_10">
+               <item>
+                <widget class="QPushButton" name="pushButton_31">
+                 <property name="text">
+                  <string>Unlock Level 1</string>
+                 </property>
+                </widget>
+               </item>
+               <item>
+                <widget class="QPushButton" name="pushButton_32">
+                 <property name="text">
+                  <string>Unlock Level 3</string>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </widget>
+            </item>
+           </layout>
+          </widget>
+          <widget class="QWidget" name="tab_2">
+           <attribute name="title">
+            <string>校准</string>
+           </attribute>
+           <layout class="QVBoxLayout" name="verticalLayout_10">
+            <item>
+             <layout class="QVBoxLayout" name="verticalLayout_11">
+              <item>
+               <widget class="QPushButton" name="pushButton_9">
+                <property name="text">
+                 <string>Start Calibration</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_11">
+                <property name="text">
+                 <string>Calibration Z</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_13">
+                <property name="text">
+                 <string>Calibration M</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_18">
+                <property name="text">
+                 <string>Calibration M+</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_22">
+                <property name="text">
+                 <string>Calibration M-</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_24">
+                <property name="text">
+                 <string>Calibration X2</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_26">
+                <property name="text">
+                 <string>Calibration X1</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_27">
+                <property name="text">
+                 <string>Calibration Y1</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_28">
+                <property name="text">
+                 <string>Calibration Y2</string>
+                </property>
+               </widget>
+              </item>
+              <item>
+               <widget class="QPushButton" name="pushButton_29">
+                <property name="text">
+                 <string>Calibration Gap</string>
+                </property>
+               </widget>
+              </item>
+             </layout>
+            </item>
+           </layout>
+          </widget>
+          <widget class="QWidget" name="tab_3">
+           <attribute name="title">
+            <string>功能指示</string>
+           </attribute>
+           <layout class="QHBoxLayout" name="horizontalLayout_14">
+            <item>
+             <layout class="QVBoxLayout" name="verticalLayout_15" stretch="5,1">
+              <item>
+               <widget class="QGroupBox" name="groupBox_6">
+                <property name="title">
+                 <string>换挡器状态</string>
+                </property>
+                <layout class="QHBoxLayout" name="horizontalLayout_8">
+                 <item>
+                  <layout class="QVBoxLayout" name="verticalLayout_13" stretch="2,2,2">
+                   <item>
+                    <widget class="QPushButton" name="pushButton_35">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;</string>
+                     </property>
+                     <property name="text">
+                      <string>M+</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_39">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;</string>
+                     </property>
+                     <property name="text">
+                      <string>M</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_36">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;</string>
+                     </property>
+                     <property name="text">
+                      <string>M-</string>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </item>
+                 <item>
+                  <layout class="QVBoxLayout" name="verticalLayout_12" stretch="1,1,1,1,1">
+                   <item>
+                    <widget class="QPushButton" name="pushButton_37">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;
+</string>
+                     </property>
+                     <property name="text">
+                      <string>X2</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_38">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;
+</string>
+                     </property>
+                     <property name="text">
+                      <string>X1</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_30">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;</string>
+                     </property>
+                     <property name="text">
+                      <string>Z</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_33">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;</string>
+                     </property>
+                     <property name="text">
+                      <string>Y1</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_34">
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;</string>
+                     </property>
+                     <property name="text">
+                      <string>Y2</string>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </item>
+                 <item>
+                  <layout class="QVBoxLayout" name="verticalLayout_14" stretch="1,1">
+                   <item>
+                    <widget class="QPushButton" name="pushButton_41">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;</string>
+                     </property>
+                     <property name="text">
+                      <string>Unlock</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_40">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="styleSheet">
+                      <string notr="true">background-color: rgb(123, 123, 123);
+color: rgb(255,255,255);  
+border-radius: 30px; 
+font: 9pt &quot;AcadEref&quot;;
+border-style: outset;</string>
+                     </property>
+                     <property name="text">
+                      <string>Park</string>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </item>
+                </layout>
+               </widget>
+              </item>
+              <item>
+               <layout class="QHBoxLayout" name="horizontalLayout_11" stretch="2,5">
+                <item>
+                 <widget class="QGroupBox" name="groupBox_5">
+                  <property name="title">
+                   <string>换挡器CAN</string>
+                  </property>
+                  <layout class="QHBoxLayout" name="horizontalLayout_13">
+                   <item>
+                    <widget class="QLabel" name="label_6">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>10</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>60</height>
+                      </size>
+                     </property>
+                     <property name="text">
+                      <string>CAN error:</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QLineEdit" name="lineEdit_17">
+                     <property name="sizePolicy">
+                      <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                       <horstretch>0</horstretch>
+                       <verstretch>0</verstretch>
+                      </sizepolicy>
+                     </property>
+                     <property name="minimumSize">
+                      <size>
+                       <width>60</width>
+                       <height>0</height>
+                      </size>
+                     </property>
+                     <property name="maximumSize">
+                      <size>
+                       <width>60</width>
+                       <height>16777215</height>
+                      </size>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </widget>
+                </item>
+                <item>
+                 <widget class="QGroupBox" name="groupBox_4">
+                  <property name="title">
+                   <string>TCU Command</string>
+                  </property>
+                  <layout class="QHBoxLayout" name="horizontalLayout_12">
+                   <item>
+                    <widget class="QPushButton" name="pushButton_42">
+                     <property name="text">
+                      <string>P</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_45">
+                     <property name="text">
+                      <string>R</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_44">
+                     <property name="text">
+                      <string>N</string>
+                     </property>
+                    </widget>
+                   </item>
+                   <item>
+                    <widget class="QPushButton" name="pushButton_43">
+                     <property name="text">
+                      <string>D</string>
+                     </property>
+                    </widget>
+                   </item>
+                  </layout>
+                 </widget>
+                </item>
+               </layout>
+              </item>
+             </layout>
+            </item>
+           </layout>
+          </widget>
+          <widget class="QWidget" name="tab_4">
+           <attribute name="title">
+            <string>Bootloader</string>
+           </attribute>
+           <layout class="QVBoxLayout" name="verticalLayout_18">
+            <item>
+             <widget class="QGroupBox" name="groupBox_7">
+              <property name="title">
+               <string>Set File</string>
+              </property>
+              <layout class="QVBoxLayout" name="verticalLayout_17">
+               <item>
+                <layout class="QHBoxLayout" name="horizontalLayout_17" stretch="1,6,1">
+                 <item>
+                  <widget class="QLabel" name="label_22">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="minimumSize">
+                    <size>
+                     <width>60</width>
+                     <height>12</height>
+                    </size>
+                   </property>
+                   <property name="text">
+                    <string>Load APP:</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QComboBox" name="comboBox_4"/>
+                 </item>
+                 <item>
+                  <widget class="QPushButton" name="pushButton_46">
+                   <property name="text">
+                    <string>Load APP</string>
+                   </property>
+                  </widget>
+                 </item>
+                </layout>
+               </item>
+               <item>
+                <layout class="QHBoxLayout" name="horizontalLayout_16" stretch="1,6,1">
+                 <item>
+                  <widget class="QLabel" name="label_23">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="minimumSize">
+                    <size>
+                     <width>60</width>
+                     <height>12</height>
+                    </size>
+                   </property>
+                   <property name="text">
+                    <string>Set Log:</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QComboBox" name="comboBox_10"/>
+                 </item>
+                 <item>
+                  <widget class="QPushButton" name="pushButton_47">
+                   <property name="text">
+                    <string>Set Log</string>
+                   </property>
+                  </widget>
+                 </item>
+                </layout>
+               </item>
+               <item>
+                <widget class="QRadioButton" name="radioButton_2">
+                 <property name="text">
+                  <string>Start from boot</string>
+                 </property>
+                </widget>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item>
+             <widget class="QGroupBox" name="groupBox_8">
+              <property name="title">
+               <string>Progress</string>
+              </property>
+              <layout class="QHBoxLayout" name="horizontalLayout_18">
+               <item>
+                <layout class="QHBoxLayout" name="horizontalLayout_15" stretch="1,6,1">
+                 <item>
+                  <widget class="QLabel" name="label_24">
+                   <property name="sizePolicy">
+                    <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+                     <horstretch>0</horstretch>
+                     <verstretch>0</verstretch>
+                    </sizepolicy>
+                   </property>
+                   <property name="minimumSize">
+                    <size>
+                     <width>60</width>
+                     <height>12</height>
+                    </size>
+                   </property>
+                   <property name="text">
+                    <string>Progress:</string>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QProgressBar" name="progressBar">
+                   <property name="value">
+                    <number>24</number>
+                   </property>
+                  </widget>
+                 </item>
+                 <item>
+                  <widget class="QPushButton" name="pushButton_48">
+                   <property name="text">
+                    <string>Program</string>
+                   </property>
+                  </widget>
+                 </item>
+                </layout>
+               </item>
+              </layout>
+             </widget>
+            </item>
+            <item>
+             <spacer name="verticalSpacer_3">
               <property name="orientation">
                <enum>Qt::Vertical</enum>
               </property>
               <property name="sizeHint" stdset="0">
                <size>
                 <width>20</width>
-                <height>40</height>
+                <height>282</height>
                </size>
               </property>
              </spacer>
@@ -668,7 +1354,7 @@
          <enum>QTabWidget::West</enum>
         </property>
         <property name="currentIndex">
-         <number>0</number>
+         <number>2</number>
         </property>
         <widget class="QWidget" name="tab_logger">
          <attribute name="title">
@@ -743,6 +1429,19 @@
           </item>
          </layout>
         </widget>
+        <widget class="QWidget" name="tab_Consloe">
+         <property name="locale">
+          <locale language="Chinese" country="China"/>
+         </property>
+         <attribute name="title">
+          <string>Console</string>
+         </attribute>
+         <layout class="QVBoxLayout" name="verticalLayout_16">
+          <item>
+           <widget class="QTextEdit" name="textEdit_2"/>
+          </item>
+         </layout>
+        </widget>
        </widget>
       </item>
      </layout>
diff --git a/mainwindows.py b/mainwindows.py
index 78c2f7f..1b0c42c 100644
--- a/mainwindows.py
+++ b/mainwindows.py
@@ -1,11 +1,11 @@
 # -*- coding: utf-8 -*-
 
 ################################################################################
-# Form generated from reading UI file 'main.ui'
+## Form generated from reading UI file 'main.ui'
 ##
-# Created by: Qt User Interface Compiler version 5.15.2
+## Created by: Qt User Interface Compiler version 5.15.2
 ##
-# WARNING! All changes made in this file will be lost when recompiling UI file!
+## WARNING! All changes made in this file will be lost when recompiling UI file!
 ################################################################################
 
 from PySide2.QtCore import *
@@ -17,17 +17,16 @@
     def setupUi(self, MainWindow):
         if not MainWindow.objectName():
             MainWindow.setObjectName(u"MainWindow")
-        MainWindow.resize(800, 575)
-        MainWindow.setMinimumSize(QSize(800, 575))
+        MainWindow.resize(1050, 800)
+        MainWindow.setMinimumSize(QSize(1050, 800))
         self.centralwidget = QWidget(MainWindow)
         self.centralwidget.setObjectName(u"centralwidget")
         sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding)
         sizePolicy.setHorizontalStretch(0)
         sizePolicy.setVerticalStretch(0)
-        sizePolicy.setHeightForWidth(
-            self.centralwidget.sizePolicy().hasHeightForWidth())
+        sizePolicy.setHeightForWidth(self.centralwidget.sizePolicy().hasHeightForWidth())
         self.centralwidget.setSizePolicy(sizePolicy)
-        self.centralwidget.setMinimumSize(QSize(800, 575))
+        self.centralwidget.setMinimumSize(QSize(1050, 800))
         self.verticalLayout = QVBoxLayout(self.centralwidget)
         self.verticalLayout.setObjectName(u"verticalLayout")
         self.verticalLayout_5 = QVBoxLayout()
@@ -47,8 +46,7 @@
         sizePolicy1 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Preferred)
         sizePolicy1.setHorizontalStretch(0)
         sizePolicy1.setVerticalStretch(0)
-        sizePolicy1.setHeightForWidth(
-            self.label.sizePolicy().hasHeightForWidth())
+        sizePolicy1.setHeightForWidth(self.label.sizePolicy().hasHeightForWidth())
         self.label.setSizePolicy(sizePolicy1)
         self.label.setMinimumSize(QSize(54, 0))
 
@@ -59,8 +57,7 @@
         sizePolicy2 = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
         sizePolicy2.setHorizontalStretch(1)
         sizePolicy2.setVerticalStretch(0)
-        sizePolicy2.setHeightForWidth(
-            self.comboBox_2.sizePolicy().hasHeightForWidth())
+        sizePolicy2.setHeightForWidth(self.comboBox_2.sizePolicy().hasHeightForWidth())
         self.comboBox_2.setSizePolicy(sizePolicy2)
         self.comboBox_2.setLayoutDirection(Qt.LeftToRight)
 
@@ -75,16 +72,14 @@
         self.horizontalLayout_20.setObjectName(u"horizontalLayout_20")
         self.label_3 = QLabel(self.groupBox)
         self.label_3.setObjectName(u"label_3")
-        sizePolicy1.setHeightForWidth(
-            self.label_3.sizePolicy().hasHeightForWidth())
+        sizePolicy1.setHeightForWidth(self.label_3.sizePolicy().hasHeightForWidth())
         self.label_3.setSizePolicy(sizePolicy1)
 
         self.horizontalLayout_20.addWidget(self.label_3)
 
         self.comboBox_3 = QComboBox(self.groupBox)
         self.comboBox_3.setObjectName(u"comboBox_3")
-        sizePolicy2.setHeightForWidth(
-            self.comboBox_3.sizePolicy().hasHeightForWidth())
+        sizePolicy2.setHeightForWidth(self.comboBox_3.sizePolicy().hasHeightForWidth())
         self.comboBox_3.setSizePolicy(sizePolicy2)
 
         self.horizontalLayout_20.addWidget(self.comboBox_3)
@@ -98,8 +93,7 @@
         self.horizontalLayout_21.setObjectName(u"horizontalLayout_21")
         self.label_19 = QLabel(self.groupBox)
         self.label_19.setObjectName(u"label_19")
-        sizePolicy1.setHeightForWidth(
-            self.label_19.sizePolicy().hasHeightForWidth())
+        sizePolicy1.setHeightForWidth(self.label_19.sizePolicy().hasHeightForWidth())
         self.label_19.setSizePolicy(sizePolicy1)
         self.label_19.setMinimumSize(QSize(54, 0))
 
@@ -107,8 +101,7 @@
 
         self.comboBox_5 = QComboBox(self.groupBox)
         self.comboBox_5.setObjectName(u"comboBox_5")
-        sizePolicy2.setHeightForWidth(
-            self.comboBox_5.sizePolicy().hasHeightForWidth())
+        sizePolicy2.setHeightForWidth(self.comboBox_5.sizePolicy().hasHeightForWidth())
         self.comboBox_5.setSizePolicy(sizePolicy2)
 
         self.horizontalLayout_21.addWidget(self.comboBox_5)
@@ -130,10 +123,10 @@
 
         self.verticalLayout_7.addWidget(self.pushButton)
 
-        self.verticalSpacer = QSpacerItem(
-            20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+        self.verticalSpacer = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
 
         self.verticalLayout_7.addItem(self.verticalSpacer)
+
 
         self.horizontalLayout_4.addWidget(self.groupBox)
 
@@ -152,61 +145,44 @@
         self.verticalLayout_6 = QVBoxLayout()
         self.verticalLayout_6.setSpacing(1)
         self.verticalLayout_6.setObjectName(u"verticalLayout_6")
-        self.horizontalLayout_8 = QHBoxLayout()
-        self.horizontalLayout_8.setObjectName(u"horizontalLayout_8")
-        self.label_2 = QLabel(self.groupBox_2)
-        self.label_2.setObjectName(u"label_2")
-        sizePolicy3 = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Fixed)
-        sizePolicy3.setHorizontalStretch(0)
-        sizePolicy3.setVerticalStretch(0)
-        sizePolicy3.setHeightForWidth(
-            self.label_2.sizePolicy().hasHeightForWidth())
-        self.label_2.setSizePolicy(sizePolicy3)
-        self.label_2.setAlignment(Qt.AlignCenter)
-
-        self.horizontalLayout_8.addWidget(self.label_2)
-
+        self.horizontalLayout_9 = QHBoxLayout()
+        self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
         self.label_4 = QLabel(self.groupBox_2)
         self.label_4.setObjectName(u"label_4")
-        sizePolicy3.setHeightForWidth(
-            self.label_4.sizePolicy().hasHeightForWidth())
+        sizePolicy3 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
+        sizePolicy3.setHorizontalStretch(0)
+        sizePolicy3.setVerticalStretch(0)
+        sizePolicy3.setHeightForWidth(self.label_4.sizePolicy().hasHeightForWidth())
         self.label_4.setSizePolicy(sizePolicy3)
         self.label_4.setAlignment(Qt.AlignCenter)
 
-        self.horizontalLayout_8.addWidget(self.label_4)
+        self.horizontalLayout_9.addWidget(self.label_4)
 
-        self.label_5 = QLabel(self.groupBox_2)
-        self.label_5.setObjectName(u"label_5")
-        sizePolicy3.setHeightForWidth(
-            self.label_5.sizePolicy().hasHeightForWidth())
-        self.label_5.setSizePolicy(sizePolicy3)
-        self.label_5.setAlignment(Qt.AlignCenter)
-
-        self.horizontalLayout_8.addWidget(self.label_5)
-
-        self.label_6 = QLabel(self.groupBox_2)
-        self.label_6.setObjectName(u"label_6")
-
-        self.horizontalLayout_8.addWidget(self.label_6)
-
-        self.horizontalLayout_8.setStretch(0, 1)
-        self.horizontalLayout_8.setStretch(1, 4)
-        self.horizontalLayout_8.setStretch(2, 2)
-        self.horizontalLayout_8.setStretch(3, 2)
-
-        self.verticalLayout_6.addLayout(self.horizontalLayout_8)
-
-        self.horizontalLayout_9 = QHBoxLayout()
-        self.horizontalLayout_9.setObjectName(u"horizontalLayout_9")
         self.comboBox_6 = QComboBox(self.groupBox_2)
         self.comboBox_6.setObjectName(u"comboBox_6")
 
         self.horizontalLayout_9.addWidget(self.comboBox_6)
 
+        self.label_2 = QLabel(self.groupBox_2)
+        self.label_2.setObjectName(u"label_2")
+        sizePolicy3.setHeightForWidth(self.label_2.sizePolicy().hasHeightForWidth())
+        self.label_2.setSizePolicy(sizePolicy3)
+        self.label_2.setAlignment(Qt.AlignCenter)
+
+        self.horizontalLayout_9.addWidget(self.label_2)
+
         self.lineEdit = QLineEdit(self.groupBox_2)
         self.lineEdit.setObjectName(u"lineEdit")
 
         self.horizontalLayout_9.addWidget(self.lineEdit)
+
+        self.label_5 = QLabel(self.groupBox_2)
+        self.label_5.setObjectName(u"label_5")
+        sizePolicy3.setHeightForWidth(self.label_5.sizePolicy().hasHeightForWidth())
+        self.label_5.setSizePolicy(sizePolicy3)
+        self.label_5.setAlignment(Qt.AlignCenter)
+
+        self.horizontalLayout_9.addWidget(self.label_5)
 
         self.lineEdit_2 = QLineEdit(self.groupBox_2)
         self.lineEdit_2.setObjectName(u"lineEdit_2")
@@ -223,13 +199,14 @@
 
         self.horizontalLayout_9.addWidget(self.pushButton_3)
 
-        self.horizontalLayout_9.setStretch(0, 1)
-        self.horizontalLayout_9.setStretch(1, 4)
-        self.horizontalLayout_9.setStretch(2, 2)
+        self.horizontalLayout_9.setStretch(1, 3)
         self.horizontalLayout_9.setStretch(3, 1)
-        self.horizontalLayout_9.setStretch(4, 1)
+        self.horizontalLayout_9.setStretch(5, 3)
+        self.horizontalLayout_9.setStretch(6, 1)
+        self.horizontalLayout_9.setStretch(7, 1)
 
         self.verticalLayout_6.addLayout(self.horizontalLayout_9)
+
 
         self.verticalLayout_2.addLayout(self.verticalLayout_6)
 
@@ -292,12 +269,8 @@
 
         self.pushButton_4 = QPushButton(self.groupBox_2)
         self.pushButton_4.setObjectName(u"pushButton_4")
-        sizePolicy4 = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
-        sizePolicy4.setHorizontalStretch(0)
-        sizePolicy4.setVerticalStretch(0)
-        sizePolicy4.setHeightForWidth(
-            self.pushButton_4.sizePolicy().hasHeightForWidth())
-        self.pushButton_4.setSizePolicy(sizePolicy4)
+        sizePolicy3.setHeightForWidth(self.pushButton_4.sizePolicy().hasHeightForWidth())
+        self.pushButton_4.setSizePolicy(sizePolicy3)
         self.pushButton_4.setMinimumSize(QSize(45, 23))
 
         self.gridLayout.addWidget(self.pushButton_4, 0, 2, 1, 1)
@@ -452,7 +425,12 @@
 
         self.gridLayout.addWidget(self.pushButton_21, 6, 5, 1, 1)
 
+
         self.verticalLayout_2.addLayout(self.gridLayout)
+
+        self.verticalSpacer_2 = QSpacerItem(20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+
+        self.verticalLayout_2.addItem(self.verticalSpacer_2)
 
         self.verticalLayout_2.setStretch(0, 1)
         self.verticalLayout_2.setStretch(1, 5)
@@ -470,6 +448,7 @@
 
         self.horizontalLayout_6.addWidget(self.comboBox)
 
+
         self.horizontalLayout_5.addWidget(self.SessionContrl_gbx)
 
         self.SessionContrl_gbx_3 = QGroupBox(self.tab)
@@ -480,6 +459,7 @@
         self.comboBox_8.setObjectName(u"comboBox_8")
 
         self.verticalLayout_3.addWidget(self.comboBox_8)
+
 
         self.horizontalLayout_5.addWidget(self.SessionContrl_gbx_3)
 
@@ -492,6 +472,7 @@
 
         self.verticalLayout_4.addWidget(self.comboBox_9)
 
+
         self.horizontalLayout_5.addWidget(self.SessionContrl_gbx_4)
 
         self.SessionContrl_gbx_2 = QGroupBox(self.tab)
@@ -502,6 +483,7 @@
         self.comboBox_7.setObjectName(u"comboBox_7")
 
         self.verticalLayout_8.addWidget(self.comboBox_7)
+
 
         self.horizontalLayout_5.addWidget(self.SessionContrl_gbx_2)
 
@@ -532,17 +514,442 @@
 
         self.verticalLayout_9.addLayout(self.horizontalLayout_5)
 
-        self.verticalSpacer_2 = QSpacerItem(
-            20, 40, QSizePolicy.Minimum, QSizePolicy.Expanding)
+        self.groupBox_3 = QGroupBox(self.tab)
+        self.groupBox_3.setObjectName(u"groupBox_3")
+        self.horizontalLayout_10 = QHBoxLayout(self.groupBox_3)
+        self.horizontalLayout_10.setObjectName(u"horizontalLayout_10")
+        self.pushButton_31 = QPushButton(self.groupBox_3)
+        self.pushButton_31.setObjectName(u"pushButton_31")
 
-        self.verticalLayout_9.addItem(self.verticalSpacer_2)
+        self.horizontalLayout_10.addWidget(self.pushButton_31)
 
+        self.pushButton_32 = QPushButton(self.groupBox_3)
+        self.pushButton_32.setObjectName(u"pushButton_32")
+
+        self.horizontalLayout_10.addWidget(self.pushButton_32)
+
+
+        self.verticalLayout_9.addWidget(self.groupBox_3)
+
+        self.verticalLayout_9.setStretch(0, 6)
+        self.verticalLayout_9.setStretch(1, 1)
+        self.verticalLayout_9.setStretch(2, 1)
         self.tabWidget.addTab(self.tab, "")
+        self.tab_2 = QWidget()
+        self.tab_2.setObjectName(u"tab_2")
+        self.verticalLayout_10 = QVBoxLayout(self.tab_2)
+        self.verticalLayout_10.setObjectName(u"verticalLayout_10")
+        self.verticalLayout_11 = QVBoxLayout()
+        self.verticalLayout_11.setObjectName(u"verticalLayout_11")
+        self.pushButton_9 = QPushButton(self.tab_2)
+        self.pushButton_9.setObjectName(u"pushButton_9")
+
+        self.verticalLayout_11.addWidget(self.pushButton_9)
+
+        self.pushButton_11 = QPushButton(self.tab_2)
+        self.pushButton_11.setObjectName(u"pushButton_11")
+
+        self.verticalLayout_11.addWidget(self.pushButton_11)
+
+        self.pushButton_13 = QPushButton(self.tab_2)
+        self.pushButton_13.setObjectName(u"pushButton_13")
+
+        self.verticalLayout_11.addWidget(self.pushButton_13)
+
+        self.pushButton_18 = QPushButton(self.tab_2)
+        self.pushButton_18.setObjectName(u"pushButton_18")
+
+        self.verticalLayout_11.addWidget(self.pushButton_18)
+
+        self.pushButton_22 = QPushButton(self.tab_2)
+        self.pushButton_22.setObjectName(u"pushButton_22")
+
+        self.verticalLayout_11.addWidget(self.pushButton_22)
+
+        self.pushButton_24 = QPushButton(self.tab_2)
+        self.pushButton_24.setObjectName(u"pushButton_24")
+
+        self.verticalLayout_11.addWidget(self.pushButton_24)
+
+        self.pushButton_26 = QPushButton(self.tab_2)
+        self.pushButton_26.setObjectName(u"pushButton_26")
+
+        self.verticalLayout_11.addWidget(self.pushButton_26)
+
+        self.pushButton_27 = QPushButton(self.tab_2)
+        self.pushButton_27.setObjectName(u"pushButton_27")
+
+        self.verticalLayout_11.addWidget(self.pushButton_27)
+
+        self.pushButton_28 = QPushButton(self.tab_2)
+        self.pushButton_28.setObjectName(u"pushButton_28")
+
+        self.verticalLayout_11.addWidget(self.pushButton_28)
+
+        self.pushButton_29 = QPushButton(self.tab_2)
+        self.pushButton_29.setObjectName(u"pushButton_29")
+
+        self.verticalLayout_11.addWidget(self.pushButton_29)
+
+
+        self.verticalLayout_10.addLayout(self.verticalLayout_11)
+
+        self.tabWidget.addTab(self.tab_2, "")
+        self.tab_3 = QWidget()
+        self.tab_3.setObjectName(u"tab_3")
+        self.horizontalLayout_14 = QHBoxLayout(self.tab_3)
+        self.horizontalLayout_14.setObjectName(u"horizontalLayout_14")
+        self.verticalLayout_15 = QVBoxLayout()
+        self.verticalLayout_15.setObjectName(u"verticalLayout_15")
+        self.groupBox_6 = QGroupBox(self.tab_3)
+        self.groupBox_6.setObjectName(u"groupBox_6")
+        self.horizontalLayout_8 = QHBoxLayout(self.groupBox_6)
+        self.horizontalLayout_8.setObjectName(u"horizontalLayout_8")
+        self.verticalLayout_13 = QVBoxLayout()
+        self.verticalLayout_13.setObjectName(u"verticalLayout_13")
+        self.pushButton_35 = QPushButton(self.groupBox_6)
+        self.pushButton_35.setObjectName(u"pushButton_35")
+        sizePolicy3.setHeightForWidth(self.pushButton_35.sizePolicy().hasHeightForWidth())
+        self.pushButton_35.setSizePolicy(sizePolicy3)
+        self.pushButton_35.setMinimumSize(QSize(60, 60))
+        self.pushButton_35.setMaximumSize(QSize(60, 60))
+        self.pushButton_35.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_13.addWidget(self.pushButton_35)
+
+        self.pushButton_39 = QPushButton(self.groupBox_6)
+        self.pushButton_39.setObjectName(u"pushButton_39")
+        sizePolicy3.setHeightForWidth(self.pushButton_39.sizePolicy().hasHeightForWidth())
+        self.pushButton_39.setSizePolicy(sizePolicy3)
+        self.pushButton_39.setMinimumSize(QSize(60, 60))
+        self.pushButton_39.setMaximumSize(QSize(60, 60))
+        self.pushButton_39.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_13.addWidget(self.pushButton_39)
+
+        self.pushButton_36 = QPushButton(self.groupBox_6)
+        self.pushButton_36.setObjectName(u"pushButton_36")
+        sizePolicy3.setHeightForWidth(self.pushButton_36.sizePolicy().hasHeightForWidth())
+        self.pushButton_36.setSizePolicy(sizePolicy3)
+        self.pushButton_36.setMinimumSize(QSize(60, 60))
+        self.pushButton_36.setMaximumSize(QSize(60, 60))
+        self.pushButton_36.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_13.addWidget(self.pushButton_36)
+
+        self.verticalLayout_13.setStretch(0, 2)
+        self.verticalLayout_13.setStretch(1, 2)
+        self.verticalLayout_13.setStretch(2, 2)
+
+        self.horizontalLayout_8.addLayout(self.verticalLayout_13)
+
+        self.verticalLayout_12 = QVBoxLayout()
+        self.verticalLayout_12.setObjectName(u"verticalLayout_12")
+        self.pushButton_37 = QPushButton(self.groupBox_6)
+        self.pushButton_37.setObjectName(u"pushButton_37")
+        sizePolicy3.setHeightForWidth(self.pushButton_37.sizePolicy().hasHeightForWidth())
+        self.pushButton_37.setSizePolicy(sizePolicy3)
+        self.pushButton_37.setMinimumSize(QSize(60, 60))
+        self.pushButton_37.setMaximumSize(QSize(60, 60))
+        self.pushButton_37.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;\n"
+"")
+
+        self.verticalLayout_12.addWidget(self.pushButton_37)
+
+        self.pushButton_38 = QPushButton(self.groupBox_6)
+        self.pushButton_38.setObjectName(u"pushButton_38")
+        sizePolicy3.setHeightForWidth(self.pushButton_38.sizePolicy().hasHeightForWidth())
+        self.pushButton_38.setSizePolicy(sizePolicy3)
+        self.pushButton_38.setMinimumSize(QSize(60, 60))
+        self.pushButton_38.setMaximumSize(QSize(60, 60))
+        self.pushButton_38.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;\n"
+"")
+
+        self.verticalLayout_12.addWidget(self.pushButton_38)
+
+        self.pushButton_30 = QPushButton(self.groupBox_6)
+        self.pushButton_30.setObjectName(u"pushButton_30")
+        sizePolicy3.setHeightForWidth(self.pushButton_30.sizePolicy().hasHeightForWidth())
+        self.pushButton_30.setSizePolicy(sizePolicy3)
+        self.pushButton_30.setMinimumSize(QSize(60, 60))
+        self.pushButton_30.setMaximumSize(QSize(60, 60))
+        self.pushButton_30.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_12.addWidget(self.pushButton_30)
+
+        self.pushButton_33 = QPushButton(self.groupBox_6)
+        self.pushButton_33.setObjectName(u"pushButton_33")
+        sizePolicy3.setHeightForWidth(self.pushButton_33.sizePolicy().hasHeightForWidth())
+        self.pushButton_33.setSizePolicy(sizePolicy3)
+        self.pushButton_33.setMinimumSize(QSize(60, 60))
+        self.pushButton_33.setMaximumSize(QSize(60, 60))
+        self.pushButton_33.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_12.addWidget(self.pushButton_33)
+
+        self.pushButton_34 = QPushButton(self.groupBox_6)
+        self.pushButton_34.setObjectName(u"pushButton_34")
+        self.pushButton_34.setMinimumSize(QSize(60, 60))
+        self.pushButton_34.setMaximumSize(QSize(60, 60))
+        self.pushButton_34.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_12.addWidget(self.pushButton_34)
+
+        self.verticalLayout_12.setStretch(0, 1)
+        self.verticalLayout_12.setStretch(1, 1)
+        self.verticalLayout_12.setStretch(2, 1)
+        self.verticalLayout_12.setStretch(3, 1)
+        self.verticalLayout_12.setStretch(4, 1)
+
+        self.horizontalLayout_8.addLayout(self.verticalLayout_12)
+
+        self.verticalLayout_14 = QVBoxLayout()
+        self.verticalLayout_14.setObjectName(u"verticalLayout_14")
+        self.pushButton_41 = QPushButton(self.groupBox_6)
+        self.pushButton_41.setObjectName(u"pushButton_41")
+        sizePolicy3.setHeightForWidth(self.pushButton_41.sizePolicy().hasHeightForWidth())
+        self.pushButton_41.setSizePolicy(sizePolicy3)
+        self.pushButton_41.setMinimumSize(QSize(60, 60))
+        self.pushButton_41.setMaximumSize(QSize(60, 60))
+        self.pushButton_41.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_14.addWidget(self.pushButton_41)
+
+        self.pushButton_40 = QPushButton(self.groupBox_6)
+        self.pushButton_40.setObjectName(u"pushButton_40")
+        sizePolicy3.setHeightForWidth(self.pushButton_40.sizePolicy().hasHeightForWidth())
+        self.pushButton_40.setSizePolicy(sizePolicy3)
+        self.pushButton_40.setMinimumSize(QSize(60, 60))
+        self.pushButton_40.setMaximumSize(QSize(60, 60))
+        self.pushButton_40.setStyleSheet(u"background-color: rgb(123, 123, 123);\n"
+"color: rgb(255,255,255);  \n"
+"border-radius: 30px; \n"
+"font: 9pt \"AcadEref\";\n"
+"border-style: outset;")
+
+        self.verticalLayout_14.addWidget(self.pushButton_40)
+
+        self.verticalLayout_14.setStretch(0, 1)
+        self.verticalLayout_14.setStretch(1, 1)
+
+        self.horizontalLayout_8.addLayout(self.verticalLayout_14)
+
+
+        self.verticalLayout_15.addWidget(self.groupBox_6)
+
+        self.horizontalLayout_11 = QHBoxLayout()
+        self.horizontalLayout_11.setObjectName(u"horizontalLayout_11")
+        self.groupBox_5 = QGroupBox(self.tab_3)
+        self.groupBox_5.setObjectName(u"groupBox_5")
+        self.horizontalLayout_13 = QHBoxLayout(self.groupBox_5)
+        self.horizontalLayout_13.setObjectName(u"horizontalLayout_13")
+        self.label_6 = QLabel(self.groupBox_5)
+        self.label_6.setObjectName(u"label_6")
+        sizePolicy3.setHeightForWidth(self.label_6.sizePolicy().hasHeightForWidth())
+        self.label_6.setSizePolicy(sizePolicy3)
+        self.label_6.setMinimumSize(QSize(60, 10))
+        self.label_6.setMaximumSize(QSize(60, 60))
+
+        self.horizontalLayout_13.addWidget(self.label_6)
+
+        self.lineEdit_17 = QLineEdit(self.groupBox_5)
+        self.lineEdit_17.setObjectName(u"lineEdit_17")
+        sizePolicy3.setHeightForWidth(self.lineEdit_17.sizePolicy().hasHeightForWidth())
+        self.lineEdit_17.setSizePolicy(sizePolicy3)
+        self.lineEdit_17.setMinimumSize(QSize(60, 0))
+        self.lineEdit_17.setMaximumSize(QSize(60, 16777215))
+
+        self.horizontalLayout_13.addWidget(self.lineEdit_17)
+
+
+        self.horizontalLayout_11.addWidget(self.groupBox_5)
+
+        self.groupBox_4 = QGroupBox(self.tab_3)
+        self.groupBox_4.setObjectName(u"groupBox_4")
+        self.horizontalLayout_12 = QHBoxLayout(self.groupBox_4)
+        self.horizontalLayout_12.setObjectName(u"horizontalLayout_12")
+        self.pushButton_42 = QPushButton(self.groupBox_4)
+        self.pushButton_42.setObjectName(u"pushButton_42")
+
+        self.horizontalLayout_12.addWidget(self.pushButton_42)
+
+        self.pushButton_45 = QPushButton(self.groupBox_4)
+        self.pushButton_45.setObjectName(u"pushButton_45")
+
+        self.horizontalLayout_12.addWidget(self.pushButton_45)
+
+        self.pushButton_44 = QPushButton(self.groupBox_4)
+        self.pushButton_44.setObjectName(u"pushButton_44")
+
+        self.horizontalLayout_12.addWidget(self.pushButton_44)
+
+        self.pushButton_43 = QPushButton(self.groupBox_4)
+        self.pushButton_43.setObjectName(u"pushButton_43")
+
+        self.horizontalLayout_12.addWidget(self.pushButton_43)
+
+
+        self.horizontalLayout_11.addWidget(self.groupBox_4)
+
+        self.horizontalLayout_11.setStretch(0, 2)
+        self.horizontalLayout_11.setStretch(1, 5)
+
+        self.verticalLayout_15.addLayout(self.horizontalLayout_11)
+
+        self.verticalLayout_15.setStretch(0, 5)
+        self.verticalLayout_15.setStretch(1, 1)
+
+        self.horizontalLayout_14.addLayout(self.verticalLayout_15)
+
+        self.tabWidget.addTab(self.tab_3, "")
+        self.tab_4 = QWidget()
+        self.tab_4.setObjectName(u"tab_4")
+        self.verticalLayout_18 = QVBoxLayout(self.tab_4)
+        self.verticalLayout_18.setObjectName(u"verticalLayout_18")
+        self.groupBox_7 = QGroupBox(self.tab_4)
+        self.groupBox_7.setObjectName(u"groupBox_7")
+        self.verticalLayout_17 = QVBoxLayout(self.groupBox_7)
+        self.verticalLayout_17.setObjectName(u"verticalLayout_17")
+        self.horizontalLayout_17 = QHBoxLayout()
+        self.horizontalLayout_17.setObjectName(u"horizontalLayout_17")
+        self.label_22 = QLabel(self.groupBox_7)
+        self.label_22.setObjectName(u"label_22")
+        sizePolicy3.setHeightForWidth(self.label_22.sizePolicy().hasHeightForWidth())
+        self.label_22.setSizePolicy(sizePolicy3)
+        self.label_22.setMinimumSize(QSize(60, 12))
+
+        self.horizontalLayout_17.addWidget(self.label_22)
+
+        self.comboBox_4 = QComboBox(self.groupBox_7)
+        self.comboBox_4.setObjectName(u"comboBox_4")
+
+        self.horizontalLayout_17.addWidget(self.comboBox_4)
+
+        self.pushButton_46 = QPushButton(self.groupBox_7)
+        self.pushButton_46.setObjectName(u"pushButton_46")
+
+        self.horizontalLayout_17.addWidget(self.pushButton_46)
+
+        self.horizontalLayout_17.setStretch(0, 1)
+        self.horizontalLayout_17.setStretch(1, 6)
+        self.horizontalLayout_17.setStretch(2, 1)
+
+        self.verticalLayout_17.addLayout(self.horizontalLayout_17)
+
+        self.horizontalLayout_16 = QHBoxLayout()
+        self.horizontalLayout_16.setObjectName(u"horizontalLayout_16")
+        self.label_23 = QLabel(self.groupBox_7)
+        self.label_23.setObjectName(u"label_23")
+        sizePolicy3.setHeightForWidth(self.label_23.sizePolicy().hasHeightForWidth())
+        self.label_23.setSizePolicy(sizePolicy3)
+        self.label_23.setMinimumSize(QSize(60, 12))
+
+        self.horizontalLayout_16.addWidget(self.label_23)
+
+        self.comboBox_10 = QComboBox(self.groupBox_7)
+        self.comboBox_10.setObjectName(u"comboBox_10")
+
+        self.horizontalLayout_16.addWidget(self.comboBox_10)
+
+        self.pushButton_47 = QPushButton(self.groupBox_7)
+        self.pushButton_47.setObjectName(u"pushButton_47")
+
+        self.horizontalLayout_16.addWidget(self.pushButton_47)
+
+        self.horizontalLayout_16.setStretch(0, 1)
+        self.horizontalLayout_16.setStretch(1, 6)
+        self.horizontalLayout_16.setStretch(2, 1)
+
+        self.verticalLayout_17.addLayout(self.horizontalLayout_16)
+
+        self.radioButton_2 = QRadioButton(self.groupBox_7)
+        self.radioButton_2.setObjectName(u"radioButton_2")
+
+        self.verticalLayout_17.addWidget(self.radioButton_2)
+
+
+        self.verticalLayout_18.addWidget(self.groupBox_7)
+
+        self.groupBox_8 = QGroupBox(self.tab_4)
+        self.groupBox_8.setObjectName(u"groupBox_8")
+        self.horizontalLayout_18 = QHBoxLayout(self.groupBox_8)
+        self.horizontalLayout_18.setObjectName(u"horizontalLayout_18")
+        self.horizontalLayout_15 = QHBoxLayout()
+        self.horizontalLayout_15.setObjectName(u"horizontalLayout_15")
+        self.label_24 = QLabel(self.groupBox_8)
+        self.label_24.setObjectName(u"label_24")
+        sizePolicy3.setHeightForWidth(self.label_24.sizePolicy().hasHeightForWidth())
+        self.label_24.setSizePolicy(sizePolicy3)
+        self.label_24.setMinimumSize(QSize(60, 12))
+
+        self.horizontalLayout_15.addWidget(self.label_24)
+
+        self.progressBar = QProgressBar(self.groupBox_8)
+        self.progressBar.setObjectName(u"progressBar")
+        self.progressBar.setValue(24)
+
+        self.horizontalLayout_15.addWidget(self.progressBar)
+
+        self.pushButton_48 = QPushButton(self.groupBox_8)
+        self.pushButton_48.setObjectName(u"pushButton_48")
+
+        self.horizontalLayout_15.addWidget(self.pushButton_48)
+
+        self.horizontalLayout_15.setStretch(0, 1)
+        self.horizontalLayout_15.setStretch(1, 6)
+        self.horizontalLayout_15.setStretch(2, 1)
+
+        self.horizontalLayout_18.addLayout(self.horizontalLayout_15)
+
+
+        self.verticalLayout_18.addWidget(self.groupBox_8)
+
+        self.verticalSpacer_3 = QSpacerItem(20, 282, QSizePolicy.Minimum, QSizePolicy.Expanding)
+
+        self.verticalLayout_18.addItem(self.verticalSpacer_3)
+
+        self.tabWidget.addTab(self.tab_4, "")
 
         self.horizontalLayout_4.addWidget(self.tabWidget)
 
         self.horizontalLayout_4.setStretch(0, 2)
-        self.horizontalLayout_4.setStretch(1, 8)
+        self.horizontalLayout_4.setStretch(1, 6)
 
         self.verticalLayout_5.addLayout(self.horizontalLayout_4)
 
@@ -554,6 +961,7 @@
         self.line.setFrameShadow(QFrame.Sunken)
 
         self.horizontalLayout.addWidget(self.line)
+
 
         self.verticalLayout_5.addLayout(self.horizontalLayout)
 
@@ -602,6 +1010,17 @@
         self.horizontalLayout_3.addWidget(self.textEdit)
 
         self.tabWidget_2.addTab(self.tab_6, "")
+        self.tab_Consloe = QWidget()
+        self.tab_Consloe.setObjectName(u"tab_Consloe")
+        self.tab_Consloe.setLocale(QLocale(QLocale.Chinese, QLocale.China))
+        self.verticalLayout_16 = QVBoxLayout(self.tab_Consloe)
+        self.verticalLayout_16.setObjectName(u"verticalLayout_16")
+        self.textEdit_2 = QTextEdit(self.tab_Consloe)
+        self.textEdit_2.setObjectName(u"textEdit_2")
+
+        self.verticalLayout_16.addWidget(self.textEdit_2)
+
+        self.tabWidget_2.addTab(self.tab_Consloe, "")
 
         self.verticalLayout_5.addWidget(self.tabWidget_2)
 
@@ -614,134 +1033,122 @@
 
         self.retranslateUi(MainWindow)
 
-        self.tabWidget.setCurrentIndex(0)
-        self.tabWidget_2.setCurrentIndex(0)
+        self.tabWidget.setCurrentIndex(3)
+        self.tabWidget_2.setCurrentIndex(2)
+
 
         QMetaObject.connectSlotsByName(MainWindow)
     # setupUi
 
     def retranslateUi(self, MainWindow):
-        MainWindow.setWindowTitle(QCoreApplication.translate(
-            "MainWindow", u"MainWindow", None))
-        self.groupBox.setTitle(QCoreApplication.translate(
-            "MainWindow", u"Config", None))
-        self.label.setText(QCoreApplication.translate(
-            "MainWindow", u"Device:", None))
-        self.label_3.setText(QCoreApplication.translate(
-            "MainWindow", u"Baudrate:", None))
-        self.label_19.setText(QCoreApplication.translate(
-            "MainWindow", u"Channel", None))
-        self.pushButton_2.setText(QCoreApplication.translate(
-            "MainWindow", u"Refresh Port", None))
-        self.pushButton.setText(QCoreApplication.translate(
-            "MainWindow", u"OPEN CAN", None))
-        self.groupBox_2.setTitle(QCoreApplication.translate(
-            "MainWindow", u"DataIdentifier", None))
-        self.label_2.setText(QCoreApplication.translate(
-            "MainWindow", u"DID", None))
-        self.label_4.setText(QCoreApplication.translate(
-            "MainWindow", u"Description", None))
-        self.label_5.setText(QCoreApplication.translate(
-            "MainWindow", u"Value", None))
-        self.label_6.setText("")
-        self.pushButton_14.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.pushButton_3.setText(
-            QCoreApplication.translate("MainWindow", u"Write", None))
-        self.label_8.setText(QCoreApplication.translate(
-            "MainWindow", u"M SWVer.", None))
-        self.label_14.setText(QCoreApplication.translate(
-            "MainWindow", u"HW Ver.", None))
-        self.label_12.setText(QCoreApplication.translate(
-            "MainWindow", u"DiagVersion.", None))
-        self.pushButton_5.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.pushButton_25.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.pushButton_23.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.label_18.setText(QCoreApplication.translate(
-            "MainWindow", u"SupplierID", None))
-        self.pushButton_4.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.pushButton_8.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.pushButton_20.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.label_10.setText(QCoreApplication.translate(
-            "MainWindow", u"VehicleName", None))
-        self.label_15.setText(QCoreApplication.translate(
-            "MainWindow", u"SW Ver.", None))
-        self.label_17.setText(QCoreApplication.translate(
-            "MainWindow", u"Manu Date", None))
-        self.pushButton_16.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.label_7.setText(QCoreApplication.translate(
-            "MainWindow", u"VIN", None))
-        self.pushButton_15.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.label_9.setText(QCoreApplication.translate(
-            "MainWindow", u"DFLZM PN.", None))
-        self.label_13.setText(QCoreApplication.translate(
-            "MainWindow", u"ECU SN.", None))
-        self.pushButton_10.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.pushButton_6.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.pushButton_12.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.label_16.setText(QCoreApplication.translate(
-            "MainWindow", u"Session", None))
-        self.pushButton_19.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.label_11.setText(QCoreApplication.translate(
-            "MainWindow", u"BootID", None))
-        self.label_20.setText(QCoreApplication.translate(
-            "MainWindow", u"Session", None))
-        self.pushButton_17.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.label_21.setText(QCoreApplication.translate(
-            "MainWindow", u"HW Ver.", None))
-        self.pushButton_21.setText(
-            QCoreApplication.translate("MainWindow", u"Read", None))
-        self.SessionContrl_gbx.setTitle(QCoreApplication.translate(
-            "MainWindow", u"SessionControl(0x10)", None))
-        self.SessionContrl_gbx_3.setTitle(
-            QCoreApplication.translate("MainWindow", u" ECUReset(0x11)", None))
-        self.SessionContrl_gbx_4.setTitle(QCoreApplication.translate(
-            "MainWindow", u"CommControl(0x28)", None))
-        self.SessionContrl_gbx_2.setTitle(
-            QCoreApplication.translate("MainWindow", u"ClearDiag(0x14)", None))
-        self.SessionContrl_gbx_5.setTitle(QCoreApplication.translate(
-            "MainWindow", u"TesterPresent(0x3E)", None))
+        MainWindow.setWindowTitle(QCoreApplication.translate("MainWindow", u"MainWindow", None))
+        self.groupBox.setTitle(QCoreApplication.translate("MainWindow", u"Config", None))
+        self.label.setText(QCoreApplication.translate("MainWindow", u"Device:", None))
+        self.label_3.setText(QCoreApplication.translate("MainWindow", u"Baudrate:", None))
+        self.label_19.setText(QCoreApplication.translate("MainWindow", u"Channel", None))
+        self.pushButton_2.setText(QCoreApplication.translate("MainWindow", u"Refresh Port", None))
+        self.pushButton.setText(QCoreApplication.translate("MainWindow", u"OPEN CAN", None))
+        self.groupBox_2.setTitle(QCoreApplication.translate("MainWindow", u"DataIdentifier", None))
+        self.label_4.setText(QCoreApplication.translate("MainWindow", u"Name:", None))
+        self.label_2.setText(QCoreApplication.translate("MainWindow", u"DID:", None))
+        self.label_5.setText(QCoreApplication.translate("MainWindow", u"Value:", None))
+        self.pushButton_14.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.pushButton_3.setText(QCoreApplication.translate("MainWindow", u"Write", None))
+        self.label_8.setText(QCoreApplication.translate("MainWindow", u"M SWVer.", None))
+        self.label_14.setText(QCoreApplication.translate("MainWindow", u"HW Ver.", None))
+        self.label_12.setText(QCoreApplication.translate("MainWindow", u"DiagVersion.", None))
+        self.pushButton_5.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.pushButton_25.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.pushButton_23.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.label_18.setText(QCoreApplication.translate("MainWindow", u"SupplierID", None))
+        self.pushButton_4.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.pushButton_8.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.pushButton_20.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.label_10.setText(QCoreApplication.translate("MainWindow", u"VehicleName", None))
+        self.label_15.setText(QCoreApplication.translate("MainWindow", u"SW Ver.", None))
+        self.label_17.setText(QCoreApplication.translate("MainWindow", u"Manu Date", None))
+        self.pushButton_16.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.label_7.setText(QCoreApplication.translate("MainWindow", u"VIN", None))
+        self.pushButton_15.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.label_9.setText(QCoreApplication.translate("MainWindow", u"DFLZM PN.", None))
+        self.label_13.setText(QCoreApplication.translate("MainWindow", u"ECU SN.", None))
+        self.pushButton_10.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.pushButton_6.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.pushButton_12.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.label_16.setText(QCoreApplication.translate("MainWindow", u"Session", None))
+        self.pushButton_19.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.label_11.setText(QCoreApplication.translate("MainWindow", u"BootID", None))
+        self.label_20.setText(QCoreApplication.translate("MainWindow", u"Session", None))
+        self.pushButton_17.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.label_21.setText(QCoreApplication.translate("MainWindow", u"HW Ver.", None))
+        self.pushButton_21.setText(QCoreApplication.translate("MainWindow", u"Read", None))
+        self.SessionContrl_gbx.setTitle(QCoreApplication.translate("MainWindow", u"SessionControl(0x10)", None))
+        self.SessionContrl_gbx_3.setTitle(QCoreApplication.translate("MainWindow", u"Security(0x27)", None))
+        self.SessionContrl_gbx_4.setTitle(QCoreApplication.translate("MainWindow", u"CommControl(0x28)", None))
+        self.SessionContrl_gbx_2.setTitle(QCoreApplication.translate("MainWindow", u"ClearDiag(0x14)", None))
+        self.SessionContrl_gbx_5.setTitle(QCoreApplication.translate("MainWindow", u"TesterPresent(0x3E)", None))
         self.radioButton.setText("")
-        self.pushButton_7.setText(QCoreApplication.translate(
-            "MainWindow", u"TesterPresent", None))
-        self.tabWidget.setTabText(self.tabWidget.indexOf(
-            self.tab), QCoreApplication.translate("MainWindow", u"UDS", None))
+        self.pushButton_7.setText(QCoreApplication.translate("MainWindow", u"TesterPresent", None))
+        self.groupBox_3.setTitle(QCoreApplication.translate("MainWindow", u"Security Access", None))
+        self.pushButton_31.setText(QCoreApplication.translate("MainWindow", u"Unlock Level 1", None))
+        self.pushButton_32.setText(QCoreApplication.translate("MainWindow", u"Unlock Level 3", None))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), QCoreApplication.translate("MainWindow", u"UDS", None))
+        self.pushButton_9.setText(QCoreApplication.translate("MainWindow", u"Start Calibration", None))
+        self.pushButton_11.setText(QCoreApplication.translate("MainWindow", u"Calibration Z", None))
+        self.pushButton_13.setText(QCoreApplication.translate("MainWindow", u"Calibration M", None))
+        self.pushButton_18.setText(QCoreApplication.translate("MainWindow", u"Calibration M+", None))
+        self.pushButton_22.setText(QCoreApplication.translate("MainWindow", u"Calibration M-", None))
+        self.pushButton_24.setText(QCoreApplication.translate("MainWindow", u"Calibration X2", None))
+        self.pushButton_26.setText(QCoreApplication.translate("MainWindow", u"Calibration X1", None))
+        self.pushButton_27.setText(QCoreApplication.translate("MainWindow", u"Calibration Y1", None))
+        self.pushButton_28.setText(QCoreApplication.translate("MainWindow", u"Calibration Y2", None))
+        self.pushButton_29.setText(QCoreApplication.translate("MainWindow", u"Calibration Gap", None))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), QCoreApplication.translate("MainWindow", u"\u6821\u51c6", None))
+        self.groupBox_6.setTitle(QCoreApplication.translate("MainWindow", u"\u6362\u6321\u5668\u72b6\u6001", None))
+        self.pushButton_35.setText(QCoreApplication.translate("MainWindow", u"M+", None))
+        self.pushButton_39.setText(QCoreApplication.translate("MainWindow", u"M", None))
+        self.pushButton_36.setText(QCoreApplication.translate("MainWindow", u"M-", None))
+        self.pushButton_37.setText(QCoreApplication.translate("MainWindow", u"X2", None))
+        self.pushButton_38.setText(QCoreApplication.translate("MainWindow", u"X1", None))
+        self.pushButton_30.setText(QCoreApplication.translate("MainWindow", u"Z", None))
+        self.pushButton_33.setText(QCoreApplication.translate("MainWindow", u"Y1", None))
+        self.pushButton_34.setText(QCoreApplication.translate("MainWindow", u"Y2", None))
+        self.pushButton_41.setText(QCoreApplication.translate("MainWindow", u"Unlock", None))
+        self.pushButton_40.setText(QCoreApplication.translate("MainWindow", u"Park", None))
+        self.groupBox_5.setTitle(QCoreApplication.translate("MainWindow", u"\u6362\u6321\u5668CAN", None))
+        self.label_6.setText(QCoreApplication.translate("MainWindow", u"CAN error:", None))
+        self.groupBox_4.setTitle(QCoreApplication.translate("MainWindow", u"TCU Command", None))
+        self.pushButton_42.setText(QCoreApplication.translate("MainWindow", u"P", None))
+        self.pushButton_45.setText(QCoreApplication.translate("MainWindow", u"R", None))
+        self.pushButton_44.setText(QCoreApplication.translate("MainWindow", u"N", None))
+        self.pushButton_43.setText(QCoreApplication.translate("MainWindow", u"D", None))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), QCoreApplication.translate("MainWindow", u"\u529f\u80fd\u6307\u793a", None))
+        self.groupBox_7.setTitle(QCoreApplication.translate("MainWindow", u"Set File", None))
+        self.label_22.setText(QCoreApplication.translate("MainWindow", u"Load APP:", None))
+        self.pushButton_46.setText(QCoreApplication.translate("MainWindow", u"Load APP", None))
+        self.label_23.setText(QCoreApplication.translate("MainWindow", u"Set Log:", None))
+        self.pushButton_47.setText(QCoreApplication.translate("MainWindow", u"Set Log", None))
+        self.radioButton_2.setText(QCoreApplication.translate("MainWindow", u"Start from boot", None))
+        self.groupBox_8.setTitle(QCoreApplication.translate("MainWindow", u"Progress", None))
+        self.label_24.setText(QCoreApplication.translate("MainWindow", u"Progress:", None))
+        self.pushButton_48.setText(QCoreApplication.translate("MainWindow", u"Program", None))
+        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), QCoreApplication.translate("MainWindow", u"Bootloader", None))
         ___qtablewidgetitem = self.tableWidget.horizontalHeaderItem(0)
-        ___qtablewidgetitem.setText(QCoreApplication.translate(
-            "MainWindow", u"\u5e8f\u53f7", None))
+        ___qtablewidgetitem.setText(QCoreApplication.translate("MainWindow", u"\u5e8f\u53f7", None));
         ___qtablewidgetitem1 = self.tableWidget.horizontalHeaderItem(1)
-        ___qtablewidgetitem1.setText(QCoreApplication.translate(
-            "MainWindow", u"\u65f6\u95f4", None))
+        ___qtablewidgetitem1.setText(QCoreApplication.translate("MainWindow", u"\u65f6\u95f4", None));
         ___qtablewidgetitem2 = self.tableWidget.horizontalHeaderItem(2)
-        ___qtablewidgetitem2.setText(QCoreApplication.translate(
-            "MainWindow", u"\u6570\u636e\u65b9\u5411", None))
+        ___qtablewidgetitem2.setText(QCoreApplication.translate("MainWindow", u"\u6570\u636e\u65b9\u5411", None));
         ___qtablewidgetitem3 = self.tableWidget.horizontalHeaderItem(3)
-        ___qtablewidgetitem3.setText(
-            QCoreApplication.translate("MainWindow", u"ID", None))
+        ___qtablewidgetitem3.setText(QCoreApplication.translate("MainWindow", u"ID", None));
         ___qtablewidgetitem4 = self.tableWidget.horizontalHeaderItem(4)
-        ___qtablewidgetitem4.setText(
-            QCoreApplication.translate("MainWindow", u"DLC", None))
+        ___qtablewidgetitem4.setText(QCoreApplication.translate("MainWindow", u"DLC", None));
         ___qtablewidgetitem5 = self.tableWidget.horizontalHeaderItem(5)
-        ___qtablewidgetitem5.setText(QCoreApplication.translate(
-            "MainWindow", u"\u5e27\u7c7b\u578b", None))
+        ___qtablewidgetitem5.setText(QCoreApplication.translate("MainWindow", u"\u5e27\u7c7b\u578b", None));
         ___qtablewidgetitem6 = self.tableWidget.horizontalHeaderItem(6)
-        ___qtablewidgetitem6.setText(QCoreApplication.translate(
-            "MainWindow", u"\u6570\u636e", None))
-        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(
-            self.tab_logger), QCoreApplication.translate("MainWindow", u"logging", None))
-        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(
-            self.tab_6), QCoreApplication.translate("MainWindow", u"Graphic", None))
+        ___qtablewidgetitem6.setText(QCoreApplication.translate("MainWindow", u"\u6570\u636e", None));
+        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_logger), QCoreApplication.translate("MainWindow", u"logging", None))
+        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_6), QCoreApplication.translate("MainWindow", u"Graphic", None))
+        self.tabWidget_2.setTabText(self.tabWidget_2.indexOf(self.tab_Consloe), QCoreApplication.translate("MainWindow", u"Console", None))
     # retranslateUi
+
diff --git a/test.py b/test.py
index a61aad1..d5a5927 100644
--- a/test.py
+++ b/test.py
@@ -10,138 +10,188 @@
 import sys
 from PySide2.QtWidgets import QApplication, QMainWindow
 from mainwindows import *
-from multiprocessing import Process, Queue, Value
+from multiprocessing import Process, Queue, Value, Pipe
 import datetime
 # def rece_msg(bus):
 #     msg = bus.Receive(0.1)
 #     if msg[0] is not None:
 #         print(msg[0].arbitration_id)
+DID_dic = {
+    "ProgrammingCounter": 0x2100,
+    "ProAtpCounter": 0x2101,
+    "BackupConfig": 0x2102,
+    "VehicleName": 0x2103,
+    "DiagVersion": 0x2104,
+    "BootSoftId": 0x2105,
+    "DFLZMPartNum": 0xF187,
+    "VehiclEECUSoftwareVersion": 0x2108,
+    "SupplierID": 0xF18A,
+    "ECUManufacturingDate": 0x210B,
+    "ECUSerialNumID": 0xf18c,
+    "VINDataIdentifier": 0xF190,
+    "ECUHardwareVersion": 0xF193,
+    "ECUSoftwareVersion": 0xF195,
+    "SystemNameOrEngineType": 0x2110,
+    "RepairShopCodeOrTester": 0x2111,
+    "ECUProgtammingDate": 0x2111,
+    "InstallDate": 0x2113,
+    "NetConfig": 0xf019,
+    "FunctionConfig": 0xf010,
+    "ActiveDiagSession": 0x2106,
+    "EGSMSensorPositon": 0x2116,
+    "ReleaseButtonState": 0x2118,
+    "PButtionState": 0x2119,
+    "PaddleState": 0x211A,
+    "ECUPowerVoltage": 0x211B,
+    "VehicleSpeed": 0x211c,
+    "SystemName": 0xF197,
+    "WriteFingerPrint": 0xF15A,
+    "ReadFingerPrint": 0xf15b,
+    "IndicationLEDControl": 0x8101
+}
+
+print(DID_dic["IndicationLEDControl"])
+
+# def f(conn):
+#     conn.send([1, 'test', None])
+#     conn.send([2, 'test', None])
+#     print(conn.recv())
+#     conn.close()
 
 
-def send_msg(bus):
-    msg = Message(
-        arbitration_id=0x742,
-        is_remote_frame=0,
-        channel=0,
-        dlc=8,
-        data=[0]*8,
-    )
-    bus.send(msg)
+# if __name__ == "__main__":
+#     parent_conn, child_conn = Pipe()  # 产生两个返回对象,一个是管道这一头,一个是另一头
+#     p = Process(target=f, args=(child_conn,))
+#     p.start()
+#     print(parent_conn.recv())
+#     print(parent_conn.recv())
+#     parent_conn.send('father test')
+#     p.join()
+
+# def send_msg(bus):
+#     msg = Message(
+#         arbitration_id=0x742,
+#         is_remote_frame=0,
+#         channel=0,
+#         dlc=8,
+#         data=[0]*8,
+#     )
+#     bus.send(msg)
 
 
-# bus = open_device()
-# while True:
-#     send_msg(bus)
-#     # rece_msg(bus)
+# # bus = open_device()
+# # while True:
+# #     send_msg(bus)
+# #     # rece_msg(bus)
 
 
-device_type = DEVICETYPE['USBCAN-II']
-device_index = 0
-can_channel = 0
-can_filters = [
-    # {'can_id': self.shifter.canid.normalid, 'can_mask': 0xFFFFFFFF},
-    {'can_id': 0x420, 'can_mask': 0xFFFFFFFF}]
-bus = USBCAN(device_type, device_index, can_channel,
-             bitrate=500000, can_filters=can_filters)
+# device_type = DEVICETYPE['USBCAN-II']
+# device_index = 0
+# can_channel = 0
+# can_filters = [
+#     # {'can_id': self.shifter.canid.normalid, 'can_mask': 0xFFFFFFFF},
+#     {'can_id': 0x420, 'can_mask': 0xFFFFFFFF}]
+# bus = USBCAN(device_type, device_index, can_channel,
+#              bitrate=500000, can_filters=can_filters)
 
-msg = Message(
-    arbitration_id=0x742,
-    is_remote_frame=0,
-    channel=0,
-    dlc=8,
-    data=bytearray([0x02, 0x3e, 0, 0, 0, 0, 0, 0])
-)
+# msg = Message(
+#     arbitration_id=0x742,
+#     is_remote_frame=0,
+#     channel=0,
+#     dlc=8,
+#     data=bytearray([0x02, 0x3e, 0, 0, 0, 0, 0, 0])
+# )
 
 
-q_rx = Queue()
-q_tx = Queue()
-connect = Value('i', 1)
-close = Value('i', 0)
+# q_rx = Queue()
+# q_tx = Queue()
+# connect = Value('i', 1)
+# close = Value('i', 0)
 
-# print(q_rx.empty())
+# # print(q_rx.empty())
 
-# def start():
+# # def start():
+
+
+# # def rece_msg():
+# #     # num = bus.GetReceiveNum(device_type, device_index, can_channel)
+# #     print(num)
+# #     for i in range(num):
+# #         # while not q_rx.empty():
+# #         print(q_rx.get())
+# #         #     time.sleep(0.1)
+
+
+# # bus.CloseDevice()
+# # start()
+# def formatedata(index, item, received):
+#     data = []
+#     if received:
+#         data.append('{:0>4}'.format(index))
+#         data.append(item.timestamp)
+#         data.append('接收')
+#     else:
+#         data.append('')
+#         data.append(item.timestamp)
+#         data.append('发送')
+
+#     # print(time.time(), time.localtime(item.TimeStamp), item.TimeStamp)
+#     data.append(str.upper(str(hex(item.arbitration_id))).replace('X', 'x'))
+
+#     # data.append('远程帧' if int(item.is_remote_frame) == 1 else '数据帧')
+#     data.append(item.dlc)
+#     if int(item.is_extended_id) == 1:
+#         data.append('扩展帧')
+#     else:
+#         data.append('标准帧')
+
+#     data.append(' '.join(['{:0<2x}'.format(a) for a in list(item.data)]))
+#     return data
 
 
 # def rece_msg():
-#     # num = bus.GetReceiveNum(device_type, device_index, can_channel)
-#     print(num)
-#     for i in range(num):
-#         # while not q_rx.empty():
-#         print(q_rx.get())
-#         #     time.sleep(0.1)
+#     # msg, num = bus.Receive(len=10)
+#     num = q_rx.qsize()
+#     if not num == 0:
+#         for i in range(num):
+#             # print(msg[0].arbitration_id)
+#             print(formatedata(i, q_rx.get(), True))
 
 
-# bus.CloseDevice()
-# start()
-def formatedata(index, item, received):
-    data = []
-    if received:
-        data.append('{:0>4}'.format(index))
-        data.append(item.timestamp)
-        data.append('接收')
-    else:
-        data.append('')
-        data.append(item.timestamp)
-        data.append('发送')
-
-    # print(time.time(), time.localtime(item.TimeStamp), item.TimeStamp)
-    data.append(str.upper(str(hex(item.arbitration_id))).replace('X', 'x'))
-
-    # data.append('远程帧' if int(item.is_remote_frame) == 1 else '数据帧')
-    data.append(item.dlc)
-    if int(item.is_extended_id) == 1:
-        data.append('扩展帧')
-    else:
-        data.append('标准帧')
-
-    data.append(' '.join(['{:0<2x}'.format(a) for a in list(item.data)]))
-    return data
+# def tx_task(bus: USBCAN):
+#     while True:
+#         bus.send(msg=msg)
+#         time.sleep(0.1)
 
 
-def rece_msg():
-    # msg, num = bus.Receive(len=10)
-    num = q_rx.qsize()
-    if not num == 0:
-        for i in range(num):
-            # print(msg[0].arbitration_id)
-            print(formatedata(i, q_rx.get(), True))
+# def rx_task(bus: USBCAN):
+#     while True:
+#         msg, num = bus.Receive(len=10)
+#         time.sleep(0.1)
+#         if not num == 0:
+#             for i in range(num):
+#                 if msg[i].arbitration_id == 0x77a:
+#                     # print(formatedata(i, msg[i], True))
+#                     print(msg[i].data)
 
 
-def tx_task(bus: USBCAN):
-    while True:
-        bus.send(msg=msg)
-        time.sleep(0.1)
-
-
-def rx_task(bus: USBCAN):
-    while True:
-        msg, num = bus.Receive(len=10)
-        time.sleep(0.1)
-        if not num == 0:
-            for i in range(num):
-                if msg[i].arbitration_id == 0x77a:
-                    # print(formatedata(i, msg[i], True))
-                    print(msg[i].data)
-
-
-if __name__ == '__main__':
-    bus.InitAndStart()
-    info = bus.GetDeviceInf()
-    print(info.fw_version)
-    # arg = {bus}
-    t = threading.Thread(target=rx_task, args=(bus,))
-    tx = threading.Thread(target=tx_task, args=(bus,))
-    t.start()
-    tx.start()
-    # msgProcess = Process(
-    #     name='pyUSBCANListener',
-    #     target=bus.ListeningMsg,
-    #     args=(connect, close, q_rx, q_tx))
-    # msgProcess.daemon = True
-    # msgProcess.start()
-    # while True:
-    #     rece_msg()
+# if __name__ == '__main__':
+#     bus.InitAndStart()
+#     info = bus.GetDeviceInf()
+#     print(info.fw_version)
+#     # arg = {bus}
+#     t = threading.Thread(target=rx_task, args=(bus,))
+#     tx = threading.Thread(target=tx_task, args=(bus,))
+#     t.start()
+#     tx.start()
+# msgProcess = Process(
+#     name='pyUSBCANListener',
+#     target=bus.ListeningMsg,
+#     args=(connect, close, q_rx, q_tx))
+# msgProcess.daemon = True
+# msgProcess.start()
+# while True:
+#     rece_msg()
 
 # def inserttable(table, data):
 #     # for row in range(5):
diff --git a/widgets/ShifterTool.py b/widgets/ShifterTool.py
index 525dd9f..020d602 100644
--- a/widgets/ShifterTool.py
+++ b/widgets/ShifterTool.py
@@ -1,6 +1,9 @@
 
-from ast import Pass
+from ast import Not, Pass
+from concurrent.futures import thread
+from logging import exception
 import threading
+from typing import List
 from can import BusABC, Message
 from udsoncan.client import Client
 from udsoncan.exceptions import TimeoutException
@@ -11,13 +14,14 @@
 from isotp import CanMessage
 import queue
 from USBCAN import *
-from Shifter import ShifterClass
+from Shifter import AsciiCodec, ShifterClass
 from mainwindows import Ui_MainWindow
 from PySide2 import QtWidgets, QtCore, QtGui
 import struct
 import time
 import datetime
-from multiprocessing import Array, Pool, Process, Queue, Value
+from ShifterDefine import *
+from multiprocessing import Array, Pool, Process, Queue, Value, Pipe
 
 MAX_RCV_NUM = 20
 
@@ -46,6 +50,8 @@
 
 
 g_signal = UISignals()
+uds_conn, isotp_conn = Pipe()
+user_conn, drive_conn = Pipe()
 
 
 class HardwreDevice():
@@ -104,7 +110,6 @@
             BaseConnection.__init__(self, name)
             self.UDStoIsoTPQueue = queue.Queue()  # USD --> isotp
             self.IsoTPtoUDSQueue = queue.Queue()  # ISOTP --> UDS
-            self.CANtoIsoTPQueue = queue.Queue()  # CAN --> isotp
             # self.IsoTPtoCANQueue = queue.Queue()  # ISOTP--> CAN
             self._read_thread = None
             self.exit_requested = False
@@ -149,7 +154,8 @@
                     payload = payload[0:self.mtu]
 
             # isotp.protocol.TransportLayer uses byte array. udsoncan is strict on bytes format
-            self.UDStoIsoTPQueue.put(bytearray(payload))
+            self.isotp_layer.send(bytearray(payload))
+            # self.UDStoIsoTPQueue.put(bytearray(payload))
 
         def specific_wait_frame(self, timeout=2):
             if not self.opened:
@@ -157,11 +163,12 @@
 
             timedout = False
             frame = None
+            # frame = uds_conn.recv()
             try:
-                frame = self.IsoTPtoUDSQueue.get(block=True, timeout=timeout)
-                # frame = self.CANtoIsoTPQueue.get(block=True, timeout=timeout)
+                frame = self.IsoTPtoUDSQueue.get(block=True, timeout=5)
             except queue.Empty:
                 timedout = True
+                # frame = self.CANtoIsoTPQueue.get(block=True, timeout=timeout)
 
             if timedout:
                 raise TimeoutException(
@@ -187,19 +194,20 @@
         def rxthread_task(self):
             while not self.exit_requested:
                 try:
-                    # self.logger.debug("UDStoIsoTPQueue queue size is now %d" % (
-                    #     self.UDStoIsoTPQueue.qsize()))
-                    while not self.UDStoIsoTPQueue.empty():
-                        self.isotp_layer.send(self.UDStoIsoTPQueue.get())
+                    # # self.logger.debug("UDStoIsoTPQueue queue size is now %d" % (
+                    # #     self.UDStoIsoTPQueue.qsize()))
+                    # while not self.UDStoIsoTPQueue.empty():
+                    #     self.isotp_layer.send(self.UDStoIsoTPQueue.get())
 
                     self.isotp_layer.process()
 
                     while self.isotp_layer.available():
+                        # isotp_conn.send(self.isotp_layer.recv())
                         self.IsoTPtoUDSQueue.put(self.isotp_layer.recv())
-                    # self.logger.debug("IsoTPtoUDSQueue queue size is now %d" % (
-                    #     self.IsoTPtoUDSQueue.qsize()))
+                        self.logger.debug("IsoTPtoUDSQueue queue size is now %d" % (
+                            self.IsoTPtoUDSQueue.qsize()))
 
-                    # time.sleep(self.isotp_layer.sleep_time())
+                        # time.sleep(self.isotp_layer.sleep_time())
                     time.sleep(0.001)
 
                 except Exception as e:
@@ -216,7 +224,7 @@
         # self.protocol("WM_DELETE_WINDOW", self.Form_OnClosing)
         self.msgQueue = Queue()  # can layer receive queue
         self.sendQueue = Queue()  # can layer send queue
-
+        self.CANtoIsoTPQueue = Queue()  # CAN --> isotp
         self.shifter = ShifterClass()
         self.devicedescription = HardwreDevice()
         self.windows = QtWidgets.QMainWindow()
@@ -229,6 +237,9 @@
         self.DeviceInit()
         self.WidgetsInit()
         self.ChnInfoUpdate(self._isOpen)
+        self.drv_data: bytes = [0x1c, 0x01, 0x06, 0x80,
+                                0x1f, 0x01, 0x06, 0x80, 0xfb, 0x0a]
+        self.app_data: bytes = None
 
     def DeviceInit(self):
         self._usbcan = None
@@ -277,7 +288,7 @@
         self.udsclient = Client(self.conn, request_timeout=2)
         self.udsclient.config['security_algo'] = self.SecAlgo
         self.udsclient.config['security_algo_params'] = [
-            0x4FE87269, 0x6BC361D8, 0x9B127D51, 0x5BA41903]
+            0x11223344, 0x20AA097B, 0x11223344, 0x70237577]
         self.udsclient.config['data_identifiers'] = self.shifter.did_config
 
         self.udsclient.config['server_address_format'] = 32
@@ -303,24 +314,26 @@
         temp_key = (seed[0] << 24) | (
             seed[1] << 16) | (seed[2] << 8) | (seed[3])
         if level == 0x01:
-            output_key_temp = ((((temp_key >> 4) ^ temp_key)
-                                << 3) ^ temp_key) & 0xFFFFFFFF
-        elif level == 0x11:
-            _temp_y = ((temp_key << 24) & 0xFF000000) + ((temp_key << 8) &
-                                                         0xFF0000) + ((temp_key >> 8) & 0xFF00) + ((temp_key >> 24) & 0xFF)
-            _temp_z = 0
-            _temp_sum = 0
-            for i in range(64):
-                _temp_y += ((((_temp_z << 4) ^ (_temp_z >> 5)) + _temp_z)
-                            ^ (_temp_sum + params[_temp_sum & 0x3])) & 0xFFFFFFFF
-                _temp_y = _temp_y & 0xFFFFFFFF
-                _temp_sum += 0x8F750A1D
-                _temp_sum = _temp_sum & 0xFFFFFFFF
-                _temp_z += ((((_temp_y << 4) ^ (_temp_y >> 5)) + _temp_y) ^
-                            (_temp_sum + params[(_temp_sum >> 11) & 0x3])) & 0xFFFFFFFF
-                _temp_z = _temp_z & 0xFFFFFFFF
-            output_key_temp = (((_temp_z << 24) & 0xFF000000) | ((_temp_z << 8) & 0xFF0000) | (
-                (_temp_z >> 8) & 0xFF00) | ((_temp_z >> 24) & 0xFF))
+            output_key_temp = 0x20AA097B
+            # output_key_temp = ((((temp_key >> 4) ^ temp_key)
+            #                     << 3) ^ temp_key) & 0xFFFFFFFF
+        elif level == 0x09:
+            output_key_temp = 0x70237577
+            # _temp_y = ((temp_key << 24) & 0xFF000000) + ((temp_key << 8) &
+            #                                              0xFF0000) + ((temp_key >> 8) & 0xFF00) + ((temp_key >> 24) & 0xFF)
+            # _temp_z = 0
+            # _temp_sum = 0
+            # for i in range(64):
+            #     _temp_y += ((((_temp_z << 4) ^ (_temp_z >> 5)) + _temp_z)
+            #                 ^ (_temp_sum + params[_temp_sum & 0x3])) & 0xFFFFFFFF
+            #     _temp_y = _temp_y & 0xFFFFFFFF
+            #     _temp_sum += 0x8F750A1D
+            #     _temp_sum = _temp_sum & 0xFFFFFFFF
+            #     _temp_z += ((((_temp_y << 4) ^ (_temp_y >> 5)) + _temp_y) ^
+            #                 (_temp_sum + params[(_temp_sum >> 11) & 0x3])) & 0xFFFFFFFF
+            #     _temp_z = _temp_z & 0xFFFFFFFF
+            # output_key_temp = (((_temp_z << 24) & 0xFF000000) | ((_temp_z << 8) & 0xFF0000) | (
+            #     (_temp_z >> 8) & 0xFF00) | ((_temp_z >> 24) & 0xFF))
         else:
             output_key_temp = temp_key
 
@@ -347,16 +360,8 @@
         '''receive msg from can layer
         use queue read from can layer listen'''
         can_msgs = None
-        if not self.conn.CANtoIsoTPQueue.empty():
-            can_msgs = self.conn.CANtoIsoTPQueue.get()
-        # can_num = self.conn.CANtoIsoTPQueue.size()
-        # # can_num = self._usbcan.GetReceiveNum(self.devicedescription.channel)
-        # if can_num and not self._terminated:
-        #     read_cnt = MAX_RCV_NUM if can_num >= MAX_RCV_NUM else can_num
-        #     for i in range(read_cnt):
-        #         can_msgs[i] = self.conn.CANtoIsoTPQueue.get()
-        # else:
-        #     can_msgs = None
+        if not self.CANtoIsoTPQueue.empty():
+            can_msgs = self.CANtoIsoTPQueue.get()
         return can_msgs
 
     def isotp_send(self, isotp_msg):
@@ -368,9 +373,7 @@
         msg.channel = 0
         msg.data = isotp_msg.data  # bytearray
         msg.is_extended_id = False
-        # for i in range(isotp_msg.dlc):
-        #     msg.data[i] = isotp_msg.data[i]
-        self.sendQueue.put(msg)
+        self._usbcan.send(msg)
 
     def WidgetsInit(self):
         # self.UI.setupUi(self)
@@ -402,8 +405,32 @@
 
         self.UI.comboBox_9.addItems(['0x00使能收发', '0x01能收禁发', '0x03禁止收发'])
         self.UI.comboBox_9.activated.connect(self.communicationControl_req)
+        self.UI.comboBox_6.addItems(list(DID_dic.keys()))
+        self.DID_display()
+        self.UI.comboBox_6.activated.connect(self.DID_display)
+
+        self.UI.pushButton_31.clicked.connect(self.SecurityUnlockLevel_1)
+        self.UI.pushButton_32.clicked.connect(self.SecurityUnlockLevel_3)
+
+        self.UI.pushButton_12.clicked.connect(self.ReadSupplyID)
+        self.UI.pushButton_4.clicked.connect(self.ReadVIN)
+        self.UI.pushButton_6.clicked.connect(self.ReadMfgDate)
+        self.UI.pushButton_14.clicked.connect(self.ReadDataByID)
+        self.UI.pushButton_9.clicked.connect(self.StartCalibraiton)
+        self.UI.pushButton_11.clicked.connect(self.Calibraiton_Z)
+        self.UI.pushButton_13.clicked.connect(self.Calibraiton_M)
+        self.UI.pushButton_18.clicked.connect(self.Calibraiton_MP)
+        self.UI.pushButton_22.clicked.connect(self.Calibraiton_MN)
+        self.UI.pushButton_24.clicked.connect(self.Calibraiton_X2)
+        self.UI.pushButton_26.clicked.connect(self.Calibraiton_X1)
+        self.UI.pushButton_27.clicked.connect(self.Calibraiton_Y1)
+        self.UI.pushButton_28.clicked.connect(self.Calibraiton_Y2)
+        self.UI.pushButton_29.clicked.connect(self.Calibraiton_GAP)
 
         self.UI.radioButton.toggled.connect(self.TestPresentEvent)
+
+        self.UI.pushButton_48.clicked.connect(self.start_programming)
+        seff.UI.pushButton_46.clicked.connect(self.loadAppfile)
 
     def _formatMsgData(self, index, item, received):
         '''msg data to list
@@ -447,34 +474,49 @@
         self.can_thread.start()
 
     def can_thread(self):
-        while self._isOpen.value == 1:
+        while True:
             time.sleep(0.01)
-            if self.needdisconnect.value == 1:
-                ret = self._usbcan.CloseDevice()
-                if ret == 1:
-                    self.needdisconnect.value = 0
-                    self._isOpen.value = 0
-            else:
-                msg, num = self._usbcan.Receive(len=10)
-                if not num == 0:
-                    for i in range(num):
-                        if msg[i].arbitration_id == self.shifter.canid.phy_txId:
-                            self.conn.CANtoIsoTPQueue.put(
-                                msg[i])  # send msg to isotp
-                        self.msgQueue.put(msg[i])
-                        # send signal to update screen
-                    # logger.info('Rx: ID=0x{:0<3x} '.format(msg[i].arbitration_id) + ' '.join(['0x' +
-                    #                                                                           '{:0<2x}'.format(a).upper() for a in list(msg[i].data)]))
-                    g_signal.sig_MsgReceived.emit(num)
-                msgToSendCnt = self.sendQueue.qsize()
-                if msgToSendCnt > 0:
-                    msg = Message()
-                    for i in range(msgToSendCnt):
+            while self._isOpen.value == 1:
+                time.sleep(0.01)
+                if self.needdisconnect.value == 1:
+                    ret = self._usbcan.CloseDevice()
+                    if ret == 1:
+                        self.needdisconnect.value = 0
+                        self._isOpen.value = 0
+                else:
+                    msg, num = self._usbcan.Receive(len=1)
+                    if not num == 0:
+                        for i in range(num):
+                            if msg[i].arbitration_id == self.shifter.canid.phy_txId:
+                                # conn.send(msg[i])  # pipe connection send
+                                self.CANtoIsoTPQueue.put(
+                                    msg[i])  # send msg to isotp
+                                print('收到77A')
 
-                        msg = self.sendQueue.get()
-                        # logger.info('Tx: ID=0x{:0<3x} '.format(
-                        #     msg.arbitration_id)+'DLC={} '.format(msg.dlc)+'externd flag ={} '.format(msg.is_extended_id)+'remote frame:{} '.format(msg.is_remote_frame))
-                        self._usbcan.send(msg)
+                            self.msgQueue.put(msg[i])
+                            # logger.info('time:'.format(msg[i].timestamp)+'Rx: ID=0x{:0<3x} '.format(msg[i].arbitration_id) + ' '.join(['0x' +
+                            #    '{:0<2x}'.format(a).upper() for a in list(msg[i].data)]))
+
+                            # send signal to update screen
+
+                        g_signal.sig_MsgReceived.emit(num)
+                # msgToSendCnt = self.sendQueue.qsize()
+                # if msgToSendCnt > 0:
+                #     msg = Message()
+                #     for i in range(msgToSendCnt):
+
+                #         msg = self.sendQueue.get()
+                #         # logger.info('Tx: ID=0x{:0<3x} '.format(
+                #         #     msg.arbitration_id)+'DLC={} '.format(msg.dlc)+'externd flag ={} '.format(msg.is_extended_id)+'remote frame:{} '.format(msg.is_remote_frame))
+                #         self._usbcan.send(msg)
+    def send_dump(self):
+        msg = Message()
+        msg.arbitration_id = self.shifter.canid.phy_rxId
+        msg.dlc = 8
+        msg.channel = 0
+        msg.data = [0x02, 0x3e, 0x80, 0, 0, 0, 0, 0]
+        msg.is_extended_id = False
+        self._usbcan.send(msg)
 
     def open_close(self):
         if self._isOpen.value == 0:
@@ -494,6 +536,8 @@
                 self._deviceOpenUpdate()
                 self.can_thread_start()
                 self.conn.open()  # start iso tp thread
+                self.send_dump()
+                self.send_dump()
 
             else:
                 self._usbcan.InitAndStart()
@@ -502,6 +546,7 @@
         else:
             self.needdisconnect.value = 1
             self._deviceOpenUpdate()
+            self.TestPresentTimer.stop()
 
     def update_HardwareDevice(self):
 
@@ -529,8 +574,16 @@
             self._updateRootList()
             time.sleep(0.1)
 
-    def disp_string(self, out):
-        self.UI.statusbar.showMessage(str(out))
+    def disp_string(self, out_s):
+        dt = datetime.now()
+        nowtime_str = dt.strftime('%I:%M:%S')  # time
+        self.textEdit_2.insertPlainText(nowtime_str + ': ')
+        cursor = self.textEdit_2.textCursor()
+        cursor.movePosition(QtGui.QTextCursor.End)
+        self.textEdit_2.setTextCursor(cursor)
+        self.textEdit_2.insertPlainText(str(out_s+"\t\n"))
+
+        # self.statusbar.showMessage(str(out))
 
     def _updateRootList(self):
         _dataSize = self.msgQueue.qsize()
@@ -566,26 +619,82 @@
 
     def TestPresentEvent(self):
         if self.UI.radioButton.isChecked():
-            self.TestPresentTimer.start(4000)
+            self.TestPresentTimer.start(3000)
         else:
             self.TestPresentTimer.stop()
 
     def creat_testpresentReq(self):
-        self.udsclient.tester_present()
+        self.send_dump()
 
     def sessioncontrol_req(self):
         sesson = self.UI.comboBox.currentIndex() + 1
-        self.udsclient.change_session(sesson)
+        t = threading.Thread(
+            target=self.udsclient.change_session, args=(sesson,))
+        t.start()
+        t.join()
+        # self.udsclient.change_session(sesson)
 
     # self.UI.comboBox_8.addItems(['0x01硬件复位', '0x03软件复位'])
     def MCUReset_req(self):
         req = 0x03 if self.UI.comboBox_8.currentData() == '0x01硬件复位' else 0x01
         self.udsclient.ecu_reset(req)
 
-        # self.UI.comboBox_9.addItems(['0x00使能收发', '0x01能收禁发', '0x03禁止收发'])
+    def Security_req(self):
+        self.udsclient.unlock_security_access(1)
+        # Security_dic[self.UI.comboBox_8.currentData()]
+
+    def SecurityUnlockLevel_1(self):
+        data = self.udsclient.unlock_security_access(1)
+        if data.positive:
+            self.UI.pushButton_31.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def SecurityUnlockLevel_3(self):
+        data = self.udsclient.unlock_security_access(9)
+        if data.positive:
+            self.UI.pushButton_32.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def ReadSupplyID(self):
+        data = self.ReadByDID(0xF18A)
+        if data is not None:
+            self.UI.lineEdit_8.setText(str(data[0xF18A]))
+
+    def ReadVIN(self):
+        data = self.ReadByDID(0xF190)
+        if data is not None:
+            self.UI.lineEdit_3.setText(str(data[0xF190]))
+
+    def ReadMfgDate(self):
+        data = self.ReadByDID(0x210B)
+        if data is not None:
+            self.UI.lineEdit_5.setText(str(data[0x210B]))
+
+    def ReadByDID(self, didlist: List):
+        values = {}
+        try:
+            response = self.udsclient.read_data_by_identifier(didlist)
+            if response.positive:
+                values = response.service_data.values
+            return values
+        except Exception as e:
+            g_signal.sig_Disp_str.emit(e)
+
+    def DID_display(self):
+        # print(self.UI.comboBox_6.currentText())
+        self.UI.lineEdit.setText("0x{:0<4x}".
+                                 format((DID_dic[self.UI.comboBox_6.currentText()])))
+
+    def ReadDataByID(self):
+        tempdid = DID_dic[self.UI.comboBox_6.currentText()]
+        self.UI.lineEdit_2.clear()
+        data = self.ReadByDID(tempdid)
+        if data is not None and len(str(data[tempdid])):
+            self.UI.lineEdit_2.setText(str(data[tempdid])+' ')
+
     def communicationControl_req(self):
         req = 0x00
-        select = self.UI.comboBox_9.currentData()
+        select = self.UI.comboBox_9.currentText()
         if select == '0x00使能收发':
             req = 0
         elif select == '0x01能收禁发':
@@ -594,3 +703,257 @@
             req = 3
         self.udsclient.communication_control(
             control_type=0, communication_type=req)
+
+    def StartCalibraiton(self):
+        startcmd = bytearray([0x0, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(startcmd)):
+            self.UI.pushButton_9.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_Z(self):
+        calcmd = bytearray([0x1, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_11.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_M(self):
+        calcmd = bytearray([0x2, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_13.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_MP(self):
+        calcmd = bytearray([0x3, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_18.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_MN(self):
+        calcmd = bytearray([0x4, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_22.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_X2(self):
+        calcmd = bytearray([0x5, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_24.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_X1(self):
+        calcmd = bytearray([0x6, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_26.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_Y1(self):
+        calcmd = bytearray([0x7, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_27.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_Y2(self):
+        calcmd = bytearray([0x8, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_28.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def Calibraiton_GAP(self):
+        calcmd = bytearray([0x9, 0x0, 0x0, 0x0])
+        if self.RequestRoutControl(0xFFAA, bytes(calcmd)):
+            self.UI.pushButton_29.setStyleSheet(
+                "background-color:rgb(255, 85, 127)")
+
+    def RequestRoutControl(self, routine_id, data):
+        resp_1 = self.udsclient.start_routine(routine_id=routine_id, data=data)
+        return resp_1.positive
+
+    def pre_programming(self):
+
+        self.disp_string('# 预编程步骤')
+
+        # 进入extended session
+        self.disp_string('>>> 进入扩展模式')
+        response = self.udsclient.change_session(3)
+        if response.positive:
+            # 检查编程条件
+            self.disp_string('>>> 检查编程条件')
+            response = self.udsclient.start_routine(0xff02)
+        if response.positive:
+            # 关闭DTC的存储
+            self.disp_string('>>> 关闭DTC的存储')
+            response = self.udsclient.control_dtc_setting(2)
+        # print(response)
+        if response.positive:
+            # 关闭与诊断无关的报文
+            self.disp_string('>>> 关闭与诊断无关的报文')
+            response = self.udsclient.communication_control(0x03, 0x01)
+        else:
+            self.disp_string('>>> 预编程失败')
+
+        return response.positive
+        # print(response)
+
+    def main_programming(self):
+
+        self.disp_string('# 主编程步骤')
+
+        # 进入programming session
+        self.disp_string('>>> 进入编程模式')
+        response = self.udsclient.change_session(2)
+        # print(response)
+        if response.positive:
+            # 安全访问
+            self.disp_string('>>> 安全访问')
+            response = self.udsclient.unlock_security_access(9)
+        # print(response)
+
+        # print(response)
+        if response.positive:
+            # 发送driver文件
+            self.disp_string('>>> 发送driver文件')
+            drv_file = self.drv_data
+            address = drv_file[16] << 24 | drv_file[17] << 16 | drv_file[
+                18] << 8 | drv_file[19] << 0
+            memorysize = drv_file[20] << 24 | drv_file[21] << 16 | drv_file[
+                22] << 8 | drv_file[23] << 0
+            memory_location = MemoryLocation(address, memorysize, 32, 32)
+            response = self.udsclient.request_download(memory_location)
+        # print(response)
+
+            max_length = response.service_data.max_length
+
+        # 有效数据长度, 去除sid和sequence两个字节
+            payload_length = max_length - 2
+
+            count = (len(drv_file) + payload_length - 1) // payload_length
+
+            base = self.get_progressbar_pos()
+            for i in range(count):
+                start = i * payload_length
+                end = start + payload_length
+                response = self.udsclient.transfer_data((i + 1) % 256,
+                                                        drv_file[start:end])
+                self.set_progressbar_pos(base + end)
+            # print(response)
+        if response.positive:
+            response = self.udsclient.request_transfer_exit()
+        # print(response)
+        if response.positive:
+            # driver文件完整性检验
+            self.disp_string('>>> driver文件完整性检验')
+            response = self.udsclient.start_routine(0xf001, drv_file[0:4])
+        # print(response)
+        if response.positive:
+            app_file = self.app_data
+            address = app_file[16] << 24 | app_file[17] << 16 | app_file[
+                18] << 8 | app_file[19] << 0
+            memorysize = app_file[20] << 24 | app_file[21] << 16 | app_file[
+                22] << 8 | app_file[23] << 0
+            memory_location = MemoryLocation(address, memorysize, 32, 32)
+
+            # 删除app存储空间
+            self.disp_string('>>> 删除app存储空间')
+            data = b''
+            data += memory_location.alfid.get_byte()
+            data += memory_location.get_address_bytes()
+            data += memory_location.get_memorysize_bytes()
+            response = self.udsclient.start_routine(0xff00, data)
+        # print(response)
+        if response.positive:
+            # 发送app文件
+            self.disp_string('>>> 发送app文件')
+            response = self.udsclient.request_download(memory_location)
+        # print(response)
+
+            max_length = response.service_data.max_length
+
+        # 有效数据长度, 去除sid和sequence两个字节
+            payload_length = max_length - 2
+
+            count = (len(app_file) + payload_length - 1) // payload_length
+
+            base = self.get_progressbar_pos()
+            for i in range(count):
+                start = i * payload_length
+                end = start + payload_length
+                response = self.udsclient.transfer_data((i + 1) % 256,
+                                                        app_file[start:end])
+                self.set_progressbar_pos(base + end)
+                # print(response)
+        if response.positive:
+            response = self.udsclient.request_transfer_exit()
+            # print(response)
+        if response.positive:
+            # app文件完整性检验
+            self.disp_string('>>> app文件完整性检验')
+            response = self.udsclient.start_routine(0xf001, app_file[0:4])
+            # print(response)
+        return response.positive
+
+    def post_programming(self):
+
+        self.disp_string('# 后编程步骤')
+
+        # 回到default session
+        self.disp_string('>>> 回到默认模式')
+
+        self.udsclient.suppress_positive_response.enabled = True
+        response = self.udsclient.change_session(1)
+        return response.positive
+
+    def start_programming(self):
+
+        self.set_progressbar_pos(0)
+
+        t1 = time.time()
+
+        try:
+
+            self.pre_programming()
+            self.main_programming()
+            self.post_programming()
+        except Exception as e:
+
+            self.disp_string('%s' % e, '#ff0000')
+
+        t2 = time.time()
+
+        self.disp_string('finished in %.2f sec' % (t2 - t1))
+        self.in_programming = False
+        self.UI.pushButton_48.setDisabled(True)
+
+    def set_progressbar_pos(self, pos):
+
+        drv_data_len = len(self.drv_data) if self.drv_data is not None else 0
+        app_data_len = len(self.app_data) if self.app_data is not None else 0
+        total_len = drv_data_len + app_data_len
+        if pos > total_len:
+            pos = total_len
+        elif pos < 0:
+            pos = 0
+
+        self.UI.progressBar.setValue(pos)
+
+    def get_progressbar_pos(self):
+        return self.UI.progressBar.value()
+
+    def loadAppfile(self):
+        if self.in_programming:
+            self.disp_string('## 正在编程中')
+            return
+
+        fileName, _ = QtWidgets.QFileDialog.getOpenFileName(
+            self, 'comboBox_4', '.', 'All Files (*);;Bin Files (*.bin);;Hex Files (*.hex)')
+
+        if fileName != '':
+            self.UI.comboBox_4.addItem(fileName)
+            self.UI.comboBox_4.setCurrentText(fileName)
+            with open(fileName, 'rb') as fd:
+                self.app_data = fd.read()
+                drv_data_len = len(
+                    self.drv_data) if self.drv_data is not None else 0
+                app_data_len = len(
+                    self.app_data) if self.app_data is not None else 0
+                total_len = drv_data_len + app_data_len
+                self.UI.progressBar.setRange(0, total_len)

--
Gitblit v1.8.0