Beispiel #1
0
        public override SECSTransaction FindTransaction(string name)
        {
            string          str         = name.Substring(1, name.IndexOf("F") - 1);
            string          str2        = name.Substring(name.IndexOf("F") + 1);
            int             num         = int.Parse(str);
            int             num2        = int.Parse(str2);
            SECSTransaction transaction = new SECSTransaction();

            foreach (SECSMessage message in this.list)
            {
                if (message.Stream == num && message.Function == num2)
                {
                    transaction.Primary = (message.Clone() as SECSMessage);
                    break;
                }
            }
            foreach (SECSMessage message2 in this.list)
            {
                if (message2.Stream == num && message2.Function == num2 + 1)
                {
                    transaction.Secondary = (message2.Clone() as SECSMessage);
                    return(transaction);
                }
            }
            return(transaction);
        }
Beispiel #2
0
 private void HandleWriteError(SECSEventType type, SECSTransaction t, string errmsg)
 {
     if (this.OnHSMSEvent != null)
     {
         this.OnHSMSEvent(SECSEventType.Error, t, SECSErrors.WriteError, string.Format("{0} {1}", type.ToString(), errmsg));
     }
 }
Beispiel #3
0
 private void eventExecutor_OnSECS1Event(SECSEventType eventtype, SECSTransaction trans, SECSErrors err, string errmsg)
 {
     if (this.OnSECS1Event != null)
     {
         this.OnSECS1Event(eventtype, trans, err, errmsg);
     }
 }
Beispiel #4
0
 private void OnSocketWriteComplete(bool IsReply, SECSMessage msg)
 {
     try
     {
         SECSTransaction trans = msg.Transaction;
         if (this.OnHSMSEvent != null)
         {
             if (IsReply)
             {
                 this.OnHSMSEvent(SECSEventType.SecondarySent, trans, SECSErrors.None, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.None));
             }
             else
             {
                 trans.DeviceID    = msg.DeviceIdID;
                 trans.SystemBytes = msg.SystemBytes;
                 trans.ExpectReply = msg.WBit;
                 this.OnHSMSEvent(SECSEventType.PrimarySent, trans, SECSErrors.None, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.None));
             }
         }
     }
     catch (Exception exception)
     {
         this.logger.Error("Port#Sending Error", exception);
     }
 }
Beispiel #5
0
 public override bool Load(string filename)
 {
     this.xmlDoc = null;
     try
     {
         this.xmlDoc = XDocument.Load(filename);
         XElement element = this.xmlDoc.Element("Library");
         if (element == null)
         {
             bool result = false;
             return(result);
         }
         this.transdic.Clear();
         base.Name        = (string)element.Element("Name");
         base.Description = (string)element.Element("Description");
         foreach (XElement element2 in element.Elements("Transaction"))
         {
             SECSTransaction trans = this.XElementToTrans(element2);
             this.AddTransaction(trans);
         }
     }
     catch (Exception)
     {
         bool result = false;
         return(result);
     }
     return(true);
 }
Beispiel #6
0
 public override void AddTransaction(SECSTransaction trans)
 {
     if (trans != null)
     {
         if (this.transdic.ContainsKey(trans.Name))
         {
             trans.Name += "New";
             if (this.transdic.ContainsKey(trans.Name))
             {
                 int num = 1;
                 while (this.transdic.ContainsKey(trans.Name + num))
                 {
                     num++;
                 }
                 trans.Name += num;
                 this.transdic.Add(trans.Name, trans);
                 return;
             }
             this.transdic.Add(trans.Name, trans);
             return;
         }
         else
         {
             this.transdic.Add(trans.Name, trans);
         }
     }
 }
Beispiel #7
0
 public void Send(SECSTransaction trans)
 {
     if (trans.Primary != null)
     {
         trans.Primary.Transaction = trans;
     }
     if (trans.Secondary != null)
     {
         trans.Secondary.Transaction = trans;
     }
     if (this.porttype != eSECS_PORT_TYPE.HSMS)
     {
         this.secs1Port.SendMessage(trans.Primary);
         return;
     }
     if (!this.PortIsOpen)
     {
         this.CallSECSEvent(SECSEventType.PrimarySent, trans, SECSErrors.PortNotOpen, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.PortNotOpen));
         return;
     }
     if (!this.Connected)
     {
         this.CallSECSEvent(SECSEventType.PrimarySent, trans, SECSErrors.PortNotConnected, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.PortNotConnected));
         return;
     }
     this.hsmsPort.SendMessages(trans.Primary);
 }
