[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Change from 3.23 to 3.24 - program doesn't work?
From: |
David Taylor |
Subject: |
Change from 3.23 to 3.24 - program doesn't work? |
Date: |
Mon, 20 Jun 2022 06:26:46 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 |
I have a program which works under 3.23 but appears to run but not read gps
data under 3.24. The part I am uncertain about is:
status = gps_open (GPSD_SHARED_MEMORY, DEFAULT_GPSD_PORT, &gpsdata);
#if GPSD_API_MAJOR_VERSION >= 7
if (gps_read (&gpsdata, NULL, 0) == -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);
I am uncertain whether any changes would affect this code.
This is a fresh install of 3.24, compiled from source, on a fresh install of
the Raspberry Pi OS. cgps works correctly. gpsd started manually shows as
running. No attempt to use systemd - yet.
Versions:
Linux RasPi-22 5.15.32-v7l+ #1538 SMP Thu Mar 31 19:39:41 BST 2022 armv7l
GNU/Linux
cgps: 3.24.1~dev (revision release-3.24-138-g5a53fe309)
The full program below in case it helps....
____________________________________
/* Copyright (c) 2018-2021 David Taylor <gpsd@david.taylor.name>
Permission to use, copy, modify, and distribute this software for
any purpose without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
The user of the software is responsible for ensuring the accuracy
of any data produced by the software.
This software may not be used in safety-critical
or life-critical systems. */
#include <gps.h>
#include <stdio.h>
#include <string.h>
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, NULL, 0) == -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);
double snr_avg = 0.0;
if (used > 0) {
snr_avg = snr_total / used;
}
if (strcmp (OID_VISIBLE, argv[2]) == 0) {
printf (OID_VISIBLE);
printf ("\n");
printf ("gauge\n");
printf ("%d\n", visible);
}
if (strcmp (OID_USED, argv[2]) == 0) {
printf (OID_USED);
printf ("\n");
printf ("gauge\n");
printf ("%d\n", used);
}
if (strcmp (OID_SNR_AVG, argv[2]) == 0) {
printf (OID_SNR_AVG);
printf ("\n");
printf ("gauge\n");
printf ("%lf\n", snr_avg);
}
}
}
return 0;
}
____________________________________
Thanks,
David
--
SatSignal Software - Quality software for you
Web: https://www.satsignal.eu
Email: david-taylor@blueyonder.co.uk
Twitter: @gm8arv
- Change from 3.23 to 3.24 - program doesn't work?,
David Taylor <=
- Re: Change from 3.23 to 3.24 - program doesn't work?, Gary E. Miller, 2022/06/20
- Re: Change from 3.23 to 3.24 - program doesn't work?, David Taylor, 2022/06/20
- Re: Change from 3.23 to 3.24 - program doesn't work?, David Taylor, 2022/06/20
- Re: Change from 3.23 to 3.24 - program doesn't work?, David Taylor, 2022/06/20
- Re: Change from 3.23 to 3.24 - program doesn't work?, Gary E. Miller, 2022/06/20
- Re: Change from 3.23 to 3.24 - program doesn't work?, David Taylor, 2022/06/20
- Re: Change from 3.23 to 3.24 - program doesn't work?, Mike Tubby, 2022/06/21
- Re: Change from 3.23 to 3.24 - program doesn't work?, David Taylor, 2022/06/21
- Re: Change from 3.23 to 3.24 - program doesn't work?, Gary E. Miller, 2022/06/21