You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

using JiLinApp.Docking.Alarm;
using JiLinApp.Docking.FenceAlarm;
using JiLinApp.Docking.VibrateAlarm;
namespace JiLinApp.Biz.TransmitAlarm;
public static class AlarmMessageHelper
{
public static AlarmMessage ToAlarmMessage(this TcpAlarmHostMessage msg)
{
AlarmCode code = AlarmCodeHelper.Get(msg.AlarmId);
AlarmMessage obj = new()
{
labelCode = Convert.ToString(msg.DeviceID),
warnType = 3,
warnLevel = code.Level,
warnContent = code.Content,
dealStatus = 1,
createTime = Convert.ToDateTime(msg.AlarmTime),
kind = 2,
};
return obj;
}
public static AlarmMessage ToAlarmMessage(this UdpAlarmHostMessage msg)
{
AlarmCode code = AlarmCodeHelper.Get(msg.CID);
AlarmMessage obj = new()
{
labelCode = Convert.ToString(msg.DeviceID),
warnType = 4,
warnLevel = code.Level,
warnContent = code.Content,
dealStatus = 1,
createTime = Convert.ToDateTime(msg.AlarmTime),
kind = 2,
};
return obj;
}
}