Salam
Il y'a mieux mais
diffcilement plus simple! T'ajoute un contrôle MsComm32, un timer puis
kekchose dans ce genre: (réception des données sur le port com, parsing
puis envoi sur un serveur, mais ça aurait tout ussi bien être un
fichier texte ou autre)
faut ajouter le fichier dll du parser au projet, dispo sur le net)
Option Explicit
Dim CountTimerServer
Dim StatusGPS As Boolean
Private objParser As New NmeaParser
Private Sub bStart_Click()
On Error GoTo error_handler
If bStart.Caption = "Start" Then
bStart.Caption = "Stop"
TimerGPS.Enabled = True
MSComm1.CommPort = 4 'port utilisé
MSComm1.Settings = "4800,N,8,1"
MSComm1.InputLen = 0
MSComm1.PortOpen = True
'Initialisation de la connexion avec le serveur
TimerServer.Enabled = True
lGpsStatus.Caption = "connection en cours..."
Else
bStart.Caption = "Start"
TimerGPS.Enabled = False
Clear
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
StatusGPS = False
lGpsStatus.Caption = "Dispositif GPS non connecté..."
lServerStatus.Caption = "Serveur non connecté..."
tcpClient.Close
CmdServerUpdate.Enabled = False
End If
Exit Sub
error_handler:
MsgBox Err.Number & ", " & Err.Description
End Sub
Private Sub CmdEnd_Click()
End
End Sub
Private Sub CmdServerUpdate_Click()
SendDataToServer "Upd:0#" & txtLatitude.Text & "#" &
txtLongitude.Text & "#" & txtAltSea.Text & "#" &
txt_N_S.Text & "#" & txt_E_W.Text & "#" & TxtInfo.Text
End Sub
Private Sub Form_Load()
CountTimerServer = 0
End Sub
Private Sub Form_Terminate()
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
End If
End Sub
Sub Clear()
txtLatitude = "0"
txtLongitude = "0"
txtAltSea = "0"
txt_N_S = ""
txt_E_W = ""
End Sub
Private Sub TimerGPS_Timer()
Get_Process_Data
End Sub
Sub Get_Process_Data()
On Error GoTo error_handler
objParser.Distance = 0
objParser.ValidateK = "NMEADll"
objParser.ProcessData CStr(MSComm1.Input)
If objParser.GPS_STATE = False Then
txtLatitude.Text = "0"
txtLongitude.Text = "0"
txtAltSea.Text = "0"
txt_N_S.Text = ""
txt_E_W.Text = ""
lGpsStatus.Caption = "le
dispositif GPS est connecté, mais ne recoit pas de signal des
satellites ..."
CmdServerUpdate.Enabled = False
Else
txtLatitude.Text = objParser.GGA_LATITUDE
txtLongitude.Text = objParser.GGA_LONGITUDE
txtAltSea.Text = objParser.GGA_ALTITUDE
txt_N_S.Text = objParser.GGA_N_S
txt_E_W.Text = objParser.GGA_E_W
lGpsStatus.Caption = "le dispositif GPS est connecté..."
If tcpClient.State = 7 Then CmdServerUpdate.Enabled = True
End If
Exit Sub
error_handler:
MsgBox Err.Number & ", " & Err.Description
bStart = True 'ferme tout
End Sub
Bonne chance et bon courage

/*Peace*/