gpsd-users
[Top][All Lists]
Advanced

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

Updates from 3.20 to 3.23


From: David Taylor
Subject: Updates from 3.20 to 3.23
Date: Tue, 21 Sep 2021 16:03:59 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0

I'm trying to get a program working which was fine under 3.20, but fails with 3.23-rc1. I'm not very good with Linux, so it may be a beginner's mistake, but it may be that the structure definitions have changed, or my program isn't picking them up (i.e. it's getting the header from the wrong location). The core of the program is:

#if GPSD_API_MAJOR_VERSION >= 7
/* from <gps_json.h> */
#define GPS_JSON_RESPONSE_MAX   4096

bool showMessage = false;
char gpsdMessage[GPS_JSON_RESPONSE_MAX];
size_t gpsdMessageLen = 0;
#endif

int main (int argc, char **argv) {
  int status, used, visible;
  struct gps_data_t gpsdata;
  #define OID_VISIBLE ".1.3.6.1.2.1.25.1.31"
  #define OID_USED ".1.3.6.1.2.1.25.1.32"
  #define OID_SNR_AVG ".1.3.6.1.2.1.25.1.33"

  if ((argc > 2) && (strcmp ("-g", argv[1]) == 0))
  {
    status = gps_open (GPSD_SHARED_MEMORY, DEFAULT_GPSD_PORT, &gpsdata);

#if GPSD_API_MAJOR_VERSION >= 7
    if (gps_read (&gpsdata, gpsdMessage, gpsdMessageLen) == -1) {
#else
    if (gps_read (&gpsdata) == -1) {
#endif
    } else {

      used  = gpsdata.satellites_used;
      visible = gpsdata.satellites_visible;
      int i; double snr_total=0;
      for(i=0;i<visible;i++) {
          if (gpsdata.skyview[i].used > 0 && gpsdata.skyview[i].ss > 1) {
              snr_total+=gpsdata.skyview[i].ss;
          }
      }
      gps_close (&gpsdata);

The full program is here:
  https://www.satsignal.eu/raspberry-pi/monitoring.html#gps

I'm unsure where the program is getting gps.h from, but all three gps.h I can find are today's date and time, so I hope up-to-date.

Thanks,
David
--
SatSignal Software - Quality software for you
Web: https://www.satsignal.eu
Email: david-taylor@blueyonder.co.uk
Twitter: @gm8arv


reply via email to

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