1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161
| Private Sub BoutonStart_Click()
Dim i As Integer
Dim Index As Integer
Dim crlf As String
BoutonStop.Enabled = True
BoutonStart.Enabled = False
Ouverture_Port_COM (1)
Ouverture_Port_COM (2)
'If Option1.Enabled = True Then
' CommandeTETRA = "at+cci?" & vbCr
' Comm(2).Output = CommandeTETRA & vbCr
' Label26.Caption = CommandeTETRA
'' Call Envoi_Port_COM(CommandeTETRA, 2)
'
'ElseIf Option2.Enabled = True Then
' CommandeTETRA = "at+cci?"
' Comm(2).Output = CommandeTETRA & vbCr
' Label26.Caption = CommandeTETRA
'' Call Envoi_Port_COM(CommandeTETRA, 2)
'End If
Call Comm_OnComm(Index)
'Call TraitementTETRA(TmpChaineTETRA, CommandeTETRA)
End Sub
Private Sub TraitementGPS(TmpChaineGPS)
Dim i As Integer
Dim j As Integer
Dim tmp As String
Dim degres As String
Dim minutes As String
i = InStr(TmpChaineGPS, "GPRMC")
On Error Resume Next
Comm(1).InputLen = 0
TmpChaineGPS = TmpChaineGPS & Comm(1).Input
Text1.Text = Text1.Text & TmpChaineGPS
If Split(TmpChaineGPS, ",")(2) = "A" Then
Latitude = Split(TmpChaineGPS, ",")(4) & " " & Split(Split(TmpChaineGPS, ",")(3), ".")(0) & "'" & Split(Split(TmpChaineGPS, ",")(3), ".")(1)
tmp = Split(Split(TmpChaineGPS, ",")(3), ".")(0)
Longitude = Split(TmpChaineGPS, ",")(6) & " " & Split(Split(TmpChaineGPS, ",")(5), ".")(0) & "'" & Split(Split(TmpChaineGPS, ",")(5), ".")(1)
Heure = Mid(Split(TmpChaineGPS, ",")(1), i - 1, 2) & ":" & Mid(Split(TmpChaineGPS, ",")(1), i + 1, 2) & ":" & Mid(Split(TmpChaineGPS, ",")(1), i + 3, 2)
Label24.ForeColor = VERT
Label25.ForeColor = VERT
Label21.ForeColor = VERT
Label24.Caption = Latitude
Label21.Caption = Longitude
Label25.Caption = Heure
' NumPortTETRA = Port(0).Text
Label29.Caption = NumPortTETRA
ElseIf Split(TmpChaineGPS, ",")(2) = "V" Then
Heure = Mid(Split(TmpChaineGPS, ",")(1), i - 1, 2) & ":" & Mid(Split(TmpChaineGPS, ",")(1), i + 1, 2) & ":" & Mid(Split(TmpChaineGPS, ",")(1), i + 3, 2)
'Latitude = Split(TmpChaineGPS, ",")(4) & " " & Split(Split(TmpChaineGPS, ",")(3), ".")(0) & "'" & Split(Split(TmpChaineGPS, ",")(3), ".")(1)
tmp = Split(Split(TmpChaineGPS, ",")(3), ".")(0)
minutes = Right(tmp, 2)
degres = Left(tmp, 2)
Latitude = Math.Round(degres + minutes / 60, 6)
'Longitude = Split(TmpChaineGPS, ",")(6) & " " & Split(Split(TmpChaineGPS, ",")(5), ".")(0) & "'" & Split(Split(TmpChaineGPS, ",")(5), ".")(1)
tmp = Split(Split(TmpChaineGPS, ",")(5), ".")(0)
minutes = Right(tmp, 2)
degres = Left(tmp, 3)
Longitude = Math.Round(degres + minutes / 60, 7)
Label24.ForeColor = ROUGE
Label21.ForeColor = ROUGE
Label25.ForeColor = ROUGE
Label25.Caption = Heure
Label24.Caption = Latitude
Label21.Caption = Longitude
' NumPortTETRA = Port(0).Text
Label28.Caption = NumPortGPS
Print #1, Heure & "; " & Longitude & "; " & Latitude
End If
End Sub
Private Sub TraitementTETRA(TmpChaineTETRA, CommandeTETRA)
Dim j As Integer
Dim ChaineTETRA As String
j = InStr(TmpChaineTETRA, "CCI")
'ChaineTETRA = TmpChaineTETRA & Comm(2).Input
On Error Resume Next
Comm(2).InputLen = 0
TmpChaineTETRA = Comm(2).Input
Text2.Text = Text2.Text & TmpChaineTETRA
Label26.Caption = CommandeTETRA
MNI = Split(TmpChaineTETRA, ",")(0)
MNI = Right(MNI, 7)
Label32 = MNI
RSSI = Split(TmpChaineTETRA, ",")(1)
Label30 = RSSI
'If TmpChaineTETRA.Contains("CCI") Then
' CCI = Split(TmpChaineTETRA, ",")
' MNI = TmpChaineTETRA
' Label42.Caption = MNI
' RSSI = Split(TmpChaineTETRA, ",")(1)
' Label31.Caption = RSSI
' Serveur = Split(TmpChaineTETRA, ",")(2)
' Label32.Caption = MNI
' MNI = Split(TmpChaineTETRA, ",")(3)
' Label33.Caption = MNI
' LA = Split(TmpChaineTETRA, ",")(4)
' Label34.Caption = LA
' MNI = Split(TmpChaineTETRA, ",")(5)
' Label35.Caption = MNI
' C1 = Split(TmpChaineTETRA, ",")(6)
' Label36.Caption = C1
'End If
End Sub
Private Sub BoutonStop_Click()
BoutonStop.Enabled = False
BoutonStart.Enabled = True
Call Fermeture_Port_COM(1)
Call Fermeture_Port_COM(2)
End Sub
Private Sub Comm_OnComm(Index As Integer)
Dim InBuff As String
Comm(2).OutBufferCount = 0
Comm(2).Output = CommandeTETRA & vbCr
Select Case Comm(1).CommEvent
Case comEvReceive
TmpChaineGPS = Comm(1).Input
Call TraitementGPS(TmpChaineGPS) 'traitement données
End Select
Select Case Comm(2).CommEvent
Case comEvSend
Comm(2).Output = CommandeTETRA
CommandeTETRA = "at+cci?" & vbCr
Case comEvReceive
TmpChaineTETRA = Comm(2).Input
Call TraitementTETRA(TmpChaineTETRA, CommandeTETRA)
End Select
End Sub |
Partager