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

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

 2010-02-21 22:52:00 来源:WEB开发网   
核心提示:116 For Count = 1 To 4117 ' Does the sentence have enough words to analyze?118 If (Words.Length - 1) >= (Count * 4 + 3) Then119 ' Yes. Proceed with a

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

上一页  15 16 17 18 19 20 21 22 23 24 25  下一页

Tags:WM 平台 开发

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