PDA

View Full Version : Marshaling classes with QtDBus



Yota_VGA
21st November 2007, 01:44
Hi, this is my first post here.
Sorry if my english is too bad.

I've write an xml interface for DBus, and it working perfectly when I use a primitive type or a Qt predefined signature (some as "as" or "s").

Because I want to use some object not defined by Qt4 I've implemented a new class, I've register it with Q_DECLARE_METATYPE, qRegisterMetaType and qDBusRegisterMetaType, so I've overloaded the operator << and >> for QDBusArgument and my type.
I've change the signature in the xml and I've insert an annotation (for qdbusxml2cpp) like this:


<annotation name="com.trolltech.QtDBus.QtTypeName.Out0"
value="DBusReturn"/>

DBusReturn is my object :)

So, if I execute qdbusviewer and call the function I have an error message saying that the function don't exist.

I've think that this is a problem of qdbusviewer, that don't manage the strange signature, so I have change this one with a signature recognized from the Qts.
So, qdbusviewer work, but the result is empty. So I've write some qDebug in the << and >> operators and in the callback function, but that don't write anything.

I've try the code called in the adaptor in another place, and all work.

I've Qt 4.3.2. If you want to see some code it isn't a problem (the project is under GPL2 but the code of the last 2 days isn't online becouse don't working).

Thanks ;)

EDIT:

Sorry, double thread!

QPlace
21st November 2007, 03:24
I can't help with QtDBus, but I am curious - are you using it on Linux or on Windows? My understanding that it is only available on Linux, but it will be a great joy to find out that I am wrong.

Also, does anyone know what is in store for QtDBus in next Qt releases?

ChristianEhrlicher
21st November 2007, 07:18
My understanding that it is only available on Linux, but it will be a great joy to find out that I am wrong.

Then take a look at windows.kde.org :)

Yota_VGA
21st November 2007, 13:57
I use GNU/Linux, actually QtDBus working officially only on *nix, but the kde team has build an unofficial porting for windows.
I think that in a near future this will become official, but I'm not sure :)

ChristianEhrlicher
21st November 2007, 15:50
I wonder what you mean with 'unofficial' - it's open source and available for everyone... :confused:

Yota_VGA
21st November 2007, 15:56
I want to say that it isn't trolltech and it isn't present in the trolltech Qt release :)

QPlace
21st November 2007, 19:58
ChristianEhrlicher,

Thank you for the response. While trying to locate the project with googling <DBus KDE windows> I quickly located your post regarding DBus
http://www.nabble.com/Problem-with-dbus-service-dir-t4686135.html

, but I failed to find out DBus/windows project root. I will really appreciate it if you can point me to the place where this project is located. Also, it looks like you have an experience working with DBus on windows - may be you can share your opinion/experience/pitfalls with using it?

ChristianEhrlicher
21st November 2007, 20:02
The project is located on sourceforge: http://sourceforge.net/projects/windbus

Binary packages are also available -> use the kdewin-installer (http://download.cegit.de/kde-windows/installer) to get them (0.8.3-1 is the recent release atm)

Yota_VGA
22nd November 2007, 01:04
Ok, this is a problem of qdbusviewer. I've try to access on my dbus server with a simply python script (with pyqt and dbus modules) and all work perfectly.

So qdbusviewer is usefull only with very simple dbus interfaces. I can use python for tests but it is a wasteful amount of time. What I can use for a fast debug of a complex dbus interface?

EDIT:

Uhm, I've tested well all the things and don't generate any error, but the results are totally incorrect.

EDIT:

I'm sorry, I've commit some mistakes in my test, all OK ;)