From bc8f980e912825eaaadaf9fdd2367f443a56de02 Mon Sep 17 00:00:00 2001
From: zhaowenyu <35589726@qq.com>
Date: Sat, 07 Mar 2026 10:17:19 +0800
Subject: [PATCH] 2026-03-07 标记功能接口,支持点、线、面、圆标记存储
---
ard-sample/src/main/java/com/ard/sample/component/websocket/enums/MessageType.java | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/ard-sample/src/main/java/com/ard/sample/component/websocket/enums/MessageType.java b/ard-sample/src/main/java/com/ard/sample/component/websocket/enums/MessageType.java
index e46ea77..4f08004 100644
--- a/ard-sample/src/main/java/com/ard/sample/component/websocket/enums/MessageType.java
+++ b/ard-sample/src/main/java/com/ard/sample/component/websocket/enums/MessageType.java
@@ -5,6 +5,10 @@
STATUS("status"),
CONTROL("control"),
PROGRESS("progress"),
+ LIVESTREAM("livestream"),
+ LIVESTATUS("livestatus"),
+ PING("ping"), // 新增心跳请求
+ PONG("pong"), // 新增心跳响应
ALL("all");
private final String type;
@@ -17,12 +21,19 @@
return type;
}
- public static MessageType fromString(String type) {
+ public static boolean fromString(String type) {
+ // 遍历MessageType枚举的所有值
for (MessageType messageType : MessageType.values()) {
+ // 如果当前枚举值的type属性与传入的type字符串忽略大小写相等
if (messageType.type.equalsIgnoreCase(type)) {
- return messageType;
+ // 返回当前枚举值
+ //return messageType;
+ return true;
}
}
- throw new IllegalArgumentException("Unknown message type: " + type);
+ // 如果遍历完所有枚举值都没有找到匹配的,则抛出异常
+ //throw new IllegalArgumentException("Unknown message type: " + type);
+ return false;
}
+
}
--
Gitblit v1.9.3