/// <summary>
 /// Erzeugt eine Kopie der angegebenen Quellgruppe.
 /// </summary>
 /// <param name="group">Die ursprüngliche Quellgruppe, wobei <i>null</i> erlaubt ist.</param>
 /// <returns>Eine Kopie der Quellgruppe oder <i>null</i>.</returns>
 public static T CloneGroup <T>(this T group) where T : SourceGroup
 {
     // Create it
     if (group == null)
     {
         return(null);
     }
     else
     {
         return(SourceGroup.FromString <T>(group.ToString()));
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
        /// </summary>
        /// <param name="group">Die andere Quellgruppe.</param>
        /// <param name="legacy">Gesetzt, wenn ein partieller Vergleich erfolgen soll.</param>
        /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
        public bool CompareTo(SourceGroup group, bool legacy)
        {
            // By identity
            if (ReferenceEquals(group, null))
            {
                return(false);
            }
            if (ReferenceEquals(group, this))
            {
                return(true);
            }

            // Wrong type
            if (group.GetType() != GetType())
            {
                return(false);
            }

            // Forward
            return(OnCompare(group, legacy));
        }
        /// <summary>
        /// Ermittelt die Einschränkungen des Sendersuchlaufs bezüglich einer Quellgruppe (Transponder).
        /// </summary>
        /// <param name="profile">Das betroffene Geräteprofil.</param>
        /// <param name="group">Die gewünschte Quellgruppe.</param>
        /// <returns>Informationen zur Quellgruppe.</returns>
        /// <exception cref="ArgumentNullException">Ein Parameter wurde nicht angegeben.</exception>
        public static SourceGroupFilter GetFilter(this Profile profile, SourceGroup group)
        {
            // Validate
            if (null == profile)
            {
                throw new ArgumentNullException("profile");
            }
            if (null == group)
            {
                throw new ArgumentNullException("group");
            }

            // Forward to helper
            if (null == profile.ScanConfiguration)
            {
                return(new SourceGroupFilter());
            }
            else
            {
                return(profile.ScanConfiguration.GetFilter(group));
            }
        }
Exemplo n.º 4
0
        /// <summary>
        /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
        /// </summary>
        /// <param name="group">Die andere Quellgruppe.</param>
        /// <param name="legacy">Gesetzt, wenn ein partieller Vergleich erfolgen soll.</param>
        /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
        protected override bool OnCompare(SourceGroup group, bool legacy)
        {
            // Change type
            var other = (CableGroup)group;

            // Most groups can be uniquely identified by the frequency
            if (Frequency != other.Frequency)
            {
                return(false);
            }

            // Check for near exact comparision
            if (!legacy)
            {
                // Not so probable
                if (Modulation != other.Modulation)
                {
                    return(false);
                }

                // The rest is more or less for completeness
                if (SymbolRate != other.SymbolRate)
                {
                    return(false);
                }
                if (Bandwidth != other.Bandwidth)
                {
                    return(false);
                }
                if (SpectrumInversion != other.SpectrumInversion)
                {
                    return(false);
                }
            }

            // Same
            return(true);
        }
        /// <summary>
        /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
        /// </summary>
        /// <param name="group">Die andere Quellgruppe.</param>
        /// <param name="legacy">Gesetzt, wenn ein partieller Vergleich erfolgen soll.</param>
        /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
        protected override bool OnCompare(SourceGroup group, bool legacy)
        {
            // Change type
            var other = (TerrestrialGroup)group;

            // Most groups can be uniquely identified by the frequency
            if (Frequency != other.Frequency)
            {
                return(false);
            }

            // See if full check is required
            if (!legacy)
            {
                // Not so probable
                if (Bandwidth != other.Bandwidth)
                {
                    return(false);
                }
            }

            // Same
            return(true);
        }
Exemplo n.º 6
0
 /// <summary>
 /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
 /// </summary>
 /// <param name="group">Die andere Quellgruppe.</param>
 /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
 public bool CompareTo(SourceGroup group)
 {
     // Forward
     return(CompareTo(group, false));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
 /// </summary>
 /// <param name="group">Die andere Quellgruppe.</param>
 /// <param name="legacy">Gesetzt, wenn ein partieller Vergleich erfolgen soll.</param>
 /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
 protected abstract bool OnCompare(SourceGroup group, bool legacy);
Exemplo n.º 8
0
        /// <summary>
        /// Stellt den Empfang auf eine bestimmte Quellgruppe eines Ursprungs ein.
        /// </summary>
        /// <remarks>Der Aufruf dieser Methode darf niemals auf mehreren Threads
        /// gleichzeitig erfolgen.</remarks>
        /// <param name="location">Der gewünschte Ursprung.</param>
        /// <param name="group">Die gewünschte Quellgruppe.</param>
        public void SelectGroup(GroupLocation location, SourceGroup group)
        {
            // Report
            if (TunerTraceSwitch.Enabled)
            {
                Trace.WriteLine(string.Format(Properties.Resources.Trace_Tuner_Request, location, group), TunerTraceSwitch.DisplayName);
            }

            // Always use clones
            location = location.CloneLocation();
            group    = group.CloneGroup();

            // Stop all current
            if ((CurrentLocation != null) || (CurrentGroup != null))
            {
                // Report
                if (ConsumerTraceSwitch.Enabled)
                {
                    Trace.WriteLine(Properties.Resources.Trace_Consumer_StoppingAll, ConsumerTraceSwitch.DisplayName);
                }

                // See if provide has a fast way to stop all streams
                bool allStopped = OnStopAll();

                // Stop all table readers
                ResetReader(ref m_networkInformationReader);
                ResetReader(ref m_associationReader);
                ResetReader(ref m_serviceReader);
                m_groupReader = null;

                // Erase list of EPG receivers
                m_programGuideConsumers = null;

                // List of active consumers
                StreamInformation[] consumers;

                // Be safe
                lock (InstanceSynchronizer)
                {
                    // Remember
                    consumers = m_streamsByPID.Values.ToArray();

                    // Wipe out
                    m_streamsByPID.Clear();
                    m_streamsById.Clear();
                }

                // Forward to all streams
                if (!allStopped)
                {
                    foreach (var consumer in consumers)
                    {
                        if (consumer.ActiveConsumerCount > 0)
                        {
                            OnStop(consumer);
                        }
                    }
                }
            }

            // See if something changed
            if (!Equals(location, CurrentLocation) || !Equals(group, CurrentGroup))
            {
                // Report
                if (TunerTraceSwitch.Enabled)
                {
                    Trace.WriteLine(Properties.Resources.Trace_Tuner_Hardware, TunerTraceSwitch.DisplayName);
                }

                // Activate hardware
                OnSelectGroup(location, group);

                // Remember
                CurrentLocation = location;
                CurrentGroup    = group;

                // Mark time
                m_lastTuneTime = DateTime.UtcNow;
            }

            // Restart all readers
            ResetInformationReaders(true);
        }
Exemplo n.º 9
0
 /// <summary>
 /// Prüft, ob die angegebene Quellgruppe (Transponder) angesteuert werden kann.
 /// </summary>
 /// <param name="group">Eine Quellgruppe zur Prüfung.</param>
 /// <returns>Gesetzt, wenn die Quellgruppe angesteuert werden kann.</returns>
 public bool CanHandle(SourceGroup group)
 {
     // Check mode
     return((group != null) && OnCanHandle(group));
 }
Exemplo n.º 10
0
 /// <summary>
 /// Prüft, ob die angegebene Quellgruppe (Transponder) angesteuert werden kann.
 /// </summary>
 /// <param name="group">Eine Quellgruppe zur Prüfung.</param>
 /// <returns>Gesetzt, wenn die Quellgruppe angesteuert werden kann.</returns>
 protected abstract bool OnCanHandle(SourceGroup group);
Exemplo n.º 11
0
 /// <summary>
 /// Stellt den Empfang auf eine bestimmte Quellgruppe eines Ursprungs ein.
 /// </summary>
 /// <param name="location">Der gewünschte Ursprung.</param>
 /// <param name="group">Die gewünschte Quellgruppe.</param>
 protected abstract void OnSelectGroup(GroupLocation location, SourceGroup group);
Exemplo n.º 12
0
 /// <summary>
 /// Prüft, ob das zugehörige Gerät eine bestimmte Quellgruppe überhaupt unterstützt.
 /// </summary>
 /// <param name="group">Die zu prüfende Quellgruppe.</param>
 /// <returns>Gesetzt, wenn die Quellgruppe unterstützt wird.</returns>
 public abstract bool SupportsGroup(SourceGroup group);
Exemplo n.º 13
0
        /// <summary>
        /// Vergleicht diese Quellgruppe (Transponder) mit einer anderen.
        /// </summary>
        /// <param name="group">Die andere Quellgruppe.</param>
        /// <param name="legacy">Gesetzt, wenn ein partieller Vergleich erfolgen soll.</param>
        /// <returns>Gesetzt, wenn die Gruppen identisch sind.</returns>
        protected override bool OnCompare(SourceGroup group, bool legacy)
        {
            // Change type
            SatelliteGroup other = (SatelliteGroup)group;

            // Most groups can be uniquely identified by the frequency
            if (legacy)
            {
                // Allow shift by 5 MHz
                if (Math.Abs((long)Frequency - (long)other.Frequency) > 5000)
                {
                    return(false);
                }
            }
            else
            {
                // Exact match
                if (Frequency != other.Frequency)
                {
                    return(false);
                }
            }

            // In rare cases both polarisations are needed
            if (Polarization != other.Polarization)
            {
                return(false);
            }

            // Location in the sky
            if (!legacy)
            {
                // All of it
                if (IsWestPosition != other.IsWestPosition)
                {
                    return(false);
                }
                if (!Equals((null == OrbitalPosition) ? string.Empty : OrbitalPosition, (null == other.OrbitalPosition) ? string.Empty : other.OrbitalPosition))
                {
                    return(false);
                }
            }

            // The rest is more or less for completeness
            if (UsesS2Modulation != other.UsesS2Modulation)
            {
                return(false);
            }

            // See if we should include the modulation
            if (!legacy)
            {
                // All of it
                if (SymbolRate != other.SymbolRate)
                {
                    return(false);
                }
                if (Modulation != other.Modulation)
                {
                    return(false);
                }
                if (RollOff != other.RollOff)
                {
                    return(false);
                }
                if (InnerFEC != other.InnerFEC)
                {
                    return(false);
                }
            }

            // Same
            return(true);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Ermittelt die Einschränkungen des Sendersuchlaufs bezüglich einer Quellgruppe (Transponder).
 /// </summary>
 /// <param name="group">Die gewünschte Quellgruppe.</param>
 /// <returns>Informationen zur Quellgruppe.</returns>
 /// <exception cref="ArgumentNullException">Es wurde keine Quellgruppe angegeben.</exception>
 public abstract SourceGroupFilter GetFilter(SourceGroup group);