Results 1 to 4 of 4

Thread: Connect Problem

  1. #1
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Connect Problem

    The declaration of connect is as below for QDBusConnection,

    Qt Code:
    1. bool QDBusConnection::connect ( const QString & [B]service,[/B] const QString & [B]path[/B], const QString & [B]interface[/B], const QString & [B]name[/B], const QString & signature, QObject * [B]receive[/B]r, const char * [B]slot[/B] )
    To copy to clipboard, switch view to plain text mode 

    now scenario is as below,

    service = com.test.serivce
    path = /
    interface = ?
    name = buttonPressed
    receiver=? [because i want to call SLOT of other application whose object is not declared in this application]
    slot= ? [this slot is not defined or declared in this application its a port of current application it's in other application]

    If I call this connect from the process which have registered it's object service and path, Is it Possible to connect to SLOT in process which has created interface of this service(not registered any object)?

    Your suggestion would be highly appriciable.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Connect Problem

    You can't connect signals from your applications to receivers in other applications this way. You can only associate a signal in your application with a message that will be sent to the bus. It is the other application that has to connect to the bus and the interface exposed by your application.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Post Re: Connect Problem

    Thanks wysota,

    I got your point, but my scenario is quit different, It's like below

    I have created 2 process
    1) Qt Process (for GUI)
    2) ./MyApplication (for hardware stuff)

    QT Process would do all GUI related stuff and content functions that can change/modify the display by adding or removing widgets, this function would be call by MyApplication.

    Qt Process CODE
    Qt Code:
    1. main(int argc, char *argv[])
    2. {
    3. QApplication a(argc, argv)
    4. Widget w;
    5.  
    6. // get connected to DBus
    7. // registered service & object
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 

    Myapplication will create interface to this sevice and call the methods of this Qt process(I am able to do this)
    MyApplication Code
    Qt Code:
    1. main()
    2. {
    3. // Create interface to dbus service.
    4.  
    5. // Call function of Qt process from this MyApplication process
    6. interface.call("method_name",arg1,arg2,...)
    7.  
    8.  
    9. }
    To copy to clipboard, switch view to plain text mode 


    I will(my device) get messages from another device [ master ] in my case, master will send commands and messages to MyApplication process.

    Master's command & mesg. would be the information, what to show on display(what widget, color, font size, widget string etc.) .

    MyApplication process will interpret this messages and call function of Qt Process to show widgets on the display according the argument passed from MyApplication process.

    Now,I want signal / or message from Qt on click of any widget.
    In MyApplication I have not registered any object and service, I have just created interface and calling function directly, Because my MyApplication code is just like below

    Qt Code:
    1. main()
    2. {
    3. // system initialization
    4.  
    5. // create Interface of service registered by Qt Process
    6.  
    7. while()
    8. {
    9. //driver events to poll
    10. // DSP message queue to poll(check for messg and command )
    11. // other time critical tasks
    12.  
    13. // call function of Qt process if Display need to change the content
    14. interface.call("method_name",arg1,arg2,...)
    15.  
    16. }
    17.  
    18.  
    19. }
    To copy to clipboard, switch view to plain text mode 

    Now if I register object from MyApplication, I need to use Q_OBJECT and I must call exec() to get into the event loop. if I call exec(), process will go in wait state and my time critical data would be missed.

    What should I do? how can it possible to manage communication with dbus without affection other time Critical tasks ?

    Your suggestion would be great help for me.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Connect Problem

    You don't have to use Qt to use D-BUS. On the other hand if you want to be notified about something happening in another application (regardless if you use Qt or not and if you use D-BUS or not) you will have to do some polling or waiting. If you want, you can do that in a secondary thread but at some point you will have to check whether there is something waiting for you in the IPC channel.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Very strange socket programming problem
    By montylee in forum Qt Programming
    Replies: 5
    Last Post: 11th November 2008, 12:05
  2. deployment problem: msvc++ 2008 Express, Qt 4.4.3
    By vonCZ in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2008, 14:38
  3. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  4. connect problem QDialog
    By Zergi in forum Newbie
    Replies: 1
    Last Post: 1st January 2008, 13:36

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.