[Top][All Lists]

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

[gpsd-dev] Checking API versions

From: Michael J. Tubby B.Sc. MIET
Subject: [gpsd-dev] Checking API versions
Date: Sun, 5 Nov 2017 18:29:45 +0000
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.4.0


I'm using GPSD version 3.17 built from source and developing an application against it.

My application is a separate daemon (AVLD) and and uses libgps.  It needs to test the API version to ensure that if GPSD has been upgraded by the user to a version that's not compatible that we break and issue an appropriate error message.

Unless I'm missing something there are two #defines provided in gps.h:

#define GPSD_API_MAJOR_VERSION  6       /* bump on incompatible changes */
#define GPSD_API_MINOR_VERSION  1       /* bump on compatible changes */

but they don't show up in the version_t structure:

struct version_t {
    char release[64];                   /* external version */
    char rev[64];                       /* internal revision ID */
    int proto_major, proto_minor;       /* API major and minor versions */
    char remote[GPS_PATH_MAX];          /* could be from a remote device */

So I'm not sure what I am supposed to compare with what to perform the tests?

This code snippet:

fprintf(stderr, "GPSD version: %s Protocol version: %d.%d AVLD built against API version: %d.%d\n",         gp->version.release, gp->version.proto_major, gp->version.proto_minor, GPSD_API_MAJOR_VERSION, GPSD_API_MINOR_VERSION);

produces this output:

GPSD version: 3.17 Protocol version: 3.12  AVLD built against API version: 6.1

So, what is the approved way of my code testing that:

a) it is built against the right library?

b) that the library is talking to the right version of GPSD?


reply via email to

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