张世豪
2 天以前 c9b1d33979b3972fe6a82fa427b4ba9a20989112
新增mqtt相关功能
已修改14个文件
已添加1个文件
658 ■■■■ 文件已修改
set.properties 12 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Mqttmessage/Client.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Mqttmessage/Entity/GPSData.java 143 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/Mqttmessage/PushCallback.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/denglu/Denglu.java 7 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/gecaoji/Device.java 217 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/gecaoji/GecaojiMeg.java 124 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/gecaoji/gecaojistatus.java 68 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/publicway/Gpstoxuzuobiao.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/set/Setsys.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/udpdell/UDPServer.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/user/Usrdell.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/zhuye/Coordinate.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/zhuye/Shouye.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
user.properties 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
set.properties
@@ -1,5 +1,5 @@
#Mower Configuration Properties - Updated
#Wed Dec 24 17:17:31 CST 2025
#Current work land selection updated
#Wed Dec 24 18:54:38 CST 2025
appVersion=-1
boundaryLengthVisible=false
currentWorkLandNumber=LAND1
@@ -8,12 +8,12 @@
handheldMarkerId=1872
idleTrailDurationSeconds=60
manualBoundaryDrawingMode=false
mapScale=0.78
mapScale=1.34
measurementModeEnabled=false
mowerId=860
mowerId=6258
serialAutoConnect=true
serialBaudRate=115200
serialPortName=COM15
simCardNumber=-1
viewCenterX=-148.00
viewCenterY=424.51
viewCenterX=-195.34
viewCenterY=432.68
src/Mqttmessage/Client.java
@@ -4,6 +4,9 @@
import org.eclipse.paho.client.mqttv3.MqttConnectOptions;
import org.eclipse.paho.client.mqttv3.MqttException;
import set.Setsys;
import user.Usrdell;
/**
 * MQTT客户端工具类
 * ç”¨äºŽè¿žæŽ¥MQTT服务器并订阅主题
@@ -94,12 +97,12 @@
     * ç¤ºä¾‹ç”¨æ³•
     */
    public static void test()  {
    public static void lianjiemqqt()  {
        try {
            String host = "tcp://39.99.43.227:1883";
            String deiveID="6258";
            String clientId = "hxzkMQTT";
            String clientId2 = "hxzkMQTT2";
            String deiveID=Setsys.getMowerIdValue();
            String clientId =Usrdell.getUserEmail()+"mower";
            String clientId2 =Usrdell.getUserEmail()+"response";
            String topic = "mower/"+deiveID+"/gps";
            String topic2 = "mower/"+deiveID+"/response";
            Client mqttClient = new Client(host, topic, clientId);
src/Mqttmessage/Entity/GPSData.java
@@ -45,6 +45,8 @@
    /**
     * IMU数据内部类(简化版,只包含角度信息)
     */
@@ -83,6 +85,7 @@
        private Integer self_check_status;  // è‡ªæ£€çŠ¶æ€ï¼š1-完成,0-未完成
        private Integer error_code;         // é”™è¯¯ä»£ç 
        private String error_message;       // é”™è¯¯ä¿¡æ¯
        private String path_id_saved;       // å­˜å‚¨çš„路径ID
        /**
         * å¸¦å‚数的构造函数
@@ -95,10 +98,11 @@
         * @param self_check_status è‡ªæ£€çŠ¶æ€ï¼š1-完成,0-未完成
         * @param error_code é”™è¯¯ä»£ç 
         * @param error_message é”™è¯¯ä¿¡æ¯
         * @param path_id_saved å­˜å‚¨çš„路径ID
         */
        public StatusInfo(Integer battery_level, Double battery_voltage, String operation_mode,
                         String motor_status, String blade_status, Integer blade_height,
                         Integer self_check_status, Integer error_code, String error_message) {
                         Integer self_check_status, Integer error_code, String error_message, String path_id_saved) {
            this.battery_level = battery_level;
            this.battery_voltage = battery_voltage;
            this.operation_mode = operation_mode;
@@ -108,6 +112,87 @@
            this.self_check_status = self_check_status;
            this.error_code = error_code;
            this.error_message = error_message;
            this.path_id_saved = path_id_saved;
        }
        public Integer getBattery_level() {
            return battery_level;
        }
        public void setBattery_level(Integer battery_level) {
            this.battery_level = battery_level;
        }
        public Double getBattery_voltage() {
            return battery_voltage;
        }
        public void setBattery_voltage(Double battery_voltage) {
            this.battery_voltage = battery_voltage;
        }
        public String getOperation_mode() {
            return operation_mode;
        }
        public void setOperation_mode(String operation_mode) {
            this.operation_mode = operation_mode;
        }
        public String getMotor_status() {
            return motor_status;
        }
        public void setMotor_status(String motor_status) {
            this.motor_status = motor_status;
        }
        public String getBlade_status() {
            return blade_status;
        }
        public void setBlade_status(String blade_status) {
            this.blade_status = blade_status;
        }
        public Integer getBlade_height() {
            return blade_height;
        }
        public void setBlade_height(Integer blade_height) {
            this.blade_height = blade_height;
        }
        public Integer getSelf_check_status() {
            return self_check_status;
        }
        public void setSelf_check_status(Integer self_check_status) {
            this.self_check_status = self_check_status;
        }
        public Integer getError_code() {
            return error_code;
        }
        public void setError_code(Integer error_code) {
            this.error_code = error_code;
        }
        public String getError_message() {
            return error_message;
        }
        public void setError_message(String error_message) {
            this.error_message = error_message;
        }
        public String getPath_id_saved() {
            return path_id_saved;
        }
        public void setPath_id_saved(String path_id_saved) {
            this.path_id_saved = path_id_saved;
        }
    }
@@ -133,4 +218,60 @@
        private String age;         // å·®åˆ†GPS数据期限
        private String stationId;   // å·®åˆ†å‚考基站标号
    }
    public String getMsg_id() {
        return msg_id;
    }
    public void setMsg_id(String msg_id) {
        this.msg_id = msg_id;
    }
    public Long getTimestamp() {
        return timestamp;
    }
    public void setTimestamp(Long timestamp) {
        this.timestamp = timestamp;
    }
    public String getDevice_id() {
        return device_id;
    }
    public void setDevice_id(String device_id) {
        this.device_id = device_id;
    }
    public String getData_type() {
        return data_type;
    }
    public void setData_type(String data_type) {
        this.data_type = data_type;
    }
    public IMUData getImu_data() {
        return imu_data;
    }
    public void setImu_data(IMUData imu_data) {
        this.imu_data = imu_data;
    }
    public StatusInfo getStatus() {
        return status;
    }
    public void setStatus(StatusInfo status) {
        this.status = status;
    }
    public GGAData getGgaData() {
        return ggaData;
    }
    public void setGgaData(GGAData ggaData) {
        this.ggaData = ggaData;
    }
}
src/Mqttmessage/PushCallback.java
@@ -1,15 +1,13 @@
package Mqttmessage;
import Mqttmessage.Util.DeviceMessageParser;
import gecaoji.gecaojistatus;
import Mqttmessage.Entity.GPSData;
import Mqttmessage.Entity.GPSData.StatusInfo;
import org.eclipse.paho.client.mqttv3.IMqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import udpdell.UDPServer;
public class PushCallback implements MqttCallback {
@@ -30,6 +28,7 @@
        //ResponseData responseData = DeviceMessageParser.parseResponseData(new String(message.getPayload()));//解析响应数据
        String gpsRaw = gpsData.getGps_raw();
        UDPServer.processSerialData(gpsRaw);
        gecaojistatus.parseStatus(gpsData.getStatus());
    }
}
src/denglu/Denglu.java
@@ -8,6 +8,7 @@
import set.Setsys;
import udpdell.UDPServer;
import user.Usrdell;
import Mqttmessage.Client;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
@@ -542,6 +543,12 @@
            mainFrame.setVisible(true);
            System.out.println("主应用程序已启动");
            // å¯åŠ¨åŽè¿žæŽ¥MQTT
            new Thread(() -> {
                System.out.println("正在连接MQTT服务器...");
                Client.lianjiemqqt();
            }).start();
        });
    }
    
