/// <summary>
            /// Erzeugt ein neue Zustandsinformation.
            /// </summary>
            /// <param name="pipeline">Die zugehörige Gesamtliste aller Aktionen gleicher Art.</param>
            /// <param name="location">Der Ursprung für die angegebene Quellgruppe.</param>
            /// <param name="group">Die neue Quellgruppe.</param>
            /// <returns>Die gewünschte Information.</returns>
            /// <exception cref="ArgumentNullException">Es wurde kein Graph übergeben.</exception>
            internal static TuneToken Create(ActionPipeline <TuneToken> pipeline, GroupLocation location, SourceGroup group)
            {
                // Create new
                var token = new TuneToken(pipeline, location, group);

                // Configure
                IDVBTuningSpace2  tuningSpace;
                Action <ILocator> initializer;

                switch (pipeline.Graph.DVBType)
                {
                case DVBSystemType.Terrestrial: tuningSpace = token.PrepareTerrestrial(out initializer); break;

                case DVBSystemType.Satellite: tuningSpace = token.PrepareSatellite(out initializer); break;

                case DVBSystemType.Cable: tuningSpace = token.PrepareCable(out initializer); break;

                default: throw new NotImplementedException(pipeline.Graph.DVBType.ToString());
                }

                // With cleanup
                try
                {
                    // Create a new tune request
                    token.CreateTuneRequest(tuningSpace, initializer);
                }
                finally
                {
                    // No longer used
                    BDAEnvironment.Release(ref tuningSpace);
                }

                // Report
                return(token);
            }
 /// <summary>
 /// Erzeugt eine neue Beschreibung.
 /// </summary>
 /// <param name="pipeline">Die zugehörige Gesamtliste aller Aktionen gleicher Art.</param>
 /// <param name="location">Der Ursprung für die angegebene Quellgruppe.</param>
 /// <param name="group">Die neue Quellgruppe.</param>
 private TuneToken(ActionPipeline <TuneToken> pipeline, GroupLocation location, SourceGroup group)
     : base(pipeline)
 {
     // Remember
     GroupLocation = location;
     SourceGroup   = group;
 }
Esempio n. 3
0
        public AnycastClient(ClientConfig config)
        {
            this.Config = config;
            this.Status = ConnectionStatus.Disconnected;

            _listeners = new List <IMessageListener>();

            _pipeline = new ActionPipeline();
        }
Esempio n. 4
0
 /// <summary>
 /// Erzeugt einen neuen Graphen.
 /// </summary>
 public DataGraph()
 {
     // Finish
     DecryptionPipeline = new ActionPipeline <DecryptToken>(this, Properties.Resources.Pipeline_Decrypt, null);
     TunePipeline       = new ActionPipeline <TuneToken>(this, Properties.Resources.Pipeline_Tune, SetTuneRequest);
     SignalPipeline     = new ActionPipeline <SignalToken>(this, Properties.Resources.Pipeline_Signal, null);
     Configuration      = new GraphConfiguration(this);
     DVBType            = DVBSystemType.Unknown;
 }
Esempio n. 5
0
            /// <summary>
            /// Erzeugt ein neue Zustandsinformation.
            /// </summary>
            /// <param name="pipeline">Die zugehörige Gesamtliste aller Aktionen gleicher Art.</param>
            /// <returns>Die gewünschte Information.</returns>
            /// <exception cref="ArgumentNullException">Es wurde kein Graph übergeben.</exception>
            internal static SignalToken Create(ActionPipeline <SignalToken> pipeline)
            {
                // Status to use
                BDASignalStatus status   = null;
                int?            strength = null;

                // See if something is provided
                var tuner = pipeline.Graph.TunerFilter;

                if (tuner != null)
                {
                    // Ask network provider for signal information
                    using (var filter = pipeline.Graph.NetworkProvider.MarshalToManaged())
                        try
                        {
                            // Attach to the primary interface and read the strength if provided - may be more current than the signal statistics
                            var tunerInterface = filter.Object as ITuner;
                            if (tunerInterface != null)
                            {
                                strength = tunerInterface.SignalStrength;
                            }
                        }
                        catch
                        {
                            // Just ignore any error
                        }

                    // Attach to interface
                    var statistics = tuner.GetSignalStatistics();
                    if (statistics != null)
                    {
                        try
                        {
                            // Report
                            status = new BDASignalStatus(statistics.SignalLocked != 0, statistics.SignalStrength, statistics.SignalQuality / 100.0);
                        }
                        catch
                        {
                            // Just ignore any error
                        }
                        finally
                        {
                            // Back to COM
                            BDAEnvironment.Release(ref statistics);
                        }
                    }
                }

                // Create new
                return(new SignalToken(pipeline, status, strength));
            }
Esempio n. 6
0
            /// <summary>
            /// Erzeugt eine neue Beschreibung.
            /// </summary>
            /// <param name="pipeline">Die zugehörige Gesamtliste aller Aktionen gleicher Art.</param>
            /// <param name="status">Der initiale Status.</param>
            /// <param name="tunerStrength">Die vom Empfängerfilter gemeldete Signalstärke.</param>
            private SignalToken(ActionPipeline <SignalToken> pipeline, BDASignalStatus status, int?tunerStrength)
                : base(pipeline)
            {
                // Remember
                SignalStrength = tunerStrength;
                Status         = status;

                // Prepare result
                if (Status == null)
                {
                    SignalInformation = new SignalInformation();
                }
                else
                {
                    SignalInformation = new SignalInformation {
                        Locked = status.Locked, Quality = status.Quality, Strength = status.Strength
                    }
                };
            }
 /// <summary>
 /// Erzeugt ein neue Zustandsinformation.
 /// </summary>
 /// <param name="pipeline">Die zugehörige Gesamtliste aller Aktionen gleicher Art.</param>
 /// <param name="sources">Die Liste der zu entschlüsselnden Quellen.</param>
 /// <returns>Die gewünschte Information.</returns>
 /// <exception cref="ArgumentNullException">Es wurde kein Graph übergeben.</exception>
 internal static DecryptToken Create(ActionPipeline <DecryptToken> pipeline, SourceIdentifier[] sources)
 {
     // Create new
     return(new DecryptToken(pipeline, sources));
 }
 /// <summary>
 /// Erzeugt eine neue Beschreibung.
 /// </summary>
 /// <param name="pipeline">Die zugehörige Gesamtliste aller Aktionen gleicher Art.</param>
 /// <param name="sources">Die Liste der zu entschlüsselnden Quellen.</param>
 private DecryptToken(ActionPipeline <DecryptToken> pipeline, SourceIdentifier[] sources)
     : base(pipeline)
 {
     // Remember
     Sources = sources;
 }