|
2010-11-26
, 10:56
|
Posts: 235 |
Thanked: 339 times |
Joined on Nov 2010
|
#2
|
/* gcc ShowPlaceGeo.c -o ShowPlaceGeo -Wall $(pkg-config --cflags --libs glib-2.0 dbus-glib-1) */
#include <stdlib.h>
#include <glib.h>
#include <dbus/dbus-glib.h>
int main (void)
{
DBusGConnection *connection;
GError *error = NULL;
DBusGProxy *proxy;
const gdouble latitude = FILLMEIN;
const gdouble longitude = FILLMEIN;
g_type_init ();
connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error);
if (!connection)
{
g_printerr ("Failed to open connection to bus: %s\n",
error->message);
g_error_free (error);
return EXIT_FAILURE;
}
proxy = dbus_g_proxy_new_for_name (connection,
"com.nokia.Navigation.NokiaMapsProvider",
"/Provider",
"com.nokia.Navigation.MapProvider");
/* dbus_g_proxy_call_no_reply */
if (!dbus_g_proxy_call (proxy, "ShowPlaceGeo", &error, G_TYPE_DOUBLE, latitude, G_TYPE_DOUBLE, longitude, G_TYPE_UINT, 0, G_TYPE_INVALID, G_TYPE_INVALID))
{
/* Just to demonstrate remote exceptions versus regular GError */
if (error->domain == DBUS_GERROR && error->code == DBUS_GERROR_REMOTE_EXCEPTION)
g_printerr ("Caught remote method exception %s: %s",
dbus_g_error_get_name (error),
error->message);
else
g_printerr ("Error: %s\n", error->message);
g_error_free (error);
return EXIT_FAILURE;
}
g_object_unref (proxy);
return EXIT_SUCCESS;
}
|
2011-01-02
, 16:16
|
Posts: 166 |
Thanked: 106 times |
Joined on Dec 2007
@ Finland
|
#3
|
Please point me to the thread this is talked about as I found one once but am not able to find it again.
|
2011-01-02
, 16:17
|
Posts: 166 |
Thanked: 106 times |
Joined on Dec 2007
@ Finland
|
#4
|
|
2011-01-03
, 10:39
|
|
Administrator |
Posts: 1,036 |
Thanked: 2,019 times |
Joined on Sep 2009
@ Germany
|
#5
|
Maybe this one:
http://talk.maemo.org/showthread.php?t=52914
For CLI with Lon./Lat. you may consider a direct step
What the abook does with a contacts address to open it in Nokia Maps is a AddressToLocation call with the known strings, the dbus reply is the location in Lon./Lat.. Then it calls the ShowPlaceGeo I mentioned first.
Please point me to the thread this is talked about as I found one once but am not able to find it again.
Any additional code snippets for Python C# C++ and others are more than welcome. If anyone does fancy a full AddressToLocation call please tell as I didn't do that yet and am pleased with any further help on fixing this up in here (or the other thread) to have it, once ready, updated at the wiki.
useful links for newcomers: New members say hello, New users start here, Community subforum, Beginners' wiki page, Maemo5 101, FAQ