src/gecaoji/Device.java
@@ -68,21 +68,30 @@
    // èˆªå‘è§’
    private String pitch;
    // ä¿¯ä»°è§’
    private String battery;
    // å®žæ—¶ç”µé‡
    private String roll; // æ¨ªæ»šè§’ è§’度
    private String yaw; // åèˆªè§’ è§’度
    private String battery_level; // ç”µæ± ç”µé‡ç™¾åˆ†æ¯”
    private String battery_voltage; // ç”µæ± ç”µåŽ‹
    private String operation_mode; // æ“ä½œæ¨¡å¼ï¼šmanual, auto, emergency_stop
    private String motor_status; // ç”µæœºçŠ¶æ€ï¼šstopped, running, error
    private String blade_status; // åˆ€ç‰‡çŠ¶æ€ï¼šstopped, rotating
    private String path_id_saved; // å­˜å‚¨çš„路径ID
    private String error_code; // é”™è¯¯ä»£ç 
    private String error_message; // é”™è¯¯ä¿¡æ¯
    private String positioningStatus;
    // å®šä½çŠ¶æ€
    private String satelliteCount;
    // å«æ˜Ÿå¯æ•°
    private String differentialAge;
    // å·®åˆ†æ—¶é—´
    private String selfCheckStatus = "-1";
    private String self_check_status = "-1"; // æ–°å¢žè‡ªæ£€çŠ¶æ€ï¼š1-完成,0-未完成
    // å‰²è‰æœºè‡ªæ£€çŠ¶æ€
    private String mowerStartStatus = "-1";
    // å‰²è‰æœºå¯åŠ¨çŠ¶æ€ï¼š1开启,0熄火,-1未知
    private String mowerLightStatus = "-1";
    // å‰²è‰æœºç¯å¼€å…³çŠ¶æ€ï¼š1开启,0关闭,-1未知
    private String mowerBladeHeight = "-1";
    private String blade_height = "-1"; // åˆ€ç›˜é«˜åº¦ åŽ˜ç±³
    // å‰²è‰æœºåˆ€ç›˜é«˜åº¦ï¼š-1未知
    private String mowerWidth;
    // å‰²è‰æœºå®½åº¦ï¼Œå•位米
