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
	Animal() { mood = 0; }
	public slots:
	void feed(void) {
		emit moodChanged(mood);
	void shoutAt(void) {
		emit moodChanged(mood);
	int currentMood() const { return mood; }

	void moodChanged(int mood);
	int mood;

main.cpp file:
QDBusConnection bus = QDBusConnection::sessionBus();

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