From 69b40096cb0ae965f2a3e92672b880edfe7d04d2 Mon Sep 17 00:00:00 2001
From: 826220679@qq.com <826220679@qq.com>
Date: 星期六, 27 十二月 2025 21:14:09 +0800
Subject: [PATCH] 优化了登录页面
---
src/Mqttmessage/Client.java | 21 ---------------------
1 files changed, 0 insertions(+), 21 deletions(-)
diff --git a/src/Mqttmessage/Client.java b/src/Mqttmessage/Client.java
index ca1e876..35c9b35 100644
--- a/src/Mqttmessage/Client.java
+++ b/src/Mqttmessage/Client.java
@@ -57,7 +57,6 @@
*/
public void connect() throws MqttException {
if (client != null && client.isConnected()) {
- System.out.println("MQTT瀹㈡埛绔凡杩炴帴锛孋lientId: " + clientId);
return;
}
@@ -78,7 +77,6 @@
// 鎵ц杩炴帴
client.connect(options);
- System.out.println("MQTT杩炴帴鎴愬姛锛丆lientId: " + clientId + ", 鏈嶅姟鍣�: " + host + ", 涓婚: " + topic);
// 鍚姩杩炴帴鐩戞帶绾跨▼
startConnectionMonitor();
@@ -95,7 +93,6 @@
connect();
}
client.subscribe(topic, qos);
- System.out.println("宸茶闃呬富棰�: " + topic + ", QoS: " + qos);
}
/**
@@ -132,7 +129,6 @@
Thread.sleep(5000); // 姣�5绉掓鏌ヤ竴娆�
if (client != null && !client.isConnected()) {
- System.out.println("妫�娴嬪埌MQTT杩炴帴鏂紑锛屽皾璇曢噸杩�... ClientId: " + clientId);
try {
// 灏濊瘯閲嶆柊杩炴帴
if (!client.isConnected()) {
@@ -140,7 +136,6 @@
// 閲嶈繛鎴愬姛鍚庨噸鏂拌闃�
if (client.isConnected()) {
client.subscribe(topic, qos);
- System.out.println("杩炴帴鐩戞帶锛氶噸杩炴垚鍔熷苟閲嶆柊璁㈤槄涓婚: " + topic);
}
}
} catch (Exception e) {
@@ -167,7 +162,6 @@
connectionMonitorThread.setDaemon(true);
connectionMonitorThread.setName("MQTT-ConnectionMonitor-" + clientId);
connectionMonitorThread.start();
- System.out.println("宸插惎鍔∕QTT杩炴帴鐩戞帶绾跨▼: " + clientId);
}
/**
@@ -228,13 +222,11 @@
public static boolean connectMQTT() {
// 闃叉閲嶅閲嶈繛
if (isReconnecting) {
- System.out.println("MQTT姝e湪閲嶈繛涓紝璺宠繃鏈閲嶈繛璇锋眰");
return false;
}
// 妫�鏌ユ槸鍚﹀凡缁忚繛鎺�
if (areClientsConnected()) {
- System.out.println("MQTT瀹㈡埛绔凡杩炴帴锛屾棤闇�閲嶅杩炴帴");
return true;
}
@@ -269,7 +261,6 @@
if (gpsClient != null && gpsClient.isConnected()) {
gpsClient.subscribe();
gpsSuccess = true;
- System.out.println("GPS涓婚MQTT杩炴帴骞惰闃呮垚鍔�");
}
} catch (MqttException e) {
System.err.println("GPS涓婚MQTT杩炴帴澶辫触: " + e.getMessage());
@@ -291,7 +282,6 @@
if (responseClient != null && responseClient.isConnected()) {
responseClient.subscribe();
responseSuccess = true;
- System.out.println("鍝嶅簲涓婚MQTT杩炴帴骞惰闃呮垚鍔�");
}
} catch (MqttException e) {
System.err.println("鍝嶅簲涓婚MQTT杩炴帴澶辫触: " + e.getMessage());
@@ -305,10 +295,8 @@
}
if (gpsSuccess && responseSuccess) {
- System.out.println("鎵�鏈塎QTT涓婚杩炴帴骞惰闃呮垚鍔燂紒");
return true;
} else if (gpsSuccess || responseSuccess) {
- System.out.println("閮ㄥ垎MQTT涓婚杩炴帴鎴愬姛");
return true;
} else {
System.err.println("鎵�鏈塎QTT涓婚杩炴帴澶辫触");
@@ -337,13 +325,11 @@
public static boolean connectMQTT(String host, String deviceId, String userEmail) {
// 闃叉閲嶅閲嶈繛
if (isReconnecting) {
- System.out.println("MQTT姝e湪閲嶈繛涓紝璺宠繃鏈閲嶈繛璇锋眰");
return false;
}
// 妫�鏌ユ槸鍚﹀凡缁忚繛鎺�
if (areClientsConnected()) {
- System.out.println("MQTT瀹㈡埛绔凡杩炴帴锛屾棤闇�閲嶅杩炴帴");
return true;
}
@@ -376,7 +362,6 @@
if (gpsClient != null && gpsClient.isConnected()) {
gpsClient.subscribe();
gpsSuccess = true;
- System.out.println("GPS涓婚MQTT杩炴帴骞惰闃呮垚鍔�");
}
} catch (MqttException e) {
System.err.println("GPS涓婚MQTT杩炴帴澶辫触: " + e.getMessage());
@@ -398,7 +383,6 @@
if (responseClient != null && responseClient.isConnected()) {
responseClient.subscribe();
responseSuccess = true;
- System.out.println("鍝嶅簲涓婚MQTT杩炴帴骞惰闃呮垚鍔�");
}
} catch (MqttException e) {
System.err.println("鍝嶅簲涓婚MQTT杩炴帴澶辫触: " + e.getMessage());
@@ -412,10 +396,8 @@
}
if (gpsSuccess && responseSuccess) {
- System.out.println("鎵�鏈塎QTT涓婚杩炴帴骞惰闃呮垚鍔燂紒");
return true;
} else if (gpsSuccess || responseSuccess) {
- System.out.println("閮ㄥ垎MQTT涓婚杩炴帴鎴愬姛");
return true;
} else {
System.err.println("鎵�鏈塎QTT涓婚杩炴帴澶辫触");
@@ -447,7 +429,6 @@
Client mqttClient = new Client(host, topic, clientId);
mqttClient.connect();
mqttClient.subscribe(qos);
- System.out.println("MQTT瀹㈡埛绔垱寤哄苟璁㈤槄鎴愬姛锛屼富棰�: " + topic + ", ClientId: " + clientId);
return mqttClient;
} catch (MqttException e) {
System.err.println("MQTT瀹㈡埛绔垱寤哄け璐�: " + e.getMessage() + ", 涓婚: " + topic);
@@ -474,12 +455,10 @@
try {
if (gpsClient != null) {
gpsClient.close();
- System.out.println("GPS涓婚MQTT杩炴帴宸叉柇寮�");
gpsClient = null;
}
if (responseClient != null) {
responseClient.close();
- System.out.println("鍝嶅簲涓婚MQTT杩炴帴宸叉柇寮�");
responseClient = null;
}
} catch (Exception e) {
--
Gitblit v1.10.0