Révision 462
Ajouté par lefraisse il y a presque 4 ans
branch/FRAISSE/sp4a12/main.c | ||
---|---|---|
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
|
||
//Comparaison des trames avec le type choisi
|
||
int trame_cmp(char* trame,char* type){
|
||
int n=1,i;
|
||
for (i=0;i<4;i++){
|
||
... | ... | |
|
||
//renvoie la valeur d?cimale associ?e ? un caract?re donn?
|
||
int decode_int(char c){
|
||
int n=c-'0';
|
||
int n;
|
||
if ((0=<n)&&(9>=n)){
|
||
n=c-'0';
|
||
}
|
||
else
|
||
n=-1;
|
||
return n;
|
||
}
|
||
|
||
... | ... | |
}
|
||
|
||
//traite les trames GPGGA
|
||
void traitement(char * trame)
|
||
{
|
||
void traitement(char * trame){
|
||
static int cpt=0 ;
|
||
cpt++;
|
||
if (trame_cmp(trame,"GPGGA"))
|
||
printf ("> %s\n",trame);
|
||
}
|
||
|
||
//Structure d'une position GPS
|
||
typedef struct {
|
||
float latitude;
|
||
float longitude;
|
||
} Position ;
|
||
|
||
//Conversion de la latitude/longitude en sexagesimal vers les degr?s flottants
|
||
float conversion(char * ch){
|
||
int i=0,j;
|
||
float deglat,deglong;
|
||
... | ... | |
|
||
}
|
||
|
||
//Test pour d?coder la latitude et la longitude des trames "$GPGGA" en degr? d?cimaux
|
||
int decode_trame (char *trame,Position P){
|
||
int i,compteur_virgule=0,compteur_element=0,valide,virgule=0;
|
||
char memorisation_latitude[]={'0','0','0','0','0','0','0','0','\0'};
|
||
... | ... | |
return valide;
|
||
}
|
||
|
||
//Calcul de la distance entre deux positions GPS
|
||
float calcul_distance(Position p_1,Position p_2){
|
||
float r=6378.137;
|
||
return 2*r*asin(sqrt(pow(sin(pi/180*(p_1.latitude-p_2.latitude)/2),2)+cos(pi/180*p_1.latitude)*cos(pi/180*p_2.latitude)*pow(sin(pi/180*(p_1.longitude-p_2.longitude)/2),2)));
|
||
}
|
||
|
||
//Calcul de la vitesse entre 2 positions Gps
|
||
float calcul
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
branch/FRAISSE/sp4a12/sp4a.cbp | ||
---|---|---|
<Build>
|
||
<Target title="Debug">
|
||
<Option output="sp4a" prefix_auto="1" extension_auto="1" />
|
||
<Option object_output=".\debug" />
|
||
<Option object_output="./debug" />
|
||
<Option type="1" />
|
||
<Option compiler="gcc" />
|
||
<Compiler>
|
||
... | ... | |
<Compiler>
|
||
<Add option="-Wall" />
|
||
</Compiler>
|
||
<Unit filename="../../Untitled1.c">
|
||
<Option compilerVar="CC" />
|
||
</Unit>
|
||
<Unit filename="gps.log" />
|
||
<Unit filename="main.c">
|
||
<Option compilerVar="CC" />
|
||
... | ... | |
</Unit>
|
||
<Unit filename="trame.h" />
|
||
<Extensions>
|
||
<code_completion />
|
||
<envvars />
|
||
<debugger />
|
||
<lib_finder disable_auto="1" />
|
||
</Extensions>
|
||
</Project>
|
Formats disponibles : Unified diff