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

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

 2010-02-21 22:52:00 来源:WEB开发网   
核心提示:53 ' Do we have enough values to parse satellite-derived time?54 If Words(1) <> "" Then55 ' Yes. Extract hours, minutes, seconds and mil

53 ' Do we have enough values to parse satellite-derived time?

54 If Words(1) <> "" Then

55 ' Yes. Extract hours, minutes, seconds and milliseconds

56 Dim UtcHours As Integer = CType(Words(1).Substring(0, 2), Integer)

57 Dim UtcMinutes As Integer = CType(Words(1).Substring(2, 2), Integer)

58 Dim UtcSeconds As Integer = CType(Words(1).Substring(4, 2), Integer)

59 Dim UtcMilliseconds As Integer

60 ' Extract milliseconds if it is available

61 If Words(1).Length > 7 Then UtcMilliseconds = _

62 CType(Single.Parse(Words(1).Substring(6), _

63 CultureInfo.InvariantCulture) * 1000, Integer)

64 ' Now build a DateTime object with all values

65 Dim Today As DateTime = System.DateTime.Now.ToUniversalTime

66 Dim SatelliteTime As New System.DateTime(Today.Year, Today.Month, _

67 Today.Day, UtcHours, UtcMinutes, UtcSeconds, UtcMilliseconds)

68 ' Notify of the new time, adjusted to the local time zone

69 RaiseEvent DateTimeChanged(SatelliteTime.ToLocalTime)

70 End If

71 ' Do we have enough information to extract the current speed?

72 If Words(7) <> "" Then

73 ' Yes. Convert it into MPH

74 Dim Speed As Double = CType(Words(7), Double) * 1.150779

75 ' If we're over 55MPH then trigger a speed alarm!

76 If Speed > 55 Then RaiseEvent SpeedLimitReached()

77 ' Notify of the new speed

78 RaiseEvent SpeedReceived(Speed)

79 End If

80 ' Do we have enough information to extract bearing?

81 If Words(8) <> "" Then

82 ' Indicate that the sentence was recognized

83 Dim Bearing As Double = CType(Words(8), Double)

84 RaiseEvent BearingReceived(Bearing)

85 End If

86 ' Does the device currently have a satellite fix?

上一页  9 10 11 12 13 14 15 16 17 18 19  下一页

Tags:WM 平台 开发

编辑录入:coldstar [复制链接] [打 印]
[]
  • 好
  • 好的评价 如果觉得好,就请您
      0%(0)
  • 差
  • 差的评价 如果觉得差,就请您
      0%(0)
赞助商链接