在 WM 平台上开发 GPS 导航系统
2010-02-21 22:52:00 来源:WEB开发网75 ' Notify of the new time, adjusted to the local time zone
76 RaiseEvent DateTimeChanged(SatelliteTime.ToLocalTime)
77 End If
78 ' Do we have enough information to extract the current speed?
79 If Words(7) <> "" Then
80 ' Yes. Convert it into MPH
81 Dim Speed As Double = CType(Words(7), Double) * 1.150779
82 ' If we're over 55MPH then trigger a speed alarm!
83 If Speed > 55 Then RaiseEvent SpeedLimitReached()
84 ' Notify of the new speed
85 RaiseEvent SpeedReceived(Speed)
86 End If
87 ' Do we have enough information to extract bearing?
88 If Words(8) <> "" Then
89 ' Indicate that the sentence was recognized
90 Dim Bearing As Double = CType(Words(8), Double)
91 RaiseEvent BearingReceived(Bearing)
92 End If
93 ' Does the device currently have a satellite fix?
94 If Words(2) <> "" Then
95 Select Case Words(2)
96 Case "A"
97 RaiseEvent FixObtained()
98 Case "V"
99 RaiseEvent FixLost()
100 End Select
101 End If
102 ' Indicate that the sentence was recognized
103 Return True
104 End Function
105 ' Interprets a "Satellites in View" NMEA sentence
106 Public Function ParseGPGSV(ByVal sentence As String) As Boolean
107 Dim PseudoRandomCode As Integer
108 Dim Azimuth As Integer
109 Dim Elevation As Integer
110 Dim SignalToNoiseRatio As Integer
111 ' Divide the sentence into words
112 Dim Words() As String = GetWords(sentence)
113 ' Each sentence contains four blocks of satellite information.
114 ' Read each block and report each satellite's information
115 Dim Count As Integer
更多精彩
赞助商链接