From e4b4347318f1f37c64b8055f1f1898da59a167ba Mon Sep 17 00:00:00 2001
From: 张世豪 <979909237@qq.com>
Date: 星期五, 26 十二月 2025 19:38:43 +0800
Subject: [PATCH] 优化了细节
---
src/gecaoji/Device.java | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 1 deletions(-)
diff --git a/src/gecaoji/Device.java b/src/gecaoji/Device.java
index 9d1a1c3..bb96f57 100644
--- a/src/gecaoji/Device.java
+++ b/src/gecaoji/Device.java
@@ -99,7 +99,11 @@
// 鍓茶崏鏈洪暱搴︼紝鍗曚綅绫�
private String mowingSafetyDistance;
// 鍓茶崏瀹夊叏璺濈锛屽崟浣嶇背
-
+ private String movement_speed = "-1"; // 杩愬姩閫熷害 km/h
+ // 澶х伅鐘舵�侊細0鍏抽棴锛�1寮�鍚�
+ private String headlight_status = "-1";
+ // 鍓茶崏鏈哄紑鍏崇姸鎬侊細0鐔勭伀锛�1寮�鍚�
+ private String mower_switch_status = "-1";
private static final double METERS_PER_DEGREE_LAT = 111320.0d;
@@ -184,6 +188,9 @@
if (mowerWidth != null) properties.setProperty("mowerWidth", mowerWidth);
if (mowerLength != null) properties.setProperty("mowerLength", mowerLength);
if (mowingSafetyDistance != null) properties.setProperty("mowingSafetyDistance", mowingSafetyDistance);
+ if (movement_speed != null) properties.setProperty("movement_speed", movement_speed);
+ if (headlight_status != null) properties.setProperty("headlight_status", headlight_status);
+ if (mower_switch_status != null) properties.setProperty("mower_switch_status", mower_switch_status);
// 淇濆瓨鍒版枃浠�
try (FileOutputStream output = new FileOutputStream("device.properties");
@@ -240,6 +247,9 @@
target.mowerWidth = properties.getProperty("mowerWidth", "-1");
target.mowerLength = properties.getProperty("mowerLength", "-1");
target.mowingSafetyDistance = properties.getProperty("mowingSafetyDistance", "-1");
+ target.movement_speed = properties.getProperty("movement_speed", "-1");
+ target.headlight_status = properties.getProperty("headlight_status", "-1");
+ target.mower_switch_status = properties.getProperty("mower_switch_status", "-1");
}
private void applyDefaults(Device target) {
@@ -288,6 +298,9 @@
target.mowerWidth = "-1";
target.mowerLength = "-1";
target.mowingSafetyDistance = "-1";
+ target.movement_speed = "-1";
+ target.headlight_status = "-1";
+ target.mower_switch_status = "-1";
}
public static synchronized Device initializeActiveDevice(String mowerId) { // 鏍规嵁璁惧ID鍒濆鍖栨椿璺冭澶�
@@ -434,6 +447,15 @@
case "mowingSafetyDistance":
this.mowingSafetyDistance = value;
return true;
+ case "movement_speed":
+ this.movement_speed = value;
+ return true;
+ case "headlight_status":
+ this.headlight_status = value;
+ return true;
+ case "mower_switch_status":
+ this.mower_switch_status = value;
+ return true;
default:
System.err.println("鏈煡瀛楁: " + fieldName);
return false;
@@ -1070,6 +1092,30 @@
this.mowingSafetyDistance = mowingSafetyDistance;
}
+ public String getMovement_speed() { // 鑾峰彇杩愬姩閫熷害
+ return movement_speed;
+ }
+
+ public void setMovement_speed(String movement_speed) { // 璁剧疆杩愬姩閫熷害
+ this.movement_speed = movement_speed;
+ }
+
+ public String getHeadlight_status() { // 鑾峰彇澶х伅鐘舵��
+ return headlight_status;
+ }
+
+ public void setHeadlight_status(String headlight_status) { // 璁剧疆澶х伅鐘舵��
+ this.headlight_status = headlight_status;
+ }
+
+ public String getMower_switch_status() { // 鑾峰彇鍓茶崏鏈哄紑鍏崇姸鎬�
+ return mower_switch_status;
+ }
+
+ public void setMower_switch_status(String mower_switch_status) { // 璁剧疆鍓茶崏鏈哄紑鍏崇姸鎬�
+ this.mower_switch_status = mower_switch_status;
+ }
+
@Override
public String toString() { // 杈撳嚭瀵硅薄淇℃伅
return "Device{" +
@@ -1113,6 +1159,9 @@
", mowerWidth='" + mowerWidth + '\'' +
", mowerLength='" + mowerLength + '\'' +
", mowingSafetyDistance='" + mowingSafetyDistance + '\'' +
+ ", movement_speed='" + movement_speed + '\'' +
+ ", headlight_status='" + headlight_status + '\'' +
+ ", mower_switch_status='" + mower_switch_status + '\'' +
'}';
}
}
\ No newline at end of file
--
Gitblit v1.10.0