1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-15 10:17:20 +00:00

Recognise the GPS receiver from Trimble

in NMEA mode (without date).

        Trimble OEM Ace-II receiver. Low cost PCB with single
        voltage input, external active antenna and two serial
        ports with either NMEA and ITAPs output. Programmable
        to be tuned for 'time' accuracy in fixed station config.

Author of tool notified.

Submitted by:	Dirk van Gulik <dirk.vangulik@jrc.it>
This commit is contained in:
Nick Hibma 1999-08-23 14:49:22 +00:00
parent 614926e47a
commit 0d68c4b07e
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50243

View File

@ -210,15 +210,20 @@ nmea_receive(rbufp)
* we only care about a few of them. The most important being
* the $GPRMC format
* $GPRMC,hhmmss,a,fddmm.xx,n,dddmmm.xx,w,zz.z,yyy.,ddmmyy,dd,v*CC
* $GPGGA,162617.0,4548.339,N,00837.719,E,1,07,0.97,00262,M,048,M,,*5D
*/
#define GPRMC 0
#define GPXXX 1
#define GPGCA 2
cp = pp->lastcode;
pp->leap = 0;
cmdtype=0;
if(strncmp(cp,"$GPRMC",6)==0) {
cmdtype=GPRMC;
}
else if(strncmp(cp,"$GPGGA",6)==0) {
cmdtype=GPGCA;
}
else if(strncmp(cp,"$GPXXX",6)==0) {
cmdtype=GPXXX;
}
@ -227,6 +232,7 @@ nmea_receive(rbufp)
switch( cmdtype ) {
case GPRMC:
case GPGCA:
/*
* Check time code format of NMEA
*/
@ -250,6 +256,14 @@ nmea_receive(rbufp)
}
if (cmdtype ==GPGCA) {
/* only time */
time_t tt = time(NULL);
struct tm * t = gmtime(&tt);
day = t->tm_mday;
month = t->tm_mon + 1;
pp->year= t->tm_year;
} else {
dp = field_parse(cp,9);
/*
* Convert date and check values.
@ -260,6 +274,7 @@ nmea_receive(rbufp)
month = (month * 10) + dp[3] - '0';
pp->year = dp[4] - '0';
pp->year = (pp->year * 10) + dp[5] - '0';
}
if (month < 1 || month > 12 || day < 1) {
refclock_report(peer, CEVNT_BADTIME);