Go Back   maemo.org - Talk > OS / Platform > Development
 
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
  #1  
Old 2010-11-26, 10:13
chemist's Avatar
chemist chemist is offline
Administrator
 
Join Date: Sep 2009
Location: Germany
Posts: 1,036
Thanks!: 346
Thanked 2,019 Times in 515 Posts
Default Using Nokia Maps with dbus

We had this discussion on IRC (#maemo) lately, about how to start Nokia Maps with dbus. As I do not know if they changed anything within changes of PR1.2-1.3 I can only tell that this is the PR1.3 way we figured to work.

For CLI with Lon./Lat. you may consider a direct step
Code:
dbus-send –dest=com.nokia.Navigation.NokiaMapsProvider –type=method_call /Provider com.nokia.Navigation.MapProvider.ShowPlaceGeo double:<latitude> double:<longitude> uint32:0
To get an address you may use this
Code:
dbus-send –dest=com.nokia.Navigation.NokiaMapsProvider –type=method_call /Provider com.nokia.Navigation.MapProvider.LocationToAddresses double:<latitude> double:<longitude> boolean:false
it returns a bunch of strings as dbus reply.

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.
Reply With Quote
The Following 4 Users Say Thank You to chemist For This Useful Post:
  #2  
Old 2010-11-26, 10:56
jstokes jstokes is offline
 
Join Date: Nov 2010
Posts: 235
Thanks!: 766
Thanked 339 Times in 164 Posts
Default Re: Using Nokia Maps with dbus

QtDBus (not by me): https://garage.maemo.org/plugins/ggi...3ab73a;hb=HEAD

Untested DBus-GLib (http://dbus.freedesktop.org/doc/dbus...mple-program-1) for the ShowPlaceGeo call:
PHP Code:
/* 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", &errorG_TYPE_DOUBLElatitudeG_TYPE_DOUBLElongitudeG_TYPE_UINT0G_TYPE_INVALIDG_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;

Reply With Quote
  #3  
Old 2011-01-02, 16:16
jlu jlu is offline
 
Join Date: Dec 2007
Location: Finland
Posts: 166
Thanks!: 10
Thanked 106 Times in 58 Posts
Default Re: Using Nokia Maps with dbus

Quote:
Originally Posted by chemist View Post
Please point me to the thread this is talked about as I found one once but am not able to find it again.
Maybe this one:

http://talk.maemo.org/showthread.php?t=52914
Reply With Quote
  #4  
Old 2011-01-02, 16:17
jlu jlu is offline
 
Join Date: Dec 2007
Location: Finland
Posts: 166
Thanks!: 10
Thanked 106 Times in 58 Posts
Default Re: Using Nokia Maps with dbus

Quote:
Originally Posted by jstokes View Post
Untested DBus-GLib
Works fine!
Reply With Quote
  #5  
Old 2011-01-03, 10:39
chemist's Avatar
chemist chemist is offline
Administrator
 
Join Date: Sep 2009
Location: Germany
Posts: 1,036
Thanks!: 346
Thanked 2,019 Times in 515 Posts
Default Re: Using Nokia Maps with dbus

Quote:
Originally Posted by jlu View Post
Thanks but I was looking for another one and tried some power searching with no luck yet. The CLI snippet and the codes above are more than enough to get a clue how to use the Location framework of OviMaps for now.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:01.