using Aitex.Core.Common.DeviceData;
using MECF.Framework.Common.DataCenter;
using MECF.Framework.Common.Equipment;
using MECF.Framework.Common.OperationCenter;
using Prism.Commands;
using Prism.Mvvm;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows.Threading;
using Venus_Core;
using Venus_MainPages.Unity;
using Venus_MainPages.Views;
using Venus_Themes.CustomControls;

namespace Venus_MainPages.ViewModels
{
    public class TMOperationViewModel : BindableBase
    {
        #region 私有字段
        private TMOperationView m_TMOperationView;
        private bool m_IsOFFline = true;

        private bool m_TMIsOFFline = true;


        private bool m_PMAIsInstalled;
        private bool m_PMBIsInstalled;
        private bool m_PMCIsInstalled;
        private bool m_PMDIsInstalled;
        private bool m_LLAIsInstalled;
        private bool m_LLBIsInstalled;

        private Dictionary<string, object> m_RtDataValues;

        private string m_ModuleCheckedName = "TM";

        private bool m_TMValveN2IsOpen;
        private bool m_TMSoftPumpValveIsOpen;
        private bool m_TMFastPumpValveIsOpen;
        private bool m_TMPurgeValveIsOpen;
        private bool m_TMSoftVentValveIsOpen;
        private bool m_TMFastVentValveIsOpen;
        private bool m_LLASoftPumpValveIsOpen;
        private bool m_LLAFastPumpValveIsOpen;
        private bool m_LLAPurgeValveIsOpen;
        private bool m_LLAVentValveIsOpen;
        private bool m_LLBSoftPumpValveIsOpen;
        private bool m_LLBFastPumpValveIsOpen;
        private bool m_LLBPurgeValveIsOpen;
        private bool m_LLBVentValveIsOpen;
        private List<string> m_RtDataKeys = new List<string>();

        private int m_TMOutChamberPressure;
        private int m_TMOutChamberFlow;

        private int m_TMChamberPressureSetPoint;
        private int m_TMChamberFlowSetPoint;
        private ObservableCollection<string> m_HomeAllSteps = new ObservableCollection<string>();
        private int m_StepProcess;
        private bool m_TMIsHoming;
        private PressureType m_PressureType;
        private TMState m_TMCurrentState;
        private LLState m_LLACurrentState;
        private LLState m_LLBCurrentState;
        private ObservableCollection<PMLeakCheckResult> m_LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>();

        private bool m_firstLoad = true;
        #endregion