Beispiel #8
0
 private void Secs1Port_OnSECS1Event(SECSEventType eventtype, SECSTransaction trans, SECSErrors err, string errmsg)
 {
     if (this.s9FxMonitor.PreHandleSECSEvent(eventtype, trans, err))
     {
         this.CallSECSEvent(eventtype, trans, err, errmsg);
     }
 }
Beispiel #9
0
 private void RemoveConversationTimeout(SECSEventType eventtype, SECSTransaction trans, SECSErrors err)
 {
     if (eventtype == SECSEventType.PrimaryRcvd && trans != null && trans.Primary != null && err == SECSErrors.None)
     {
         string str = string.Format("S{0}F{1}", trans.Primary.Stream, trans.Primary.Function);
         if (this.conversactionReflect.ContainsKey(str))
         {
             lock (this.syncConversation)
             {
                 int num = -1;
                 for (int i = 0; i < this.conversationList.Count; i++)
                 {
                     if (this.conversationList[i].Transaction1 == this.conversactionReflect[str])
                     {
                         num = i;
                         break;
                     }
                 }
                 if (num != -1)
                 {
                     this.conversationList.RemoveAt(num);
                 }
             }
         }
     }
 }
Beispiel #10
0
 public void WriteSendMessage(SECSMessage msg)
 {
     if (msg == null)
     {
         this.logger.Error("WriteSendMessage msg == null");
         return;
     }
     byte[] bs = null;
     try
     {
         bs = new SECSEncoding(msg).GetEncodingData((int)msg.DeviceIdID, msg.WBit, msg.SystemBytes);
         if (bs.Length > 0 && msg.WBit)
         {
             this.mHsmsTimer.StartT3Timer(msg);
             this.logger.Debug(string.Format("WriteSendMessage: StartT3Timer {0}", msg.SystemBytes));
         }
     }
     catch (Exception exception)
     {
         this.logger.Error("WriteSendMessage: encoder", exception);
         SECSTransaction t = msg.Transaction;
         if (this.OnWriteError != null)
         {
             this.OnWriteError(SECSEventType.PrimarySent, t, string.Format("{0}: Invalid SECS Message Format or Data.", SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.WriteError)));
         }
     }
     if (bs != null && bs.Length > 0)
     {
         try
         {
             this.writer.Write(bs);
             this.writer.Flush();
             //this.logger.Info(string.Format("[SEND] S{0}F{1} {2} SystemBytes={3}\n{4}", new object[]
             //{
             //    msg.Stream,
             //    msg.Function,
             //    msg.WBit ? "W" : "",
             //    msg.SystemBytes,
             //    ByteStringBuilder.ToLogString(bs)
             //}));
             //this.logger.Warn("[SEND] " + SecsItem2Str.GetSecsMessageStr(msg));
             if (this.OnWriteCompleted != null)
             {
                 this.OnWriteCompleted(false, msg);
             }
         }
         catch (Exception exception2)
         {
             this.logger.Error("WriteSendMessage", exception2);
             SECSTransaction transaction = msg.Transaction;
             if (this.OnWriteError != null)
             {
                 this.OnWriteError(SECSEventType.PrimarySent, transaction, string.Format("{0}: Socket Error.", SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.WriteError)));
             }
             this.FireDisconnect(exception2.Message);
         }
     }
 }
Beispiel #11
0
 private void HandleRcvdSecondaryMessage(SECSMessage rcvd, SECSMessage sent)
 {
     if (this.OnHSMSEvent != null)
     {
         SECSTransaction trans = sent.Transaction;
         trans.Secondary = rcvd;
         this.OnHSMSEvent(SECSEventType.SecondaryRcvd, trans, SECSErrors.None, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.None));
     }
 }
Beispiel #12
0
        private void HandleRcvdAbortMessage(SECSMessage sent, SECSMessage rcvd)
        {
            SECSTransaction trans = sent.Transaction;

            trans.Secondary = rcvd;
            if (this.OnHSMSEvent != null)
            {
                this.OnHSMSEvent(SECSEventType.Error, trans, SECSErrors.RcvdAbortMessage, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.RcvdAbortMessage));
            }
        }
Beispiel #13
0
 internal void CallSECSEvent(SECSEventType type, SECSTransaction trans, SECSErrors err, string errmsg)
 {
     if (type == SECSEventType.Error || type == SECSEventType.Warn)
     {
         this.logger.Error(string.Format("SystemBytes: {0}, ERRCODE: {1}, ERRDESC: {2}.", (trans != null) ? trans.SystemBytes.ToString() : "null", err, errmsg));
     }
     if (this.OnSECSEvent != null)
     {
         this.OnSECSEvent(this, type, trans, err, errmsg);
     }
 }
