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.
42 lines
1.2 KiB
42 lines
1.2 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.CID);
|
|
AlarmMessage obj = new()
|
|
{
|
|
LabelCode = Convert.ToString(msg.DeviceID),
|
|
ChannelId = Convert.ToInt32(msg.SensorAddr),
|
|
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),
|
|
ChannelId = msg.SectorId,
|
|
WarnType = 4,
|
|
WarnLevel = code.Level,
|
|
WarnContent = code.Content,
|
|
DealStatus = 1,
|
|
CreateTime = Convert.ToDateTime(msg.AlarmTime),
|
|
Kind = 2,
|
|
};
|
|
return obj;
|
|
}
|
|
}
|