PDA

View Full Version : how to communicate between C and Qt application using D-Bus



sanjeet
18th February 2012, 10:14
Hi Everybody,

In my project there are two separate applications(two different exe), one application is in C while other is in Qt.
I have to communicate between these two separate applications through D-Bus, mean i have to send and receive some
data between these two applications via D-Bus.

I am new to D-Bus. I am able to communicate between two Qt-applications, but i don't know how to
communicate these two applications( one is written in C and other is in Qt).

Can you guide me how to do it ?????

Thanks in advance .....!
sanjeet

wysota
18th February 2012, 12:21
Exactly the same way. Use Qt D-bus API in Qt and C D-bus API in C.

sanjeet
20th February 2012, 04:18
Dear wysota,
Thank for guiding me........ i am doing in same way, as you have said.
but it's not happening......... i think i am doing some mistake...?
can you provide me some link or example ?

ChrisW67
20th February 2012, 05:36
Thank for guiding me........ i am doing in same way, as you have said.
but it's not happening......... i think i am doing some mistake...?

I think you are doing some mistake also.

According to your first post, Qt <-> Qt is no problem. Your attempt to replace one end with a C program is failing. Since this program is nothing to do with Qt you would be will served by looking at the documentation for DBus and the C language bindings you are using.



can you provide me some link or example ?

http://dbus.freedesktop.org/doc/dbus-tutorial.html

sanjeet
20th February 2012, 09:49
i have tried a lot........ but i am not able to do it.
can you provide me some demo code(or link of that code)......

sanjeet
24th February 2012, 06:49
Hi Everybody,
I am able to communicate between two qt-application via D-Bus.
For this i am using "qdbusxml2cpp" and generating adaptor and interface, and using one's interface into other.

Even i am able to communicate between two C-application via C-API for Dbus.

But i have to communicate between one c-application and qt-application, i am not able to do it.
I have to send some string from c-application and that i have to display (on Label in my dialog) in qt-application.

when i am watching through "dbus-monitor" it's giving one error :

"No such method 'displayMsg' in interface 'com.myOrg.myInterface"

I am posting my code, Can you let me know/advice me what's wrong i am doing ?

Whatever i have observed, i am not able to "exposes a method call and waits for it to be called" in my qt side application how to reply to c-application.
It's because, when both applications are in qt, i can easily use one's interface object in to another and call it, but here one application is C.

Can you look my code and find my mistake or guide me how to do it. It's my first time i am using D-Bus in any project.

Thanks in advance !