@@ -154,14 +163,24 @@
        if (realtimeSpeed != null) properties.setProperty("realtimeSpeed", realtimeSpeed);
        if (heading != null) properties.setProperty("heading", heading);
        if (pitch != null) properties.setProperty("pitch", pitch);
        if (battery != null) properties.setProperty("battery", battery);
        if (roll != null) properties.setProperty("roll", roll);
        if (yaw != null) properties.setProperty("yaw", yaw);
        if (battery_level != null) properties.setProperty("battery_level", battery_level);
        if (battery_voltage != null) properties.setProperty("battery_voltage", battery_voltage);
        if (operation_mode != null) properties.setProperty("operation_mode", operation_mode);
        if (motor_status != null) properties.setProperty("motor_status", motor_status);
        if (blade_status != null) properties.setProperty("blade_status", blade_status);
        if (path_id_saved != null) properties.setProperty("path_id_saved", path_id_saved);
        if (error_code != null) properties.setProperty("error_code", error_code);
        if (error_message != null) properties.setProperty("error_message", error_message);
        if (positioningStatus != null) properties.setProperty("positioningStatus", positioningStatus);
        if (satelliteCount != null) properties.setProperty("satelliteCount", satelliteCount);
        if (differentialAge != null) properties.setProperty("differentialAge", differentialAge);
        if (selfCheckStatus != null) properties.setProperty("selfCheckStatus", selfCheckStatus);
        if (self_check_status != null) properties.setProperty("self_check_status", self_check_status);
        if (mowerStartStatus != null) properties.setProperty("mowerStartStatus", mowerStartStatus);
        if (mowerLightStatus != null) properties.setProperty("mowerLightStatus", mowerLightStatus);
        if (mowerBladeHeight != null) properties.setProperty("mowerBladeHeight", mowerBladeHeight);
        if (blade_height != null) properties.setProperty("blade_height", blade_height);
        if (mowerWidth != null) properties.setProperty("mowerWidth", mowerWidth);
        if (mowerLength != null) properties.setProperty("mowerLength", mowerLength);
        if (mowingSafetyDistance != null) properties.setProperty("mowingSafetyDistance", mowingSafetyDistance);
