|
- using Glorysoft.SECS.EQP.Common;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Reflection;
- using System.Text;
- using System.Threading.Tasks;
-
- namespace ARI.EAP.HOST.Common
- {
- public static class EquipmentStatus
- {
- public static string S5F3 { get; set; } = "AlarmEnable";
- public static bool S1F1FuntionStatus { get; set; } = false;
- public static ushort SpoolingFlag { get; set; } = 0;
- public static Dictionary<string, IEventHandler> EventHandlers { get; set; }
- public static ushort commandCount { get; set; } = 0;
- public static bool initStatus { get; set; } = false;
-
- public static MESHeartBit mESHeartBit;
-
- public static SocketClient socketClient;
-
- public static S1F1HeartBit S1F1HeartBit;
-
- private static string _MQstate = ConnectState.disconnected;
-
- private static string _EqConnectState = ConnectState.disconnected;
-
- private static RunState _EapState = RunState.Stop;
-
- public static string MQstate
- {
- get { return _MQstate; }
- set
- {
- if (!_MQstate.Equals(value))
- {
- _MQstate = value;
- Global.MF.MQConnectStatusSet(value);
- PublishStatus();
- }
- }
- }
-
- public static string EqConnectState
- {
- get { return _EqConnectState; }
- set
- {
- if (!_EqConnectState.Equals(value))
- {
- _EqConnectState = value;
- Global.MF.ConnectStatusSet(value);
- PublishStatus();
- }
- }
- }
-
- public static RunState EapState
- {
- get { return _EapState; }
- set
- {
- if (!_EapState.Equals(value))
- {
- _EapState = value;
- PublishStatus();
- }
- }
- }
-
- static EquipmentStatus()
- {
- mESHeartBit = new MESHeartBit();
- socketClient = new SocketClient();
- S1F1HeartBit = new S1F1HeartBit();
- EventHandlers = new Dictionary<string, IEventHandler>();
- foreach (Type item in MethodBase.GetCurrentMethod().DeclaringType.Assembly.GetTypes())
- {
- if (item.IsClass && item.GetInterface(nameof(IEventHandler)) != null)
- {
- EventHandlers.Add(item.Name, Activator.CreateInstance(item) as IEventHandler);
- }
- }
- }
-
- static void PublishStatus() {
- Task.Run(() => mESHeartBit.Method());
- }
- }
-
- }
|