From 48ee74129bb09a817a0bbbabe860c4007b74c66b Mon Sep 17 00:00:00 2001
From: 826220679@qq.com <826220679@qq.com>
Date: 星期日, 21 十二月 2025 12:37:44 +0800
Subject: [PATCH] 新增了往返路径

---
 src/gecaoji/Device.java |   67 +++++++++++++++++++++++++++++++++
 1 files changed, 67 insertions(+), 0 deletions(-)

diff --git a/src/gecaoji/Device.java b/src/gecaoji/Device.java
index fd7cae4..97a3333 100644
--- a/src/gecaoji/Device.java
+++ b/src/gecaoji/Device.java
@@ -1,6 +1,7 @@
 package gecaoji;
 import baseStation.BaseStation;
 import set.Setsys;
+import zhuye.MowerLocationData;
 import java.io.FileInputStream;
 import java.io.FileOutputStream;
 import java.io.IOException;
@@ -83,6 +84,12 @@
     // 鍓茶崏鏈虹伅寮�鍏崇姸鎬侊細1寮�鍚紝0鍏抽棴锛�-1鏈煡
     private String mowerBladeHeight = "-1";
     // 鍓茶崏鏈哄垁鐩橀珮搴︼細-1鏈煡
+    private String mowerWidth;
+    // 鍓茶崏鏈哄搴︼紝鍗曚綅绫�
+    private String mowerLength;
+    // 鍓茶崏鏈洪暱搴︼紝鍗曚綅绫�
+    private String mowingSafetyDistance;
+    // 鍓茶崏瀹夊叏璺濈锛屽崟浣嶇背
 
     private static final double METERS_PER_DEGREE_LAT = 111320.0d;
     
@@ -155,6 +162,9 @@
         if (mowerStartStatus != null) properties.setProperty("mowerStartStatus", mowerStartStatus);
         if (mowerLightStatus != null) properties.setProperty("mowerLightStatus", mowerLightStatus);
         if (mowerBladeHeight != null) properties.setProperty("mowerBladeHeight", mowerBladeHeight);
+        if (mowerWidth != null) properties.setProperty("mowerWidth", mowerWidth);
+        if (mowerLength != null) properties.setProperty("mowerLength", mowerLength);
+        if (mowingSafetyDistance != null) properties.setProperty("mowingSafetyDistance", mowingSafetyDistance);
         
         // 淇濆瓨鍒版枃浠�
         try (FileOutputStream output = new FileOutputStream("device.properties");
@@ -198,6 +208,9 @@
         target.mowerStartStatus = properties.getProperty("mowerStartStatus", "-1");
         target.mowerLightStatus = properties.getProperty("mowerLightStatus", "-1");
         target.mowerBladeHeight = properties.getProperty("mowerBladeHeight", "-1");
+        target.mowerWidth = properties.getProperty("mowerWidth", "-1");
+        target.mowerLength = properties.getProperty("mowerLength", "-1");
+        target.mowingSafetyDistance = properties.getProperty("mowingSafetyDistance", "-1");
     }
 
     private void applyDefaults(Device target) {
@@ -233,6 +246,9 @@
         target.mowerStartStatus = "-1";
         target.mowerLightStatus = "-1";
         target.mowerBladeHeight = "-1";
+        target.mowerWidth = "-1";
+        target.mowerLength = "-1";
+        target.mowingSafetyDistance = "-1";
     }
 
     public static synchronized Device initializeActiveDevice(String mowerId) { // 鏍规嵁璁惧ID鍒濆鍖栨椿璺冭澶�
@@ -343,6 +359,15 @@
             case "mowerBladeHeight":
                 this.mowerBladeHeight = value;
                 return true;
+            case "mowerWidth":
+                this.mowerWidth = value;
+                return true;
+            case "mowerLength":
+                this.mowerLength = value;
+                return true;
+            case "mowingSafetyDistance":
+                this.mowingSafetyDistance = value;
+                return true;
             default:
                 System.err.println("鏈煡瀛楁: " + fieldName);
                 return false;
@@ -412,6 +437,12 @@
         }
 
         positioningStatus = defaultIfEmpty(sanitizeField(fields, 6));
