Dialogue entre un Gps et un Pc

gul141 Messages postés 2 Date d'inscription samedi 4 janvier 2003 Statut Membre Dernière intervention 20 janvier 2003 - 5 janv. 2003 à 17:06
syxe_mpl Messages postés 58 Date d'inscription mercredi 15 décembre 2004 Statut Membre Dernière intervention 20 décembre 2010 - 1 févr. 2006 à 12:13
Bonjour,

JE suis en train de concevoir un petit prog aéronautique pour utiliser un GPS, mais je ne sais pas utiliser la Fonction Mscomm. Quelqu'un veut-il bien m'aider ?

D'avance Merci

Guillaume

ps : en fait je ne sais pas écouter le GPS qui envoie des infos sur com 1. Alors s'il y a miex que Mscomm...

2 réponses

abeking_mail Messages postés 13 Date d'inscription dimanche 22 mai 2005 Statut Membre Dernière intervention 20 janvier 2010
24 nov. 2005 à 09:28
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)

<hr size="2" width="100%">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

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

<hr size="2" width="100%">Bonne chance et bon courage

/*Peace*/
0
syxe_mpl Messages postés 58 Date d'inscription mercredi 15 décembre 2004 Statut Membre Dernière intervention 20 décembre 2010
1 févr. 2006 à 12:13
Salut,

tu es en VB6 ou sur VB net???
en fonction du language, je pourrai te répondre! je travaille principalement sur l'utilisation des ports comm.. donc..

PS: je développe aussi une appli (GPS) pour positionner des points sur une carte mais je galaire fortement pour le positionnement des points sur la carte à partir de coordonné GPS UTM ou WGS84.. si tu peux me donner des infos en passant je serai preneur !
A+
0
Rejoignez-nous