コード例 #1
0
 internal override void LineTimeoutReceived(object sender, NamedPortEventArgs e)
 {
     foreach (VaiTcpIpClient client in clients)
     {
         if (string.Compare(client.RemoteSocketName, e.PortLongName, false) == 0)
         {
             lock (clientsToBeRemovedLock)
             {
                 SimpleFileWriter.WriteLineToEventFile(DirectoryName.Diag, "Client in timeout:" + e.PortLongName);
                 MarkClientToBeRemoved(client);
                 break;
             }
         }
     }
 }
コード例 #2
0
        internal static void RaiseTextReceived(INamedPort ivp, string messageText)
        {
            int test = 0;

            try
            {
                test = 1;
                var e = new NamedPortEventArgs(NamedPortEventArgs.PortEventType.TextReceived, messageText, ivp);
                test++;
                if (VirtualPortEvent != null)
                {
                    test = 10;
                    VirtualPortEvent(ivp, e);
                    test = 11;
                }
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException("RaiseTextReceived:" + test + ">", ex);
            }
        }
コード例 #3
0
        internal protected void PortEventReceived(object sender, NamedPortEventArgs e)
        {
            try
            {
                if (e == null || IpAndPort == cDefaultIpAndPort)
                {
                    return;
                }

                string eventLocalPort = (e.Port != null ? e.Port.RemoteSocketName : "Null port");

                if (eventLocalPort != IpAndPort)
                {
                    return;
                }

                var eventType = e.PortEvent;
                if (eventType == NamedPortEventArgs.PortEventType.TextReceived)
                {
                    parserAssistant.PlainTextReceived(e.Text, e.Port);
                }
                else if (eventType == NamedPortEventArgs.PortEventType.DataWithEndCharReceived)
                {
                    parserAssistant.DataReceived(e.Text, e.Port);
                }
                else if (eventType == NamedPortEventArgs.PortEventType.LineIdleTimeout)
                {
                    LineTimeoutReceived(sender, e);
                }

                //else if (e.GetPortEventType == VirtualPortEventArgs.PortEventType.ModemEvent)
                //    ModemEventReceived(e);
            }
            catch (Exception ex)
            {
                ExceptionHandler.HandleException(ex, "PortEventReceived");
            }
        }
コード例 #4
0
        internal static void RaiseTextWithEndCharReceived(INamedPort ivp, string messageText)
        {
            var e = new NamedPortEventArgs(NamedPortEventArgs.PortEventType.DataWithEndCharReceived, messageText, ivp);

            VirtualPortEvent?.Invoke(ivp, e);
        }
コード例 #5
0
        internal static void RaiseByteReceivedEvent(INamedPort ivp, byte messageBytes)
        {
            var e = new NamedPortEventArgs(NamedPortEventArgs.PortEventType.ByteReceived, messageBytes, ivp);

            VirtualPortEvent?.Invoke(ivp, e);
        }
コード例 #6
0
        internal static void RaiseDialUpModemEvent(INamedPort port, string text)
        {
            var e = new NamedPortEventArgs(NamedPortEventArgs.PortEventType.ModemEvent, text, port);

            VirtualPortEvent?.Invoke(port, e);
        }
コード例 #7
0
        internal static void RaiseLineTimeoutEvent(INamedPort ivp)
        {
            var e = new NamedPortEventArgs(NamedPortEventArgs.PortEventType.LineIdleTimeout, ivp);

            VirtualPortEvent?.Invoke(ivp, e);
        }
コード例 #8
0
 internal abstract void LineTimeoutReceived(object sender, NamedPortEventArgs e);