Exemplo n.º 1
0
 private void StopTimer(eTimeout e)
 {
     try
     {
         lock (this.syncTimeout)
         {
             if (this.otherTimerDict.ContainsKey(e))
             {
                 this.otherTimerDict.Remove(e);
             }
         }
         this.logger.Debug(string.Format("Timer::StopTimer {0}", e));
     }
     catch (Exception exception)
     {
         this.logger.Error("Timer::StopTimer", exception);
     }
 }
Exemplo n.º 2
0
 internal void StopTimer(eTimeout e)
 {
     if (e == eTimeout.T1)
     {
         this.timer.StopT1Timer();
         return;
     }
     if (e == eTimeout.T2)
     {
         this.timer.StopT2Timer();
         return;
     }
     if (e != eTimeout.T4)
     {
         throw new ArgumentException(string.Format("Only Support T1, T2, T4 Timer, but now Timer is {0}", e));
     }
     this.timer.StopT4Timer();
 }
Exemplo n.º 3
0
 private void StopTimer(eTimeout e)
 {
     try
     {
         lock (this.syncTimeout)
         {
             if (this.mOtherTimers.ContainsKey(e))
             {
                 this.mOtherTimers.Remove(e);
             }
         }
         if (e != eTimeout.T1)
         {
             this.logger.Debug(string.Format("Stop {0} Timer", e));
         }
     }
     catch (Exception exception)
     {
         this.logger.Error("HSMSTimer::StopTimer ", exception);
     }
 }
Exemplo n.º 4
0
 private void StartTimer(eTimeout e)
 {
     try
     {
         lock (this.syncTimeout)
         {
             HSMSTimer.CheckTimerPara para = new HSMSTimer.CheckTimerPara
             {
                 SystemBytes = (long)e,
                 msg         = null,
                 StartTime   = DateTime.Now
             };
             this.otherTimerDict.Add(e, para);
         }
         this.logger.Debug(string.Format("Timer::StartTimer {0}", e));
     }
     catch (Exception exception)
     {
         this.logger.Error("Timer::StartTimer ", exception);
     }
 }
Exemplo n.º 5
0
 private void CheckOtherTimeout()
 {
     try
     {
         List <eTimeout> list = new List <eTimeout>();
         foreach (eTimeout timeout in this.otherTimerDict.Keys)
         {
             list.Add(timeout);
         }
         for (int i = 0; i < list.Count; i++)
         {
             DateTime now                  = DateTime.Now;
             eTimeout timeout2             = list[i];
             HSMSTimer.CheckTimerPara para = this.otherTimerDict[timeout2];
             double num2 = (now - para.StartTime).TotalMilliseconds / 1000.0;
             if ((timeout2 == eTimeout.T6 && num2 > (double)this.t6Interval) || (timeout2 == eTimeout.T7 && num2 > (double)this.t7Interval) || (timeout2 == eTimeout.T8 && num2 > (double)this.t8Interval) || (timeout2 == eTimeout.LinkTest && num2 > (double)this.linkTestInterval))
             {
                 this.logger.Debug(string.Format("HSMSTimer::CheckOtherTimeout: {0}, {1}", num2, timeout2));
                 this.otherTimerDict.Remove(timeout2);
                 TimerPara para2 = new TimerPara
                 {
                     Type = timeout2,
                     Msg  = null
                 };
                 this.timeoutQueue.Enqueue(para2);
             }
             else if (timeout2 != eTimeout.T6 && timeout2 != eTimeout.T7 && timeout2 != eTimeout.T8 && timeout2 != eTimeout.LinkTest)
             {
                 this.logger.Debug(string.Format("CheckOtherTimeout: {0}-{1}", timeout2, num2));
             }
         }
     }
     catch (Exception exception)
     {
         this.logger.Error("CheckOtherTimeout: ", exception);
     }
 }