@@ -200,14 +219,24 @@
        target.realtimeSpeed = properties.getProperty("realtimeSpeed", "-1");
        target.heading = properties.getProperty("heading", "-1");
        target.pitch = properties.getProperty("pitch", "-1");
        target.battery = properties.getProperty("battery", "-1");
        target.roll = properties.getProperty("roll", "-1");
        target.yaw = properties.getProperty("yaw", "-1");
        target.battery_level = properties.getProperty("battery_level", "-1");
        target.battery_voltage = properties.getProperty("battery_voltage", "-1");
        target.operation_mode = properties.getProperty("operation_mode", "-1");
        target.motor_status = properties.getProperty("motor_status", "-1");
        target.blade_status = properties.getProperty("blade_status", "-1");
        target.path_id_saved = properties.getProperty("path_id_saved", "-1");
        target.error_code = properties.getProperty("error_code", "-1");
        target.error_message = properties.getProperty("error_message", "-1");
        target.positioningStatus = properties.getProperty("positioningStatus", "-1");
        target.satelliteCount = properties.getProperty("satelliteCount", "-1");
        target.differentialAge = properties.getProperty("differentialAge", "-1");
        target.selfCheckStatus = properties.getProperty("selfCheckStatus", "-1");
        target.self_check_status = properties.getProperty("self_check_status", "-1");
        target.mowerStartStatus = properties.getProperty("mowerStartStatus", "-1");
        target.mowerLightStatus = properties.getProperty("mowerLightStatus", "-1");
        target.mowerBladeHeight = properties.getProperty("mowerBladeHeight", "-1");
        target.blade_height = properties.getProperty("blade_height", "-1");
        target.mowerWidth = properties.getProperty("mowerWidth", "-1");
        target.mowerLength = properties.getProperty("mowerLength", "-1");
        target.mowingSafetyDistance = properties.getProperty("mowingSafetyDistance", "-1");
@@ -238,14 +267,24 @@
        target.realtimeSpeed = "-1";
        target.heading = "-1";
        target.pitch = "-1";
        target.battery = "-1";
        target.roll = "-1";
        target.yaw = "-1";
        target.battery_level = "-1";
        target.battery_voltage = "-1";
        target.operation_mode = "-1";
        target.motor_status = "-1";
        target.blade_status = "-1";
        target.path_id_saved = "-1";
        target.error_code = "-1";
        target.error_message = "-1";
        target.positioningStatus = "-1";
        target.satelliteCount = "-1";
        target.differentialAge = "-1";
        target.selfCheckStatus = "-1";
        target.self_check_status = "-1";
        target.mowerStartStatus = "-1";
        target.mowerLightStatus = "-1";
        target.mowerBladeHeight = "-1";
        target.blade_height = "-1";
        target.mowerWidth = "-1";
        target.mowerLength = "-1";
        target.mowingSafetyDistance = "-1";
@@ -335,8 +374,35 @@
            case "pitch":
                this.pitch = value;
                return true;
            case "battery":
                this.battery = value;
            case "roll":
                this.roll = value;
                return true;
            case "yaw":
                this.yaw = value;
                return true;
            case "battery_level":
                this.battery_level = value;
                return true;
            case "battery_voltage":
                this.battery_voltage = value;
                return true;
            case "operation_mode":
                this.operation_mode = value;
                return true;
            case "motor_status":
                this.motor_status = value;
                return true;
            case "blade_status":
                this.blade_status = value;
                return true;
            case "path_id_saved":
                this.path_id_saved = value;
                return true;
            case "error_code":
                this.error_code = value;
                return true;
            case "error_message":
                this.error_message = value;
                return true;
            case "positioningStatus":
                this.positioningStatus = value;
