protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
 {
     if (reason != StopReason.UserReconnect)
     {
         Stop(reason);
     }
 }
Exemplo n.º 2
0
        protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
        {
            switch (reason)
            {
            case StopReason.UnavailableError:
                IgnoreNode(connection.SourceUri);
                Reconnect(SelectSourceHost());
                break;

            case StopReason.ConnectionError:
            case StopReason.OffAir:
                if (connection.SourceUri == this.SourceUri)
                {
                    Stop(reason);
                }
                else
                {
                    IgnoreNode(connection.SourceUri);
                    Reconnect(SelectSourceHost());
                }
                break;

            case StopReason.UserReconnect:
                break;

            case StopReason.UserShutdown:
            default:
                Stop(reason);
                break;
            }
        }
Exemplo n.º 3
0
        protected void StartConnection(Uri source_uri)
        {
            if (sourceConnection != null)
            {
                StopConnection(StopReason.UserReconnect);
            }
            var conn = CreateConnection(source_uri);

            sourceConnection     = conn;
            sourceConnectionTask = sourceConnection
                                   .Run()
                                   .ContinueWith(prev => {
                if (prev.IsFaulted)
                {
                    Queue(() => { OnConnectionStopped(conn, StopReason.NotIdentifiedError); });
                }
                else if (prev.IsCanceled)
                {
                    Queue(() => { OnConnectionStopped(conn, StopReason.UserShutdown); });
                }
                else
                {
                    Queue(() => { OnConnectionStopped(conn, prev.Result); });
                }
            });
        }
Exemplo n.º 4
0
        protected override void OnConnectionStopped(ISourceConnection connection, ConnectionStoppedArgs args)
        {
            switch (args.Reason)
            {
            case StopReason.UserReconnect:
            case StopReason.UserShutdown:
                break;

            default:
                args.Delay     = 3000;
                args.Reconnect = true;
                break;
            }
        }
Exemplo n.º 5
0
        public Telegram(TelegramDefinition def, ref ISourceConnection source)
        {
            InitializeComponent();
            dataSource     = source;
            telegramDef    = def;
            itemControls   = new Dictionary <string, IValueControl>();
            itemDefs       = new Dictionary <string, LibTelcom.TelegramItem>();
            groupBox1.Text = def.TelegramName + " (" + def.Description + ")";

            foreach (LibTelcom.TelegramItem item in def.TelegramItems)
            {
                addItem(item);
            }
        }
Exemplo n.º 6
0
 protected void StartConnection(Uri source_uri)
 {
     if (sourceConnection != null)
     {
         sourceConnection.Stopped -= OnSourceConnectionStopped;
         StopConnection(StopReason.UserReconnect);
     }
     sourceConnection          = CreateConnection(source_uri);
     sourceConnection.Stopped += OnSourceConnectionStopped;
     sourceConnectionThread    = new Thread(state => {
         sourceConnection.Run();
     });
     sourceConnectionThread.Start();
 }
Exemplo n.º 7
0
        protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
        {
            switch (reason)
            {
            case StopReason.UserReconnect:
                break;

            case StopReason.UserShutdown:
                Stop(reason);
                break;

            default:
                Task.Delay(3000).ContinueWith(prev => Reconnect());
                break;
            }
        }
Exemplo n.º 8
0
        protected override void OnConnectionStopped(ISourceConnection connection, ConnectionStoppedArgs args)
        {
            switch (args.Reason)
            {
            case StopReason.UnavailableError:
                args.IgnoreSource = connection.SourceUri;
                args.Reconnect    = true;
                break;

            case StopReason.ConnectionError:
            case StopReason.OffAir:
                if (connection.SourceUri != this.SourceUri)
                {
                    args.IgnoreSource = connection.SourceUri;
                    args.Reconnect    = true;
                }
                break;
            }
        }
Exemplo n.º 9
0
        protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
        {
            switch (reason)
            {
            case StopReason.UserReconnect:
                break;

            case StopReason.UserShutdown:
                Stop(reason);
                break;

            case StopReason.NoHost:
                Stop(reason);
                break;

            default:
                Reconnect();
                break;
            }
        }
Exemplo n.º 10
0
 protected void StartConnection(Uri source_uri)
 {
     if (sourceConnection!=null) {
     sourceConnection.Stopped -= OnSourceConnectionStopped;
     StopConnection(StopReason.UserReconnect);
       }
       sourceConnection = CreateConnection(source_uri);
       sourceConnection.Stopped += OnSourceConnectionStopped;
       sourceConnectionThread = new Thread(state => {
     sourceConnection.Run();
       });
       sourceConnectionThread.Start();
 }
Exemplo n.º 11
0
 protected virtual void OnConnectionStopped(ISourceConnection connection, ConnectionStoppedArgs args)
 {
 }
Exemplo n.º 12
0
 protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
 {
   switch (reason) {
   case StopReason.UserReconnect:
     break;
   case StopReason.UserShutdown:
     Stop(reason);
     break;
   case StopReason.NoHost:
     Stop(reason);
     break;
   default:
     Task.Delay(3000).ContinueWith(prev => Reconnect());
     break;
   }
 }
Exemplo n.º 13
0
 protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
 {
   switch (reason) {
   case StopReason.UserReconnect:
     break;
   case StopReason.UserShutdown:
     Stop(reason);
     break;
   case StopReason.NoHost:
     Stop(reason);
     break;
   default:
     Reconnect();
     break;
   }
 }
Exemplo n.º 14
0
 public ConnectionStoppedEvent(ISourceConnection connection, StopReason reason)
     : base(SourceStreamEventType.ConnectionStopped)
 {
     this.Connection = connection;
     this.StopReason = reason;
 }
Exemplo n.º 15
0
 public ConnectionStoppedEvent(ISourceConnection connection, StopReason reason)
     : base(SourceStreamEventType.ConnectionStopped)
 {
     this.Connection = connection;
     this.StopReason = reason;
 }
Exemplo n.º 16
0
 protected abstract void OnConnectionStopped(ISourceConnection connection, StopReason reason);
Exemplo n.º 17
0
 private ConnectionWrapper(ISourceConnection connection, Func <ConnectionWrapper, Task <StopReason>, Task> taskFunc)
 {
     Connection = connection;
     Task       = taskFunc(this, connection.Run());
 }
Exemplo n.º 18
0
 static public ConnectionWrapper Run(ISourceConnection connection, Func <ConnectionWrapper, Task <StopReason>, Task> taskFunc)
 {
     return(new ConnectionWrapper(connection, taskFunc));
 }
Exemplo n.º 19
0
 protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
 {
   switch (reason) {
   case StopReason.UnavailableError:
     IgnoreNode(connection.SourceUri);
     Reconnect(SelectSourceHost());
     break;
   case StopReason.ConnectionError:
   case StopReason.OffAir:
     if (connection.SourceUri==this.SourceUri) {
       Stop(reason);
     }
     else {
       IgnoreNode(connection.SourceUri);
       Reconnect(SelectSourceHost());
     }
     break;
   case StopReason.UserReconnect:
     break;
   case StopReason.UserShutdown:
   default:
     Stop(reason);
     break;
   }
 }