Ejemplo n.º 1
0
        public void OpenPort()
        {
            SECSLogManager.Instance.CreateNewLogger(this.logConfig);
            this.logger = LogManager.GetLogger("SECSwell", this.Name);
            this.logger.Debug(string.Format("Start to Open the {0} SECS Port", this.Name));
            SECSS9FxMonitor monitor = new SECSS9FxMonitor(this)
            {
                Logger = this.logger
            };

            this.s9FxMonitor = monitor;
            this.s9FxMonitor.Start();
            if (this.porttype == eSECS_PORT_TYPE.HSMS)
            {
                this.hsmsPort.Name         = this.Name;
                this.hsmsPara.DeviceID     = this.deviceId;
                this.hsmsPort.HsmsPara     = this.hsmsPara;
                this.hsmsPort.OnHSMSEvent += new HSMSPort.HSMSEventHandler(this.HsmsPort_OnHSMSEvent);
                this.hsmsPort.Logger       = this.logger;
                this.hsmsPort.Initialize();
                this.isOpen = true;
            }
            else
            {
                this.secs1Port.Name          = this.Name;
                this.secs1Para.DeviceID      = this.deviceId;
                this.secs1Port.SECS1Para     = this.secs1Para;
                this.secs1Port.OnSECS1Event += new SECS1Port.SECS1EventHandler(this.Secs1Port_OnSECS1Event);
                this.secs1Port.Logger        = this.logger;
                this.secs1Port.Initialize();
            }
            this.logger.Debug(string.Format("Completely Open the {0} SECS Port", this.Name));
        }
Ejemplo n.º 2
0
 public void ClosePort()
 {
     this.logger.Debug(string.Format("Start to Close the {0} SECS Port", this.Name));
     if (this.porttype == eSECS_PORT_TYPE.HSMS)
     {
         this.hsmsPort.OnHSMSEvent -= new HSMSPort.HSMSEventHandler(this.HsmsPort_OnHSMSEvent);
         this.hsmsPort.Terminate();
         this.isOpen = false;
     }
     else
     {
         this.secs1Port.OnSECS1Event -= new SECS1Port.SECS1EventHandler(this.Secs1Port_OnSECS1Event);
         this.secs1Port.Terminate();
     }
     if (this.s9FxMonitor != null)
     {
         this.s9FxMonitor.Stop();
         this.s9FxMonitor = null;
     }
     this.logger.Debug(string.Format("Completely Close the {0} SECS Port", this.Name));
 }