From c9b1d33979b3972fe6a82fa427b4ba9a20989112 Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期三, 24 十二月 2025 18:56:28 +0800
Subject: [PATCH] 新增mqtt相关功能

---
 src/gecaoji/GecaojiMeg.java |  124 ++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 121 insertions(+), 3 deletions(-)

diff --git a/src/gecaoji/GecaojiMeg.java b/src/gecaoji/GecaojiMeg.java
index e573211..589c883 100644
--- a/src/gecaoji/GecaojiMeg.java
+++ b/src/gecaoji/GecaojiMeg.java
@@ -27,6 +27,22 @@
     private JLabel satelliteCountLabel;
     private JLabel realtimeSpeedLabel;
     private JLabel headingLabel;
+    
+    // 鏂板灞炴�ф爣绛�
+    private JLabel pathIdLabel;
+    private JLabel batteryLevelLabel;
+    private JLabel batteryVoltageLabel;
+    private JLabel operationModeLabel;
+    private JLabel motorStatusLabel;
+    private JLabel bladeStatusLabel;
+    private JLabel bladeHeightLabel;
+    private JLabel selfCheckStatusLabel;
+    private JLabel errorCodeLabel;
+    private JLabel errorMessageLabel;
+    private JLabel rollLabel;
+    private JLabel pitchLabel;
+    private JLabel yawLabel;
+    
     private JLabel updateTimeLabel;
 
     public GecaojiMeg(JPanel anchorPanel, Gecaoji mower) {
@@ -197,15 +213,57 @@
         headingLabel.setFont(valueFont);
         grid.add(headingLabel, gbc);
         
-        // 绗叓琛�
-        gbc.gridx = 0; gbc.gridy = 7;
+        // 鏂板灞炴�ф樉绀�
+        int currentRow = 7;
+        
+        // 瀛樺偍鐨勮矾寰処D
+        addLabelRow(grid, gbc, currentRow++, "璺緞ID锛�", pathIdLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 鐢垫睜鐢甸噺
+        addLabelRow(grid, gbc, currentRow++, "鐢垫睜鐢甸噺锛�", batteryLevelLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 鐢垫睜鐢靛帇
+        addLabelRow(grid, gbc, currentRow++, "鐢垫睜鐢靛帇锛�", batteryVoltageLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 鎿嶄綔妯″紡
+        addLabelRow(grid, gbc, currentRow++, "鎿嶄綔妯″紡锛�", operationModeLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 鐢垫満鐘舵��
+        addLabelRow(grid, gbc, currentRow++, "鐢垫満鐘舵�侊細", motorStatusLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 鍒�鐗囩姸鎬�
+        addLabelRow(grid, gbc, currentRow++, "鍒�鐗囩姸鎬侊細", bladeStatusLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 鍒�鐩橀珮搴�
+        addLabelRow(grid, gbc, currentRow++, "鍒�鐩橀珮搴︼細", bladeHeightLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 鑷鐘舵��
+        addLabelRow(grid, gbc, currentRow++, "鑷鐘舵�侊細", selfCheckStatusLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 閿欒浠g爜
+        addLabelRow(grid, gbc, currentRow++, "閿欒浠g爜锛�", errorCodeLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 閿欒淇℃伅
+        addLabelRow(grid, gbc, currentRow++, "閿欒淇℃伅锛�", errorMessageLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 妯粴瑙�
+        addLabelRow(grid, gbc, currentRow++, "妯粴瑙掞細", rollLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 淇话瑙�
+        addLabelRow(grid, gbc, currentRow++, "淇话瑙掞細", pitchLabel = createValueLabel(), titleFont, valueFont);
+        
+        // 鍋忚埅瑙�
+        addLabelRow(grid, gbc, currentRow++, "鍋忚埅瑙掞細", yawLabel = createValueLabel(), titleFont, valueFont);
+
+        // 鏇存柊鏃堕棿
+        gbc.gridx = 0; gbc.gridy = currentRow;
         gbc.weightx = 0.3;
         JLabel label8 = new JLabel("鏇存柊鏃堕棿锛�");
         label8.setFont(titleFont);
         label8.setForeground(new Color(102, 102, 102));
         grid.add(label8, gbc);
         
-        gbc.gridx = 1; gbc.gridy = 7;
+        gbc.gridx = 1; gbc.gridy = currentRow;
         gbc.weightx = 0.7;
         updateTimeLabel = createValueLabel();
         updateTimeLabel.setFont(valueFont);
@@ -310,6 +368,21 @@
         satelliteCountLabel = null;
         realtimeSpeedLabel = null;
         headingLabel = null;
+        
+        pathIdLabel = null;
+        batteryLevelLabel = null;
+        batteryVoltageLabel = null;
+        operationModeLabel = null;
+        motorStatusLabel = null;
+        bladeStatusLabel = null;
+        bladeHeightLabel = null;
+        selfCheckStatusLabel = null;
+        errorCodeLabel = null;
+        errorMessageLabel = null;
+        rollLabel = null;
+        pitchLabel = null;
+        yawLabel = null;
+        
         updateTimeLabel = null;
     }
 
@@ -333,6 +406,22 @@
         satelliteCountLabel.setText(formatDeviceValue(device.getSatelliteCount()));
         realtimeSpeedLabel.setText(formatDeviceValue(device.getRealtimeSpeed()));
         headingLabel.setText(formatDeviceValue(device.getHeading()));
+        
+        // 鏇存柊鏂板灞炴��
+        pathIdLabel.setText(formatDeviceValue(device.getPath_id_saved()));
+        batteryLevelLabel.setText(formatDeviceValue(device.getBattery_level()));
+        batteryVoltageLabel.setText(formatDeviceValue(device.getBattery_voltage()));
+        operationModeLabel.setText(formatDeviceValue(device.getOperation_mode()));
+        motorStatusLabel.setText(formatDeviceValue(device.getMotor_status()));
+        bladeStatusLabel.setText(formatDeviceValue(device.getBlade_status()));
+        bladeHeightLabel.setText(formatDeviceValue(device.getBlade_height()));
+        selfCheckStatusLabel.setText(formatDeviceValue(device.getSelf_check_status()));
+        errorCodeLabel.setText(formatDeviceValue(device.getError_code()));
+        errorMessageLabel.setText(formatDeviceValue(device.getError_message()));
+        rollLabel.setText(formatDeviceValue(device.getRoll()));
+        pitchLabel.setText(formatDeviceValue(device.getPitch()));
+        yawLabel.setText(formatDeviceValue(device.getYaw()));
+        
         updateTimeLabel.setText(formatTimestamp(device.getGupdateTime()));
     }
 
@@ -344,6 +433,21 @@
         if (satelliteCountLabel != null) satelliteCountLabel.setText(value);
         if (realtimeSpeedLabel != null) realtimeSpeedLabel.setText(value);
         if (headingLabel != null) headingLabel.setText(value);
+        
+        if (pathIdLabel != null) pathIdLabel.setText(value);
+        if (batteryLevelLabel != null) batteryLevelLabel.setText(value);
+        if (batteryVoltageLabel != null) batteryVoltageLabel.setText(value);
+        if (operationModeLabel != null) operationModeLabel.setText(value);
+        if (motorStatusLabel != null) motorStatusLabel.setText(value);
+        if (bladeStatusLabel != null) bladeStatusLabel.setText(value);
+        if (bladeHeightLabel != null) bladeHeightLabel.setText(value);
+        if (selfCheckStatusLabel != null) selfCheckStatusLabel.setText(value);
+        if (errorCodeLabel != null) errorCodeLabel.setText(value);
+        if (errorMessageLabel != null) errorMessageLabel.setText(value);
+        if (rollLabel != null) rollLabel.setText(value);
+        if (pitchLabel != null) pitchLabel.setText(value);
+        if (yawLabel != null) yawLabel.setText(value);
+        
         if (updateTimeLabel != null) updateTimeLabel.setText(value);
     }
 
@@ -406,4 +510,18 @@
             return sanitized;
         }
     }
+
+    private void addLabelRow(JPanel grid, GridBagConstraints gbc, int row, String title, JLabel valueLabel, Font titleFont, Font valueFont) {
+        gbc.gridx = 0; gbc.gridy = row;
+        gbc.weightx = 0.3;
+        JLabel label = new JLabel(title);
+        label.setFont(titleFont);
+        label.setForeground(new Color(102, 102, 102));
+        grid.add(label, gbc);
+        
+        gbc.gridx = 1; gbc.gridy = row;
+        gbc.weightx = 0.7;
+        valueLabel.setFont(valueFont);
+        grid.add(valueLabel, gbc);
+    }
 }
\ No newline at end of file

--
Gitblit v1.10.0