Exemplo n.º 6
0
 private void CheckOtherTimeout()
 {
     try
     {
         List <eTimeout> list = new List <eTimeout>();
         foreach (eTimeout timeout in this.mOtherTimers.Keys)
         {
             list.Add(timeout);
         }
         for (int i = 0; i < list.Count; i++)
         {
             DateTime now      = DateTime.Now;
             eTimeout timeout2 = list[i];
             double   num2     = (now - this.mOtherTimers[timeout2].StartTime).TotalMilliseconds / 1000.0;
             if ((timeout2 == eTimeout.T1 && num2 > this.mT1Interval) || (timeout2 == eTimeout.T2 && num2 > this.mT2Interval) || (timeout2 == eTimeout.T4 && num2 > (double)this.mT3Interval))
             {
                 this.logger.Debug(string.Format("SECS1Timer::CheckOtherTimeout: {0}, {1}", num2, timeout2));
                 this.mOtherTimers.Remove(timeout2);
                 TimerPara para2 = new TimerPara
                 {
                     Type = timeout2,
                     Msg  = null
                 };
                 this.mTimeoutQueue.Enqueue(para2);
             }
             else if (timeout2 != eTimeout.T1 && timeout2 != eTimeout.T2 && timeout2 != eTimeout.T4)
             {
                 this.logger.Debug(string.Format("CheckOtherTimeout: {0}-{1}", timeout2, num2));
             }
         }
     }
     catch (Exception exception)
     {
         this.logger.Error("CheckOtherTimeout: ", exception);
     }
 }
Exemplo n.º 7
0
 private void StartTimer(eTimeout e)
 {
     try
     {
         lock (this.syncTimeout)
         {
             SECS1Timer.CheckTimerPara para = new SECS1Timer.CheckTimerPara
             {
                 SystemBytes = (long)e,
                 msg         = null,
                 StartTime   = DateTime.Now
             };
             this.mOtherTimers.Add(e, para);
         }
         if (e != eTimeout.T1)
         {
             this.logger.Debug(string.Format("Start {0} Timer", e));
         }
     }
     catch (Exception exception)
     {
         this.logger.Error("HSMSTimer::StartTimer ", exception);
     }
 }
Exemplo n.º 8
0
        private void OnTimeout(TimerPara aPara)
        {
            try
            {
                if (aPara.Msg != null && this.mNeedReplyMsg.ContainsKey(aPara.Msg.SystemBytes))
                {
                    lock (this.syncNeedReplyObject)
                    {
                        this.mNeedReplyMsg.Remove(aPara.Msg.SystemBytes);
                    }
                }
                eTimeout type = aPara.Type;
                if (type != eTimeout.LinkTest)
                {
                    switch (type)
                    {
                    case eTimeout.T8:
                        if (this.OnHSMSEvent != null)
                        {
                            this.OnHSMSEvent(SECSEventType.Error, null, SECSErrors.T8TimeOut, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.T8TimeOut));
                        }
                        this.OnDisconnect(SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.T8TimeOut));
                        break;

                    case eTimeout.T7:
                        if (this.OnHSMSEvent != null)
                        {
                            this.OnHSMSEvent(SECSEventType.Error, null, SECSErrors.T7TimeOut, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.T7TimeOut));
                        }
                        this.OnDisconnect(SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.T7TimeOut));
                        break;

                    case eTimeout.T6:
                        if (this.OnHSMSEvent != null)
                        {
                            this.OnHSMSEvent(SECSEventType.Error, null, SECSErrors.T6TimeOut, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.T6TimeOut));
                        }
                        this.OnDisconnect(SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.T6TimeOut));
                        break;

                    case eTimeout.T5:
                        if (this.OnHSMSEvent != null)
                        {
                            this.OnHSMSEvent(SECSEventType.Error, null, SECSErrors.T5TimeOut, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.T5TimeOut));
                        }
                        break;

                    case eTimeout.T3:
                        if (this.OnHSMSEvent != null)
                        {
                            SECSTransaction trans = aPara.Msg.Transaction;
                            trans.Secondary = null;
                            this.OnHSMSEvent(SECSEventType.Error, trans, SECSErrors.T3TimeOut, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.T3TimeOut));
                        }
                        break;
                    }
                }
                else
                {
                    long ctrlSystemBytes = this.GetCtrlSystemBytes();
                    this.mHsmsWriter.WriteControlMessage(ctrlSystemBytes, 0, eControlMessage.LINKTEST_REQ, 255, 255);
                    this.mHsmsTimer.StartLinkTestTimer();
                }
            }
            catch (Exception exception)
            {
                this.logger.Debug("Port#OnTimeout", exception);
            }
        }