Révision 646
Ajouté par yoguer il y a presque 4 ans
main.c | ||
---|---|---|
long longitude;
|
||
}position;
|
||
|
||
typedef struct
|
||
{
|
||
position rpos;
|
||
float vitmax;
|
||
} Zone;
|
||
|
||
Zone zones[2] = {{{26873220, -1807200}, 50}, {{26873460, -1807800}, 70}};
|
||
|
||
|
||
//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",
|
||
... | ... | |
|
||
void traitement_trame(char *trame, position *p1)
|
||
{
|
||
char tab_latitude[13],tab_longitude[14];
|
||
long i,j;
|
||
p1->latitude=conversion_sexa(&trame[17]);
|
||
p1->longitude=conversion_sexa(&trame[29]);
|
||
|
||
for(i=0;i<11;i++)
|
||
{
|
||
tab_latitude[i]=trame[i+17];
|
||
}
|
||
p1->latitude=conversion_sexa(tab_latitude);
|
||
|
||
for(j=0;j<12;j++)
|
||
{
|
||
tab_longitude[j]=trame[j+29];
|
||
}
|
||
p1->longitude=conversion_sexa(tab_longitude);
|
||
|
||
printf("> %s\n",trame);
|
||
}
|
||
|
||
|
||
long calcul_vitesse(position *p1, position *p2)
|
||
{
|
||
float distance, vitesse;
|
||
long distance, vitesse;
|
||
|
||
if((p2->latitude!=p1->latitude) || (p2->longitude!=p1->longitude))
|
||
{
|
||
... | ... | |
vitesse=distance*0.1852507138; //rayon de la terre * kradian = 0.1852507138 (vitesse en m/s)
|
||
vitesse=vitesse*3.6; //vitesse en km/h, 3.6=3600s/1000m
|
||
|
||
printf("vitesse=%f\n",vitesse);
|
||
printf("vitesse=%ld\n",vitesse);
|
||
printf("dist=%ld\n",distance);
|
||
|
||
printf("latitude=%d\n",p1->latitude);
|
||
printf("longitude=%d\n",p1->longitude);
|
||
printf("memolat=%d\n",p2->latitude);
|
||
printf("memolong=%d\n",p2->longitude);
|
||
}
|
||
p2->latitude=p1->latitude;
|
||
p2->longitude=p1->longitude;
|
||
p2->latitude = p1->latitude;
|
||
p2->longitude = p1->longitude;
|
||
}
|
||
|
||
|
||
... | ... | |
static long cpt=0;
|
||
cpt++ ;
|
||
|
||
position p1,p2;
|
||
static position p1,p2;
|
||
|
||
if (trame_cmp(trame,"GPGGA")==1)
|
||
{
|
||
... | ... | |
|
||
|
||
// Ne pas modifier cette fonction
|
||
long main(long argc,char ** argv)
|
||
long main(int argc,char ** argv)
|
||
{
|
||
|
||
tests_unitaires();
|
Formats disponibles : Unified diff