gpsd-dev
[Top][All Lists]
Advanced

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

Re: [gpsd-dev] Minimum working example for libgps


From: Eric S. Raymond
Subject: Re: [gpsd-dev] Minimum working example for libgps
Date: Sat, 4 Nov 2017 10:27:27 -0400
User-agent: Mutt/1.5.24 (2015-08-30)

David Huichen Dai <address@hidden>:
> ​Thanks for your reply. Why do you say that my sensor reports at 1-second
> interval?

Because that's what the hardware does, unless you have one of the rare and more
expensive devices with a shorter cycle.  

>​I set the gps_waiting time to 2 seconds, which means I wait for
>up to 2 seconds to get the coordinates, not sampling every 2 seconds, right?

Correct.

> Do I need a separate thread to sample the coordinates, store them in a
> variable, and access it from other thread when I need the coordinates? Is
> this the common way to use the libgps?

That depends entirely on what other kinds of events your application waits on.
Some applications are best written as a simple blocking loop - especially
if they're simple noninteractive report generators.  On the other hand, if
you ever wait on a keystroke, having a separate capture thread is probably
a good idea so that your socket buffer doesn't fill up and look to gpsd
like a dead device.  It will drop the client connection when that happens.
-- 
                <a href="http://www.catb.org/~esr/";>Eric S. Raymond</a>

My work is funded by the Internet Civil Engineering Institute: https://icei.org
Please visit their site and donate: the civilization you save might be your own.





reply via email to

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