| | |
| | | } |
| | | } |
| | | |
| | | 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, |
| | |
| | | |
| | | 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) { } |