在 WM 平台上开发 GPS 导航系统
2010-02-21 22:52:00 来源:WEB开发网127 If Words(Count * 4) <> "" And Words(Count * 4 + 1) <> "" _
128 And Words(Count * 4 + 2) <> "" And Words(Count * 4 + 3) <> "" Then
129 ' Yes. Extract satellite information and report it
130 PseudoRandomCode = CType(Words(Count * 4), Integer)
131 Elevation = CType(Words(Count * 4 + 1), Integer)
132 Azimuth = CType(Words(Count * 4 + 2), Integer)
133 SignalToNoiseRatio = CType(Words(Count * 4 + 2), Integer)
134 ' Notify of this satellite's information
135 RaiseEvent SatelliteReceived(PseudoRandomCode, Azimuth, Elevation, _
136 SignalToNoiseRatio)
137 End If
138 End If
139 Next
140 ' Indicate that the sentence was recognized
141 Return True
142 End Function
143 ' Returns True if a sentence's checksum matches the calculated checksum
144 Public Function IsValid(ByVal sentence As String) As Boolean
145 ' Compare the characters after the asterisk to the calculation
146 Return sentence.Substring(sentence.IndexOf("*") + 1) = GetChecksum(sentence)
147 End Function
148 ' Calculates the checksum for a sentence
149 Public Function GetChecksum(ByVal sentence As String) As String
150 ' Loop through all chars to get a checksum
151 Dim Character As Char
152 Dim Checksum As Integer
153 For Each Character In sentence
154 Select Case Character
155 Case "$"c
156 ' Ignore the dollar sign
157 Case "*"c
158 ' Stop processing before the asterisk
159 Exit For
160 Case Else
161 ' Is this the first value for the checksum?
162 If Checksum = 0 Then
163 ' Yes. Set the checksum to the value
164 Checksum = Convert.ToByte(Character)
- ››开发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性能优化的一些经验
更多精彩
赞助商链接