Beispiel #14
0
 private void UpdateMatchedSecondary(SECSEventType eventtype, SECSTransaction trans)
 {
     if (eventtype == SECSEventType.PrimaryRcvd && trans != null && trans.Primary != null && this.secsPort.Library != null && trans.Primary.WBit)
     {
         SECSTransaction transaction = this.secsPort.Library.FindTransaction(string.Format("S{0}F{1}", trans.Primary.Stream, trans.Primary.Function));
         if (transaction != null)
         {
             trans.Secondary = transaction.Secondary;
         }
     }
 }
Beispiel #15
0
 private void AddConversationTimeout(SECSEventType eventtype, SECSTransaction trans, SECSErrors err)
 {
     if (eventtype == SECSEventType.SecondarySent && err == SECSErrors.None && trans != null && trans.Secondary != null)
     {
         string str = string.Format("S{0}F{1}", trans.Secondary.Stream, trans.Secondary.Function);
         if (this.conversactionConfigure.ContainsKey(str))
         {
             if (str == "S3F12")
             {
                 if (trans.Secondary.Root.Item(2).IsEmpty)
                 {
                     return;
                 }
                 if ((int)trans.Secondary.Root.Item(2).Value != 2)
                 {
                     return;
                 }
             }
             else
             {
                 if (trans.Secondary.Root.IsEmpty)
                 {
                     return;
                 }
                 if ((int)trans.Secondary.Root.Value != 0)
                 {
                     return;
                 }
             }
             SECSS9FxMonitor.ConversactionItem item = new SECSS9FxMonitor.ConversactionItem
             {
                 Transaction1 = this.conversactionConfigure[str].Transaction1,
                 Transaction2 = this.conversactionConfigure[str].Transaction2,
                 Transaction  = trans
             };
             try
             {
                 item.EDID = trans.Primary.Root.Item(1).Value.ToString();
                 item.EDID = this.conversactionConfigure[str].EDID + ": " + item.EDID;
             }
             catch (Exception)
             {
                 item.EDID = this.conversactionConfigure[str].EDID;
             }
             lock (this.syncConversation)
             {
                 item.DeadLine = DateTime.Now.AddSeconds(45.0);
                 this.conversationList.Add(item);
             }
         }
     }
 }
Beispiel #16
0
        private void HandleRcvdUnknownMessage(SECSMessage rcvd)
        {
            SECSTransaction trans = new SECSTransaction
            {
                Primary   = null,
                Secondary = rcvd
            };

            if (this.OnHSMSEvent != null)
            {
                this.OnHSMSEvent(SECSEventType.Error, trans, SECSErrors.RcvdUnknownMessage, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.RcvdUnknownMessage));
            }
        }
Beispiel #17
0
        private static SECSTransaction DeepCopy(SECSTransaction trans)
        {
            object obj2;

            using (MemoryStream stream = new MemoryStream())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                formatter.Serialize(stream, trans);
                stream.Seek(0L, SeekOrigin.Begin);
                obj2 = formatter.Deserialize(stream);
            }
            return((SECSTransaction)obj2);
        }
Beispiel #18
0
        public void ReplyAsync(SECSTransaction t, XElement xmlSecondaryMessage)
        {
            SECSMessage message = new SECSMessage
            {
                Stream      = t.Primary.Stream,
                Function    = t.Primary.Function + 1,
                SystemBytes = t.Primary.SystemBytes,
                DeviceIdID  = t.DeviceID,
                Root        = this.Library.XElementToSECSItem(xmlSecondaryMessage)
            };

            t.Secondary = message;
            this.Reply(t);
        }
Beispiel #19
0
        public void SendAsync(string transName, XElement xmlPrimaryMessage)
        {
            SECSTransaction trans = this.Library.FindTransaction(transName);

            if (trans == null)
            {
                throw new ArgumentException(string.Format("Transaction {0} Not Found in AbstractSECSLibrary.", transName));
            }
            trans.Name         = transName;
            trans.Primary.Root = null;
            trans.Primary.Root = this.Library.XElementToSECSItem(xmlPrimaryMessage);
            trans.Secondary    = null;
            this.Send(trans);
        }
 internal void NotifyEVENT(SECSEventType type, SECSTransaction trans, SECSErrors err)
 {
     lock (this.syncObject)
     {
         SECS1EventArgs args = new SECS1EventArgs
         {
             EventType = type,
             ErrorCode = err,
             ErrorMsg  = SECSErrorsMessage.GetSECSErrorMessage(err),
             Trans     = trans
         };
         this.eventQueue.Enqueue(args);
     }
 }
