Esempio n. 1
0
 /// <summary>
 /// Verändert den Netzwerkversand für eine aktive Quelle.
 /// </summary>
 /// <param name="source">Die Auswahl der Quelle.</param>
 /// <param name="uniqueIdentifier">Der eindeutige Name der Quelle.</param>
 /// <param name="target">Die Daten zum Netzwerkversand.</param>
 /// <exception cref="ArgumentNullException">Es wurde keine Quelle angegeben.</exception>
 protected override void OnSetStreamTarget(SourceIdentifier source, Guid uniqueIdentifier, string target)
 {
     // Process
     Execute(new SetStreamTargetRequest {
         Source = source, UniqueIdentifier = uniqueIdentifier, Target = target
     });
 }
Esempio n. 2
0
        /// <summary>
        /// Wählt einen NVOD Dienst aus.
        /// </summary>
        /// <param name="service">Der gewünschte Dienst.</param>
        /// <returns>Name des Dienstes inklusive der aktuellen Tonspur oder
        /// <i>null</i>, wenn eine Aktivierung des Dienstes nicht möglich war.</returns>
        public override string SetService(ServiceItem service)
        {
            // Must be a known channel
            VCRNETRestProxy.Source source;
            if (!Sources.TryGetValue(service.Identifier, out source))
            {
                return(null);
            }

            // Stop sending data
            Accessor.Stop();

            // Tune
            VCRNETRestProxy.TuneSync(m_serverRoot, Profile, SourceIdentifier.ToString(service.Identifier));

            // Got the portal
            if (service.Index == 0)
            {
                // Reset
                CurrentService = null;

                // Done
                return(source.nameWithProvider);
            }

            // Got a real service
            CurrentService = service.Name;

            // Done
            return(CurrentService);
        }
Esempio n. 3
0
 /// <summary>
 /// Stellt den Empfang für eine Quelle ein.
 /// </summary>
 /// <param name="source">Die betroffene Quelle.</param>
 /// <param name="uniqueIdentifier">Der eindeutige Name der Quelle.</param>
 protected override void OnRemoveSource(SourceIdentifier source, Guid uniqueIdentifier)
 {
     // Forward
     Execute(new RemoveSourceRequest {
         Source = new SourceIdentifier(source), UniqueIdentifier = uniqueIdentifier
     });
 }
