dc/Common/S1F1HeartBit.cs

50 lines
1.4 KiB
C#
Raw Permalink Normal View History

2022-12-16 13:01:24 +08:00
using Glorysoft.SECS.EQP.Commands;
using Glorysoft.SECS.EQP.Utilities;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace ARI.EAP.HOST.Common
{
public class S1F1HeartBit
{
public Timer timer1;
public Timer timer2;
public S1F1HeartBit()
{
timer1 = new Timer(60000);
timer1.Elapsed += new ElapsedEventHandler(Method);
timer1.AutoReset = true;
timer1.Enabled = true;
timer2 = new Timer(30000);
timer2.Elapsed += new ElapsedEventHandler(Method1);
timer2.AutoReset = false;
timer2.Enabled = false;
}
public void Method(object source, ElapsedEventArgs e)
{
if (EquipmentStatus.S1F1FuntionStatus)
{
if (EquipmentStatus.EqConnectState.Equals(ConnectState.connected))
{
Command.S1F1Command(null);
timer2.Stop();
timer2.Start();
}
}
}
public void Method1(object source, ElapsedEventArgs e)
{
LoggerService.SYSLogger.Debug("未收到S1F2回复判断设备与EAP已断连开始重连...");
EquipmentStatus.EqConnectState = ConnectState.connecting;
Global.MF.pushBotton("Connect");
}
}
}