Пример #1
0
        /// <summary>
        /// Parse the given NMEA 0183 sentence into a concrete instance of NmeaSentence
        /// </summary>
        /// <param name="sentence">The NMEA 0183 sentence to parse</param>
        /// <returns>A concrete instance of NmeaSentence</returns>
        private NmeaSentence ParseSentence(string sentence)
        {
            NmeaSentence nmeaSentence          = new NmeaSentence(sentence);
            NmeaSentence stronglyTypedSentence = NmeaSentenceFactory.CreateConcreteSentence(nmeaSentence);

            return(stronglyTypedSentence);
        }
Пример #2
0
        /// <summary>
        /// Use the factory assigned to the id of the given sentence to construct a
        /// concrete implementation of the NmeaSentence class. If no factory is assigned
        /// to the sentence id, then the sentence is unknown, and the NmeaUnknownFactory
        /// is used to just return the given sentence
        /// </summary>
        /// <param name="sentence">A generic NmeaSentence to create a concrete implementation
        /// of NmeaSentence for</param>
        /// <returns>A concrete implementation of NmeaSentence, if the sentence is supported,
        /// otherwise the given sentence is returned.</returns>
        public static NmeaSentence CreateConcreteSentence(NmeaSentence sentence)
        {
            if (sentence == null)
            {
                return(null);
            }

            string sentendId            = sentence.SentenceId;
            NmeaSentenceFactory factory = GetFactory(sentence);

            return(factory.Create(sentence));
        }