/// <summary> /// Erzeugt eine neue Beschreibung. /// </summary> /// <param name="section">Der SI Bereich, in dem die Information gefunden wurde.</param> /// <param name="offset">Der Index des ersten Bytes dieser Information in den Rohdaten des SI Bereichs.</param> /// <param name="length">Die Anzahl der Bytes für diese Information.</param> /// <returns>Die zugehörige Information oder <i>null</i>, wenn eine Rekonstruktion nicht möglich war.</returns> public static FrequencyLink Create(Section section, int offset, int length) { // Check minimum length if (length < 7) { return(null); } // Correct length length -= 7; // Read length of extension data int extlen = section[offset + 6]; // Validate if (extlen > length) { return(null); } // Read direct data ushort cellId = Tools.MergeBytesToWord(section[offset + 1], section[offset + 0]); uint frequency = Tools.MergeBytesToDoubleWord(section[offset + 5], section[offset + 4], section[offset + 3], section[offset + 2]); // Create new FrequencyLink info = new FrequencyLink { Length = 7 + extlen, Identifier = cellId, Frequency = Descriptors.TerrestrialDelivery.ConvertFrequency(frequency) }; // Report return(info); }
/// <summary> /// Erzeugt eine neue Beschreibung. /// </summary> /// <param name="section">Der SI Bereich, in dem die Information gefunden wurde.</param> /// <param name="offset">Der Index des ersten Bytes dieser Information in den Rohdaten des SI Bereichs.</param> /// <param name="length">Die Anzahl der Bytes für diese Information.</param> /// <returns>Die zugehörige Information oder <i>null</i>, wenn eine Rekonstruktion nicht möglich war.</returns> public static FrequencyLink Create( Section section, int offset, int length ) { // Check minimum length if (length < 7) return null; // Correct length length -= 7; // Read length of extension data int extlen = section[offset + 6]; // Validate if (extlen > length) return null; // Read direct data ushort cellId = Tools.MergeBytesToWord( section[offset + 1], section[offset + 0] ); uint frequency = Tools.MergeBytesToDoubleWord( section[offset + 5], section[offset + 4], section[offset + 3], section[offset + 2] ); // Create new FrequencyLink info = new FrequencyLink { Length = 7 + extlen, Identifier = cellId, Frequency = Descriptors.TerrestrialDelivery.ConvertFrequency( frequency ) }; // Report return info; }
/// <summary> /// Erzeugt eine neue Referenzliste. /// </summary> /// <param name="container">Der SI Bereich, in dem diese Liste gefunden wurde.</param> /// <param name="offset">Der Index des ersten Bytes dieser Liste in den Rohdaten des SI Bereichs.</param> /// <param name="length">Die Anzahl der Bytes für diese Liste.</param> public CellFrequencyLink(IDescriptorContainer container, int offset, int length) : base(container, offset, length) { // Check minimum length if (length < 0) { return; } // Attach to data Section section = container.Section; // Helper List <FrequencyLink> links = new List <FrequencyLink>(); // Load while (length > 0) { // Create FrequencyLink link = FrequencyLink.Create(section, offset, length); // Done if (null == link) { break; } // Remember links.Add(link); // Correct offset += link.Length; length -= link.Length; } // Test m_Valid = (0 == length); // Load if (m_Valid) { Links = links; } }