[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-users] count of satellites_used is incorrect
From: |
Ralph Nemitz |
Subject: |
[gpsd-users] count of satellites_used is incorrect |
Date: |
Thu, 26 Apr 2018 16:31:04 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
Hi everybody,
when I try to get the count of "satellites_used" by the following little
program:
/*
* Copyright (c) 2010 by the GPSD project
* Copyright (c) 2012,2013,2014,2015 LogicWay GmbH
* BSD terms apply: see the file COPYING in the distribution root for
details.
*
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <syslog.h>
#include <math.h>
#include <time.h>
#include <errno.h>
#include <libgen.h>
#include <signal.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <unistd.h>
#include <sys/wait.h>
#include <gps.h>
unsigned char loglevel = 0;
int gpsdc_mainloop ( void )
{
struct gps_data_t gpsdata;
unsigned long cycle = 0, outtimed = 0;
fprintf ( stderr, "%s: starting%s\n", __FILE__, (loglevel ? "" : "
(log is off)"));
if ( gps_open ( "localhost", "2947", &gpsdata ) != 0 ) {
fprintf ( stderr, "%s: No gpsd is running or network error: %d,
%s.\n", __FILE__, errno, gps_errstr(errno) );
return -1;
} else {
if ( gps_stream ( &gpsdata, WATCH_ENABLE, NULL ) >= 0 ) {
for (;;) {
cycle++;
if ( gps_waiting ( &gpsdata, 5000000 ) ) {
if ( gps_read ( &gpsdata ) == -1 ) {
fprintf ( stderr, "%s: gpsd read error\n",
__FILE__ );
break;
} else {
if ( loglevel ) {
fprintf ( stderr, "%s (%lu/%lu) fix: %d
lat/lon/alt: %f/%f/%f status: %d deviations: %f/%f satellites: %d\n",
__FILE__, outtimed, cycle,
gpsdata.fix.mode,
gpsdata.fix.latitude, gpsdata.fix.longitude, gpsdata.fix.altitude,
gpsdata.status, gpsdata.dop.pdop,
gpsdata.dop.hdop, gpsdata.satellites_used );
}
}
} else {
fprintf ( stderr, "%s: gpsd read timeout
(%lu/%lu)\n", __FILE__, outtimed, cycle );
outtimed++;
}
}
}
gps_stream ( &gpsdata, WATCH_DISABLE, NULL );
gps_close ( &gpsdata );
fprintf ( stderr, "%s: finished\n", __FILE__);
}
return 0;
}
int main ( int argc, char **argv )
{
int opt;
while ( ( opt = getopt ( argc, argv, "v" ) ) != -1 ) {
switch ( opt ) {
case 'v':
loglevel++;
break;
default:
printf ( "gpsd_c [-v]\n -v ... verbose\n" );
exit ( -1 );
break;
}
}
gpsdc_mainloop();
return 0;
}
the count of "satellites_used" decreases to one after about half an
hour. The count of "satellites_used" in the program "gpsmon" stays
meanwhile nearly constant at eigth to ten. The other values from the
gpsdata structure correspond to the values on "gpsmon".
What can be the reason for decreasing "satellites_used"?
I use gpsd-3.16 with linux (buildroot), the gps-chip is "GNS1301" from
Unitronics.
Thanks for your help!
Ralph
--
--
###############################################################
Dipl.-Phys. Ralph Nemitz Tel.: (0385) 3993 9354
Logic Way GmbH Fax: (0385) 3993 458
Hagenower Strasse 73 HTTP: http://www.logicway.de
19061 Schwerin E-Mail: address@hidden
###############################################################
- [gpsd-users] count of satellites_used is incorrect,
Ralph Nemitz <=
- Re: [gpsd-users] count of satellites_used is incorrect, David J Taylor, 2018/04/26
- Re: [gpsd-users] count of satellites_used is incorrect, Gary E. Miller, 2018/04/26
- Re: [gpsd-users] count of satellites_used is incorrect, David J Taylor, 2018/04/27
- Re: [gpsd-users] count of satellites_used is incorrect, Gary E. Miller, 2018/04/27
- Re: [gpsd-users] count of satellites_used is incorrect, David J Taylor, 2018/04/28
- Re: [gpsd-users] count of satellites_used is incorrect, Gary E. Miller, 2018/04/28
- Message not available
- Message not available
- Re: [gpsd-users] count of satellites_used is incorrect, David J Taylor, 2018/04/30
- Re: [gpsd-users] count of satellites_used is incorrect, Gary E. Miller, 2018/04/30
- Re: [gpsd-users] count of satellites_used is incorrect, David J Taylor, 2018/04/30
- Re: [gpsd-users] count of satellites_used is incorrect, Gary E. Miller, 2018/04/30