在 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 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
- ››开发Android 日历教程
- ››开发学院总结 Win 8实用技巧大全
- ››开发学院原创教程:把win8的IE10放桌面上方法(非...
- ››开发者眼中的Windows Phone和Android
- ››开发学院教你用SQL 语句最快速清空MySQL 数据表的...
- ››WM 无法连接到win 7及webservice的异类原因
- ››开发一个自己的HTML在线编辑器(一)
- ››开发一个自己的HTML在线编辑器(二)
- ››开发者在App Store上赚的钱比在Android Market上多...
- ››开发者应深入学习的10个Android开源应用项目
- ››WM/WP上最完美的背光控制软件
- ››WM性能优化的一些经验
更多精彩
赞助商链接