private void UpdateEventEndpoint(uint oldValue, uint newValue, int eventId)
 {
     if (oldValue != 0)
     {
         var target = machine.SystemBus.WhatPeripheralIsAt(oldValue);
         if (target is INRFEventProvider nrfTarget)
         {
             //todo: how to do it on reset?
             nrfTarget.EventTriggered -= eventCallbacks[eventId];
             registeredEventSenders.Remove(EventEntry.Create(nrfTarget, eventId));
             this.Log(LogLevel.Debug, "Disconnected channel {1} from event 0x{0:X}", oldValue, eventId);
         }
         else
         {
             this.Log(LogLevel.Error, "Failed to unregister PPI from 0x{0:X} for channel {1}", oldValue, eventId);
         }
     }
     eventEndpoint[eventId] = newValue;
     if (newValue != 0)
     {
         var target = machine.SystemBus.WhatPeripheralIsAt(newValue);
         if (target is INRFEventProvider nrfTarget)
         {
             nrfTarget.EventTriggered += eventCallbacks[eventId];
             registeredEventSenders.Add(EventEntry.Create(nrfTarget, eventId));
             this.Log(LogLevel.Debug, "Connected channel {1} to event 0x{0:X}", newValue, eventId);
         }
         else
         {
             this.Log(LogLevel.Error, "Failed to register PPI from 0x{0:X} for channel {1}", newValue, eventId);
         }
     }
 }
Beispiel #2
0
        protected override void OnEventWritten(EventWrittenEventArgs eventData)
        {
            var entry = EventEntry.Create(eventData, this.schemaCache.GetSchema(eventData.EventId, eventData.EventSource));

            lock (this.lockObject)
            {
                this.Formatter.WriteEvent(entry, this.writer);
                this.writer.Flush();
                this.writenBytes = this.Stream.Length;

                if (this.waitEvents != null)
                {
                    this.waitEvents.Reset();
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Load the fields of this instance from the <see cref="Section"/> raw data.
        /// If any validation is successful <see cref="Table.IsValid"/> will be set.
        /// </summary>
        /// <remarks>
        /// <see cref="Entries"/> will be <i>null</i> and not an empty <see cref="Array"/>
        /// if <see cref="Table.IsValid"/> ends up unset.
        /// </remarks>
        /// <param name="section">The related <see cref="Section"/>.</param>
        public EIT(Section section)
            : base(section)
        {
            // Get the size of the event entry region
            int offset = 11, length = section.Length - 3 - offset - 4;

            // Minimum size
            if (length < 0)
            {
                return;
            }

            // Direct
            SegmentLastSectionNumber = section[9];
            LastTableIdentifier      = section[10];

            // Construct
            m_TransportStreamIdentifier = Tools.MergeBytesToWord(section[6], section[5]);
            m_OriginalNetworkIdentifier = Tools.MergeBytesToWord(section[8], section[7]);
            m_ServiceIdentifier         = Tools.MergeBytesToWord(section[1], section[0]);

            // Create helper
            List <EventEntry> entries = new List <EventEntry>();

            // Process
            for (EventEntry entry; null != (entry = EventEntry.Create(this, offset, length));)
            {
                if (entry.IsValid)
                {
                    // Remember
                    entries.Add(entry);

                    // Correct
                    offset += entry.Length;
                    length -= entry.Length;
                }
            }

            // Usefull
            m_IsValid = (0 == length);

            // Convert
            if (m_IsValid)
            {
                Entries = entries.ToArray();
            }
        }
 protected override void OnEventWritten(EventWrittenEventArgs eventData)
 {
     WrittenEntries.Add(EventEntry.Create(eventData, EventSourceSchemaCache.Instance.GetSchema(eventData.EventId, eventData.EventSource)));
 }