Révision 178
Ajouté par Ely SENE il y a environ 3 ans
branch/ely_sene/sp4a12/main.c | ||
---|---|---|
"$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39",
|
||
"$GPVTG,99.4,T,,M,0.4,N,0.7,K*57",
|
||
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
0};
|
||
|
||
//fonction comparant les trames
|
||
int trame_cmp(char*trame,char*type)
|
||
{
|
||
int i=0 , j=0, comp=0; //comparateur
|
||
while(type[i]!='\0')
|
||
{
|
||
i++;
|
||
}
|
||
while(j<1)
|
||
{
|
||
if(trame[j+1]!=type[j])
|
||
{
|
||
comp=0;
|
||
}
|
||
j++;
|
||
}
|
||
return comp;
|
||
}
|
||
|
||
//fonction qui retourne l'entier correspondant au caractere mis en argument. (le caract?re '1' retourne l'entier 1)
|
||
int decode_int (char c)
|
||
{
|
||
int i=0;
|
||
if ((c>=48)&&(c<=57))
|
||
{
|
||
i=c-48;
|
||
}
|
||
else
|
||
{
|
||
(i=-1);
|
||
}
|
||
return i;
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
static int cpt=0;
|
||
cpt++;
|
||
printf ("> %s\n",trames[4]);
|
||
cpt++;
|
||
if(trame_cmp(trame,"GPGGA")) //n'affiche que la trame GPGGA
|
||
printf ("> %s\n",trame);
|
||
}
|
||
|
||
int trame_cmp(char*trame, char*type)
|
||
... | ... | |
if (trame_cmp("$GPZDA suite chaine","GPZDA")!=1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if ((decode_int('0')!=0)||(decode_int('9')!=9)||(decode_int('A')!=-1)) //fonction test decode_int
|
||
{
|
||
printf ("Erreur Test unitaire decode_int.\n");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
Formats disponibles : Unified diff
modification du programme pour qu'il n'affiche que les trames GPGGA, Implanter la fonction decode_int()