Révision 213
Ajouté par gasacco il y a presque 4 ans
branch/sacco/sp4a12/main.c | ||
---|---|---|
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
|
||
typedef struct
|
||
{
|
||
float latitude;
|
||
float longitude;
|
||
} Position;
|
||
|
||
typedef struct
|
||
{
|
||
Position rpos;
|
||
float vitmax;
|
||
}Zone;
|
||
|
||
|
||
int decode_int(char c)
|
||
{
|
||
unsigned int ValDecimale;
|
||
... | ... | |
}
|
||
return 1;
|
||
}
|
||
|
||
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
... | ... | |
float conversion(char * coord)
|
||
{
|
||
int i=0;
|
||
Position P;
|
||
while (coord[i]!='.')
|
||
{
|
||
i=i+1;
|
||
... | ... | |
}
|
||
if (i==4)
|
||
{
|
||
return conversion_Latitude_sexa_dec(coord);
|
||
P.latitude = conversion_Latitude_sexa_dec(coord);
|
||
return P.latitude;
|
||
}
|
||
else if (i==5)
|
||
{
|
||
return conversion_Long_sexa_dec(coord);
|
||
P.longitude = conversion_Long_sexa_dec(coord);
|
||
return P.longitude;
|
||
|
||
}
|
||
else
|
||
... | ... | |
return -1;
|
||
}
|
||
}
|
||
|
||
int decode_trame( char *trame, Position *p)
|
||
{
|
||
if (trame_cmp(trame, "GPGGA"))
|
||
{
|
||
int nb_Virgule = 0;
|
||
int i =0;
|
||
int k;
|
||
int Lat[10];
|
||
int Long[12];
|
||
int debut_Lat;
|
||
int debut_Long;
|
||
|
||
while (trame[i] !='\0')
|
||
{
|
||
if (trame[i] = ',')
|
||
{
|
||
nb_Virgule += 1;
|
||
if (nb_Virgule ==2)
|
||
{
|
||
Lat[i+1] = trame[i+1];
|
||
p->latitude = conversion(Lat);
|
||
}
|
||
if (nb_Virgule == 4)
|
||
{
|
||
Long[i+1] = trame[i+1];
|
||
p->longitude = conversion(Long);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
return -1;
|
||
}
|
||
printf("Latitude= %f , Longitude = %f\n", p->latitude, p->longitude);
|
||
}
|
||
|
||
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
Formats disponibles : Unified diff
Codage de decode_trame (pas totalement fini)