| | |
| | | return simulator.snapshot(); |
| | | } |
| | | |
| | | /** 模拟现场人工统一开关全部检测柜和采集器,不发送任何设备控制命令。 */ |
| | | @PostMapping("/dev/bts-simulator/power") |
| | | public StateSnapshot setPower(@RequestBody SimulatorPowerCommand command) |
| | | { |
| | | if (command == null || command.poweredOn() == null) |
| | | throw badRequest(new IllegalArgumentException("poweredOn must be true or false")); |
| | | simulator.setAllDevicesPoweredOn(command.poweredOn()); |
| | | return simulator.snapshot(); |
| | | } |
| | | |
| | | /** 添加一台虚拟设备。 */ |
| | | @PostMapping("/dev/bts-simulator/devices") |
| | | public StateSnapshot createDevice(@RequestBody CreateDeviceCommand command) |
| | |
| | | |
| | | public record CreateDeviceCommand(String ip, int channelCount) { } |
| | | |
| | | public record SimulatorPowerCommand(Boolean poweredOn) { } |
| | | |
| | | public record DeviceStateCommand(String ip, int channelCount, boolean online) { } |
| | | |
| | | public record ChannelStateCommand(boolean online, DeviceWorkStatus workStatus) { } |