Révision 437
Ajouté par Lilian MEMBRE il y a environ 3 ans
tag/rc_1/MEMBRE/main.c | ||
---|---|---|
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include <strings.h>
|
||
#include <math.h>
|
||
#include "trame.h"
|
||
#define PI 3.14159
|
||
|
||
//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",
|
||
"$GPRMC,141914.00,A,4545.6424,N,00306.6036,E,0.4,99.4,010206,,*0C",
|
||
"$GPGLL,4545.6424,N,00306.6036,E,141914.00,A*0E",
|
||
"$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D",
|
||
"$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39",
|
||
"$GPVTG,99.4,T,,M,0.4,N,0.7,K*57",
|
||
"$GPZDA,141914.00,01,02,2006,00,00*69",
|
||
0};
|
||
|
||
|
||
|
||
|
||
|
||
//Fontion trame_cmp
|
||
int trame_cmp(char * trame, char * type)
|
||
{
|
||
int i;
|
||
int egalite = 1;
|
||
|
||
for (i=0;i<5;i++)
|
||
{
|
||
if (trame[i+1]!= type[i])
|
||
{
|
||
egalite=0;
|
||
}
|
||
}
|
||
return egalite;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//Fonction decode_int
|
||
|
||
int decode_int(char c)
|
||
{
|
||
if ((c<'A') && (c>='0'))
|
||
{
|
||
c =c-48;
|
||
}
|
||
else
|
||
{
|
||
c=-1;
|
||
}
|
||
return c;
|
||
}
|
||
|
||
|
||
//test decode_int
|
||
void test_decode_int(void)
|
||
{
|
||
if (decode_int('0')!=0){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('1')!=1){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('2')!=2){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('3')!=3){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('4')!=4){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('5')!=5){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('6')!=6){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('7')!=7){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('8')!=8){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('9')!=9){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('A')!=-1){
|
||
printf("Erreur test unitaire");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//Fonction decode_nombre
|
||
int decode_nombre(char * ch, int n)
|
||
{
|
||
int p=0;
|
||
int i;
|
||
for(i=0;i<n;i++)
|
||
{
|
||
p= decode_int(ch[i]) + p*10;
|
||
}
|
||
return p;
|
||
}
|
||
|
||
|
||
//Test de decode_nombre
|
||
int test_decode_nombre()
|
||
{
|
||
if (decode_nombre("123",3)!=123)
|
||
{
|
||
printf("Erreur test nombre1");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("987654321",2)!=98)
|
||
{
|
||
printf("Erreur test nombre2");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
|
||
//Fonction latitude en nombre flottant
|
||
|
||
int latitude(char l[])
|
||
{
|
||
int n=0;
|
||
int degree=0;
|
||
int minutes=0;
|
||
int lati=0;
|
||
|
||
|
||
while (l[n]!='\0')
|
||
{
|
||
n=n+1;
|
||
}
|
||
if (n==9)
|
||
{
|
||
degree = ((l[0]-48)*10+(l[1]-48));
|
||
minutes = ((l[2]-48)*10+(l[3]-48)+(l[5]-48)*0.1+(l[6]-48)*0.01+(l[7]-48)*0.001+(l[8]-48)*0.0001);
|
||
lati = degree + minutes/60;
|
||
}
|
||
else
|
||
{
|
||
printf("Erreur de saisie");
|
||
}
|
||
return lati;
|
||
}
|
||
|
||
|
||
// Fonction longitude en nombre flotttant
|
||
|
||
int longitude(char l[])
|
||
{
|
||
int n=0;
|
||
int degree=0;
|
||
int minutes=0;
|
||
int longi=0;
|
||
|
||
|
||
while (l[n]!='\0')
|
||
{
|
||
n=n+1;
|
||
}
|
||
if (n==10)
|
||
{
|
||
degree = ((l[0]-48)*100+(l[1]-48)*10+(l[2]-48));
|
||
minutes = ((l[3]-48)*10+(l[4]-48)+(l[6]-48)*0.1+(l[7]-48)*0.01+(l[8]-48)*0.001+(l[9]-48)*0.0001);
|
||
longi = degree + minutes/60;
|
||
}
|
||
else
|
||
{
|
||
printf("Erreur de saisie");
|
||
}
|
||
return longi;
|
||
}
|
||
|
||
|
||
//Fonction latitude/longitude nombre flottant
|
||
|
||
float decode_lat_long (char c[]) {
|
||
int n=0, degre=0,i=1,b;
|
||
float min=0, secondes=0, res=0,p;
|
||
|
||
|
||
do{
|
||
n++;
|
||
} while (c[n]!='.');
|
||
|
||
if (n==4) {
|
||
degre = (c[0]-48)*10+(c[1]-48);
|
||
min = (c[2]-48)*10+(c[3]-48);
|
||
} else {
|
||
degre = (c[0]-48)*100+(c[1]-48)*10+(c[2]-48);
|
||
min = (c[3]-48)*10+(c[4]-48);
|
||
}
|
||
|
||
n++;
|
||
do {
|
||
p=1;
|
||
for (b=0;b<i;b++) {
|
||
p=p*0.1;
|
||
}
|
||
secondes= secondes + (c[n]-48)*p;
|
||
i++;
|
||
n++;
|
||
} while (c[n]!='\0');
|
||
|
||
res = degre + (min+secondes)/60;
|
||
|
||
return res;
|
||
|
||
}
|
||
|
||
|
||
//Test de latitude
|
||
|
||
int test_latitude()
|
||
{
|
||
if (latitude("3723.2475")-37.387458<0.000001&& 37.387458-latitude("3723.2475")<0.000001)
|
||
{
|
||
printf("Erreur test latitude");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
|
||
//Test de longitude
|
||
|
||
int test_longitude()
|
||
{
|
||
if (longitude("00306.6036")-37.387458<0.000001 && 37.387458-latitude("00306.6036")<0.000001)
|
||
{
|
||
printf("Erreur test latitude");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
//Test de latitude/longitude
|
||
|
||
void test_decode_lat_long(void) {
|
||
float a,b,c,e;
|
||
a= 37.387458 - decode_lat_long("3723.2475");
|
||
c= 45.760703 - decode_lat_long("4545.6422");
|
||
b=3.11006 - decode_lat_long("00306.6036");
|
||
e= 3.110077 - decode_lat_long("00306.6046");
|
||
|
||
if (a*a > 0.000001){
|
||
printf("erreur");
|
||
exit(-1);
|
||
}
|
||
if (b*b > 0.000001){
|
||
printf("erreur2");
|
||
exit(-1);
|
||
}
|
||
if (c*c > 0.000001){
|
||
printf("erreur2");
|
||
exit(-1);
|
||
}
|
||
if (e*e > 0.000001){
|
||
printf("erreur2");
|
||
exit(-1);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
//Fonction ? modifier !!!!!
|
||
void traitement(char * trame)
|
||
{
|
||
static int cpt=0;
|
||
cpt++;
|
||
position p;
|
||
|
||
if (trame_cmp(trame,"GPGGA")==1)
|
||
{
|
||
printf ("%s\n",trame);
|
||
decode_trame(trame,&p);
|
||
printf("latitude= %f , longitude= %f \n",p.latitude,p.longitude);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
/* TP SP4A N?2 */
|
||
|
||
typedef struct{
|
||
|
||
float latitude;
|
||
float longitude;
|
||
} position;
|
||
|
||
|
||
position p,p1,p2;
|
||
|
||
typedef struct {
|
||
position pos;
|
||
float vitesse;
|
||
}zone;
|
||
|
||
zone zones[]= {
|
||
{{44.788776, -3.01200}, 50},
|
||
{{44.789122, -3.01300}, 70},
|
||
{{45.896654, 3.224569}, 60},
|
||
{{46.251478, 4.000000}, 80},
|
||
{{47.353711, 5.199235}, 90},
|
||
};
|
||
|
||
|
||
//Fonction decode_tram v2
|
||
|
||
int decode_trame_v2(char *l, position *p)
|
||
{
|
||
int degree_latitude,minutes_latitude=0,degree_longitude,minutes_longitude=0;
|
||
double res_latitude=0,res_longitude=0;
|
||
|
||
degree_longitude=decode_int(l[29])*100+decode_int(l[30])*10+decode_int(l[31]);
|
||
minutes_longitude=(decode_int(l[32])*10+decode_int(l[33])+decode_int(l[35])*0.1+decode_int(l[36])*0.01+decode_int(l[37])*0.001+decode_int(l[38])*0.0001)/60;
|
||
res_longitude=degree_longitude+minutes_longitude;
|
||
|
||
if(l[27]=='S') //identifier si la latitude est nord ou sud
|
||
{
|
||
res_latitude = -res_latitude;
|
||
}
|
||
degree_latitude=decode_int(l[17])*10+decode_int(l[18]);
|
||
minutes_latitude=(decode_int(l[19])*10+decode_int(l[20])+decode_int(l[22])*0.1+decode_int(l[23])*0.01+decode_int(l[24])*0.001+decode_int(l[25])*0.0001)/60;
|
||
res_latitude=degree_latitude+minutes_latitude;
|
||
if(l[40]=='W')
|
||
{
|
||
res_longitude= -res_longitude;
|
||
}
|
||
p ->longitude=res_longitude;
|
||
p ->latitude=res_latitude;
|
||
}
|
||
|
||
//Test decode_trame
|
||
|
||
/*void test_decode_tram (void)
|
||
{
|
||
decode_trame_v2("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D",&p);
|
||
if(fabs(fabs(p.latitude)-46.759373 >10-6))
|
||
{
|
||
printf ("Erreur test latitude decode_trame_v2");
|
||
exit(-1);
|
||
}
|
||
if(fabs(fabs(p.longitude)-101.202358 >10-6))
|
||
{
|
||
printf ("Erreur test longitude decode_trame_v2");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
*/
|
||
//Fonction calcul_distance
|
||
|
||
float clacul_distance(position *p1, position *p2)
|
||
{
|
||
float distance;
|
||
distance=acos(sin(PI * p1 ->latitude/180.0)*sin(PI * p2 ->latitude/180.0)+cos(PI* p1 ->latitude/180.0)*cos(PI* p2 ->latitude/180.0)*cos(PI*(fabs(p1 ->longitude - p2 ->longitude))/180.0))*6371;
|
||
return (float) distance;
|
||
}
|
||
|
||
//Fonction calcul_vitesse
|
||
|
||
float clacul_vitesse(position *p1, position *p2)
|
||
{
|
||
float vitesse;
|
||
|
||
vitesse=calcul_distance(&p1,&p2);
|
||
vitesse=vitesse*3600;
|
||
|
||
return vitesse;
|
||
}
|
||
|
||
/*Test calcul_vitesse
|
||
|
||
float test_calcul_vitesse()
|
||
{
|
||
position p1,p2;
|
||
float v;
|
||
decode_tram_v1("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D", &p1);
|
||
decode_tram_v1("$GPGGA,141915.00,4545.0242,N,00306.6039,E,1,05,3.4,499.5,M,,M,,*72", &p2);
|
||
|
||
v=calcul_vitesse(p1,p2);
|
||
}*/
|
||
|
||
|
||
/* distance ? la proche zone */
|
||
|
||
int distance_a_la_proche_zone(position p, zone r[],int nb_zones, float *d)
|
||
{
|
||
int i=0,dist_zone,res;
|
||
dist_zone=calcul_distance(&p,&r[0].pos);
|
||
for(i=0;i<nb_zones;i++)
|
||
{
|
||
*d=calcul_distance(&p,&r[i].pos);
|
||
printf("\n%f\n",*d);
|
||
if(-*d<dist_zone<*d)
|
||
{
|
||
dist_zone=*d;
|
||
res=i;
|
||
}
|
||
}
|
||
return res;
|
||
}
|
||
|
||
|
||
|
||
|
||
|
||
//Ajouter vos tests unitaires dans cette fonction.
|
||
void tests_unitaires(void){
|
||
|
||
position p2,p1,p;
|
||
position p,p1,p2;
|
||
p1.latitude=35.968723;
|
||
p1.longitude=170.652056;
|
||
p2.longitude=156.831330;
|
||
p2.latitude=55.806160;
|
||
|
||
|
||
if (5!=5){
|
||
printf ("Erreur Test unitaire basique.\n");
|
||
exit(-1);
|
||
}
|
||
if (trame_cmp("$GPGGA suite chaine","GPGGA")!=1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if (trame_cmp("$GPRMC suite chaine","GPGGA")!=0){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if (trame_cmp("$GPRMC... ", "GPRMC" )!=1){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
if (trame_cmp("$APRMC...", "GPGGA")!=0){
|
||
printf ("Erreur Test unitaire trame_cmp.\n");
|
||
exit(-1);
|
||
}
|
||
|
||
/* test decode_int */
|
||
|
||
|
||
if (decode_int('0')!=0){
|
||
printf("Erreur test int0");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('1')!=1){
|
||
printf("Erreur test int1");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('2')!=2){
|
||
printf("Erreur test int2");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('3')!=3){
|
||
printf("Erreur test int3");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('4')!=4){
|
||
printf("Erreur test int4");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('5')!=5){
|
||
printf("Erreur test int5");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('6')!=6){
|
||
printf("Erreur test int6");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('7')!=7){
|
||
printf("Erreur test int7");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('8')!=8){
|
||
printf("Erreur test int8");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('9')!=9){
|
||
printf("Erreur test int9");
|
||
exit(-1);
|
||
}
|
||
if (decode_int('A')!=-1){
|
||
printf("Erreur test intA");
|
||
exit(-1);
|
||
}
|
||
|
||
|
||
/* decode _nombre */
|
||
|
||
if (decode_nombre("123",3)!=123)
|
||
{
|
||
printf("Erreur test nombre1");
|
||
exit(-1);
|
||
}
|
||
if (decode_nombre("987654321",2)!=98)
|
||
{
|
||
printf("Erreur test nombre2");
|
||
exit(-1);
|
||
}
|
||
|
||
/* test longitude */
|
||
|
||
if (longitude("13558.8889")-135,981481<0.000001 && 135,981481-longitude("13558.8889")<0.000001)
|
||
{
|
||
printf("Erreur test longitude1");
|
||
exit(-1);
|
||
}
|
||
|
||
if (longitude("10112.1415")-101,202358<0.000001 && 101,202358-longitude("10112.1415")<0.000001)
|
||
{
|
||
printf ("Erreur test longitude2");
|
||
exit(-1);
|
||
}
|
||
/* test latitude */
|
||
|
||
if (latitude("3558.8889")-35,981481>0.000001 && 35,981481-latitude("3558.8889")<0.000001)
|
||
{
|
||
printf ("Erreur test latitude1");
|
||
exit(-1);
|
||
}
|
||
if (latitude("0112.1415")-01,202358>0.000001 && 01,202358-latitude("0112.1415")<0.000001)
|
||
{
|
||
printf ("Erreur test latitude2");
|
||
exit(-1);
|
||
}
|
||
|
||
|
||
/* test latitude/longitude */
|
||
|
||
float a,b,c,e;
|
||
a= 37.387458 - decode_lat_long("3723.2475");
|
||
c= 45.760703 - decode_lat_long("4545.6422");
|
||
b=3.11006 - decode_lat_long("00306.6036");
|
||
e= 3.110077 - decode_lat_long("00306.6046");
|
||
|
||
if (a*a > 0.000001){
|
||
printf("erreur");
|
||
exit(-1);
|
||
}
|
||
if (b*b > 0.000001){
|
||
printf("erreur2");
|
||
exit(-1);
|
||
}
|
||
if (c*c > 0.000001){
|
||
printf("erreur2");
|
||
exit(-1);
|
||
}
|
||
if (e*e > 0.000001){
|
||
printf("erreur2");
|
||
exit(-1);
|
||
}
|
||
|
||
/*Test decode tram latitude */
|
||
|
||
decode_trame_v2("$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*7D",&p);
|
||
if(fabs(fabs(p.latitude)-46.759373 >10-6))
|
||
{
|
||
printf ("Erreur test latitude decode_trame_v2");
|
||
exit(-1);
|
||
}
|
||
|
||
|
||
|
||
/*Test decode tram longitude */
|
||
|
||
|
||
decode_trame("$GPGGA,141914.00,4645.5624,N,10112.1415,E,1,05,3.4,499.3,M,,M,,*7D",&p);
|
||
if(fabs(fabs(p.longitude)-101.202358 >10-6))
|
||
{
|
||
printf ("Erreur test longitude decode_trame_v2");
|
||
exit(-1);
|
||
}
|
||
|
||
|
||
/* test calcul_distance */
|
||
|
||
|
||
if(calcul_distance(&p1,&p2)<2441 && calcul_distance(&p1,&p2)>2442)
|
||
{
|
||
printf (" Erreur test calcul distance");
|
||
exit(-1);
|
||
}
|
||
}
|
||
|
||
// Ne pas modifier cette fonction
|
||
int main(int argc,char ** argv)
|
||
{
|
||
|
||
tests_unitaires();
|
||
|
||
// Affichage des trames definies dans la table trames.
|
||
printf ("Trames de tests tableau trames:\n");
|
||
int i=0;
|
||
while (trames[i])
|
||
traitement(trames[i++]);
|
||
|
||
if (!trame_init())
|
||
exit(-1);
|
||
// Affichage des trames du fichier gps.log
|
||
char *trame;
|
||
printf ("Trames de tests du fichier gps.log\n");
|
||
while ((trame = trame_suivante()))
|
||
traitement(trame);
|
||
|
||
return 0;
|
||
}
|
tag/rc_1/MEMBRE/gps.log | ||
---|---|---|
$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
|
||
$GPRMC,141914.00,A,4545.6424,N,00306.6036,E,0.4,99.4,010206,,*0C
|
||
$GPGLL,4545.6424,N,00306.6036,E,141914.00,A*0E
|
||
$GPGGA,141914.00,4545.0000,N,00306.6036,E,1,05,3.4,499.3,M,,M,,*79
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,99.4,T,,M,0.4,N,0.7,K*57
|
||
$GPZDA,141914.00,01,02,2006,00,00*69
|
||
$GPGSV,3,1,10,01,13,142,46,03,48,144,47,11,41,277,,14,27,104,42*75
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,41,19,85,271,,20,08,214,*7F
|
||
$GPGSV,3,3,10,22,39,053,48,28,15,320,*77
|
||
$GPRMC,141915.00,A,4545.6423,N,00306.6039,E,0.6,110.2,010206,,*31
|
||
$GPGLL,4545.6423,N,00306.6039,E,141915.00,A*07
|
||
$GPGGA,141915.00,4545.0242,N,00306.6039,E,1,05,3.4,499.5,M,,M,,*75
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,110.2,T,,M,0.6,N,1.2,K*67
|
||
$GPZDA,141915.00,01,02,2006,00,00*68
|
||
$GPGSV,3,1,10,01,13,142,45,03,48,144,47,11,41,277,,14,27,104,41*75
|
||
$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,49,28,15,320,*76
|
||
$GPRMC,141916.00,A,4545.6422,N,00306.6037,E,0.1,211.1,010206,,*3B
|
||
$GPGLL,4545.6422,N,00306.6037,E,141916.00,A*0B
|
||
$GPGGA,141916.00,4545.0484,N,00306.6037,E,1,05,3.4,500.0,M,,M,,*70
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,211.1,T,,M,0.1,N,0.2,K*60
|
||
$GPZDA,141916.00,01,02,2006,00,00*6B
|
||
$GPGSV,3,1,10,01,13,142,45,03,48,144,48,11,41,277,,14,27,104,43*78
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,44,19,85,271,,20,08,214,*7A
|
||
$GPGSV,3,3,10,22,39,053,48,28,15,320,*77
|
||
$GPRMC,141917.00,A,4545.6422,N,00306.6039,E,0.3,122.3,010206,,*37
|
||
$GPGLL,4545.6422,N,00306.6039,E,141917.00,A*04
|
||
$GPGGA,141917.00,4545.0726,N,00306.6039,E,1,05,3.4,499.6,M,,M,,*73
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,122.3,T,,M,0.3,N,0.5,K*64
|
||
$GPZDA,141917.00,01,02,2006,00,00*6A
|
||
$GPGSV,3,1,10,01,13,142,45,03,48,144,46,11,41,277,,14,27,104,41*74
|
||
$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,48,28,15,320,*77
|
||
$GPRMC,141918.00,A,4545.6421,N,00306.6034,E,0.5,252.2,010206,,*35
|
||
$GPGLL,4545.6421,N,00306.6034,E,141918.00,A*05
|
||
$GPGGA,141918.00,4545.0968,N,00306.6034,E,1,05,3.4,498.8,M,,M,,*7A
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,252.2,T,,M,0.5,N,1.0,K*63
|
||
$GPZDA,141918.00,01,02,2006,00,00*65
|
||
$GPGSV,3,1,10,01,13,142,45,03,48,144,48,11,41,277,,14,27,104,42*79
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,42,19,85,271,,20,08,214,*7C
|
||
$GPGSV,3,3,10,22,38,053,49,28,15,320,*77
|
||
$GPRMC,141919.00,A,4545.6420,N,00306.6040,E,0.6,95.2,010206,,*0C
|
||
$GPGLL,4545.6420,N,00306.6040,E,141919.00,A*06
|
||
$GPGGA,141919.00,4545.1210,N,00306.6040,E,1,05,3.4,500.2,M,,M,,*77
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,95.2,T,,M,0.6,N,1.2,K*5B
|
||
$GPZDA,141919.00,01,02,2006,00,00*64
|
||
$GPGSV,3,1,10,01,13,142,46,03,48,144,49,11,41,277,,14,27,104,42*7B
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,43,19,85,271,,20,08,214,*7D
|
||
$GPGSV,3,3,10,22,38,053,49,28,15,320,*77
|
||
$GPRMC,141920.00,A,4545.6419,N,00306.6039,E,0.2,133.1,010206,,*38
|
||
$GPGLL,4545.6419,N,00306.6039,E,141920.00,A*08
|
||
$GPGGA,141920.00,4545.1410,N,00306.6039,E,1,05,3.4,500.0,M,,M,,*77
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,133.1,T,,M,0.2,N,0.4,K*66
|
||
$GPZDA,141920.00,01,02,2006,00,00*6E
|
||
$GPGSV,3,1,10,01,13,142,45,03,48,144,46,11,41,277,,14,27,104,43*76
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,41,19,85,271,,20,08,214,*7F
|
||
$GPGSV,3,3,10,22,38,053,50,28,15,320,*7F
|
||
$GPRMC,141921.00,A,4545.6419,N,00306.6043,E,0.6,103.1,010206,,*33
|
||
$GPGLL,4545.6419,N,00306.6043,E,141921.00,A*04
|
||
$GPGGA,141921.00,4545.1610,N,00306.6043,E,1,05,3.4,499.8,M,,M,,*70
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,103.1,T,,M,0.6,N,1.1,K*65
|
||
$GPZDA,141921.00,01,02,2006,00,00*6F
|
||
$GPGSV,3,1,10,01,13,142,46,03,48,144,48,11,41,277,,14,27,104,42*7A
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,42,19,85,271,,20,08,214,*7C
|
||
$GPGSV,3,3,10,22,38,053,48,28,15,320,*76
|
||
$GPRMC,141922.00,A,4545.6418,N,00306.6046,E,0.7,96.9,010206,,*00
|
||
$GPGLL,4545.6418,N,00306.6046,E,141922.00,A*03
|
||
$GPGGA,141922.00,4545.1810,N,00306.6046,E,1,05,3.4,500.6,M,,M,,*77
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,96.9,T,,M,0.7,N,1.3,K*53
|
||
$GPZDA,141922.00,01,02,2006,00,00*6C
|
||
$GPGSV,3,1,10,01,13,142,47,03,48,144,46,11,41,277,,14,27,104,43*74
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,43,19,85,271,,20,08,214,*7D
|
||
$GPGSV,3,3,10,22,38,053,48,28,15,320,*76
|
||
$GPRMC,141923.00,A,4545.6417,N,00306.6046,E,0.3,113.6,010206,,*39
|
||
$GPGLL,4545.6417,N,00306.6046,E,141923.00,A*0D
|
||
$GPGGA,141923.00,4545.2010,N,00306.6046,E,1,05,3.4,500.6,M,,M,,*7D
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,113.6,T,,M,0.3,N,0.7,K*61
|
||
$GPZDA,141923.00,01,02,2006,00,00*6D
|
||
$GPGSV,3,1,10,01,13,142,45,03,48,144,47,11,41,277,,14,27,104,41*75
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,43,19,85,271,,20,08,214,*7D
|
||
$GPGSV,3,3,10,22,38,053,49,28,15,320,*77
|
||
$GPRMC,141924.00,A,4545.6416,N,00306.6044,E,0.2,197.7,010206,,*31
|
||
$GPGLL,4545.6416,N,00306.6044,E,141924.00,A*09
|
||
$GPGGA,141924.00,4545.2210,N,00306.6044,E,1,05,3.4,500.5,M,,M,,*79
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,197.7,T,,M,0.2,N,0.4,K*6E
|
||
$GPZDA,141924.00,01,02,2006,00,00*6A
|
||
$GPGSV,3,1,10,01,13,142,45,03,48,144,47,11,41,277,,14,27,104,40*74
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,43,19,85,271,,20,08,214,*7D
|
||
$GPGSV,3,3,10,22,38,053,49,28,15,320,*77
|
||
$GPRMC,141925.00,A,4545.6415,N,00306.6046,E,0.2,130.8,010206,,*33
|
||
$GPGLL,4545.6415,N,00306.6046,E,141925.00,A*09
|
||
$GPGGA,141925.00,4545.2410,N,00306.6046,E,1,05,3.4,501.4,M,,M,,*7C
|
||
$GPGSA,A,3,,03,,22,14,,01,,18,,,,3.9,3.4,1.9*39
|
||
$GPVTG,130.8,T,,M,0.2,N,0.5,K*6D
|
||
$GPZDA,141925.00,01,02,2006,00,00*6B
|
||
$GPGSV,3,1,10,01,13,142,45,03,48,144,47,11,41,277,,14,27,104,40*74
|
||
$GPGSV,3,2,10,15,03,077,,18,04,041,41,19,85,271,,20,08,214,*7F
|
||
$GPGSV,3,3,10,22,38,053,47,28,15,320,*79
|
||
$GPRMC,141926.?E,0.2,260.8,010206,,*34
|
tag/rc_1/MEMBRE/trame.c | ||
---|---|---|
/* Fichier trames.c - Gestion et decodage des trames */
|
||
/* Ce fichier sera fourni */
|
||
|
||
#include <stdio.h>
|
||
#include <stdlib.h>
|
||
#include "trame.h"
|
||
|
||
#define FICHIER_TRAMES "gps.log" /* Par exemple */
|
||
|
||
#define MAX_FRAME_LENGTH 80
|
||
|
||
static char trame_buf[MAX_FRAME_LENGTH];
|
||
static FILE *trame_fic;
|
||
|
||
int trame_init(void)
|
||
{
|
||
trame_fic = fopen(FICHIER_TRAMES, "r");
|
||
if (trame_fic)
|
||
return 1;
|
||
|
||
fprintf(stderr, "Impossible d'ouvrir le fichier %s\n", FICHIER_TRAMES);
|
||
return 0;
|
||
}
|
||
|
||
char *trame_suivante(void)
|
||
{
|
||
return fgets(trame_buf, MAX_FRAME_LENGTH-1, trame_fic);
|
||
}
|
tag/rc_1/MEMBRE/sp4a.cbp | ||
---|---|---|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||
<CodeBlocks_project_file>
|
||
<FileVersion major="1" minor="6" />
|
||
<Project>
|
||
<Option title="sp4a" />
|
||
<Option pch_mode="2" />
|
||
<Option compiler="gcc" />
|
||
<Build>
|
||
<Target title="Debug">
|
||
<Option output="sp4a" prefix_auto="1" extension_auto="1" />
|
||
<Option object_output=".\debug" />
|
||
<Option type="1" />
|
||
<Option compiler="gcc" />
|
||
<Compiler>
|
||
<Add option="-g" />
|
||
</Compiler>
|
||
</Target>
|
||
</Build>
|
||
<Compiler>
|
||
<Add option="-Wall" />
|
||
</Compiler>
|
||
<Unit filename="gps.log" />
|
||
<Unit filename="main.c">
|
||
<Option compilerVar="CC" />
|
||
</Unit>
|
||
<Unit filename="trame.c">
|
||
<Option compilerVar="CC" />
|
||
</Unit>
|
||
<Unit filename="trame.h" />
|
||
<Extensions>
|
||
<code_completion />
|
||
<envvars />
|
||
<debugger />
|
||
<lib_finder disable_auto="1" />
|
||
</Extensions>
|
||
</Project>
|
||
</CodeBlocks_project_file>
|
tag/rc_1/MEMBRE/trame.h | ||
---|---|---|
|
||
int trame_init(void);
|
||
char * trame_suivante(void);
|
Formats disponibles : Unified diff
Version final du TP 1 et 2