Beispiel #21
0
 private void HandleRcvdPrimaryMessage(SECSMessage rcvd)
 {
     if (this.OnHSMSEvent != null)
     {
         SECSTransaction trans = new SECSTransaction
         {
             Primary     = rcvd,
             SystemBytes = rcvd.SystemBytes,
             Secondary   = null,
             ExpectReply = rcvd.WBit,
             DeviceID    = rcvd.DeviceIdID
         };
         this.OnHSMSEvent(SECSEventType.PrimaryRcvd, trans, SECSErrors.None, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.None));
     }
 }
Beispiel #22
0
 private void HsmsPort_OnHSMSEvent(SECSEventType eventtype, SECSTransaction trans, SECSErrors err, string errmsg)
 {
     if (eventtype == SECSEventType.HSMSConnected)
     {
         this.isConnected = true;
     }
     else if (eventtype == SECSEventType.HSMSDisconnected)
     {
         this.isConnected = false;
     }
     if (this.s9FxMonitor.PreHandleSECSEvent(eventtype, trans, err))
     {
         this.CallSECSEvent(eventtype, trans, err, errmsg);
     }
 }
Beispiel #23
0
 private bool CheckS9F1Exception(SECSEventType eventtype, SECSTransaction trans)
 {
     if (eventtype == SECSEventType.PrimaryRcvd && trans != null && trans.Primary != null && trans.Primary.DeviceIdID != this.secsPort.DeviceID)
     {
         this.SendS9Fx(1, trans.Primary.Header);
         this.secsPort.CallSECSEvent(SECSEventType.Error, trans, SECSErrors.UnrecognizedDeviceID, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.UnrecognizedDeviceID));
         return(false);
     }
     if (eventtype == SECSEventType.SecondaryRcvd && trans != null && trans.Secondary != null && trans.Secondary.DeviceIdID != this.secsPort.DeviceID)
     {
         this.SendS9Fx(1, trans.Secondary.Header);
         this.secsPort.CallSECSEvent(SECSEventType.Error, trans, SECSErrors.UnrecognizedDeviceID, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.UnrecognizedDeviceID));
         return(false);
     }
     return(true);
 }
Beispiel #24
0
        public override XElement TransToXElement(SECSTransaction trans)
        {
            if (trans == null)
            {
                return(null);
            }
            XElement element = new XElement("Transaction");

            element.Add(new XElement("Name", new XText(trans.Name)));
            element.Add(new XElement("Description", new XText(trans.Description)));
            element.Add(new XElement("ReplyExpected", new XText(trans.ExpectReply.ToString())));
            if (trans.Primary != null)
            {
                element.Add(new XElement("Stream", new XText(trans.Primary.Stream.ToString(CultureInfo.InvariantCulture))));
                element.Add(new XElement("Function", new XText(trans.Primary.Function.ToString(CultureInfo.InvariantCulture))));
            }
            else if (trans.Secondary != null)
            {
                element.Add(new XElement("Stream", new XText(trans.Secondary.Stream.ToString(CultureInfo.InvariantCulture))));
                element.Add(new XElement("Function", new XText(trans.Secondary.Function.ToString(CultureInfo.InvariantCulture))));
            }
            if (trans.Primary != null)
            {
                XElement element2 = new XElement("Primary");
                element.Add(element2);
                if (trans.Primary.Root != null)
                {
                    XElement element3 = this.SECSItemToXElement(trans.Primary.Root);
                    element2.Add(element3);
                }
            }
            if (trans.Secondary != null)
            {
                XElement element4 = new XElement("Secondary");
                element.Add(element4);
                if (trans.Primary != null && (trans.Primary == null || trans.Primary.Function == 0))
                {
                    return(element);
                }
                if (trans.Secondary.Root != null)
                {
                    XElement element5 = this.SECSItemToXElement(trans.Secondary.Root);
                    element4.Add(element5);
                }
            }
            return(element);
        }
