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

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

 2010-02-21 22:52:00 来源:WEB开发网   
核心提示:information?127 If Words(Count * 4) <> "" And Words(Count * 4 + 1) <> "" _128 And Words(Count * 4 + 2) <> "" And
information?

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)

上一页  20 21 22 23 24 25 26  下一页

Tags:WM 平台 开发

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