From 1c26cdb81070af7f29df4462d3bfc1ae588ff8f3 Mon Sep 17 00:00:00 2001
From: yeg <1347747024@qq.com>
Date: 星期日, 30 八月 2026 14:11:34 +0800
Subject: [PATCH] 模拟器优化
---
ruoyi-device/src/main/java/com/ruoyi/device/simulator/BtsSimulatorStateStore.java | 41 +++++++++++++++++++++++++++++++++++++++--
1 files changed, 39 insertions(+), 2 deletions(-)
diff --git a/ruoyi-device/src/main/java/com/ruoyi/device/simulator/BtsSimulatorStateStore.java b/ruoyi-device/src/main/java/com/ruoyi/device/simulator/BtsSimulatorStateStore.java
index 58a90fe..a950af0 100644
--- a/ruoyi-device/src/main/java/com/ruoyi/device/simulator/BtsSimulatorStateStore.java
+++ b/ruoyi-device/src/main/java/com/ruoyi/device/simulator/BtsSimulatorStateStore.java
@@ -66,9 +66,20 @@
}
}
- record DeviceState(int deviceId, String ip, boolean online, List<ChannelState> channels)
+ record DeviceState(int deviceId, String ip, boolean online, List<ChannelState> channels,
+ BtsDeviceProfile profile)
{
- public DeviceState { channels = List.copyOf(channels); }
+ public DeviceState
+ {
+ channels = List.copyOf(channels);
+ profile = profile == null ? BtsDeviceProfile.virtual(channels.size()) : profile;
+ }
+
+ /** 兼容旧版只保存拓扑和通道状态的模拟设备。 */
+ public DeviceState(int deviceId, String ip, boolean online, List<ChannelState> channels)
+ {
+ this(deviceId, ip, online, channels, BtsDeviceProfile.virtual(channels.size()));
+ }
}
record CollectorState(int collectorId, String deviceCode, String ip, String mac, String name,
@@ -137,6 +148,32 @@
record ChannelState(int channelId, boolean online, DeviceWorkStatus workStatus) { }
+ /** BTS 检测柜的可配置厂商 profile;参数用于发现展示和边界内的演示数据生成。 */
+ record BtsDeviceProfile(int devtype, int subDeviceId, String name, String manufacturer, String model,
+ String serialNumber, String firmwareVersion, int channelCount, BigDecimal currentMinA,
+ BigDecimal currentMaxA, BigDecimal voltageMinV, BigDecimal voltageMaxV, int sampleIntervalMs)
+ {
+ public BtsDeviceProfile
+ {
+ if (devtype < 0 || subDeviceId < 0 || channelCount < 1 || sampleIntervalMs < 1)
+ throw new IllegalArgumentException("Invalid BTS device profile limits");
+ if (name == null || name.isBlank() || manufacturer == null || manufacturer.isBlank()
+ || model == null || model.isBlank() || serialNumber == null || serialNumber.isBlank()
+ || firmwareVersion == null || firmwareVersion.isBlank())
+ throw new IllegalArgumentException("BTS device profile metadata must not be blank");
+ if (currentMinA == null || currentMaxA == null || voltageMinV == null || voltageMaxV == null
+ || currentMinA.compareTo(currentMaxA) > 0 || voltageMinV.compareTo(voltageMaxV) > 0)
+ throw new IllegalArgumentException("Invalid BTS device profile ranges");
+ }
+
+ public static BtsDeviceProfile virtual(int channelCount)
+ {
+ return new BtsDeviceProfile(22, 1, "dev-sim 设备", "开发模拟器", "BTS Virtual Cabinet",
+ "SIM-VIRTUAL", "dev-sim", channelCount, new BigDecimal("-6.000"),
+ new BigDecimal("6.000"), BigDecimal.ZERO, new BigDecimal("5.000"), 100);
+ }
+ }
+
record ChannelTombstone(int deviceId, String ip, int channelId, int remainingDiscoveries) { }
record RecentRequest(Instant receivedAt, String command, String request) { }
--
Gitblit v1.7.1