WEB开发网
开发学院手机开发Windows Mobile 开发 在 WM 平台上开发 GPS 导航系统 阅读

在 WM 平台上开发 GPS 导航系统

 2010-02-21 22:52:00 来源:WEB开发网   
核心提示:63 Dim SatelliteTime As New System.DateTime(Today.Year, Today.Month, _64 Today.Day, UtcHours, UtcMinutes, UtcSeconds, UtcMilliseconds)65 ' Notify of the new

63 Dim SatelliteTime As New System.DateTime(Today.Year, Today.Month, _

64 Today.Day, UtcHours, UtcMinutes, UtcSeconds, UtcMilliseconds)

65 ' Notify of the new time, adjusted to the local time zone

66 RaiseEvent DateTimeChanged(SatelliteTime.ToLocalTime)

67 End If

68 ' Do we have enough information to extract the current speed?

69 If Words(7) <> "" Then

70 ' Yes. Convert it into MPH

71 Dim Speed As Double = CType(Words(7), Double) * 1.150779

72 ' If we're over 55MPH then trigger a speed alarm!

73 If Speed > 55 Then RaiseEvent SpeedLimitReached()

74 ' Notify of the new speed

75 RaiseEvent SpeedReceived(Speed)

76 End If

77 ' Do we have enough information to extract bearing?

78 If Words(8) <> "" Then

79 ' Indicate that the sentence was recognized

80 Dim Bearing As Double = CType(Words(8), Double)

81 RaiseEvent BearingReceived(Bearing)

82 End If

83 ' Indicate that the sentence was recognized

84 Return True

85 End Function

86 ' Returns True if a sentence's checksum matches the calculated checksum

87 Public Function IsValid(ByVal sentence As String) As Boolean

88 ' Compare the characters after the asterisk to the calculation

89 Return sentence.Substring(sentence.IndexOf("*") + 1) = _

90 GetChecksum(sentence)

91 End Function

92 ' Calculates the checksum for a sentence

93 Public Function GetChecksum(ByVal sentence As String) As String

94 ' Loop through all chars to get a checksum

95 Dim Character As Char

96 Dim Checksum As Integer

97 For Each Character In sentence

98 Select Case Character

99 Case "$"c

100 ' Ignore the dollar sign

上一页  6 7 8 9 10 11 12 13 14 15 16  下一页

Tags:WM 平台 开发

编辑录入:coldstar [复制链接] [打 印]
赞助商链接