diff options
author | Ankit <ankitstarski@gmail.com> | 2015-04-01 16:23:59 +0530 |
---|---|---|
committer | Zeeshan Ali (Khattak) <zeeshanak@gnome.org> | 2015-04-08 15:41:58 +0100 |
commit | 6305278d60560b753e6b94e9b2a4ced1e3f82231 (patch) | |
tree | b5f240f544a778410b91a14ddc02a704eb0e1458 /demo | |
parent | cc23e0449ac7795aeef0c1956129db5f866440ee (diff) | |
download | geoclue-6305278d60560b753e6b94e9b2a4ced1e3f82231.tar.gz |
demo,where-am-i: Print speed & heading
Now that speed and heading are reported on Location interface, let's
print them.
https://bugs.freedesktop.org/show_bug.cgi?id=89395
Diffstat (limited to 'demo')
-rw-r--r-- | demo/where-am-i.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/demo/where-am-i.c b/demo/where-am-i.c index 281a8ed..d19807b 100644 --- a/demo/where-am-i.c +++ b/demo/where-am-i.c @@ -85,7 +85,7 @@ on_location_proxy_ready (GObject *source_object, { GDBusProxy *location = G_DBUS_PROXY (source_object); GVariant *value; - gdouble latitude, longitude, accuracy, altitude; + gdouble latitude, longitude, accuracy, altitude, speed, heading; const char *desc; gsize desc_len; GError *error = NULL; @@ -105,6 +105,10 @@ on_location_proxy_ready (GObject *source_object, accuracy = g_variant_get_double (value); value = g_dbus_proxy_get_cached_property (location, "Altitude"); altitude = g_variant_get_double (value); + value = g_dbus_proxy_get_cached_property (location, "Speed"); + speed = g_variant_get_double (value); + value = g_dbus_proxy_get_cached_property (location, "Heading"); + heading = g_variant_get_double (value); g_print ("\nNew location:\n"); g_print ("Latitude: %f\nLongitude: %f\nAccuracy (in meters): %f\n", @@ -113,6 +117,10 @@ on_location_proxy_ready (GObject *source_object, accuracy); if (altitude != -G_MAXDOUBLE) g_print ("Altitude (in meters): %f\n", altitude); + if (speed >= 0) + g_print ("Speed (in meters per second): %f\n", speed); + if (heading >= 0) + g_print ("Heading (in degrees): %f\n", heading); value = g_dbus_proxy_get_cached_property (location, "Description"); desc = g_variant_get_string (value, &desc_len); |