[Top][All Lists]

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

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

From: Lisandro Damián Nicanor Pérez Meyer
Subject: [gpsd-users] Correct way to handle 5 Hz on an application
Date: Mon, 22 Oct 2018 11:16:24 -0300

Hi! I have some doubts on how to correctly handle this case, so please bear 
with me.

The situation is the following: gpsd receives NMEA from a GPS device from a 
UDP stream. The GPS device is configured via a µController to send updates at 

On my code I do the following:

  result = gps_open(host, port,&mGPSData);

  [check result]

  result = gps_stream(&mGPSData,WATCH_ENABLE|WATCH_JSON, NULL);

  [check result]

And then I set up a timer to poll every 150ms., which does:

  if(gps_waiting(&mGPSData, 500))
      int result;

      // Read as much data as possible, we need the last available state.
      while((result = gps_read(&mGPSData)) > 0);

      if(result == -1)
          <handle error>
  else [...]
My questions are:

  - Is polling the right thing to do here?
  - Is there another way to handle this? I tired dbus and shmem but could not 
make them work (running Debian unstable). I don't know if it's because the 
data comes from an UDP feed or something else is happening. I have checked 
that the Debian package builds with dbus andshmem support, but still :-/
  - Should I check mGPSData.fix.time to see if the info I received is new or 
gps_read() will only return the latest status?

Thanks *a lot* in advance, Lisandro.

Lisandro Damián Nicanor Pérez Meyer

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

reply via email to

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