Commit 2bd3da48 authored by Jussi Kukkonen's avatar Jussi Kukkonen

prevent some unnecessary position_changed-signals

Previously signal was emitted if any data was updated by gpsd.
Now it's emitted when lat/lon is updated.

It _should_ be emitted only when lat/lon are different
than last time.
parent b7f47ff1
......@@ -68,7 +68,14 @@ void geoclue_position_current_position_changed (GeocluePosition* obj, gdouble la
/* callback for gpsd signals */
static void gps_callback (struct gps_data_t *gpsdata, char *message, size_t len, int level)
{
g_signal_emit_by_name (obj, "current_position_changed", gpsdata->fix.latitude, gpsdata->fix.longitude);
if (gpsdata->set & LATLON_SET) {
/* FIXME: should only emit the signal if lat/lon have actually changed */
g_signal_emit_by_name (obj, "current_position_changed", gpsdata->fix.latitude, gpsdata->fix.longitude);
/* clear the flag */
gpsdata->set &= ~LATLON_SET;
}
}
......@@ -152,8 +159,7 @@ gboolean geoclue_position_current_position(GeocluePosition *obj, gdouble* OUT_la
/* if everything is fine, we can just read obj->gpsdata */
if (obj->gpsdata->status &&
obj->gpsdata->online &&
obj->gpsdata->fix.mode > 1 &&
(obj->gpsdata->set & (LATLON_SET | ALTITUDE_SET))) {
obj->gpsdata->fix.mode > 1) {
*OUT_latitude = obj->gpsdata->fix.latitude;
*OUT_longitude = obj->gpsdata->fix.longitude;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment