gpsd-users
[Top][All Lists]
Advanced

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

Re: [gpsd-users] External main loop. Was: Correct way to handle 5 Hz on


From: Lisandro Damián Nicanor Pérez Meyer
Subject: Re: [gpsd-users] External main loop. Was: Correct way to handle 5 Hz on an application
Date: Wed, 24 Oct 2018 10:20:45 -0300

Yo again! This time changing subject to distinguish stuff.

El martes, 23 de octubre de 2018 22:06:42 -03 Gary E. Miller escribió:
> Yo Lisandro!
[snip]
> > 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.

Let's use "fix" then.

> > 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.

Exactly.

> > 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 base.watch() in xgps you see how easy it is to set up
> the Qt callback (5 lines).

Except gpsd currently only supports Qt4. Yes, I have seen the [bug report]

[bug report] <https://savannah.nongnu.org/bugs/?52299>

Tip: ideally you could build libQ5gpsmm when building against Qt5, and keep 
libQgpsmm for Qt4. I don't know a thing about scons, so I'll keep it as a 
simple suggestion for now, but it should be really really easy.

> > 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.

Right, but they create their own main loop. Even libgps' gps_mainloop() does 
exactly that: create a main loop. What I would need it the ability to use my 
own, already present main loop.

Now that I have read a nice amount of gpsd's code I see that there is 
currently no public code to do this, so my main questions are now pretty 
clearly answered. Adding a backend to do this would probably not be too 
complicated, I'll keep it in my ToDo list to see if I could hack it sometime.

Of course if anyone has any ideas wrt this, I'm eager to hear them.

Thanks for your time!

-- 
The generation of random numbers is too important to be left to chance.
  http://www.devtopics.com/best-programming-jokes/

Lisandro Damián Nicanor Pérez Meyer
http://perezmeyer.com.ar/
http://perezmeyer.blogspot.com/

Attachment: signature.asc
Description: This is a digitally signed message part.


reply via email to

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