Révision 637
Ajouté par jcguifodjo il y a presque 4 ans
main.c | ||
---|---|---|
|
||
i++;
|
||
}
|
||
if(i==9){
|
||
if(i==8){
|
||
deg_lat=decode_nombre(c,2);
|
||
deg_lat+=(c[2]-'0')*1/6;
|
||
deg_lat+=(c[3]-'0')*1/60;
|
||
... | ... | |
}
|
||
return deg_lat;
|
||
}
|
||
if(i==10){
|
||
if(i==9){
|
||
|
||
deg_long=decode_nombre(c,3);
|
||
deg_long+=(c[3]-'0')*1/6;
|
||
... | ... | |
|
||
|
||
//Decodage d'une trame
|
||
int decode_trame(char *trame, Position p)
|
||
void decode_trame(char *trame, Position* p)
|
||
{
|
||
int i,j,d;
|
||
char lat[N],lon[N],indx_lat[]={'0','\0'},indx_lon[]={'0','\0'};
|
||
... | ... | |
}
|
||
indx_lat[0]=trame[27];
|
||
indx_lon[0]=trame[40];
|
||
p.latitude= conversion(lat);
|
||
p.longitude=conversion(lon);
|
||
(*p).latitude= conversion(lat);
|
||
(*p).longitude=conversion(lon);
|
||
|
||
if(indx_lat[0]=='S'){
|
||
p.latitude=-p.latitude;
|
||
(*p).latitude=-(*p).latitude;
|
||
}
|
||
|
||
if(indx_lon[0]=='W'){
|
||
p.longitude=-p.longitude;
|
||
(*p).longitude=-(*p).longitude;
|
||
|
||
}
|
||
}
|
||
else{
|
||
d=0;
|
||
|
||
}
|
||
return d;
|
||
printf("\nTrames: %s", trame);
|
||
printf("\nLatitude: %2.2f", (*p).latitude);
|
||
printf("\nLongitude: %2.2f", (*p).longitude);
|
||
|
||
}
|
||
|
||
//Fonction qui calcule la distance entre deux positions
|
||
... | ... | |
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
Position p;
|
||
int d;
|
||
static int cpt=0 ;
|
||
cpt++ ;
|
||
if (trame_cmp(trame,"GPGGA")==1)
|
||
{
|
||
d=decode_trame(trame,Position p);
|
||
printf ("d= %d",d);
|
||
decode_trame(trame, &p);
|
||
|
||
|
||
}
|
||
|
||
}
|
||
... | ... | |
exit(-1);
|
||
// Affichage des trames du fichier gps.log
|
||
char *trame;
|
||
printf ("Trames de tests du fichier gps.log\n");
|
||
printf ("\nTrames de tests du fichier gps.log\n");
|
||
while ((trame = trame_suivante()))
|
||
traitement(trame);
|
||
|
Formats disponibles : Unified diff
Implémentation de la fonction decode trame