@@ -347,8 +413,8 @@
            case "differentialAge":
                this.differentialAge = value;
                return true;
            case "selfCheckStatus":
                this.selfCheckStatus = value;
            case "self_check_status":
                this.self_check_status = value;
                return true;
            case "mowerStartStatus":
                this.mowerStartStatus = value;
@@ -356,8 +422,8 @@
            case "mowerLightStatus":
                this.mowerLightStatus = value;
                return true;
            case "mowerBladeHeight":
                this.mowerBladeHeight = value;
            case "blade_height":
                this.blade_height = value;
                return true;
            case "mowerWidth":
                this.mowerWidth = value;
@@ -458,7 +524,7 @@
        }
        satelliteCount = defaultIfEmpty(sanitizeField(fields, 7));
        differentialAge = defaultIfEmpty(sanitizeField(fields, 13));
        battery = defaultIfEmpty(sanitizeField(fields, 16));
        battery_level = defaultIfEmpty(sanitizeField(fields, 16));
        pitch = defaultIfEmpty(sanitizeField(fields, 17));
        realtimeSpeed = defaultIfEmpty(sanitizeField(fields, 18));
        GupdateTime = String.valueOf(System.currentTimeMillis());
@@ -844,12 +910,84 @@
        this.pitch = pitch;
    }
    public String getBattery() { // èŽ·å–å®žæ—¶ç”µé‡
        return battery;
    public String getRoll() {
        return roll;
    }
    public void setBattery(String battery) { // è®¾ç½®å®žæ—¶ç”µé‡
        this.battery = battery;
    public void setRoll(String roll) {
        this.roll = roll;
    }
    public String getYaw() {
        return yaw;
    }
    public void setYaw(String yaw) {
        this.yaw = yaw;
    }
    public String getBattery_level() {
        return battery_level;
    }
    public void setBattery_level(String battery_level) {
        this.battery_level = battery_level;
    }
    public String getBattery_voltage() {
        return battery_voltage;
    }
    public void setBattery_voltage(String battery_voltage) {
        this.battery_voltage = battery_voltage;
    }
    public String getOperation_mode() {
        return operation_mode;
    }
    public void setOperation_mode(String operation_mode) {
        this.operation_mode = operation_mode;
    }
    public String getMotor_status() {
        return motor_status;
    }
    public void setMotor_status(String motor_status) {
        this.motor_status = motor_status;
    }
    public String getBlade_status() {
        return blade_status;
    }
    public void setBlade_status(String blade_status) {
        this.blade_status = blade_status;
    }
    public String getPath_id_saved() {
        return path_id_saved;
    }
    public void setPath_id_saved(String path_id_saved) {
        this.path_id_saved = path_id_saved;
    }
    public String getError_code() {
        return error_code;
    }
    public void setError_code(String error_code) {
        this.error_code = error_code;
    }
    public String getError_message() {
        return error_message;
    }
    public void setError_message(String error_message) {
        this.error_message = error_message;
    }
    public String getPositioningStatus() { // èŽ·å–å®šä½çŠ¶æ€
@@ -876,12 +1014,12 @@
        this.differentialAge = differentialAge;
    }
    public String getSelfCheckStatus() { // èŽ·å–è‡ªæ£€çŠ¶æ€
        return selfCheckStatus;
    public String getSelf_check_status() { // èŽ·å–è‡ªæ£€çŠ¶æ€
        return self_check_status;
    }
    public void setSelfCheckStatus(String selfCheckStatus) { // è®¾ç½®è‡ªæ£€çŠ¶æ€
        this.selfCheckStatus = selfCheckStatus;
    public void setSelf_check_status(String self_check_status) { // è®¾ç½®è‡ªæ£€çŠ¶æ€
        this.self_check_status = self_check_status;
    }
    public String getMowerStartStatus() { // èŽ·å–å‰²è‰æœºå¯åŠ¨çŠ¶æ€
@@ -900,12 +1038,12 @@
        this.mowerLightStatus = mowerLightStatus;
    }
    public String getMowerBladeHeight() { // èŽ·å–å‰²è‰æœºåˆ€ç›˜é«˜åº¦
        return mowerBladeHeight;
    public String getBlade_height() { // èŽ·å–å‰²è‰æœºåˆ€ç›˜é«˜åº¦
        return blade_height;
    }
    public void setMowerBladeHeight(String mowerBladeHeight) { // è®¾ç½®å‰²è‰æœºåˆ€ç›˜é«˜åº¦
        this.mowerBladeHeight = mowerBladeHeight;
    public void setBlade_height(String blade_height) { // è®¾ç½®å‰²è‰æœºåˆ€ç›˜é«˜åº¦
        this.blade_height = blade_height;
    }
    public String getMowerWidth() { // èŽ·å–å‰²è‰æœºå®½åº¦
@@ -955,14 +1093,23 @@
                ", realtimeSpeed='" + realtimeSpeed + '\'' +
                ", heading='" + heading + '\'' +
                ", pitch='" + pitch + '\'' +
                ", battery='" + battery + '\'' +
                ", roll='" + roll + '\'' +
                ", yaw='" + yaw + '\'' +
                ", battery_level='" + battery_level + '\'' +
                ", battery_voltage='" + battery_voltage + '\'' +
                ", operation_mode='" + operation_mode + '\'' +
                ", motor_status='" + motor_status + '\'' +
                ", blade_status='" + blade_status + '\'' +
                ", path_id_saved='" + path_id_saved + '\'' +
                ", error_code='" + error_code + '\'' +
                ", error_message='" + error_message + '\'' +
                ", positioningStatus='" + positioningStatus + '\'' +
                ", satelliteCount='" + satelliteCount + '\'' +
                ", differentialAge='" + differentialAge + '\'' +
                ", selfCheckStatus='" + selfCheckStatus + '\'' +
                ", self_check_status='" + self_check_status + '\'' +
                ", mowerStartStatus='" + mowerStartStatus + '\'' +
                ", mowerLightStatus='" + mowerLightStatus + '\'' +
                ", mowerBladeHeight='" + mowerBladeHeight + '\'' +
                ", blade_height='" + blade_height + '\'' +
                ", mowerWidth='" + mowerWidth + '\'' +
                ", mowerLength='" + mowerLength + '\'' +
                ", mowingSafetyDistance='" + mowingSafetyDistance + '\'' +
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;
        // å­˜å‚¨çš„路径ID
        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);
        // é”™è¯¯ä»£ç 
        addLabelRow(grid, gbc, currentRow++, "错误代码:", 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);
    }
}
src/gecaoji/gecaojistatus.java
¶Ô±ÈÐÂÎļþ
@@ -0,0 +1,68 @@
package gecaoji;
import Mqttmessage.Entity.GPSData.StatusInfo;
/**
 * å‰²è‰æœºçŠ¶æ€è§£æžç±»
 * ç”¨äºŽè§£æžæ”¶åˆ°çš„割草机状态数据
 */
public class gecaojistatus {
//    "path_id_saved": 15865475, // å­˜å‚¨çš„路径ID
//      "battery_level": 85, // ç”µæ± ç”µé‡ç™¾åˆ†æ¯”
//      "battery_voltage": 24.5, // ç”µæ± ç”µåŽ‹
//      "operation_mode": "auto", // æ“ä½œæ¨¡å¼ï¼šmanual, auto, emergency_stop
//      "motor_status": "running", // ç”µæœºçŠ¶æ€ï¼šstopped, running, error
//      "blade_status": "rotating", // åˆ€ç‰‡çŠ¶æ€ï¼šstopped, rotating
//      "blade_height": 10,//刀盘高度 åŽ˜ç±³
//      "self_check_status": 1,  // æ–°å¢žè‡ªæ£€çŠ¶æ€ï¼š1-完成,0-未完成
//      "error_code": 0, // é”™è¯¯ä»£ç 
//      "error_message": "", // é”™è¯¯ä¿¡æ¯
    /**
     * è§£æžçŠ¶æ€æ•°æ®å­—ç¬¦ä¸²
     * @param status æŽ¥æ”¶åˆ°çš„状态对象
     */
    public static void parseStatus(StatusInfo status) {
        if (status != null) {
            Device device = Device.getGecaoji();
            if (device == null) {
                return;
            }
            if (status.getPath_id_saved() != null) {
                device.setPath_id_saved(String.valueOf(status.getPath_id_saved()));
            }
            if (status.getBattery_level() != null) {
                device.setBattery_level(String.valueOf(status.getBattery_level()));
            }
            if (status.getBattery_voltage() != null) {
                device.setBattery_voltage(String.valueOf(status.getBattery_voltage()));
            }
            if (status.getOperation_mode() != null) {
                device.setOperation_mode(status.getOperation_mode());
            }
            if (status.getMotor_status() != null) {
                device.setMotor_status(status.getMotor_status());
            }
            if (status.getBlade_status() != null) {
                device.setBlade_status(status.getBlade_status());
            }
            if (status.getBlade_height() != null) {
                device.setBlade_height(String.valueOf(status.getBlade_height()));
            }
            if (status.getSelf_check_status() != null) {
                device.setSelf_check_status(String.valueOf(status.getSelf_check_status()));
            }
            if (status.getError_code() != null) {
                device.setError_code(String.valueOf(status.getError_code()));
            }
            if (status.getError_message() != null) {
                device.setError_message(status.getError_message());
            }
        }
    }
}
src/publicway/Gpstoxuzuobiao.java
@@ -33,7 +33,7 @@
     * @return double[]{x, y} ç›¸å¯¹åæ ‡
     */
    public static double[] processGNGGAToXY(String gnggaData, double baseLat, double baseLon) {
        if (gnggaData == null || !gnggaData.contains("$GNGGA")) {
        if (gnggaData == null) {
            return null;
        }
        
@@ -41,10 +41,10 @@
        // æ ¼å¼: $GNGGA,hhmmss.ss,lat,latDir,lon,lonDir,quality,sats,hdop,alt,units,sep,units,age,refID*cs
        
        String[] parts = gnggaData.split(",");
        // æ‰¾åˆ°$GNGGA的位置
        // æ‰¾åˆ°$GNGGA/$GPGGA/$GBGGA的位置
        int index = -1;
        for(int i=0; i<parts.length; i++) {
            if (parts[i].contains("$GNGGA")) {
            if (parts[i].contains("$GNGGA") || parts[i].contains("$GPGGA") || parts[i].contains("$GBGGA")) {
                index = i;
                break;
            }
src/set/Setsys.java
@@ -274,6 +274,14 @@
        System.out.println("idleTrailDurationSeconds: " + idleTrailDurationSeconds);
    }
    /**
     * èŽ·å–å‰²è‰æœºç¼–å·
     * @return å‰²è‰æœºç¼–号
     */
    public static String getMowerIdValue() {
        return getPropertyValue("mowerId");
    }
    // æ ¹æ®set.properties中的键名获取对应的值,没有或为-1时返回null
    public static String getPropertyValue(String key) {
        if (key == null || key.trim().isEmpty()) {
src/udpdell/UDPServer.java
@@ -104,6 +104,7 @@
    /** å¤„理串口接收到的数据 */
    public static void processSerialData(String message) {
        message=message.replace("GPGGA", "GNGGA");
        String[] fields = message.split(",");
        // æ£€æŸ¥å­—段数量是否完整
        if (fields.length < 15) {
src/user/Usrdell.java
@@ -133,6 +133,14 @@
    }
    /**
     * èŽ·å–ç”¨æˆ·é‚®ç®±
     * @return ç”¨æˆ·é‚®ç®±
     */
    public static String getUserEmail() {
        return getEmail();
    }
    /**
     * èŽ·å–è¯­è¨€è®¾ç½®
     * @return è¯­è¨€è®¾ç½®
     */
src/zhuye/Coordinate.java
@@ -79,28 +79,19 @@
    /**
     * è§£æžGNGGA数据返回Coordinate对象列表(增强版,包含高程数据)
     * è§£æžGNGGA/GPGGA/GBGGA数据返回Coordinate对象列表(增强版,包含高程数据)
     */
    public static void parseGNGGAToCoordinateList(String gnggaData) {   
        if (!isStartSaveGngga || gnggaData == null || gnggaData.isEmpty()) {
            return;
        }
        // å¤„理完整的GNGGA数据(可能包含$GNGGA前缀)
        String cleaned = gnggaData.trim();
        if (cleaned.startsWith("$GNGGA")) {
            // å¦‚果数据以$GNGGA开头,直接解析
            String record = cleaned.substring("$GNGGA".length());
            Coordinate coord = parseSingleGnggaRecord(record, false);
            if (coord != null) {
                coordinates.add(coord);
            }
        } else {
            // å¤„理可能包含多个$GNGGA记录的情况
            String[] records = cleaned.split("\\$GNGGA");
        // ä½¿ç”¨æ­£åˆ™åˆ†å‰²æ”¯æŒå¤šç§å¤´éƒ¨
        String[] records = cleaned.split("\\$(GN|GP|GB)GGA");
            for (String record : records) {
                if (record == null || record.trim().isEmpty()) {
                    continue;  // è·³è¿‡ç©ºå­—符串(split产生的第一个元素可能是空的)
                continue;
                }
                Coordinate coord = parseSingleGnggaRecord(record, false);
                if (coord != null) {
@@ -108,7 +99,6 @@
                }
            }
        }
    }
    /**
     * ä¸²å£å®žæ—¶æ•°æ®ç›´æŽ¥è§£æžå…¥å£ã€‚
@@ -123,9 +113,19 @@
            return null;
        }
        int markerIndex = cleaned.indexOf("$GNGGA");
        int markerIndex = -1;
        String[] headers = {"$GNGGA", "$GPGGA", "$GBGGA"};
        // æ‰¾åˆ°æœ€æ—©å‡ºçŽ°çš„å¤´éƒ¨
        for (String header : headers) {
            int idx = cleaned.indexOf(header);
            if (idx >= 0 && (markerIndex == -1 || idx < markerIndex)) {
                markerIndex = idx;
            }
        }
        String record = markerIndex >= 0
                ? cleaned.substring(markerIndex + "$GNGGA".length())
                ? cleaned.substring(markerIndex + 6) // æ‰€æœ‰å¤´éƒ¨é•¿åº¦å‡ä¸º6
                : cleaned;
        Coordinate coordinate = parseSingleGnggaRecord(record, true);
@@ -168,7 +168,8 @@
                return null;
            }
            if (fixQuality != 4) {
            // ä¿®æ”¹ä¸ºå…è®¸éžRTK固定解也能显示位置(只要不是无效定位0即可)
            if (fixQuality == 0) {
                return null;
            }
src/zhuye/Shouye.java
@@ -113,12 +113,15 @@
    private final Consumer<String> serialLineListener = line -> {
        SwingUtilities.invokeLater(() -> {
            updateDataPacketCountLabel();
            // å¦‚果收到$GNGGA数据,立即更新拖尾
            if (line != null && line.trim().startsWith("$GNGGA")) {
            // å¦‚果收到GGA数据,立即更新拖尾
            if (line != null) {
                String trimmed = line.trim();
                if (trimmed.startsWith("$GNGGA") || trimmed.startsWith("$GPGGA") || trimmed.startsWith("$GBGGA")) {
                if (mapRenderer != null && !pathPreviewActive) {
                    mapRenderer.forceUpdateIdleMowerTrail();
                }
            }
            }
        });
    };
    private static final int FLOAT_ICON_SIZE = 32;
user.properties
@@ -1,6 +1,6 @@
#Updated User Properties
#Wed Dec 24 17:05:38 CST 2025
email=789
email=7892584@qq.com
language=zh
lastLoginTime=1766567138180
password=123