        #region 属性
        public PressureType PressureType
        {
            get { return m_PressureType; }
            set { SetProperty(ref m_PressureType, value); }
        }
        public bool TMValveN2IsOpen
        {
            get { return m_TMValveN2IsOpen; }
            set { SetProperty(ref m_TMValveN2IsOpen, value); }
        }
        public bool TMSoftPumpValveIsOpen
        {
            get { return m_TMSoftPumpValveIsOpen; }
            set { SetProperty(ref m_TMSoftPumpValveIsOpen, value); }
        }
        public bool TMFastPumpValveIsOpen
        {
            get { return m_TMFastPumpValveIsOpen; }
            set { SetProperty(ref m_TMFastPumpValveIsOpen, value); }
        }
        public bool TMPurgeValveIsOpen
        {
            get { return m_TMPurgeValveIsOpen; }
            set { SetProperty(ref m_TMPurgeValveIsOpen, value); }
        }
        public bool TMSoftVentValveIsOpen
        {
            get { return m_TMSoftVentValveIsOpen; }
            set { SetProperty(ref m_TMSoftVentValveIsOpen, value); }
        }
        public bool TMFastVentValveIsOpen
        {
            get { return m_TMFastVentValveIsOpen; }
            set { SetProperty(ref m_TMFastVentValveIsOpen, value); }
        }
        public bool LLAFastPumpValveIsOpen
        {
            get { return m_LLAFastPumpValveIsOpen; }
            set { SetProperty(ref m_LLAFastPumpValveIsOpen, value); }
        }
        public bool LLASoftPumpValveIsOpen
        {
            get { return m_LLASoftPumpValveIsOpen; }
            set { SetProperty(ref m_LLASoftPumpValveIsOpen, value); }
        }
        public bool LLAPurgeValveIsOpen
        {
            get { return m_LLAPurgeValveIsOpen; }
            set { SetProperty(ref m_LLAPurgeValveIsOpen, value); }
        }
        public bool LLAVentValveIsOpen
        {
            get { return m_LLAVentValveIsOpen; }
            set { SetProperty(ref m_LLAVentValveIsOpen, value); }
        }
        public bool LLBSoftPumpValveIsOpen
        {
            get { return m_LLBSoftPumpValveIsOpen; }
            set { SetProperty(ref m_LLBSoftPumpValveIsOpen, value); }
        }
        public bool LLBFastPumpValveIsOpen
        {
            get { return m_LLBFastPumpValveIsOpen; }
            set { SetProperty(ref m_LLBFastPumpValveIsOpen, value); }
        }
        public bool LLBPurgeValveIsOpen
        {
            get { return m_LLBPurgeValveIsOpen; }
            set { SetProperty(ref m_LLBPurgeValveIsOpen, value); }
        }
        public bool LLBVentValveIsOpen
        {
            get { return m_LLBVentValveIsOpen; }
            set { SetProperty(ref m_LLBVentValveIsOpen, value); }
        }
        public int TMChamberPressureSetPoint
        {
            get { return m_TMChamberPressureSetPoint; }
            set { SetProperty(ref m_TMChamberPressureSetPoint, value); }
        }
        public int TMChamberFlowSetPoint
        {
            get { return m_TMChamberFlowSetPoint; }
            set { SetProperty(ref m_TMChamberFlowSetPoint, value); }
        }
        public bool IsOFFline
        {
            get { return m_IsOFFline; }
            set
            {
                SetProperty(ref m_IsOFFline, value);
            }
        }
        public bool TMIsOFFline
        {
            get { return m_TMIsOFFline; }
            set
            {
                SetProperty(ref m_TMIsOFFline, value);
            }
        }

        public Dictionary<string, object> RtDataValues
        {
            get { return m_RtDataValues; }
            set { SetProperty(ref m_RtDataValues, value); }
        }
        public bool PMAIsInstalled
        {
            get { return m_PMAIsInstalled; }
            set { SetProperty(ref m_PMAIsInstalled, value); }
        }
        public bool PMBIsInstalled
        {
            get { return m_PMBIsInstalled; }
            set { SetProperty(ref m_PMBIsInstalled, value); }
        }
        public bool PMCIsInstalled
        {
            get { return m_PMCIsInstalled; }
            set { SetProperty(ref m_PMCIsInstalled, value); }
        }
        public bool PMDIsInstalled
        {
            get { return m_PMDIsInstalled; }
            set { SetProperty(ref m_PMDIsInstalled, value); }
        }
        public bool LLAIsInstalled
        {
            get { return m_LLAIsInstalled; }
            set { SetProperty(ref m_LLAIsInstalled, value); }
        }
        public bool LLBIsInstalled
        {
            get { return m_LLBIsInstalled; }
            set { SetProperty(ref m_LLBIsInstalled, value); }
        }
        public int TMOutChamberFlow
        {
            get { return m_TMOutChamberFlow; }
            set
            {
                if (value != m_TMOutChamberFlow)
                {
                    InvokeClient.Instance.Service.DoOperation($"TM.SetChamberFlow", value);
                }
                SetProperty(ref m_TMOutChamberFlow, value);
            }
        }

