[Top][All Lists]

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

Re: [gpsd-users] Correct way to handle 5 Hz on an application

From: Gary E. Miller
Subject: Re: [gpsd-users] Correct way to handle 5 Hz on an application
Date: Tue, 23 Oct 2018 18:06:42 -0700

Yo Lisandro!

On Tue, 23 Oct 2018 12:03:29 -0300
Lisandro Damián Nicanor Pérez Meyer <address@hidden> wrote:

> Before starting: the whole stack is working: I can run xgps, gpsmon
> and my own app using libgps trough a socket and everything "just
> works".

Good way to start.

> My *main* issue here is to know which would be the (possibly) best
> way to handle my case (cited below) on a Qt 5-based application. Read
> it: ideally every time a new fix [1] is achieved a
> "signal" (callback, if you want) would be called to consume it.

I mostly familiar with the xgps program which uses the Python Qt
bindings.  The Python Qt binding are a pretty thin layer, so the same
concepts apply. gosd.

> [1] I might be using the wrong word here, maybe "new data arrives"
> should be used. Any insights on the correct terms here are highly
> appreciated.

Much new data can arrive that is not fix data.  Maybe you really are
only looking for new fix data?  But you gotta deal with it all.

> Currently I'm using gps_waiting, which, as you say, checks the input
> queue and returns either when a timeout is reached or there is
> available data. Once either of them happens I need to call it again
> for gain more data. This, in my eyes, it's a kind of polling.

Polling inside your program.  Not polling between your program and gpsd.
The GObject.io_add_watch() method maps the one to the other for you.

> So if I could libgps to "signal" me that there is data ready and then
> fetch it as possible it would be just cool.

If you are doing Qt, then I assume you are doing C++.  In that case
you use libgpsmm, or libQgpsmm, which are C++ wrappers over libgps.

If you look at in xgps you see how easy it is to set up
the Qt callback (5 lines).

> Now there might be good reasons to not do this, in this case I would
> really like to know.

I can't think of a reason not to do that, or to do that, but I'm not a
Qt guy.  But I do know the xgps way to use gpsd with Qt is pretty simple
and solid.

Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin

Attachment: pgpagD1PSr3zU.pgp
Description: OpenPGP digital signature

reply via email to

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