Révision 369
Ajouté par Rayan REZKI il y a presque 3 ans
branch/REZKI/sp4a12/main.c | ||
---|---|---|
#define PI 3.14159265
|
||
|
||
typedef struct {
|
||
float latitude;
|
||
float longitude;
|
||
float latitud;
|
||
float longitud;
|
||
}position;
|
||
|
||
typedef struct {
|
||
... | ... | |
return res;
|
||
}
|
||
|
||
decode_trame(char *ch, position *p)
|
||
/*
|
||
struct position decode_trame(char *ch, float latitud, float longitud)
|
||
{
|
||
p->latitude = latitude(ch);
|
||
p->longitude = longitude(ch);
|
||
position pos;
|
||
pos.latitud=latitude(ch);
|
||
pos.longitud=longitude(ch);
|
||
return pos;
|
||
}
|
||
*/
|
||
|
||
float decode_trame_latitude(char *ch)
|
||
{
|
||
... | ... | |
static int cpt=0;
|
||
cpt++;
|
||
if(trame_cmp(trame,"GPGGA")==1)//verifie le bon format de la trame
|
||
printf ("> %s\n",trame);
|
||
{
|
||
printf("> %s\n",trame);
|
||
printf("La latitude est %f.\nLa longitude est %f.\n",decode_trame_latitude(trame),decode_trame_longitude(trame));
|
||
}
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
... | ... | |
exit(-1);
|
||
}
|
||
// pr?cise ? 10e-6 pr?s car 2 floattants ne peuvent pas ?tre compar?s directement
|
||
if((fabs(latitude("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D"))-45.75) > 10e-6)
|
||
if(fabs(latitude("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D")-45.75) > 1e-6)
|
||
{
|
||
printf ("Erreur Test unitaire latitude.\n");
|
||
exit(-1);
|
||
}
|
||
if((fabs(longitude("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D"))-3.11006) > 10e-6)
|
||
if(fabs(longitude("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D")-3.11006) > 10e-6)
|
||
{
|
||
printf ("Erreur Test unitaire longitude.\n");
|
||
exit(-1);
|
||
}
|
||
if ((fabs(decode_trame_longitude("$GPGGA,141914.00,4645.5624,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D")-46.759373) > 10e-6)
|
||
&& fabs(decode_trame_latitude("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D")-3.11006) > 10e-6)
|
||
{
|
||
|
||
}
|
||
}
|
||
|
||
|
Formats disponibles : Unified diff
TP2: Q3 terminée