gpsd-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-users] strange - currently only few satellites


From: David J Taylor
Subject: Re: [gpsd-users] strange - currently only few satellites
Date: Sat, 9 Apr 2016 08:58:35 +0100

Dear David,

you can download the source from github:
https://github.com/hans-mayer/sat_usage
if there are any questions tell me.

// hans
==================================

Hans,

Many thanks for that that, most helpful! What I actually need is a script (or whatever) which returns the number of satellites being used by gpsd for a fix and I'll use this as input to MRTG (likely via the SNMP pass mechanism). Although I am completely unfamiliar with Linux shell commands, I've been able to simplify your script down to:

________________________________________
gpspipe -r | egrep --line-buffered  'GPGSA' | stdbuf -o0 gawk  '-F,' '
{
 CNT=0 ;
 if ( $1 ~  /GPGSA/ ) {
   for (i = 1; i <= NF; i++) {
     if ( $i != "" ) {
       # print ( $i ) ;
       CNT++ ;
     } ;
   } ;
   print ( CNT ) ;
 } ;
}'
________________________________________

which is near to what I need, with two exceptions:

1 - The script runs continuously. What I need is just to get the current number of satellites and exit. Run once, not every second. Something like a "break" after printing the count. My Linux knowledge isn't up to knowing how to do this!

2 - What I would like is also the number of satellites gpsd is actually using for a fix. Comparing the script result with "cgps -s" for example, the value returned by the script is the total number of satellites in the right-hand cgps column, whereas I would also like the number of satellites with "Y" against them - satellites being used. Perhaps this is more complex. though?

BTW: gawk isn't in the default Raspberry Pi Wheezy distribution, but easily obtained with apt-get.

Thanks,
David
--
SatSignal Software - Quality software written to your requirements
Web: http://www.satsignal.eu
Email: address@hidden
Twitter: @gm8arv



reply via email to

[Prev in Thread] Current Thread [Next in Thread]