Révision 104
Ajouté par malameynar il y a plus de 4 ans
| 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};
|
||
|
|
||
|
int trame_cmp(char* a,char* b){
|
||
|
return 0;
|
||
|
int decode_int(char c)
|
||
|
{
|
||
|
int r=c-'0';
|
||
|
if (r>9){
|
||
|
r=-1;
|
||
|
}
|
||
|
|
||
|
return(r);
|
||
|
}
|
||
|
|
||
|
int trame_cmp(char * trame,char * type){
|
||
|
int i=0;
|
||
|
while(type[i]!='\0'){
|
||
|
if (type[i]!=trame[i+1]){
|
||
|
return(0);
|
||
|
}
|
||
|
i+=1;
|
||
|
}
|
||
|
return(1);
|
||
|
}
|
||
|
|
||
|
int decode_nombre(char *ch,int n){
|
||
|
int i;
|
||
|
int x=0;
|
||
|
for(i=0;i<n;i++){
|
||
|
|
||
|
x=x+decode_int(ch[i])*pow(10,n-1-i);
|
||
|
}
|
||
|
return(x);
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
//Fonction ? modifier !!!!!
|
||
|
void traitement(char * trame)
|
||
|
{
|
||
|
static int cpt=0 ;
|
||
|
cpt++ ;
|
||
|
printf ("> %s\n",trame);
|
||
|
cpt++ ;
|
||
|
if (trame_cmp(trame,"GPGGA")==1){
|
||
|
printf ("> %s\n",trame);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
//Ajouter vos tests unitaires dans cette fonction.
|
||
| ... | ... | |
|
printf ("Erreur Test unitaire basique.\n");
|
||
|
exit(-1);
|
||
|
}
|
||
|
/* if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
|
if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
|
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
|
exit(-1);
|
||
|
}
|
||
| ... | ... | |
|
if (trame_cmp("$APRMC...", "GPGGA")!=0){
|
||
|
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
|
exit(-1);
|
||
|
}*/
|
||
|
}
|
||
|
}
|
||
|
|
||
|
// Ne pas modifier cette fonction
|
||
Formats disponibles : Unified diff
condition sur l'affichage des trames dans la fonction traitement pour n'afficher que les GPGGA