从 Simple-FR 拆出 Platform.Server 并重命名为 MiGu.Server;frontends 源码与构建脚本迁入本仓库。地图监控在 projection/cars 失败或为空时回退 reflection 车辆列表;Simple 仓库已移除旧 Platform.Server。 Co-authored-by: Cursor <cursoragent@cursor.com>
39 lines
1.5 KiB
C#
39 lines
1.5 KiB
C#
namespace MiGu.Server.Configs;
|
|
|
|
public record DeviceDriverBinding(string Id, string DeviceType, string DriverName, string Version);
|
|
|
|
public record DeviceInstance(
|
|
string Id, string Name, string DeviceType, string Protocol, string Address,
|
|
string DriverId, bool Enabled);
|
|
|
|
public record DeviceHealthPolicy(int HeartbeatSec, int OfflineSec);
|
|
|
|
public record AlarmRule(string Level, string Condition);
|
|
public record AlarmPolicy(bool Enabled, List<AlarmRule> Rules);
|
|
|
|
public record DeviceManagementConfig(
|
|
List<DeviceDriverBinding> Drivers,
|
|
List<DeviceInstance> Devices,
|
|
DeviceHealthPolicy HealthPolicy,
|
|
AlarmPolicy AlarmPolicy)
|
|
{
|
|
public static DeviceManagementConfig Default() => new(
|
|
Drivers: new List<DeviceDriverBinding>
|
|
{
|
|
new("drv-elev", "电梯", "OpcUaElevatorDriver", "1.2.0"),
|
|
new("drv-chrg", "充电桩", "ModbusChargerDriver", "1.0.5"),
|
|
new("drv-cam", "摄像头", "OnvifCameraDriver", "2.1.0")
|
|
},
|
|
Devices: new List<DeviceInstance>
|
|
{
|
|
new("dev-elev-1", "#1 电梯", "电梯", "opc-ua", "opc.tcp://10.0.2.20:4840", "drv-elev", true),
|
|
new("dev-chrg-1", "充电桩-A1", "充电桩", "modbus-tcp", "10.0.2.30:502", "drv-chrg", true)
|
|
},
|
|
HealthPolicy: new DeviceHealthPolicy(5, 30),
|
|
AlarmPolicy: new AlarmPolicy(true, new List<AlarmRule>
|
|
{
|
|
new("warn", "offline>30s"),
|
|
new("error", "driverException")
|
|
}));
|
|
}
|