Révision 102
Ajouté par Khalid YAZID il y a environ 3 ans
branch/yazid/sp4a12/main.c | ||
---|---|---|
"$GPVTG,99.4,T,,M,0.4,N,0.7,K*57",
|
||
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
static int cpt=0 ;
|
||
cpt++ ;
|
||
int b=trame_cmp(trame,"GPGGA");
|
||
if (b==1){
|
||
printf ("> %s\n",trame);
|
||
}
|
||
}
|
||
int trame_cmp(char *trame , char *type){
|
||
int i;
|
||
int test=1;
|
||
... | ... | |
int T[]= {0,1,2,3,4,5,6,7,9,8};
|
||
for(i=0;i<10;i++){
|
||
s=0;
|
||
for(j=0;j<10;j++){
|
||
if (decode_int(C[i])!=-1 ){
|
||
for(j=0;j<10;j++){
|
||
if (decode_int(*C[i])==T[j]){
|
||
s=1;
|
||
}
|
||
}
|
||
if (s!=1){
|
||
printf("ERREUR DECODE_INT.\n");
|
||
}
|
||
}}
|
||
|
||
}
|
||
}
|
||
int decode_nombre(char *ch,int n){
|
||
int i=0,x=strlen(ch);
|
||
char s;
|
||
for (i=0;i<n;i++){
|
||
int a=decode_int(ch[x-1-n-i]);
|
||
s=s+a*pow(10,i);
|
||
}
|
||
return s;
|
||
}
|
||
void traitement(char * trame)
|
||
{
|
||
|
||
static int cpt=0 ;
|
||
cpt++ ;
|
||
int b=trame_cmp(trame,"GPGGA");
|
||
if (b==1){
|
||
printf ("> %s\n",trame);
|
||
}
|
||
}
|
||
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
if (5!=5){
|
||
... | ... | |
exit(-1);
|
||
}
|
||
test_decode_int();
|
||
int y=decode_nombre("7541",3);
|
||
printf("la valeur de dedcod_nombre est%d",y);
|
||
|
||
/* if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
Formats disponibles : Unified diff
Implantation de la fonction decode_nombre() et un test unitaire test_decode_nombre()
de decode_nombre().