Esempio n. 4
0
        /// <summary>
        /// Wird aufgerufen, wenn ein Eintrag für die Programmzeitschrift der PREMIERE Dienste
        /// erkannt wurde.
        /// </summary>
        /// <param name="epg">Ein Element der Programmzeitschrift.</param>
        private void OnPremiereEPGEvent(CIT epg)
        {
            // Ignore any error
            try
            {
                // Start processing the data
                foreach (legacy.Descriptor descriptor in epg.Table.Descriptors)
                {
                    // Check for schedule information
                    legacy.Descriptors.ContentTransmissionPremiere schedule = descriptor as legacy.Descriptors.ContentTransmissionPremiere;
                    if (null == schedule)
                    {
                        continue;
                    }

                    // Create identifier
                    SourceIdentifier source = new SourceIdentifier {
                        Network = schedule.OriginalNetworkIdentifier, TransportStream = schedule.TransportStreamIdentifier, Service = schedule.ServiceIdentifier
                    };

                    // Process all start times
                    foreach (DateTime start in schedule.StartTimes)
                    {
                        AddGuideItem(source, epg.Table.Identifier, start, epg.Table.Duration, epg.Table.Descriptors);
                    }
                }
            }
            catch
            {
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Meldet eine Benachrichtigung an.
 /// </summary>
 /// <param name="source">Eine zu überwachende Quelle.</param>
 /// <param name="key">Ein Parameter für die Benachrichtigung.</param>
 /// <param name="sink">Die auszulösende Benachrichtigung.</param>
 public void FireWhenAvailable <TParameterType>(SourceIdentifier source, TParameterType key, Action <Feed, TParameterType, bool> sink)
 {
     if (sink != null)
     {
         FireWhenAvailable(source, (feed, state) => sink(feed, key, state));
     }
 }
Esempio n. 6
0
        public override ActionOnDataDelete DeleteHandler(SourceIdentifier deleteSource,
                                                         DataSet deletedDataSet, ref int historyLogLevel, ref string historyLogMessage)
        {
            if (deleteSource == SourceIdentifier.SourceIsSubscriber)
            {
                // Build a line item in the audit message to log the Subscriber deletes.
                // Note that the rowguid is the only information that is
                // available in the dataset.
                StringBuilder AuditMessage = new StringBuilder();
                AuditMessage.Append(String.Format("An existing order was deleted at {0}. " +
                                                  "The rowguid for the order is ", subscriberName));
                AuditMessage.Append(deletedDataSet.Tables[0].Rows[0]["rowguid"].ToString());

                // Set the reference parameter to write the line to the log file.
                historyLogMessage = AuditMessage.ToString();
                // Set the history log level to the default verbose level.
                historyLogLevel = 1;

                // Accept the delete and apply it to the Publisher.
                return(ActionOnDataDelete.AcceptDelete);
            }
            else
            {
                return(base.DeleteHandler(deleteSource, deletedDataSet,
                                          ref historyLogLevel, ref historyLogMessage));
            }
        }
Esempio n. 7
0
        public override ActionOnDataChange UpdateHandler(SourceIdentifier updateSource,
                                                         DataSet updatedDataSet, ref DataSet customDataSet, ref int historyLogLevel,
                                                         ref string historyLogMessage)
        {
            if (updateSource == SourceIdentifier.SourceIsPublisher)
            {
                // Build a line item in the audit message to log the Subscriber update.
                StringBuilder AuditMessage = new StringBuilder();
                AuditMessage.Append(String.Format("An existing order was updated at {0}. " +
                                                  "The SalesOrderID for the order is ", subscriberName));
                AuditMessage.Append(updatedDataSet.Tables[0].Rows[0]["SalesOrderID"].ToString());
                AuditMessage.Append("The order must now be shipped by :");
                AuditMessage.Append(updatedDataSet.Tables[0].Rows[0]["DueDate"].ToString());

                // Set the reference parameter to write the line to the log file.
                historyLogMessage = AuditMessage.ToString();
                // Set the history log level to the default verbose level.
                historyLogLevel = 1;

                // Accept the updated data in the Subscriber's data set and apply it to the Publisher.
                return(ActionOnDataChange.AcceptData);
            }
            else
            {
                return(base.UpdateHandler(updateSource, updatedDataSet,
                                          ref customDataSet, ref historyLogLevel, ref historyLogMessage));
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Erzeugt die Beschreibung eines Eintrags aus der Programmzeitschrift und vermerkt diese
        /// in der Gesamtliste.
        /// </summary>
        /// <remarks>Wird auf einem separaten <see cref="Thread"/> ausgeführt und
        /// muss alle Zugriff auf die statischen Daten geeignet synchronisieren.</remarks>
        /// <param name="source">Die Quelle, zu der die Information gehört.</param>
        /// <param name="identifier">Die eindeutige Kennung der Sendung.</param>
        /// <param name="startTime">Anfangszeitpunkt in UTC / GMT.</param>
        /// <param name="duration">Dauer der zugehörigen Sendung.</param>
        /// <param name="descriptors">Ergänzende Beschreibungen zur Sendung.</param>
        /// <returns>Die neu erzeugte Beschreibungsinstanz.</returns>
        private void AddGuideItem(SourceIdentifier source, uint identifier, DateTime startTime, TimeSpan duration, legacy.Descriptor[] descriptors)
        {
            // First create it
            ProgramGuideItem info = CreateGuideItem(source, identifier, startTime, duration, descriptors);

            if (null == info)
            {
                return;
            }

            // Must synchronize
            lock (m_EPGItems)
            {
                // Attach to the source list
                Dictionary <DateTime, ProgramGuideItem> list;
                if (!m_EPGItems.TryGetValue(source, out list))
                {
                    // Create new
                    list = new Dictionary <DateTime, ProgramGuideItem>();

                    // Add it
                    m_EPGItems[source] = list;
                }

                // Old count
                int before = list.Count;

                // Remember
                list[startTime] = info;

                // New count
                m_EPGItemCount += (list.Count - before);
            }
        }
Esempio n. 9
0
        /// <summary>
        /// Erstellt einen neuen Eintrag für die Programmzeitschrift.
        /// </summary>
        /// <param name="entry">Der originale Eintrag aus der Verwaltung.</param>
        /// <param name="profileName">Der Name des zugehörigen Geräteprofils.</param>
        /// <returns>Die gewünschte Beschreibung.</returns>
        public static GuideItem Create(ProgramGuideEntry entry, string profileName)
        {
            // Validate
            if (entry == null)
            {
                throw new ArgumentNullException("entry");
            }

            // Default name of the station
            var source = VCRProfiles.FindSource(profileName, entry.Source);

            // Create
            return
                (new GuideItem
            {
                Identifier = $"{entry.StartTime.Ticks}:{profileName}:{SourceIdentifier.ToString( entry.Source ).Replace( " ", "" )}",
                Station = (source == null) ? entry.StationName : source.GetUniqueName(),
                Duration = TimeSpan.FromSeconds(entry.Duration),
                Categories = entry.Categories.ToArray(),
                Ratings = entry.Ratings.ToArray(),
                Summary = entry.ShortDescription,
                Description = entry.Description,
                StartTime = entry.StartTime,
                Language = entry.Language,
                Name = entry.Name,
            });
        }
Esempio n. 10
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (SourceIdentifier.Expression != null)
            {
                targetCommand.AddParameter("SourceIdentifier", SourceIdentifier.Get(context));
            }

            if (SubscriptionId.Expression != null)
            {
                targetCommand.AddParameter("SubscriptionId", SubscriptionId.Get(context));
            }

            if (Force.Expression != null)
            {
                targetCommand.AddParameter("Force", Force.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
Esempio n. 11
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (SourceIdentifier.Expression != null)
            {
                targetCommand.AddParameter("SourceIdentifier", SourceIdentifier.Get(context));
            }

            if (Sender.Expression != null)
            {
                targetCommand.AddParameter("Sender", Sender.Get(context));
            }

            if (EventArguments.Expression != null)
            {
                targetCommand.AddParameter("EventArguments", EventArguments.Get(context));
            }

            if (MessageData.Expression != null)
            {
                targetCommand.AddParameter("MessageData", MessageData.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
Esempio n. 12
0
        /// <summary>
        /// Meldet eine Benachrichtigung an.
        /// </summary>
        /// <param name="source">Eine zu überwachende Quelle.</param>
        /// <param name="sink">Die auszulösende Benachrichtigung.</param>
        public void FireWhenAvailable(SourceIdentifier source, Action <Feed, bool> sink)
        {
            // No one is interested
            if (sink == null)
            {
                return;
            }

            // Can not provide data
            var reader = m_feedAwaiter;

            if (reader == null)
            {
                return;
            }

            // Register
            reader.ContinueWith(task =>
            {
                // See if there are any
                var feeds = task.Result;
                if (feeds == null)
                {
                    return;
                }

                // Find the one
                var feed = feeds.FirstOrDefault(f => f.Source.Source.Equals(source));
                if (feed != null)
                {
                    sink(feed, true);
                }
            });
        }
Esempio n. 13
0
        public void SetStreamTarget(string detail, string source, Guid scheduleIdentifier, string target)
        {
            // Analyse
            var sourceIdentifier = SourceIdentifier.Parse(source);

            // Process
            ServerRuntime.VCRServer.SetStreamTarget(detail, sourceIdentifier, scheduleIdentifier, target);
        }
Esempio n. 14
0
 /// <summary>
 /// Startet eine Überwachung.
 /// </summary>
 /// <param name="graph">Die zugehörige Empfangsinstanz.</param>
 /// <param name="services">Die Liste der Dienste.</param>
 /// <param name="processor">Der Verarbeitungsalgorithmus.</param>
 private PMTSequencer( DataGraph graph, SourceIdentifier[] services, Func<PMT, bool, bool> processor )
 {
     // Remember
     m_services = services.Where( s => s != null ).ToArray();
     m_lastTable = m_services.ToDictionary( s => s.Service, s => default( PMT ) );
     m_processor = processor;
     m_graph = graph;
 }
Esempio n. 15
0
        /// <summary>
        /// Create a new instance.
        /// </summary>
        /// <param name="id">The identifier of the service.</param>
        /// <param name="name">The name of the service.</param>
        public ServiceItem(SourceIdentifier id, string name)
        {
            // Split
            int split = name.IndexOf(',');

            // Remember
            Index      = int.Parse(name.Substring(0, split++));
            Name       = name.Substring(split);
            Identifier = id;
        }
        /// <summary>
        /// Erzeugt eine Identifikation.
        /// </summary>
        /// <param name="uniqueIdentifier">Die eindeutige Kennung dieser Quelle.</param>
        /// <param name="source">Die zugehörige Quelle.</param>
        public SourceIdenfierWithKey( Guid uniqueIdentifier, SourceIdentifier source )
        {
            // Validate
            if (source == null)
                throw new ArgumentNullException( "source" );

            // Remember            
            UniqueIdentifier = uniqueIdentifier;
            Source = source;
        }
Esempio n. 17
0
        /// <summary>
        /// Verändert den Netzwerkversand für eine aktive Quelle.
        /// </summary>
        /// <param name="source">Die Auswahl der Quelle.</param>
        /// <param name="uniqueIdentifier">Der eindeutige Name der Quelle.</param>
        /// <param name="target">Die Daten zum Netzwerkversand.</param>
        /// <returns>Steuereinheit für diesen Aufruf.</returns>
        /// <exception cref="ArgumentNullException">Es wurde keine Quelle angegeben.</exception>
        public IAsyncResult BeginSetStreamTarget(SourceIdentifier source, Guid uniqueIdentifier, string target)
        {
            // Validate
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            // Start action
            return(Start <object>(() => { OnSetStreamTarget(new SourceIdentifier(source), uniqueIdentifier, target); }));
        }
Esempio n. 18
0
        /// <summary>
        /// Stellt den Empfang für eine Quelle ein.
        /// </summary>
        /// <param name="source">Die betroffene Quelle.</param>
        /// <param name="uniqueIdentifier">Der eindeutige Name der Quelle.</param>
        /// <returns>Steuereinheit für diesen Aufruf.</returns>
        public IAsyncResult BeginRemoveSource(SourceIdentifier source, Guid uniqueIdentifier)
        {
            // Validate
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            // Start action
            return(Start <object>(() => { OnRemoveSource(source, uniqueIdentifier); }));
        }
Esempio n. 19
0
        /// <summary>
        /// Meldet eine Quelle zur Sammlung der Daten aus der Programmzeitschrift an.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        private void AddEPGSource(SourceIdentifier source)
        {
            // Process
            foreach (SourceSelection selection in AddEPGGroup(source))
            {
                // First only
                m_EPGSources[source] = selection;

                // Done
                break;
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Erzeugt eine Identifikation.
        /// </summary>
        /// <param name="uniqueIdentifier">Die eindeutige Kennung dieser Quelle.</param>
        /// <param name="source">Die zugehörige Quelle.</param>
        public SourceIdenfierWithKey(Guid uniqueIdentifier, SourceIdentifier source)
        {
            // Validate
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            // Remember
            UniqueIdentifier = uniqueIdentifier;
            Source           = source;
        }
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of System.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (InputObject.Expression != null)
            {
                targetCommand.AddParameter("InputObject", InputObject.Get(context));
            }

            if (EventName.Expression != null)
            {
                targetCommand.AddParameter("EventName", EventName.Get(context));
            }

            if (SourceIdentifier.Expression != null)
            {
                targetCommand.AddParameter("SourceIdentifier", SourceIdentifier.Get(context));
            }

            if (Action.Expression != null)
            {
                targetCommand.AddParameter("Action", Action.Get(context));
            }

            if (MessageData.Expression != null)
            {
                targetCommand.AddParameter("MessageData", MessageData.Get(context));
            }

            if (SupportEvent.Expression != null)
            {
                targetCommand.AddParameter("SupportEvent", SupportEvent.Get(context));
            }

            if (Forward.Expression != null)
            {
                targetCommand.AddParameter("Forward", Forward.Get(context));
            }

            if (MaxTriggerCount.Expression != null)
            {
                targetCommand.AddParameter("MaxTriggerCount", MaxTriggerCount.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
 /// <summary>
 /// Ermittelt den am besten passenden Eintrag aus einem Zeitraum.
 /// </summary>
 /// <typeparam name="TTarget">Die Art der Rückgabewerte.</typeparam>
 /// <param name="source">Die gewünschte Quelle.</param>
 /// <param name="start">Der Beginn des Zeitraums.</param>
 /// <param name="end">Das Ende des Zeitraums.</param>
 /// <param name="factory">Methode zum Erzeugen eines Rückgabewertes.</param>
 /// <returns>Der am besten passende Eintrag.</returns>
 public TTarget FindBestEntry <TTarget>(SourceIdentifier source, DateTime start, DateTime end, Func <ProgramGuideEntry, TTarget> factory)
 {
     // Attach to holder
     if (m_Events.TryGetValue(source, out OrderedEntries events))
     {
         return(events.FindBestEntry(start, end, factory));
     }
     else
     {
         return(default(TTarget));
     }
 }
 /// <summary>
 /// Prüft, ob für den gewählten Zeitraum ein Eintrag existiert.
 /// </summary>
 /// <param name="source">Die Quelle, deren Einträge untersucht werden sollen.</param>
 /// <param name="start">Der Beginn des Zeitraums (einschließlich).</param>
 /// <param name="end">Das Ende des Zeitraums (ausschließlich).</param>
 /// <returns>Gesetzt, wenn ein Eintrag existiert.</returns>
 public bool HasEntry(SourceIdentifier source, DateTime start, DateTime end)
 {
     // Attach to holder
     if (m_Events.TryGetValue(source, out OrderedEntries events))
     {
         return(events.HasEntry(start, end));
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// Ermittelt einen bestimmten Eintrag.
 /// </summary>
 /// <param name="source">Die Quelle, deren Eintrag ermittelt werden soll.</param>
 /// <param name="start">Der exakte Startzeitpunkt.</param>
 /// <returns>Der gewünschte Eintrag.</returns>
 public ProgramGuideEntry FindEntry(SourceIdentifier source, DateTime start)
 {
     // Attach to holder
     if (m_Events.TryGetValue(source, out OrderedEntries events))
     {
         return(events.FindEntry(start));
     }
     else
     {
         return(null);
     }
 }
Esempio n. 25
0
        protected override void OnEstablishBinding()
        {
            SourceIdentifier.AssertValid($"{gameObject.name}: No source callback found.");
            TargetIdentifier.AssertValid($"{gameObject.name}: No target event found.");

            // Resolve an actual PropertyInfo from the serialized index
            _sourceCallback = SourceIdentifier.ResolveFrom(Source);
            _targetEvent    = TargetIdentifier.ResolveFrom(Target);

            var destructor = UiEventLookup.RegisterForEvent(Target, _targetEvent, _sourceCallback, OnTargetChanged);

            AddDestructor(destructor);
        }
Esempio n. 26
0
        /// <summary>
        /// Meldet alle Einträge der Programmzeitschrift zu einer Quelle.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        /// <returns>Die gewünschte Liste.</returns>
        internal IEnumerable <ProgramGuideEntry> GetEntries(SourceIdentifier source)
        {
            // Find the real holder
            var entries = LeafEntries;

            if (null == entries)
            {
                entries = new ProgramGuideEntries();
            }

            // Report
            return(entries.GetEntries(source));
        }
Esempio n. 27
0
        /// <summary>
        /// Ermittelt den am besten passenden Eintrag aus einem Zeitraum.
        /// </summary>
        /// <typeparam name="TTarget">Die Art der Rückgabewerte.</typeparam>
        /// <param name="source">Die gewünschte Quelle.</param>
        /// <param name="start">Der Beginn des Zeitraums.</param>
        /// <param name="end">Das Ende des Zeitraums.</param>
        /// <param name="factory">Methode zum Erzeugen eines Rückgabewertes.</param>
        /// <returns>Der am besten passende Eintrag.</returns>
        public TTarget FindBestEntry <TTarget>(SourceIdentifier source, DateTime start, DateTime end, Func <ProgramGuideEntry, string, TTarget> factory)
        {
            // Forward
            var entries = LeafEntries;

            if (entries == null)
            {
                return(default(TTarget));
            }
            else
            {
                return(entries.FindBestEntry(source, start, end, entry => factory(entry, ProfileName)));
            }
        }
Esempio n. 28
0
        /// <summary>
        /// Prüft, ob für den gewählten Zeitraum ein Eintrag existiert.
        /// </summary>
        /// <param name="source">Die Quelle, deren Einträge untersucht werden sollen.</param>
        /// <param name="start">Der Beginn des Zeitraums (einschließlich).</param>
        /// <param name="end">Das Ende des Zeitraums (ausschließlich).</param>
        /// <returns>Gesetzt, wenn ein Eintrag existiert.</returns>
        public bool HasEntry(SourceIdentifier source, DateTime start, DateTime end)
        {
            // Forward
            var entries = LeafEntries;

            if (entries == null)
            {
                return(false);
            }
            else
            {
                return(entries.HasEntry(source, start, end));
            }
        }
Esempio n. 29
0
        /// <summary>
        /// Ermittelt einen bestimmten Eintrag.
        /// </summary>
        /// <param name="profileName">Das zu betrachtende Geräteprofil.</param>
        /// <param name="source">Die Quelle, deren Eintrag ermittelt werden soll.</param>
        /// <param name="start">Der exakte Startzeitpunkt.</param>
        /// <returns>Der gewünschte Eintrag.</returns>
        public ProgramGuideEntry FindProgramGuideEntry(string profileName, SourceIdentifier source, DateTime start)
        {
            // See if profile exists
            var profile = Profiles[profileName];

            if (profile == null)
            {
                return(null);
            }
            else
            {
                return(profile.ProgramGuide.FindEntry(source, start));
            }
        }
Esempio n. 30
0
        /// <summary>
        /// Aktiviert den Netzwerkversand für eine aktive Quelle.
        /// </summary>
        /// <param name="source">Die betroffene Quelle.</param>
        /// <param name="uniqueIdentifier">Die eindeutige Kennung der Teilaufzeichnung.</param>
        /// <param name="streamingTarget">Das neue Ziel für den Netzwerkversand.</param>
        public void SetStreamTarget(SourceIdentifier source, Guid uniqueIdentifier, string streamingTarget)
        {
            // Validate
            if (source == null)
            {
                throw new ArgumentNullException("source");
            }

            // Report
            Tools.ExtendedLogging("Changing Streaming for {0} [{1}] to {2}", source, uniqueIdentifier, streamingTarget);

            // Process
            EnqueueActionAndWait(() => ServerImplementation.EndRequest(Server.BeginSetStreamTarget(source, uniqueIdentifier, streamingTarget)));
        }
Esempio n. 31
0
        /// <summary>
        /// Ermittelt den passendsten Eintrag aus der Programmzeitschrift.
        /// </summary>
        /// <typeparam name="TTarget">Die Art der Rückgabewerte.</typeparam>
        /// <param name="profileName">Das zu betrachtende Geräteprofil.</param>
        /// <param name="source">Die zugehörige Quelle.</param>
        /// <param name="from">Der Beginn eines Zeitraums.</param>
        /// <param name="to">Das Ende eines Zeitraums.</param>
        /// <param name="factory">Name der Metjode zum Erzeugen eines externen Eintrags.</param>
        /// <returns>Der am besten passende Eintrag.</returns>
        public TTarget FindProgramGuideEntry <TTarget>(string profileName, SourceIdentifier source, DateTime from, DateTime to, Func <ProgramGuideEntry, string, TTarget> factory)
        {
            // See if profile exists
            var profile = Profiles[profileName];

            if (profile == null)
            {
                return(default(TTarget));
            }
            else
            {
                return(profile.ProgramGuide.FindBestEntry(source, from, to, factory));
            }
        }
Esempio n. 32
0
        /// <summary>
        /// Meldet die Gruppe (Transponder) einer Quelle zur Sammlung der
        /// Programmzeitschrift an.
        /// </summary>
        /// <param name="source">Die betroffene Quelle.</param>
        /// <returns>Meldet alle passenden Quellen.</returns>
        private SourceSelection[] AddEPGGroup(SourceIdentifier source)
        {
            // Resolve
            SourceSelection[] selections = Profile.FindSource(source);

            // Process
            foreach (SourceSelection selection in selections)
            {
                m_EPGGroups[new GroupKey(selection)] = true;
            }

            // Report
            return(selections);
        }
Esempio n. 33
0
        /// <summary>
        /// Startet eine Überwachung.
        /// </summary>
        /// <param name="graph">Die zugehörige Empfangsinstanz.</param>
        /// <param name="services">Die Liste der Dienste.</param>
        /// <param name="processor">Der Verarbeitungsalgorithmus.</param>
        public static void Start( DataGraph graph, SourceIdentifier[] services, Func<PMT, bool, bool> processor )
        {
            // Validate
            if (graph == null)
                throw new ArgumentNullException( "graph" );
            if (processor == null)
                throw new ArgumentNullException( "processor" );

            // Nothing to do
            if (services == null)
                return;

            // Create scope and process
            var sequencer = new PMTSequencer( graph, services, processor );

            // Nothing to do
            if (sequencer.m_services.Length < 1)
                return;

            // Install watch dog
            sequencer.ProcessNext( null );
        }
        /// <summary>
        /// Meldet die Gruppe (Transponder) einer Quelle zur Sammlung der
        /// Programmzeitschrift an.
        /// </summary>
        /// <param name="source">Die betroffene Quelle.</param>
        /// <returns>Meldet alle passenden Quellen.</returns>
        private SourceSelection[] AddEPGGroup( SourceIdentifier source )
        {
            // Resolve
            SourceSelection[] selections = Profile.FindSource( source );

            // Process
            foreach (SourceSelection selection in selections)
                m_EPGGroups[new GroupKey( selection )] = true;

            // Report
            return selections;
        }
Esempio n. 35
0
        /// <summary>
        /// Aktiviert die Überwachung des PMT Empfangs.
        /// </summary>
        /// <param name="service">Der zu überwachende Dienst.</param>
        /// <param name="consumer">Der Empfänger für die PMT.</param>
        public void ActivatePMTWatchDog( SourceIdentifier service, Action<EPG.Tables.PMT> consumer )
        {
            // Attach to the transport stream parser unit
            var parser = TransportStreamAnalyser.DataManager.TSParser;

            // Deactivate the waiter - will finish all pending operations
            parser.RequestPMT( 0, true );

            // Activate sink
            Interlocked.Exchange( ref m_PMTSink, consumer );

            // Activate the waiter if necessary
            if (service != null)
                parser.RequestPMT( service.Service, true );
        }
Esempio n. 36
0
        /// <summary>
        /// Prüft, ob die EPG Informationen zum aktuellen Sender und der laufenden Sendung
        /// gehören und vermerkt diese dann.
        /// </summary>
        /// <param name="section">Die EPG Informationen.</param>
        /// <param name="current">Kennung des aktuellen Senders.</param>
        protected void ProcessEPG( EPG.Section section, SourceIdentifier current )
        {
            // Test station
            if (current == null)
                return;

            // Test section
            if (section == null)
                return;
            if (!section.IsValid)
                return;

            // Test table
            var eit = section.Table as EPG.Tables.EIT;
            if (eit == null)
                return;
            if (!eit.IsValid)
                return;

            // Test identification
            if (current.Service != eit.ServiceIdentifier)
                return;
            if (current.Network != eit.OriginalNetworkIdentifier)
                return;
            if (current.TransportStream != eit.TransportStreamIdentifier)
                return;

            // Check mode
            bool gotCurrent = false, gotNext = false;

            // Test state
            foreach (var entry in eit.Entries)
            {
                // Check for current entry
                if (!gotCurrent)
                    if (entry.Status == EPG.EventStatus.Running)
                    {
                        // Remember
                        CurrentEntry = entry;
                        gotCurrent = true;

                        // Done
                        if (gotNext)
                            break;

                        // Next
                        continue;
                    }

                // Check for next entry
                if (!gotNext)
                    if (entry.Status == EPG.EventStatus.NotRunning)
                    {
                        // Remember
                        NextEntry = entry;
                        gotNext = true;

                        // Done
                        if (gotCurrent)
                            break;
                    }
            }
        }
        /// <summary>
        /// Wird aufgerufen, wenn ein Eintrag für die Programmzeitschrift der PREMIERE Dienste
        /// erkannt wurde.
        /// </summary>
        /// <param name="epg">Ein Element der Programmzeitschrift.</param>
        private void OnPremiereEPGEvent( CIT epg )
        {
            // Ignore any error
            try
            {
                // Start processing the data
                foreach (legacy.Descriptor descriptor in epg.Table.Descriptors)
                {
                    // Check for schedule information
                    legacy.Descriptors.ContentTransmissionPremiere schedule = descriptor as legacy.Descriptors.ContentTransmissionPremiere;
                    if (null == schedule)
                        continue;

                    // Create identifier
                    SourceIdentifier source = new SourceIdentifier { Network = schedule.OriginalNetworkIdentifier, TransportStream = schedule.TransportStreamIdentifier, Service = schedule.ServiceIdentifier };

                    // Process all start times
                    foreach (DateTime start in schedule.StartTimes)
                        AddGuideItem( source, epg.Table.Identifier, start, epg.Table.Duration, epg.Table.Descriptors );
                }
            }
            catch
            {
            }
        }
Esempio n. 38
0
 /// <summary>
 /// Legt den Filter für die Programmzeitschrift fest.
 /// </summary>
 /// <param name="network">Die originale Netzwerkkenung des zugehörigen Dienstes.</param>
 /// <param name="transportStream">Die Kennung des <i>Transport Streams</i>.</param>
 /// <param name="service">Die eindeutige Kennung des Dienstes zu dieser Datei.</param>
 public void SetEPGMapping( ushort network, ushort transportStream, ushort service )
 {
     // Forward
     EPGMapping = new SourceIdentifier( network, transportStream, service );
 }
        /// <summary>
        /// Erzeugt die Beschreibung eines Eintrags aus der Programmzeitschrift und vermerkt diese
        /// in der Gesamtliste.
        /// </summary>
        /// <remarks>Wird auf einem separaten <see cref="Thread"/> ausgeführt und
        /// muss alle Zugriff auf die statischen Daten geeignet synchronisieren.</remarks>
        /// <param name="source">Die Quelle, zu der die Information gehört.</param>
        /// <param name="identifier">Die eindeutige Kennung der Sendung.</param>
        /// <param name="startTime">Anfangszeitpunkt in UTC / GMT.</param>
        /// <param name="duration">Dauer der zugehörigen Sendung.</param>
        /// <param name="descriptors">Ergänzende Beschreibungen zur Sendung.</param>
        /// <returns>Die neu erzeugte Beschreibungsinstanz.</returns>
        private void AddGuideItem( SourceIdentifier source, uint identifier, DateTime startTime, TimeSpan duration, legacy.Descriptor[] descriptors )
        {
            // First create it
            ProgramGuideItem info = CreateGuideItem( source, identifier, startTime, duration, descriptors );
            if (null == info)
                return;

            // Must synchronize
            lock (m_EPGItems)
            {
                // Attach to the source list
                Dictionary<DateTime, ProgramGuideItem> list;
                if (!m_EPGItems.TryGetValue( source, out list ))
                {
                    // Create new
                    list = new Dictionary<DateTime, ProgramGuideItem>();

                    // Add it
                    m_EPGItems[source] = list;
                }

                // Old count
                int before = list.Count;

                // Remember
                list[startTime] = info;

                // New count
                m_EPGItemCount += (list.Count - before);
            }
        }
        /// <summary>
        /// Erzeugt die Beschreibung eines Eintrags aus der Programmzeitschrift.
        /// </summary>
        /// <remarks>Wird auf einem separaten <see cref="Thread"/> ausgeführt und
        /// muss alle Zugriff auf die statischen Daten geeignet synchronisieren.</remarks>
        /// <param name="source">Die Quelle, zu der die Information gehört.</param>
        /// <param name="identifier">Die eindeutige Kennung der Sendung.</param>
        /// <param name="startTime">Anfangszeitpunkt in UTC / GMT.</param>
        /// <param name="duration">Dauer der zugehörigen Sendung.</param>
        /// <param name="descriptors">Ergänzende Beschreibungen zur Sendung.</param>
        /// <returns>Die neu erzeugte Beschreibungsinstanz.</returns>
        private ProgramGuideItem CreateGuideItem( SourceIdentifier source, uint identifier, DateTime startTime, TimeSpan duration, legacy.Descriptor[] descriptors )
        {
            // Descriptors we can have
            legacy.Descriptors.ParentalRating rating = null;
            legacy.Descriptors.ShortEvent shortEvent = null;
            //

            // Collector
            var exEvents = new List<legacy.Descriptors.ExtendedEvent>();
            var categories = new HashSet<ContentCategory>();

            // Check all descriptors
            foreach (var descr in descriptors)
                if (descr.IsValid)
                {
                    // Check type
                    if (shortEvent == null)
                    {
                        // Read
                        shortEvent = descr as legacy.Descriptors.ShortEvent;

                        // Done for now
                        if (null != shortEvent)
                            continue;
                    }
                    if (rating == null)
                    {
                        // Read
                        rating = descr as legacy.Descriptors.ParentalRating;

                        // Done for now
                        if (null != rating)
                            continue;
                    }

                    // Event
                    var exEvent = descr as legacy.Descriptors.ExtendedEvent;
                    if (exEvent != null)
                    {
                        // Remember
                        exEvents.Add( exEvent );

                        // Next
                        continue;
                    }

                    // Check for content information
                    var content = descr as legacy.Descriptors.Content;
                    if (content != null)
                    {
                        // Process
                        if (content.Categories != null)
                            foreach (var singleCategory in content.Categories)
                                categories.Add( Event.GetContentCategory( singleCategory ) );

                        // Next
                        continue;
                    }
                }

            // Data
            string name = null, description = null, language = null, shortDescription = null;

            // Take the best we got
            if (exEvents.Count > 0)
            {
                // Text builder
                StringBuilder text = new StringBuilder();

                // Process all
                foreach (legacy.Descriptors.ExtendedEvent exEvent in exEvents)
                {
                    // Normal
                    if (null == name)
                        name = exEvent.Name;
                    if (null == language)
                        language = exEvent.Language;

                    // Merge
                    if (exEvent.Text != null)
                        text.Append( exEvent.Text );
                }

                // Use
                description = text.ToString();
            }

            // Try short event
            if (shortEvent != null)
            {
                // Remember
                if (string.IsNullOrEmpty( shortEvent.Name ))
                    shortDescription = shortEvent.Text;
                else if (string.IsNullOrEmpty( shortEvent.Text ))
                    shortDescription = shortEvent.Name;
                else if (string.IsNullOrEmpty( description ) || StringComparer.Ordinal.Equals( shortEvent.Text, description ))
                    shortDescription = shortEvent.Name;
                else
                    shortDescription = string.Format( "{0} ({1})", shortEvent.Name, shortEvent.Text );

                // Read
                if (string.IsNullOrEmpty( name ))
                    name = shortEvent.Name;
                if (string.IsNullOrEmpty( description ))
                    description = shortEvent.Text;
                if (string.IsNullOrEmpty( language ))
                    language = shortEvent.Language;
            }

            // Not possible
            if (string.IsNullOrEmpty( name ))
                return null;

            // Defaults
            if (shortDescription == null)
                shortDescription = string.Empty;

            // Defaults
            if (string.IsNullOrEmpty( description ))
                description = "-";
            if (null == language)
                language = string.Empty;

            // Create event
            return new ProgramGuideItem
            {
                Ratings = ((rating == null) ? null : rating.Ratings) ?? EmptyStringArray,
                Duration = (int) duration.TotalSeconds,
                ShortDescription = shortDescription,
                Content = categories.ToArray(),
                Description = description,
                Identifier = identifier,
                Language = language,
                Start = startTime,
                Source = source,
                Name = name
            };
        }
        /// <summary>
        /// Meldet eine Quelle zur Sammlung der Daten aus der Programmzeitschrift an.
        /// </summary>
        /// <param name="source">Die gewünschte Quelle.</param>
        private void AddEPGSource( SourceIdentifier source )
        {
            // Process
            foreach (SourceSelection selection in AddEPGGroup( source ))
            {
                // First only
                m_EPGSources[source] = selection;

                // Done
                break;
            }
        }
        /// <summary>
        /// Beginnt mit der Sammlung der Daten für die elektronische Programmzeitschrift
        /// (EPG).
        /// </summary>
        /// <param name="device">Das zu verwendende DVB.NET Gerät.</param>
        /// <param name="sources">Die zu berücksichtigenden Quellen.</param>
        /// <param name="extensions">Spezielle Zusatzfunktionalitäten der Sammlung.</param>
        private void StartEPGCollection( Hardware device, SourceIdentifier[] sources, EPGExtensions extensions )
        {
            // Check mode
            if (EPGProgress.HasValue)
                CardServerException.Throw( new EPGActiveFault() );
            if (m_ScanProgress >= 0)
                CardServerException.Throw( new SourceUpdateActiveFault() );

            // Reset lists
            m_EPGSources.Clear();
            m_EPGGroups.Clear();

            // Load all identifiers to scan
            if (null != sources)
                foreach (SourceIdentifier source in sources)
                    AddEPGSource( source );

            // Add specials
            if (0 != (extensions & EPGExtensions.PREMIEREDirect))
                if (AddEPGGroup( DirectCIT.TriggerSource ).Length < 1)
                    extensions &= ~EPGExtensions.PREMIEREDirect;
            if (0 != (extensions & EPGExtensions.PREMIERESport))
                if (AddEPGGroup( SportCIT.TriggerSource ).Length < 1)
                    extensions &= ~EPGExtensions.PREMIERESport;
            if (0 != (extensions & EPGExtensions.FreeSatUK))
                if (AddEPGGroup( EIT.FreeSatEPGTriggerSource ).Length < 1)
                    extensions &= ~EPGExtensions.FreeSatUK;

            // Stop all
            RemoveAll();

            // Prepare
            m_EPGPending = new List<GroupKey>( m_EPGGroups.Keys );
            m_EPGLastItemCheck = DateTime.MaxValue;
            m_EPGLastTune = DateTime.MinValue;
            m_EPGLastItemCount = -1;
            m_EPGItems.Clear();
            m_EPGItemCount = 0;

            // Mark as active
            m_EPGExtensions = extensions;
            EPGProgress = 0;

            // Enforce start
            CollectProgramGuide( device );
        }
Esempio n. 43
0
 /// <summary>
 /// Erstellt eine neue Beschreibung.
 /// </summary>
 /// <param name="source">Die zugehörige Quelle.</param>
 /// <param name="entry">Die Rohdaten aus dem DVB Datenstrom.</param>
 /// <exception cref="ArgumentNullException">Ein Parameter wurde nicht angegeben.</exception>
 public Event( SourceIdentifier source, legacy.EventEntry entry )
     : this( source, entry.EventIdentifier, entry.StartTime, entry.Duration, entry.Descriptors )
 {
 }
Esempio n. 44
0
        /// <summary>
        /// Erstellt eine neue Beschreibung.
        /// </summary>
        /// <param name="source">Die zugehörige Quelle.</param>
        /// <param name="identifier">Die eindeutige Nummer des Ereignisses.</param>
        /// <param name="startTime">Der Beginn der Sendung in UTC / GMT.</param>
        /// <param name="duration">Die Dauer der Ausstrahlung.</param>
        /// <param name="descriptors">Die Beschreibung der Sendung.</param>
        /// <exception cref="ArgumentNullException">Ein Parameter wurde nicht angegeben.</exception>
        public Event( SourceIdentifier source, uint identifier, DateTime startTime, TimeSpan duration, IEnumerable<legacy.Descriptor> descriptors )
        {
            // Validate
            if (source == null)
                throw new ArgumentNullException( "source" );

            // Copy over
            Identifier = identifier;
            StartTime = startTime;
            Duration = duration;
            Source = source;

            // Remember
            m_Descriptors = descriptors;
        }
 /// <summary>
 /// Beginnt mit der Sammlung der Daten für die elektronische Programmzeitschrift
 /// (EPG).
 /// </summary>
 /// <param name="sources">Die zu berücksichtigenden Quellen.</param>
 /// <param name="extensions">Spezielle Zusatzfunktionalitäten der Sammlung.</param>
 protected override void OnStartEPGCollection( SourceIdentifier[] sources, EPGExtensions extensions )
 {
     // Process
     Start( device => { StartEPGCollection( device, sources, extensions ); } );
 }
Esempio n. 46
0
 /// <summary>
 /// Erzeugt eine neue Ausnahme.
 /// </summary>
 /// <param name="source">Die doppelt verwendete Quelle.</param>
 public SourceInUseFault( SourceIdentifier source )
     : base( string.Format( Properties.Resources.Exception_DuplicateSource, SourceIdentifier.ToString( source ) ) )
 {
     // Remember
     Source = source;
 }
Esempio n. 47
0
        public override ActionOnDataChange InsertHandler(
            SourceIdentifier insertSource,
            DataSet insertedDataSet,
            ref DataSet customDataSet,
            ref int historyLogLevel,
            ref string historyLogMessage)
        {
            if (insertSource == SourceIdentifier.SourceIsSubscriber)
            {
                // Get the the product ID and quantity for this row.
                int productID
                    = Convert.ToInt32(insertedDataSet.Tables[0].Rows[0].ItemArray[4],
                    System.Globalization.CultureInfo.InvariantCulture);
                int orderQuantity
                    = Convert.ToInt32(insertedDataSet.Tables[0].Rows[0].ItemArray[3],
                    System.Globalization.CultureInfo.InvariantCulture);
                int salesOrderID
                    = Convert.ToInt32(insertedDataSet.Tables[0].Rows[0].ItemArray[0],
                    System.Globalization.CultureInfo.InvariantCulture);

                // Check the inventory for this item.
                checkInventoryQuery
                    = new SqlCommand(checkInventoryProcedure,
                    connection);
                checkInventoryQuery.CommandType = CommandType.StoredProcedure;
                checkInventoryQuery.Parameters.AddWithValue(@"@ProductID", productID);
                checkInventoryQuery.Parameters.AddWithValue(@"@SalesOrderID", salesOrderID);
                checkInventoryQuery.Parameters.AddWithValue(@"@OrderQuantity", orderQuantity);

                try
                {
                    Object logMessage = checkInventoryQuery.ExecuteScalar();

                    // If a message is returned, write it to the log.
                    if (logMessage != null)
                    {
                        historyLogMessage = (string)logMessage;
                        historyLogLevel = 3;
                    }
                }
                catch (Exception ex)
                {
                    // Rethrow an exception or the Merge Agent will continue.
                    throw new ApplicationException(Properties.Resources.ErrorCheckInventory,
            ex);
                }
            }

            return ActionOnDataChange.AcceptData;
        }