View Single Post
Posts: 235 | Thanked: 339 times | Joined on Nov 2010
#2
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;