+        // 鍚屾鍒扮粯鍒舵ā鍧楃殑鏁版嵁婧愶紝淇濊瘉寰�杩旂粯鍒跺畾鏃跺櫒鑳借瘑鍒畾浣嶈川閲�
+        try {
+            MowerLocationData.updateProperty("positioningQuality", positioningStatus);
+        } catch (Throwable ignored) {
+            // 闃插尽寮忥細鍗充娇鏇存柊澶辫触涔熶笉褰卞搷璁惧鏁版嵁澶勭悊
+        }
         satelliteCount = defaultIfEmpty(sanitizeField(fields, 7));
         differentialAge = defaultIfEmpty(sanitizeField(fields, 13));
         battery = defaultIfEmpty(sanitizeField(fields, 16));
@@ -461,6 +492,12 @@
         }
 
         positioningStatus = defaultIfEmpty(sanitizeField(fields, 6));
+        // 鍚屾鍒扮粯鍒舵ā鍧楃殑鏁版嵁婧愶紝淇濊瘉寰�杩旂粯鍒跺畾鏃跺櫒鑳借瘑鍒畾浣嶈川閲�
+        try {
+            MowerLocationData.updateProperty("positioningQuality", positioningStatus);
+        } catch (Throwable ignored) {
+            // 闃插尽寮忥細鍗充娇鏇存柊澶辫触涔熶笉褰卞搷璁惧鏁版嵁澶勭悊
+        }
         satelliteCount = defaultIfEmpty(sanitizeField(fields, 7));
         differentialAge = defaultIfEmpty(sanitizeField(fields, 13));       
         realtimeSpeed ="0";        
@@ -522,6 +559,9 @@
         if (Double.isFinite(eastMeters) && Double.isFinite(northMeters)) {
             realtimeX = formatMeters(eastMeters);
             realtimeY = formatMeters(northMeters);
+            
+            // 淇濆瓨鍧愭爣鍒板伐鍏风被
+            lujing.SavaXyZuobiao.addCoordinate(eastMeters, northMeters);
         }
     }
 
@@ -835,6 +875,30 @@
         this.mowerBladeHeight = mowerBladeHeight;
     }
 
+    public String getMowerWidth() { // 鑾峰彇鍓茶崏鏈哄搴�
+        return mowerWidth;
+    }
+
+    public void setMowerWidth(String mowerWidth) { // 璁剧疆鍓茶崏鏈哄搴�
+        this.mowerWidth = mowerWidth;
+    }
+
+    public String getMowerLength() { // 鑾峰彇鍓茶崏鏈洪暱搴�
+        return mowerLength;
+    }
+
+    public void setMowerLength(String mowerLength) { // 璁剧疆鍓茶崏鏈洪暱搴�
+        this.mowerLength = mowerLength;
+    }
+
+    public String getMowingSafetyDistance() { // 鑾峰彇鍓茶崏瀹夊叏璺濈
+        return mowingSafetyDistance;
+    }
+
+    public void setMowingSafetyDistance(String mowingSafetyDistance) { // 璁剧疆鍓茶崏瀹夊叏璺濈
+        this.mowingSafetyDistance = mowingSafetyDistance;
+    }
+
     @Override
     public String toString() { // 杈撳嚭瀵硅薄淇℃伅
         return "Device{" +
@@ -866,6 +930,9 @@
                 ", mowerStartStatus='" + mowerStartStatus + '\'' +
                 ", mowerLightStatus='" + mowerLightStatus + '\'' +
                 ", mowerBladeHeight='" + mowerBladeHeight + '\'' +
+                ", mowerWidth='" + mowerWidth + '\'' +
+                ", mowerLength='" + mowerLength + '\'' +
+                ", mowingSafetyDistance='" + mowingSafetyDistance + '\'' +
                 '}';
     }
 }
\ No newline at end of file

--
Gitblit v1.10.0