在 WM 平台上开发 GPS 导航系统
2010-02-21 22:52:00 来源:WEB开发网116 For Count = 1 To 4
117 ' Does the sentence have enough words to analyze?
118 If (Words.Length - 1) >= (Count * 4 + 3) Then
119 ' Yes. Proceed with analyzing the block. Does it contain any
120 ' information?
121 If Words(Count * 4) <> "" And Words(Count * 4 + 1) <> "" _
122 And Words(Count * 4 + 2) <> "" And Words(Count * 4 + 3) <> "" Then
123 ' Yes. Extract satellite information and report it
124 PseudoRandomCode = CType(Words(Count * 4), Integer)
125 Elevation = CType(Words(Count * 4 + 1), Integer)
126 Azimuth = CType(Words(Count * 4 + 2), Integer)
127 SignalToNoiseRatio = CType(Words(Count * 4 + 2), Integer)
128 ' Notify of this satellite's information
129 RaiseEvent SatelliteReceived(PseudoRandomCode, Azimuth, Elevation, _
130 SignalToNoiseRatio)
131 End If
132 End If
133 Next
134 ' Indicate that the sentence was recognized
135 Return True
136 End Function
137 ' Returns True if a sentence's checksum matches the calculated checksum
138 Public Function IsValid(ByVal sentence As String) As Boolean
139 ' Compare the characters after the asterisk to the calculation
140 Return sentence.Substring(sentence.IndexOf("*") + 1) = GetChecksum(sentence)
141 End Function
142 ' Calculates the checksum for a sentence
143 Public Function GetChecksum(ByVal sentence As String) As String
144 ' Loop through all chars to get a checksum
145 Dim Character As Char
146 Dim Checksum As Integer
147 For Each Character In sentence
148 Select Case Character
149 Case "$"c
150 ' Ignore the dollar sign
151 Case "*"c
152 ' Stop processing before the asterisk
- ››开发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性能优化的一些经验
更多精彩
赞助商链接