Révision 318
Ajouté par Erwan DESFRICHES DORIA il y a presque 3 ans
main.c | ||
---|---|---|
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include <strings.h>
|
||
#include "trame.h"
|
||
#include "trame.h"
|
||
#include <math.h>
|
||
typedef struct{
|
||
float latitude;
|
||
float longitude;
|
||
... | ... | |
|
||
return test;
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame){
|
||
static int cpt=0;
|
||
cpt++;
|
||
|
||
if (trame_cmp(trame,"GPGGA")==1){
|
||
printf ("> %s\n",trame);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
int decode_int(char c){
|
||
int res;
|
||
|
||
... | ... | |
return resDecodeLong;
|
||
}
|
||
|
||
Position decode_position(char *trame)
|
||
{
|
||
Position decode_position(char *trame){
|
||
Position p;
|
||
|
||
p.latitude = decode_latitude(trame);
|
||
... | ... | |
return p;
|
||
}
|
||
|
||
Position decode_trame(char *trame)
|
||
{
|
||
Position decode_trame(char *trame){
|
||
Position pos;
|
||
|
||
if (trame_cmp(trame,"GPGGA")==1)
|
||
... | ... | |
}
|
||
return pos;
|
||
}
|
||
|
||
float calcul_distance(Position p_1, Position p_2){
|
||
float x;
|
||
float y;
|
||
float d;
|
||
x = sin(abs(p_2.latitude - p_1.latitude));
|
||
y = sin(abs(p_2.longitude - p_1.longitude));
|
||
d = sqrt(x*x+y*y);
|
||
}
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame){
|
||
static int cpt=0;
|
||
cpt++;
|
||
|
||
if (trame_cmp(trame,"GPGGA")==1){
|
||
printf ("> %s\n",trame);
|
||
printf("> latitude : %.16f\n", decode_trame(trame).latitude);
|
||
printf("> longitude : %.16f\n", decode_trame(trame).longitude);
|
||
}
|
||
}
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
... | ... | |
|
||
test_decode_longitude();
|
||
|
||
test_decode_position();
|
||
test_decode_position();
|
||
|
||
test_decode_trame();
|
||
}
|
||
|
||
void test_decode_int(void){
|
Formats disponibles : Unified diff
mise en œuvre de la fonction calcul_distance.