Révision 104
Ajouté par Clara SOULARD il y a environ 3 ans
main.c | ||
---|---|---|
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include <strings.h>
|
||
#include "trame.h"
|
||
#include "trame.h"
|
||
|
||
|
||
//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",
|
||
"$GPGSV,3,3,10,22,39,053,50,28,15,320,*7E",
|
||
... | ... | |
int c=0;
|
||
int i;
|
||
for (i=0; i<=n-1; i++){
|
||
|
||
a=decode_int(ch[i]);
|
||
c=c*10+a;
|
||
}
|
||
printf("%d",c);
|
||
return c;
|
||
}
|
||
|
||
float convertisseur_latitude (char *ch)
|
||
{
|
||
float lat;
|
||
|
||
float decimal=0.0;
|
||
float decimal1=0.0;
|
||
float decimal2=0.0;
|
||
float dec=0.0;
|
||
float a=0.0;
|
||
int b;
|
||
int i;
|
||
a=(float)(decode_nombre(ch, 4));
|
||
float degres=(float)(decode_nombre(*ch,2));
|
||
decimal1=(a-degres);
|
||
for(i=5; i<=8; i++)
|
||
{
|
||
b=decode_int(ch[i]);
|
||
decimal2=decimal2*10+b;
|
||
|
||
}
|
||
decimal=(float)((decimal1 + ((float)(decimal2)/10000))/60);
|
||
lat=degres+decimal;
|
||
return lat;
|
||
}
|
||
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
... | ... | |
static int cpt=0;
|
||
cpt++;
|
||
|
||
if((trame[5]==65) && (trame[4]==71)&&(trame[3]==71))
|
||
if((trame[5]==65)&&(trame[4]==71)&&(trame[3]==71))
|
||
{
|
||
printf ("> %s\n",trame);
|
||
}
|
||
... | ... | |
if(decode_int('4')!=4){
|
||
printf("Erreur 4 test unitaire decode_int.\n");
|
||
}
|
||
if(decode_nombre("789654",3)!=789){
|
||
/*if(decode_nombre("789654",3)!=789){
|
||
printf("Erreur sur decode_nombre.\n");
|
||
}
|
||
if(decode_nombre("789654",4)!=7896){
|
||
printf("Erreur sur decode_nombre.\n");
|
||
}
|
||
}*/
|
||
printf(" ?a donne : %f\n",convertisseur_latitude("3723.2475"));
|
||
|
||
}
|
||
|
Formats disponibles : Unified diff
question 8 pas totalement terminée