Commit 104ab575 authored by Emilio Pozuelo Monfort's avatar Emilio Pozuelo Monfort Committed by Zeeshan Ali

Expose the location's timestamp over D-Bus

https://bugs.freedesktop.org/show_bug.cgi?id=94157
parent a3d29b68
......@@ -129,6 +129,9 @@ gclue_location_set_heading
gclue_location_get_description
gclue_location_dup_description
gclue_location_set_description
gclue_location_get_timestamp
gclue_location_dup_timestamp
gclue_location_set_timestamp
<SUBSECTION Standard>
GCLUE_IS_LOCATION
GCLUE_LOCATION
......
......@@ -326,6 +326,7 @@ gclue_location_new (gdouble latitude,
* @speed: speed in meters per second
* @heading: heading in degrees
* @altitude: altitude of location in meters
* @timestamp: timestamp in seconds since the Epoch
* @description: a description for the location
*
* Creates a new #GClueLocation object.
......@@ -339,6 +340,7 @@ gclue_location_new_full (gdouble latitude,
gdouble speed,
gdouble heading,
gdouble altitude,
guint64 timestamp,
const char *description)
{
return g_object_new (GCLUE_TYPE_LOCATION,
......@@ -348,6 +350,7 @@ gclue_location_new_full (gdouble latitude,
"speed", speed,
"heading", heading,
"altitude", altitude,
"timestamp", timestamp,
"description", description,
NULL);
}
......
......@@ -86,6 +86,7 @@ GClueLocation *gclue_location_new_full
gdouble speed,
gdouble heading,
gdouble altitude,
guint64 timestamp,
const char *description);
GClueLocation *gclue_location_create_from_gga
......
......@@ -90,8 +90,15 @@ gclue_service_location_get_property (GObject *object,
{
GClueDBusLocation *location;
GClueLocation *loc;
GVariant *timestamp;
guint64 sec, usec;
location = GCLUE_DBUS_LOCATION (object);
timestamp = gclue_dbus_location_get_timestamp (location);
g_variant_get (timestamp, "(tt)", &sec, &usec);
g_variant_unref (timestamp);
loc = gclue_location_new_full
(gclue_dbus_location_get_latitude (location),
gclue_dbus_location_get_longitude (location),
......@@ -99,6 +106,7 @@ gclue_service_location_get_property (GObject *object,
gclue_dbus_location_get_speed (location),
gclue_dbus_location_get_heading (location),
gclue_dbus_location_get_altitude (location),
sec,
gclue_dbus_location_get_description (location));
g_value_take_object (value, loc);
......@@ -137,6 +145,7 @@ gclue_service_location_set_property (GObject *object,
GClueLocation *loc;
gdouble altitude;
GeocodeLocation *g_loc;
GVariant *timestamp;
location = GCLUE_DBUS_LOCATION (object);
loc = g_value_get_object (value);
......@@ -153,6 +162,12 @@ gclue_service_location_set_property (GObject *object,
(location, gclue_location_get_speed (loc));
gclue_dbus_location_set_heading
(location, gclue_location_get_heading (loc));
timestamp = g_variant_new
("(tt)",
(guint64) geocode_location_get_timestamp (g_loc),
(guint64) 0);
gclue_dbus_location_set_timestamp
(location, timestamp);
altitude = geocode_location_get_altitude (g_loc);
if (altitude != GEOCODE_LOCATION_ALTITUDE_UNKNOWN)
gclue_dbus_location_set_altitude (location, altitude);
......
......@@ -74,5 +74,21 @@
geocode-glib.
-->
<property name="Description" type="s" access="read"/>
<!--
Timestamp:
The timestamp when the location was determined, in seconds and
microseconds since the Epoch. This is the time of measurement if the
backend provided that information, otherwise the time when GeoClue
received the new location.
Note that GeoClue can't guarantee that the timestamp will always
monotonically increase, as a backend may not respect that.
Also note that a timestamp can be very old, e.g. because of a cached
location.
-->
<property name="Timestamp" type="(tt)" access="read"/>
</interface>
</node>
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