        public int TMOutChamberPressure
        {
            get { return m_TMOutChamberPressure; }
            set
            {
                SetProperty(ref m_TMOutChamberPressure, value);
            }
        }
        public ObservableCollection<string> HomeAllSteps
        {
            get { return m_HomeAllSteps; }
            set { SetProperty(ref m_HomeAllSteps, value); }
        }
        public int StepProcess
        {
            get { return m_StepProcess; }
            set { SetProperty(ref m_StepProcess, value); }
        }
        public bool TMIsHoming
        {
            get { return m_TMIsHoming; }
            set { SetProperty(ref m_TMIsHoming, value); }
        }
        public TMState TMCurrentState
        {
            get { return m_TMCurrentState; }
            set
            {
                if ((m_TMCurrentState == TMState.Leakchecking) && value == TMState.Idle)
                {
                    var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult(m_ModuleCheckedName);
                    if (AllLeakCheckDa != null)
                    {
                        LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
                    }
                }
                SetProperty(ref m_TMCurrentState, value);
            }
        }
        public LLState LLACurrentState
        {
            get { return m_LLACurrentState; }
            set
            {
                if ((m_LLACurrentState == LLState.LeakCheck) && value == LLState.Idle)
                {
                    var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult(m_ModuleCheckedName);
                    if (AllLeakCheckDa != null)
                    {
                        LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
                    }
                }
                SetProperty(ref m_LLACurrentState, value);
            }
        }
        public LLState LLBCurrentState
        {
            get { return m_LLBCurrentState; }
            set
            {
                if ((m_LLBCurrentState == LLState.LeakCheck) && value == LLState.Idle)
                {
                    var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult(m_ModuleCheckedName);
                    if (AllLeakCheckDa != null)
                    {
                        LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
                    }
                }
                SetProperty(ref m_LLBCurrentState, value);
            }
        }
        public ObservableCollection<PMLeakCheckResult> LeakCheckResultList
        {
            get { return m_LeakCheckResultList; }
            set { SetProperty(ref m_LeakCheckResultList, value); }
        }
        #endregion

        #region 命令
        private DelegateCommand<object> _LoadCommand;
        public DelegateCommand<object> LoadCommand =>
            _LoadCommand ?? (_LoadCommand = new DelegateCommand<object>(OnLoad));

        private DelegateCommand _HomeCommand;
        public DelegateCommand HomeCommand =>
            _HomeCommand ?? (_HomeCommand = new DelegateCommand(OnHome));

        private DelegateCommand _RobotHomeCommand;
        public DelegateCommand RobotHomeCommand =>
            _RobotHomeCommand ?? (_RobotHomeCommand = new DelegateCommand(OnHome));

        private DelegateCommand _VentCommand;
        public DelegateCommand VentCommand =>
            _VentCommand ?? (_VentCommand = new DelegateCommand(OnVent));

        private DelegateCommand _PumpCommand;
        public DelegateCommand PumpCommand =>
            _PumpCommand ?? (_PumpCommand = new DelegateCommand(OnPump));

        private DelegateCommand _PurgeCommand;
        public DelegateCommand PurgeCommand =>
            _PurgeCommand ?? (_PurgeCommand = new DelegateCommand(OnPurge));

        private DelegateCommand _LeakCheckCommand;
        public DelegateCommand LeakCheckCommand =>
            _LeakCheckCommand ?? (_LeakCheckCommand = new DelegateCommand(OnLeakCheck));

        private DelegateCommand _AbortCommand;
        public DelegateCommand AbortCommand =>
            _AbortCommand ?? (_AbortCommand = new DelegateCommand(OnAbort));
        private DelegateCommand<object> _ModuleCheckedCommand;
        public DelegateCommand<object> ModuleCheckedCommand =>
            _ModuleCheckedCommand ?? (_ModuleCheckedCommand = new DelegateCommand<object>(OnModuleChecked));

        private DelegateCommand<object> _ControlValveCommand;
        public DelegateCommand<object> ControlValveCommand =>
            _ControlValveCommand ?? (_ControlValveCommand = new DelegateCommand<object>(OnControlValve));
        private DelegateCommand _OpenLLPumpCommand;
        public DelegateCommand OpenLLPumpCommand =>
            _OpenLLPumpCommand ?? (_OpenLLPumpCommand = new DelegateCommand(OnOpenLLPump));

        private DelegateCommand _CloseLLPumpCommand;
        public DelegateCommand CloseLLPumpCommand =>
            _CloseLLPumpCommand ?? (_CloseLLPumpCommand = new DelegateCommand(OnCloseLLPump));

        private DelegateCommand _OpenTMPumpCommand;
        public DelegateCommand OpenTMPumpCommand =>
            _OpenTMPumpCommand ?? (_OpenTMPumpCommand = new DelegateCommand(OnOpenTMPump));

        private DelegateCommand _CloseTMPumpCommand;
        public DelegateCommand CloseTMPumpCommand =>
            _CloseTMPumpCommand ?? (_CloseTMPumpCommand = new DelegateCommand(OnCloseTMPump));
        private DelegateCommand<object> _DoorUpDownCommand;
        public DelegateCommand<object> DoorUpDownCommand =>
            _DoorUpDownCommand ?? (_DoorUpDownCommand = new DelegateCommand<object>(OnDoorUpDown));

        private DelegateCommand<object> _ChamberDoorOpenCommand;
        public DelegateCommand<object> ChamberDoorOpenCommand =>
            _ChamberDoorOpenCommand ?? (_ChamberDoorOpenCommand = new DelegateCommand<object>(OnChamberDoorOpen));

        private DelegateCommand<object> _ChamberDoorCloseCommand;
        public DelegateCommand<object> ChamberDoorCloseCommand =>
            _ChamberDoorCloseCommand ?? (_ChamberDoorCloseCommand = new DelegateCommand<object>(OnChamberDoorClose));


        //private DelegateCommand _SetTMChamberPressureCommand;
        //public DelegateCommand SetTMChamberPressureCommand =>
        //    _SetTMChamberPressureCommand ?? (_SetTMChamberPressureCommand = new DelegateCommand(OnSetTMChamberPressure));

        private DelegateCommand _OnlineCommand;
        public DelegateCommand OnlineCommand =>
            _OnlineCommand ?? (_OnlineCommand = new DelegateCommand(OnOnline));

        private DelegateCommand _OfflineCommand;
        public DelegateCommand OfflineCommand =>
            _OfflineCommand ?? (_OfflineCommand = new DelegateCommand(OnOffline));

        #endregion

        #region 构造函数
        public TMOperationViewModel()
        {
            addDataKeys();

            string[] allModules = QueryDataClient.Instance.Service.GetConfig($"System.InstalledModules").ToString().Split(',');
            PMAIsInstalled = allModules.Contains("PMA");
            PMBIsInstalled = allModules.Contains("PMB");
            PMCIsInstalled = allModules.Contains("PMC");
            PMDIsInstalled = allModules.Contains("PMD");
            LLAIsInstalled = allModules.Contains("LLA");
            LLBIsInstalled = allModules.Contains("LLB");

            DispatcherTimer timer = new DispatcherTimer();
            timer.Interval = TimeSpan.FromSeconds(0.5);
            timer.Tick += timer_Tick;
            timer.Start();

            HomeAllSteps.Add("Lid");
            HomeAllSteps.Add("Robot");
            HomeAllSteps.Add("Slit Door");
            HomeAllSteps.Add("Pump ");

            object obj = QueryDataClient.Instance.Service.GetData("System.PressureUnitType");
            PressureType = (PressureType)Convert.ToInt32(obj);
        }


        #endregion

        #region 命令方法
        private void OnLoad(object tmOperationView)
        {
            if (m_firstLoad)
            {
                m_TMOperationView = (TMOperationView)tmOperationView;
                var AllLeakCheckDa = QueryDataClient.Instance.Service.GetPMLeakCheckResult("TM");
                if (AllLeakCheckDa != null)
                {
                    LeakCheckResultList = new ObservableCollection<PMLeakCheckResult>(AllLeakCheckDa);
                }
                m_firstLoad=false;
            }
        }

