Révision 40
Ajouté par Awa Semou FAYE il y a environ 3 ans
main.c | ||
---|---|---|
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include <strings.h>
|
||
#include "trame.h"
|
||
#include "trame.h"
|
||
#define max 10
|
||
|
||
//Trames de tests ? modifier si n?cessaire.
|
||
char * trames[]= {"$GPGSV,3,2,10,15,03,077,,18,04,041,42,19,85,271,,20,08,214,*7C",
|
||
... | ... | |
"$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* trame, char* type)
|
||
{
|
||
int N=max,i;
|
||
int ok;
|
||
ok=0|1;
|
||
for (i=0;i<=N;i++)
|
||
{
|
||
if (trame[i+1]=type[i])
|
||
{
|
||
ok=1;
|
||
|
||
}else
|
||
{
|
||
ok=0;
|
||
}
|
||
}
|
||
return ok;
|
||
}
|
||
|
||
/*int decode_int(char c)
|
||
{
|
||
int chiffre ;
|
||
if ( c <= '9' && c >='0' )
|
||
{
|
||
chiffre =c-48;
|
||
|
||
|
||
}else
|
||
{
|
||
chiffre=-1;
|
||
|
||
}
|
||
return chiffre;
|
||
|
||
}*/
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
|
||
static int cpt=0;
|
||
cpt++;
|
||
|
||
int ok;
|
||
if(ok==1)
|
||
{
|
||
printf("La trame commence par la chaine de caracteres type \n");
|
||
|
||
}else
|
||
{
|
||
printf("La trame ne commence pas par la chaine de caracteres type \n");
|
||
}
|
||
}
|
||
|
||
//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);
|
||
}*/
|
||
}
|
||
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
||
... | ... | |
while ((trame = trame_suivante()))
|
||
traitement(trame);
|
||
|
||
return 0;
|
||
return 0;
|
||
}
|
Formats disponibles : Unified diff
implantation des codes trame_cmp et decode_int