Problems with D-Bus in Java
Íñigo González
inigo.gonzalez at andago.com
Wed May 5 08:02:33 PDT 2010
Hi, I am trying to communicate a C++ Qt program with a Java program
using D-Bus. What I do is to register a QT object on the dbus and I want
another application to send data to it. I have tried to do that
communication between 2 QT apps and that has worked great.
I register the QT object in dbus like this:
hdpManager = new Dmanager();
QDBusConnection::sessionBus().registerService("com.andago.manager");
QDBusConnection::sessionBus().registerObject("/ex",hdpManager,QDBusConnection::ExportAllSlots);
And the Dmanager.h code is this:
class Dmanager: public QObject
{
Q_OBJECT
Agent *ag;
Measure *medida;
public:
Dmanager();
public slots:
Q_SCRIPTABLE QString getAgent();
Q_SCRIPTABLE QString getCurrentMeasure();
Q_SCRIPTABLE QString setAgent(int phd, QString syst, QString manuf,
QString model);
Q_SCRIPTABLE QString deleteAgent();
Q_SCRIPTABLE QString setMeasure(QString att, QString val, QString un);
};
But in java I am not able to access to that object. This is the code:
DBusConnection conn =
DBusConnection.getConnection(DBusConnection.SESSION);
if (interf.isRemote())
conn.callMethodAsync(interf, "deleteAgent");
When it tries to call the deleteAgent method it returns this error:
org.freedesktop.dbus.exceptions.DBusExecutionException:
$Proxy2.deleteAgent()
at org.freedesktop.dbus.AbstractConnection.callMethodAsync(Unknown
Source)
What is the reason for getting this error?
Thank you
More information about the dbus
mailing list