DBus newbie
Adam Trhoň
adam.trhon at gmail.com
Mon Sep 21 01:40:35 PDT 2009
Hi, I am new to DBus technology and have a problem. A learn from
http://doc.trolltech.com/qq/qq20-dbus.html Here is my code:
class Animal : public QObject
{
Q_OBJECT
public:
Animal() { mood = 0; }
public slots:
void feed(void) {
++mood;
emit moodChanged(mood);
return;
}
void shoutAt(void) {
--mood;
emit moodChanged(mood);
return;
}
int currentMood() const { return mood; }
signals:
void moodChanged(int mood);
private:
int mood;
};
main.cpp file:
QDBusConnection bus = QDBusConnection::sessionBus();
bus.interface()->registerService("Farm");
Animal cat;
bus.registerObject("/animals/Dax", &cat, QDBusConnection::ExportAllSlots);
But when I try to feed my cat:
QDBusConnection::sessionBus().call(QDBusMessage::createMethodCall("Farm", "/animals/Dax", "", "feed"));
I get this error message:
process 18995: arguments to dbus_message_new_method_call() were incorrect, assertion "destination == NULL || _dbus_check_is_valid_bus_name (destination)" failed in file dbus-message.c line 1073.
This is normally a bug in some application using the D-Bus library.
QDBusConnection: error: could not send message to service "Farm" path "/animals/Dax" interface "" member "feed"
What is wrong? Thanks for any answers.
More information about the dbus
mailing list