maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   How dose D-Bus working with QT4 in Maemo SDK 4,5 (https://talk.maemo.org/showthread.php?t=28780)

funpig 2009-05-06 14:08

How dose D-Bus working with QT4 in Maemo SDK 4,5
 
Hello,

I have a simple qt example would like working with D-Bus, but i got error when i launch it. some detail as following
Code:

#include <QtCore/QCoreApplication>
#include <QtCore/QDebug>
#include <QtCore/QStringList>
#include <QtDBus>

void method_1()
{
        qDebug() << "Demo_1 Method 1(in): ";

        QDBusConnection bus = QDBusConnection::sessionBus();
        QDBusInterface dbus_iface("org.freedesktop.Telepathy.ConnectionManager", "org/freedesktop/Telepathy/ConnectionManager",
                        "org.freedesktop.Telepathy.ConnectionManager", bus);
        QDBusReply<QStringList> reply = dbus_iface.call("ListProtocols");
        foreach (QString name, reply.value())
                qDebug() << name;
        qDebug() << "Demo_1 Method 1(out): ";
}

int main(int argc, char **argv)
{
        QCoreApplication app(argc, argv);

        if( !QDBusConnection::sessionBus().isConnected())
        {
                fprintf(stderr, "Cannot connect to the D-Bus session bus.\n"
                                "To start it, run:\n"
                                "\teval 'dbus-launch --auto-syntax'\n");
                return -1;
        }

        method_1();

        return 0;
}

and i run dbus-launch like this
Code:

dbus-launch --auto-syntax
then, i run that example and got the error like this
Code:

[sbox-DIABLO_X86: ~/qt_tmp/demo_1] > run-standalone.sh ./demo_1
Cannot connect to the D-Bus session bus.
To start it, run:
        eval 'dbus-launch --auto-syntax'
[sbox-DIABLO_X86: ~/qt_tmp/demo_1] >

Why the session bus is not connected? Dose anyone know how could qt working with D-Bus successful?

danielwilms 2009-05-07 08:01

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
Hi funpig,

the problem is not on the Qt side, but a SDK-problem. We tried it here with the Fremantle SDK and it worked. I will try to figure out how to solve that issue.

Cheers Daniel

danielwilms 2009-05-07 14:23

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
The problem can be most likely solved by export the dbus session bus address manually. you can do this by following these steps:

Code:

> eval $(dbus-launch --sh-syntax)
> export BUS_SESSION_BUS_ADDRESS
> export DBUS_SESSION_BUS_PID

Please try it out with your application. At least the dbus-monitor works then for me. If this does not work let me know.

Cheers Daniel

funpig 2009-05-07 15:39

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
Quote:

Originally Posted by danielwilms (Post 285220)
The problem can be most likely solved by export the dbus session bus address manually. you can do this by following these steps:

Code:

> eval $(dbus-launch --sh-syntax)
> export BUS_SESSION_BUS_ADDRESS
> export DBUS_SESSION_BUS_PID

Please try it out with your application. At least the dbus-monitor works then for me. If this does not work let me know.

Cheers Daniel

Hi, Daniel

thank you for your reply. i tried your way like following:
Code:

[sbox-DIABLO_X86: ~/qt_tmp/demo_1] > eval $(dbus-launch --sh-syntax)
[sbox-DIABLO_X86: ~/qt_tmp/demo_1] > export BUS_SESSION_BUS_ADDRESS
[sbox-DIABLO_X86: ~/qt_tmp/demo_1] > export DBUS_SESSION_BUS_PID
[sbox-DIABLO_X86: ~/qt_tmp/demo_1] > run-standalone.sh ./demo_1
Cannot connect to the D-Bus session bus.
To start it, run:
        eval 'dbus-launch --auto-syntax'
[sbox-DIABLO_X86: ~/qt_tmp/demo_1] > dbus-monitor --session
signal sender=org.freedesktop.DBus -> dest=:1.0 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
  string ":1.0"
method call sender=:1.0 -> dest=org.freedesktop.DBus path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
  string "type='method_call'"
method call sender=:1.0 -> dest=org.freedesktop.DBus path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
  string "type='method_return'"
method call sender=:1.0 -> dest=org.freedesktop.DBus path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=AddMatch
  string "type='error'"
^Z
[1]+  Stopped                dbus-monitor --session
[sbox-DIABLO_X86: ~/qt_tmp/demo_1] >

it looks dbus-monitor working fine. but my app still can't connected to D-bus. is it only way to fix this issue that's i update my Maemo SDK to fremantle??

Br funpig

funpig 2009-05-12 02:48

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
Hi, Daniel

Do you have other solution could fix this problem in Maemo SDK 4.5?

Br
funpig

danielwilms 2009-05-12 06:04

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
Hi funpig,

hmmm...the error message of your application is still the same as before??

But what do you need your application for? If you want to run it on your tablet then just updating to fremantle wouldn't be a solution. I will try to investigate more on it...

Cheers Daniel

funpig 2009-05-12 07:01

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
Hi, Daniel

Because i'm focus on mid-software relate with SIP in nokia phone, So, i want write a simple QT app like VoIP that working with telepathy and run it in Maemo.
i'll update my Maemo SDK to Fremantle tonight. hope everything is ok!:D
thanks for your help!

Br
funpig

funpig 2009-05-13 03:31

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
yesterday night, i just updated the scratchbox because the internet speed is too slow. it looks my app still can't connect to D-Bus just only updated the scratchbox. I'll continue to updating Maemo SDK tonight. let's see what's happened.

funpig 2009-05-14 08:08

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
It's too bad. my hard disk is too small in VM. i can't install anything because that's no free space in my hard disk after i installed the new scratchbox.:mad:
I'll resize the hard disk in VM for get more space for continue working with VM.

funpig 2009-05-19 03:55

Re: How dose D-Bus working with QT4 in Maemo SDK 4,5
 
:D my app is works fine after i upgrage to fremantle. but i got some error when i run
Code:

Xephyr :2 -host-cursor -screen 800x480x16 -dpi 96 -ac &

unrecognised device identifier!
(EE) config/hal: NewInputDeviceRequest failed

after i run Xephyr, i launch the maemo simulator. it looks have many warning. but simulator could be use.

PS: i'm not like the theme in this fremantle simulator.


All times are GMT. The time now is 06:16.

vBulletin® Version 3.8.8