Beispiel #25
0
        private void SendS9Fx(int aFx, byte[] hdr)
        {
            SECSTransaction trans   = new SECSTransaction();
            SECSMessage     message = new SECSMessage();

            trans.Primary       = message;
            message.Transaction = trans;
            message.DeviceIdID  = this.secsPort.DeviceID;
            message.Stream      = 9;
            message.Function    = aFx;
            message.WBit        = false;
            trans.DeviceID      = message.DeviceIdID;
            trans.ExpectReply   = message.WBit;
            SECSItem item = (aFx == 9) ? new SECSItem(eSECS_FORMAT.BINARY, "SHEAD") : new SECSItem(eSECS_FORMAT.BINARY, "MHEAD");

            item.Value   = hdr;
            message.Root = item;
            this.secsPort.Send(trans);
        }
Beispiel #26
0
        public override void Save(string filename)
        {
            this.xmlDoc = null;
            this.xmlDoc = new XDocument();
            XElement element = new XElement("Library");

            this.xmlDoc.AddFirst(element);
            element.Add(new XElement("Name", new XText(base.Name)));
            element.Add(new XElement("Description", new XText(base.Description)));
            foreach (KeyValuePair <string, SECSTransaction> pair in this.transdic)
            {
                SECSTransaction trans    = pair.Value;
                XElement        element2 = this.TransToXElement(trans);
                if (element2 != null)
                {
                    element.Add(element2);
                }
            }
            this.xmlDoc.Save(filename);
        }
Beispiel #27
0
        private void CheckConversationTimeout()
        {
            List <int> list = new List <int>();

            for (int i = 0; i < this.conversationList.Count; i++)
            {
                if (this.conversationList[i].DeadLine < DateTime.Now)
                {
                    list.Add(i);
                }
            }
            foreach (int num2 in list)
            {
                SECSS9FxMonitor.ConversactionItem item = this.conversationList[num2];
                this.conversationList.RemoveAt(num2);
                SECSTransaction trans = this.secsPort.Library.FindTransaction("S9F13");
                trans.Primary.Root.Item(1).Value = item.Transaction2Str;
                trans.Primary.Root.Item(2).Value = item.EDID;
                this.secsPort.Send(trans);
                this.secsPort.CallSECSEvent(SECSEventType.Error, item.Transaction, SECSErrors.ConversationTimeout, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.ConversationTimeout));
            }
        }
Beispiel #28
0
 public bool PreHandleSECSEvent(SECSEventType eventtype, SECSTransaction trans, SECSErrors err)
 {
     this.UpdateMatchedSecondary(eventtype, trans);
     if (!this.IsHost)
     {
         if (!this.CheckS9F1Exception(eventtype, trans))
         {
             return(false);
         }
         if (!this.CheckS9F357Exception(eventtype, trans))
         {
             return(false);
         }
         if (eventtype == SECSEventType.Error && err == SECSErrors.T3TimeOut)
         {
             this.SendS9Fx(9, trans.Primary.Header);
             return(true);
         }
         this.AddConversationTimeout(eventtype, trans, err);
         this.RemoveConversationTimeout(eventtype, trans, err);
     }
     return(true);
 }
Beispiel #29
0
        private bool CheckS9F357Exception(SECSEventType eventtype, SECSTransaction trans)
        {
            SECSMessage msg = null;

            if (eventtype == SECSEventType.PrimaryRcvd)
            {
                msg = trans.Primary;
            }
            else if (eventtype == SECSEventType.SecondaryRcvd)
            {
                msg = trans.Secondary;
            }
            if (this.secsPort.Library != null && msg != null)
            {
                if (!this.secsPort.Library.FindStream(msg.Stream))
                {
                    this.SendS9Fx(3, msg.Header);
                    this.secsPort.CallSECSEvent(SECSEventType.Error, trans, SECSErrors.UnrecognizedStreamType, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.UnrecognizedStreamType));
                    return(false);
                }
                if (!this.secsPort.Library.FindFunction(msg.Stream, msg.Function))
                {
                    this.SendS9Fx(5, msg.Header);
                    this.secsPort.CallSECSEvent(SECSEventType.Error, trans, SECSErrors.UnrecognizedFunctionType, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.UnrecognizedFunctionType));
                    return(false);
                }
                List <SECSMessage> list = this.secsPort.Library.FindMessage(msg.Stream, msg.Function);
                if (!this.CheckMsgFormat(msg, list))
                {
                    this.SendS9Fx(7, msg.Header);
                    this.secsPort.CallSECSEvent(SECSEventType.Error, trans, SECSErrors.IllegalData, SECSErrorsMessage.GetSECSErrorMessage(SECSErrors.IllegalData));
                    return(false);
                }
            }
            return(true);
        }
Beispiel #30
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);
            }
        }