[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
The Core of An NMEA Interpreter
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
The Core of An NMEA Interpreter
The Core of An NMEA Interpreter
The first step in making an NMEA interpreter is writing a method which does two things: separating each sentence into its individual words and examining the first word to figure out what information is available to extract. Listing 1-1 shows the start of the interpreter class. (Listing 1-1: The core of an NMEA interpreter is a function which divides NMEA sentences into individual words.)
'*******************************************************
'** A basic NMEA interpreter
'*******************************************************
Public Class NmeaInterpreter
' Processes information from the GPS receiver
Public Function Parse(ByVal sentence As String) As Boolean
' Divide the sentence into words
Dim Words() As String = GetWords(sentence)
' Look at the first word to decide where to go next
Select Case Words(0)
Case "$GPRMC" ' A "Recommended Minimum" sentence was found!
' Indicate that the sentence was recognized
Return True
Case Else
' Indicate that the sentence was not recognized
Return False
End Select
End Function
' Divides a sentence into individual words
Public Function GetWords(ByVal sentence As String) As String()
Return sentence.Split(","c)
End Function
End Class
Written By Jon Person (http://www.gpsdotnet.com)
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
