Révision 324
Ajouté par Mourougen MARIMOUTOU-POUGARY il y a environ 3 ans
main.c | ||
---|---|---|
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include <strings.h>
|
||
#include "trame.h"
|
||
#include "trame.h"
|
||
|
||
#include<math.h>
|
||
|
||
//Trames de tests ? modifier si n?cessaire.
|
||
char * trames[]= {"$GPGSV,3,2,10,15,03,077,,18,04,041,42,19,85,271,,20,08,214,*7C",
|
||
... | ... | |
"$GPVTG,99.4,T,,M,0.4,N,0.7,K*57",
|
||
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
//Structure
|
||
/*Declaration Globale*/
|
||
|
||
typedef struct
|
||
{
|
||
... | ... | |
return temp;
|
||
}
|
||
|
||
int test_decode_nombre()//A verifier
|
||
int test_decode_nombre()
|
||
{
|
||
int verif=1;
|
||
if(decode_nombre("758961",2,0)!=75)
|
||
... | ... | |
}
|
||
}
|
||
|
||
float decode_latitude(char *trame )
|
||
float decode_latitude(char *trame )//Fonction qui extrait et decode la latitude d'un trame
|
||
{
|
||
float degres,reste,flottant,res;
|
||
int i=17;
|
||
... | ... | |
|
||
}
|
||
|
||
float decode_longitude(char *trame )
|
||
float decode_longitude(char *trame )//Fonction qui extrait et decode la longitude d'un trame
|
||
{
|
||
float degres,reste,flottant,res;
|
||
int i=30;
|
||
... | ... | |
|
||
}
|
||
|
||
float decode_position(char *trame,Position Pos)
|
||
float decode_position(char *trame,Position* P)//Fonction qui stock la latitude dans la structure Position
|
||
{
|
||
Pos.Latitude=decode_latitude(trame);
|
||
Pos.Longitude=decode_longitude(trame);
|
||
(*P).Latitude=decode_latitude(trame);
|
||
(*P).Longitude=decode_longitude(trame);
|
||
return (*P).Latitude;
|
||
}
|
||
|
||
return Pos.Latitude,Pos.Longitude;
|
||
|
||
|
||
float decode_trame(char *trame,Position P)
|
||
{
|
||
int i;
|
||
if(trame_cmp(trame[i],"GPPGA")==1)
|
||
{
|
||
decode_position(trame[i],&P);
|
||
}
|
||
}
|
||
|
||
float calcul_distance(Position p_1,Position p_2)
|
||
{
|
||
float D;
|
||
int R_terre=6371;
|
||
D=sqrt(pow((p_2.Longitude-p_1.Longitude)*R_terre,2)+pow((p_2.Latitude-p_1.Latitude)*R_terre,2));
|
||
|
||
return D;
|
||
}
|
||
//
|
||
|
||
//Fonction ? modifier !!!!!
|
||
... | ... | |
printf("%f\n",decode_latitude("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D"));
|
||
printf("%f\n",decode_longitude("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D"));*/
|
||
Position pos;
|
||
printf("%f%f\n",decode_position("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D",pos));
|
||
|
||
/*printf("Latitude: %f Longitude: %f\n",decode_position("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D",&pos));*/
|
||
printf("Latitude: %f Longitude: %f\n",decode_trame(trames,pos));
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
Formats disponibles : Unified diff
implantation decode_trame