Révision 167
Ajouté par Domingos Joao BRAVO il y a environ 3 ans
branch/BRAVO/sp4a12/main.c | ||
---|---|---|
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
|
||
/*void ma_fonction(){
|
||
|
||
}
|
||
void decode_trame(char * tr){
|
||
//implanter une partie de votre code ICI.
|
||
Appel de ma_fonction() ;
|
||
}
|
||
void traitement (char * trame){
|
||
//implanter une partie de votre code ICI par exemple :
|
||
printf (?%s \n ?,trame) ;
|
||
decode_trame(trame,) ;
|
||
printf ?
|
||
}
|
||
*/
|
||
|
||
int trame_cmp(char * trame, char * type)
|
||
{
|
||
int i=0, ok;
|
||
int i=0, ok=1;
|
||
|
||
do
|
||
for(i=0;i<6;i++)
|
||
{
|
||
if(trame[i+1]!=type[i])
|
||
if(trame[i+1] !=type[i])
|
||
{
|
||
i++;
|
||
ok=0;
|
||
}
|
||
else
|
||
{
|
||
ok=1;
|
||
}
|
||
}
|
||
|
||
while(trame[i]==type[i] && (trame[i]!='\0'));
|
||
|
||
if(trame[i]=='\0')
|
||
{
|
||
ok=1;
|
||
}
|
||
else{
|
||
ok=0;
|
||
}
|
||
|
||
|
||
return ok;
|
||
}
|
||
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
... | ... | |
static int cpt=0 ;
|
||
cpt++ ;
|
||
|
||
printf ("> %s\n",trame);
|
||
/* if(trame_cmp("$GPGGA suite chaine","GPGGA"))
|
||
{
|
||
|
||
}*/
|
||
printf ("> %s\n",trame);
|
||
|
||
|
||
}
|
||
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
... | ... | |
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
int decode_int(char c)
|
||
{
|
||
if(c>='0' && (c<='9'))
|
||
{
|
||
c=c-48;
|
||
}
|
||
else
|
||
{
|
||
if((c>='A') && c<='Z')
|
||
{
|
||
c=64-c;
|
||
}
|
||
}
|
||
return c;
|
||
}
|
||
void test_decode_int(void)
|
||
{
|
||
if (decode_int('0')!=0){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('1')!=1){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('2')!=2){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('3')!=3){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('4')!=4){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('5')!=5){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('6')!=6){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('7')!=7){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('8')!=8){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
if (decode_int('9')!=9){
|
||
printf("Erreur test decode_int.\n");
|
||
}
|
||
}
|
||
|
||
int decode_nombre(char *ch, int n)
|
||
{
|
||
int temp=0, i;
|
||
|
||
for(i=0;i<n;i++)
|
||
{
|
||
temp=(temp*10) + decode_int(ch[i]);
|
||
}
|
||
return temp;
|
||
}
|
||
|
||
void test_decode_nombre(void)
|
||
{
|
||
if(decode_nombre('')!=){
|
||
|
||
printf("Erreur test decode_nombre.\n");
|
||
}
|
||
}
|
||
|
||
float convert_lat_flot(char *latitude)
|
||
{
|
||
float lat;
|
||
lat= (float)(latitude);
|
||
|
||
return lat;
|
||
}
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
||
{
|
Formats disponibles : Unified diff
Implantation de la fonction decode_nombre