        private void OnHome()
        {
            InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.Home");
        }
        //private void OnRobotHome()
        //{
        //    InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.RobotHome");
        //}
        private void OnVent()
        {
            InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Vent}");
        }
        private void OnPump()
        {
            InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Pump}");
        }
        private void OnPurge()
        {
            InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Purge}");
        }
        private void OnLeakCheck()
        {
            InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.LeakCheck}");
        }
        private void OnAbort()
        {
            InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Abort}");
        }
        private void OnModuleChecked(object obj)
        {
            m_ModuleCheckedName = obj.ToString();
        }

        private void OnControlValve(object obj)
        {
            CommonValveControl commonValveControl = (CommonValveControl)obj;
            if (commonValveControl.IsCanEdit == true)
            {
                InvokeClient.Instance.Service.DoOperation($"TM.{commonValveControl.Tag.ToString()}.{AITValveOperation.GVTurnValve}", !commonValveControl.Status);
            }
        }
        private void OnOpenTMPump()
        {
            InvokeClient.Instance.Service.DoOperation("TM.ControlPump", true);
        }
        private void OnCloseTMPump()
        {
            InvokeClient.Instance.Service.DoOperation("TM.ControlPump", false);

        }
        private void OnOpenLLPump()
        {
            InvokeClient.Instance.Service.DoOperation("LL.ControlPump", true);
        }
        private void OnCloseLLPump()
        {
            InvokeClient.Instance.Service.DoOperation("LL.ControlPump", false);
        }
        private void OnDoorUpDown(object obj)
        {
            InvokeClient.Instance.Service.DoOperation(obj.ToString());
        }
        private void OnChamberDoorOpen(object obj)
        {
            InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Open");
        }
        private void OnChamberDoorClose(object obj)
        {
            InvokeClient.Instance.Service.DoOperation($"{obj?.ToString()}.SlitDoor.Close");
        }
        //private void OnSetTMChamberPressure()
        //{
        //    //InvokeClient.Instance.Service.DoOperation($"TM.SetChamberPressure", TMChamberPressureSetPoint);
        //    //TMOutChamberPressure = TMChamberPressureSetPoint;
        //    ////InvokeClient.Instance.Service.DoOperation("System.SetConfig", "TM.ControlPressureSetPoint", TMChamberPressureSetPoint.ToString());
        //}
        private void OnOnline()
        {
            InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Online}");
        }
        private void OnOffline()
        {
            InvokeClient.Instance.Service.DoOperation($"{m_ModuleCheckedName}.{RtOperation.Offline}");
        }

        #endregion

        #region 私有方法
        void timer_Tick(object sender, EventArgs e)
        {
            TMOutChamberPressure = (int)QueryDataClient.Instance.Service.GetConfig("TM.ControlPressureSetPoint");


            RtDataValues = QueryDataClient.Instance.Service.PollData(m_RtDataKeys);

            if (RtDataValues == null)
            {
                return;
            }

            TMValveN2IsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMValveN2.IsOpen");
            TMSoftPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMSoftPumpValve.IsOpen"); ;
            TMFastPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMFastPumpValve.IsOpen"); ;
            //TMPurgeValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMPurgeValve.IsOpen"); ;
            TMSoftVentValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMPurgeValve.IsOpen"); ;
            TMFastVentValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.TMVentValve.IsOpen"); ;
            LLASoftPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLASoftPumpValve.IsOpen");
            LLAFastPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLAFastPumpValve.IsOpen");
            LLAPurgeValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLAPurgeValve.IsOpen");
            LLAVentValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLAVentValve.IsOpen");
            LLBSoftPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBSoftPumpValve.IsOpen");
            LLBFastPumpValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBFastPumpValve.IsOpen");
            LLBPurgeValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBPurgeValve.IsOpen");
            LLBVentValveIsOpen = CommonFunction.GetValue<bool>(RtDataValues, "TM.LLBVentValve.IsOpen");
            IsOFFline = !CommonFunction.GetValue<bool>(RtDataValues, $"{m_ModuleCheckedName}.IsOnline");
            TMIsOFFline = !CommonFunction.GetValue<bool>(RtDataValues, $"TM.IsOnline");
            TMCurrentState = (TMState)(Enum.Parse(typeof(TMState), RtDataValues[$"TM.FsmState"].ToString()));
            LLACurrentState = (LLState)(Enum.Parse(typeof(LLState), RtDataValues[$"LLA.FsmState"].ToString()));
            LLBCurrentState = (LLState)(Enum.Parse(typeof(LLState), RtDataValues[$"LLB.FsmState"].ToString()));
            TMIsHoming = TMCurrentState == TMState.Initializing || (TMState)(Enum.Parse(typeof(TMState), RtDataValues[$"TM.FsmState"].ToString())) == TMState.InitializingRB;
            if (m_TMOperationView != null)
            {
                m_TMOperationView.stepBar.Progress = CommonFunction.GetValue<int>(RtDataValues, "TM.Home.StepNo");

            }
        }
        private void addDataKeys()
        {
            m_RtDataKeys.Add($"TM.TMValveN2.IsOpen");
            m_RtDataKeys.Add($"TM.TMSoftPumpValve.IsOpen");
            m_RtDataKeys.Add($"TM.TMFastPumpValve.IsOpen");
            m_RtDataKeys.Add($"TM.TMPurgeValve.IsOpen");
            //m_RtDataKeys.Add($"TM.TMSoftVentValve.IsOpen");
            m_RtDataKeys.Add($"TM.TMVentValve.IsOpen");

            m_RtDataKeys.Add($"TM.LLASoftPumpValve.IsOpen");
            m_RtDataKeys.Add($"TM.LLAFastPumpValve.IsOpen");
            m_RtDataKeys.Add($"TM.LLAPurgeValve.IsOpen");
            m_RtDataKeys.Add($"TM.LLBPurgeValve.IsOpen");

            m_RtDataKeys.Add($"TM.LLAVentValve.IsOpen");
            m_RtDataKeys.Add($"TM.LLBVentValve.IsOpen");

            m_RtDataKeys.Add($"TM.LLBSoftPumpValve.IsOpen");
            m_RtDataKeys.Add($"TM.LLBFastPumpValve.IsOpen");

            m_RtDataKeys.Add($"TM.TMVacSwitch.Value");
            m_RtDataKeys.Add($"TM.LLAVacSwitch.Value");
            m_RtDataKeys.Add($"TM.LLBVacSwitch.Value");
            m_RtDataKeys.Add($"TM.TMATMSwitch.Value");
            m_RtDataKeys.Add($"TM.LLAATMSwitch.Value");
            m_RtDataKeys.Add($"TM.LLBATMSwitch.Value");
            m_RtDataKeys.Add($"TM.TMProcessGauge.Value");
            m_RtDataKeys.Add($"TM.TMForelineGauge.Value");
            m_RtDataKeys.Add($"TM.LLAPressureGauge.Value");
            m_RtDataKeys.Add($"TM.LLBPressureGauge.Value");
            m_RtDataKeys.Add($"TM.LoadlockForelineGauge.Value");
            m_RtDataKeys.Add($"TM.PumpIsRunning");
            m_RtDataKeys.Add($"LL.PumpIsRunning");
            m_RtDataKeys.Add("PMA.IsSlitDoorClosed");
            m_RtDataKeys.Add("PMB.IsSlitDoorClosed");
            m_RtDataKeys.Add("PMC.IsSlitDoorClosed");
            m_RtDataKeys.Add("PMD.IsSlitDoorClosed");

            m_RtDataKeys.Add("TM.LLATSlitDoor.IsClosed");
            m_RtDataKeys.Add("TM.LLBTSlitDoor.IsClosed");
            m_RtDataKeys.Add("TM.LLAESlitDoor.IsClosed");
            m_RtDataKeys.Add("TM.LLBESlitDoor.IsClosed");
            m_RtDataKeys.Add("TM.N2PressureSwitch.Value");
            m_RtDataKeys.Add("TM.TMPressureCtrl.TMChamberSetPoint");
            m_RtDataKeys.Add("LLA.IsOnline");
            m_RtDataKeys.Add("LLB.IsOnline");
            m_RtDataKeys.Add("TM.IsOnline");
            m_RtDataKeys.Add("TM.FsmState");
            m_RtDataKeys.Add("LLA.FsmState");
            m_RtDataKeys.Add("LLB.FsmState");

            m_RtDataKeys.Add("TM.Home.StepNo");


        }
        #endregion
    }
}