×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 28
  1. #1
    Regular Contributor
    Join Date
    Apr 2010
    Posts
    93

    QDBus can not chat in two process

    I have registered server on bus in one project,but I can find the server in another project ,can not use the function of server ,that is why?
    the following is the code ;
    server:
    MainWindow w;

    QDBusConnection connection = QDBusConnection::sessionBus();
    ret = connection.registerService("com.chensu.abcdefServer");
    ret = connection.registerObject("/",&w);

    client:
    iface=new QDBusInterface("com.chensu.abcdefServer", "/", "", QDBusConnection::sessionBus());
    if(iface->isValid())
    {
    QMessageBox::information(this,tr("Valid"),tr("Client find the valid server"),QMessageBox::Ok);
    }
    else
    {
    QMessageBox::warning(this,tr("inValid"),tr("Client find the invalid server \n ,client will exit"),QMessageBox::Ok);
    return ;
    }
    QDBusReply<QString> reply =iface->call("WritewToClient");

    if(reply.isValid())
    {
    QMessageBox::information(this,tr("Sucess"),tr("you have sucess reciving the signal from server"),QMessageBox::Ok);
    }
    else
    {
    QMessageBox::information(this,tr("Error"),tr("%1").arg(reply.error().message()),QMessageBox::Ok);
    return;
    }

  2. #2
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDBus can not chat in two process

    What happens when you are trying to introspect DBus interface of your server
    Code:
    dbus-send --type=method_call --print-reply \
        --dest=com.chensu.abcdefServer / org.freedesktop.DBus.Introspectable.Introspect

  3. #3
    Regular Contributor
    Join Date
    Apr 2010
    Posts
    93

    Re: QDBus can not chat in two process

    the client can find the server that I register on DBus,but when execute the code reply =iface->call("WritewToClient");
    It is shown that "No such method "WritewToClient" in any interface at object '/' (signature)"

  4. #4
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDBus can not chat in two process

    So, what about introspection?

  5. #5
    Regular Contributor
    Join Date
    Apr 2010
    Posts
    93

    Re: QDBus can not chat in two process

    When I input the command that you gave ,I can find the server ,but can not find the method WritewToClient,The method "WritewToClient "that I have declaer to be slot in the class MainWindow,but why I can not find in the sercer?

  6. #6
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDBus can not chat in two process

    In case you build and install application from this wiki article
    http://wiki.forum.nokia.com/index.ph...h_DBus_support
    then introspection shows that there is a top_application method available
    Code:
    $ dbus-send --type=method_call --print-reply --dest=org.indt.sample /org/indt/sample org.freedesktop.DBus.Introspectable.Introspect
    method return sender=:1.279 -> dest=:1.280 reply_serial=2
       string "<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN"
    "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd">
    <node>
      <interface name="org.indt.sample">
        <method name="top_application">
          <arg type="i" direction="out"/>
        </method>
      </interface>
      <interface name="org.freedesktop.DBus.Properties">
        <method name="Get">
          <arg name="interface_name" type="s" direction="in"/>
          <arg name="property_name" type="s" direction="in"/>
          <arg name="value" type="v" direction="out"/>
        </method>
        <method name="Set">
          <arg name="interface_name" type="s" direction="in"/>
          <arg name="property_name" type="s" direction="in"/>
          <arg name="value" type="v" direction="in"/>
        </method>
        <method name="GetAll">
          <arg name="interface_name" type="s" direction="in"/>
          <arg name="values" type="a{sv}" direction="out"/>
          <annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
        </method>
      </interface>
      <interface name="org.freedesktop.DBus.Introspectable">
        <method name="Introspect">
          <arg name="xml_data" type="s" direction="out"/>
        </method>
      </interface>
    </node>
    "

  7. #7
    Regular Contributor
    Join Date
    Apr 2010
    Posts
    93

    Re: QDBus can not chat in two process

    In the artical that http://wiki.forum.nokia.com/index.ph...h_DBus_support provide,I can not understand the sentence " At first you need to modify .desktop file:",in the project of qt,I don't find there is ".desktop file".

  8. #8
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDBus can not chat in two process

    Quote Originally Posted by chensu0526 View Post
    In the artical that http://wiki.forum.nokia.com/index.ph...h_DBus_support provide,I can not understand the sentence " At first you need to modify .desktop file:",in the project of qt,I don't find there is ".desktop file".
    Without desktop file you won't be able to integrate your application into a task launcher menu.

  9. #9
    Regular Contributor
    Join Date
    Apr 2010
    Posts
    93

    Re: QDBus can not chat in two process

    the.desktop file is a file of N900 or is a part of my object?If it is a part of my project,I really don't find the file ,my envrionment is Qt Nokia SDK.I have create the project using the commang mad pscreate -t qt_simple qtclient on MADDE.

  10. #10
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDBus can not chat in two process

    Since you've used pscreate .desktop file is located in data sub-directory of your project directory.

  11. #11
    Regular Contributor
    Join Date
    Apr 2010
    Posts
    93

    Re: QDBus can not chat in two process

    Thank you for your help ,I have founfd the file .

  12. #12
    Regular Contributor
    Join Date
    Apr 2010
    Posts
    93

    Re: QDBus can not chat in two process

    I have a new question now.
    X-Osso-Service=org.indt.sample ,It tells the desktop what is DBus service name of our application, in my applicantion ,I should write X-Osso-Service=com.chensu.abcdefServer?what's more ,when I open .desktop file of my project ,I find the the existing sentence X-Osso-Service=com.nokia.qtclient,which one is right?

  13. #13
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDBus can not chat in two process

    You should place there your service name
    X-Osso-Service=com.chensu.abcdefServer

  14. #14
    Regular Contributor
    Join Date
    Apr 2010
    Posts
    93

    Re: QDBus can not chat in two process

    but I found the name that the project automaticlly produces is com.nokia.qtclient,not com.chensu.abcdefServer,what's more,I have registed the server succefully ,and can not use the method of the project,that,s why?

  15. #15
    Super Contributor
    Join Date
    Oct 2009
    Posts
    4,326

    Re: QDBus can not chat in two process

    Quote Originally Posted by chensu0526 View Post
    but I found the name that the project automaticlly produces is com.nokia.qtclient,not com.chensu.abcdefServer
    pscreate produces only a template, it just appends project name to "com.nokia." to produce a service name.

    Quote Originally Posted by chensu0526 View Post
    what's more,I have registed the server succefully ,and can not use the method of the project,that,s why?
    You have an article which describes all details needed to make it work. Analyse your server code to find relevant differences and eliminate them.

Similar Threads

  1. How to create chat server and chat client using J2ME....
    By mapetos in forum Mobile Java General
    Replies: 24
    Last Post: 2011-08-08, 13:19
  2. Replies: 2
    Last Post: 2010-05-19, 09:30
  3. QDBus and connect to com.nokia.csd.Call
    By crabsody in forum Nokia N9
    Replies: 5
    Last Post: 2010-04-27, 22:18
  4. need help on developing chat server for J2ME chat client
    By sheetal_21 in forum Mobile Java General
    Replies: 6
    Last Post: 2007-09-30, 07:44
  5. please tell me the process to build chat server using J2ME
    By swiswire in forum Mobile Java General
    Replies: 1
    Last Post: 2006-05-17, 18:41

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×