greetings;
I was creating an application with Qt that exposes a dbus service. the
service returns its output as a QStringList. I tested this dbus service
with a client written in Qt and it worked perfectly.
I wanted to create a Desktop widget that can consume this dbus service.
I created a normal C file that calls the dbus service - just as POC to
see if it works by modifying some code i found (a C file that gets the
imei , written by mr.faheem
http://talk.maemo.org/showpost.php?p=371496&postcount=45)
my code is :
#include <stdlib.h>
#include <glib.h>
#include <glib/gprintf.h>
#include <dbus/dbus-glib.h>
#include <string.h>
#include <stdio.h>
static GList* ptimes_list = NULL;
int fn() {
DBusGConnection *conn;
GError *error = NULL;
conn = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (!conn) {
g_printerr ("Error: %s\n", error->message);
g_error_free (error);
return 0;
}
DBusGProxy *proxy = NULL;
/* replaced the cinstants with values from my dbus interface */
proxy = dbus_g_proxy_new_for_name(conn, SERVICE_NAME,PATH ,INTERFACE);
if (!proxy) {
printf("No proxy, dbus_g_proxy_new_for_name() failed \n");
return 0;
}
if (!dbus_g_proxy_call(proxy,"mthod_name", &error,my_list) )
{
/* dbus_g_proxy_call failed */
printf("dbus_g_proxy_call(proxy,method, &error,myList)
returned FALSE \n");
return 0;
}
if (!my_list) {
/* output list is empty */
printf("my_list) glist is still NULL \n");
return 0;
}
g_object_unref(proxy);
char[10] element = (char*) g_list_nth_data(my_list),0);
printf("the value of the fajr first is %s \n",element);
return 1;
}
the program fails at this point: proxy = dbus_g_proxy_new_for_name(conn,
SERVICE_NAME,PATH ,INTERFACE);
and my application stops.
I wonder what is wrong with the way I called my DBus service . Any help
is appreciated!
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers