Results 1 to 7 of 7

Thread: DBus service name

  1. #1
    Join Date
    Apr 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default DBus service name

    Hello everyone !

    I'm writing a little DBus driven standalone progress bar, something like KDialog's progress bar.

    The point would be to run a new bar from an application, getting its DBus reference through stdin and driving it from the mother application.

    Each time I'm running a new bar, a new DBus service name is created. The names are :1.10, :1.11, :1.12, etc.

    How to get this service name at registration time (so I could write it to stdout) ? The way the adaptor object is registered

    Qt Code:
    1. QDBusConnection::sessionBus().registerObject( "/", &bar )
    To copy to clipboard, switch view to plain text mode 

    doesn't return the service name. Should I use QDBusConnection::registerService ? But what if I need to run several bar at the same time ?

    Thank you very much !

  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: DBus service name

    Quote Originally Posted by charlesf View Post
    Should I use QDBusConnection::registerService ?
    Yes.

    But what if I need to run several bar at the same time ?
    That's what the object names are for. You'll have different objects for different instances of the progress bar.
    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
    Apr 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: DBus service name

    That's what the object names are for. You'll have different objects for different instances of the progress bar.
    It makes totally sense. My problem being that I don't know how to get the name of my newly created object.

  4. #4
    Join Date
    Apr 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: DBus service name

    I might have found the answer : QDBusConnection::sessionBus().interface() emits the signal serviceRegistered( const QString& ) when a new service is registered.

  5. #5
    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: DBus service name

    Quote Originally Posted by charlesf View Post
    My problem being that I don't know how to get the name of my newly created object.
    QDBusConnection::registerObject() takes a path to the object. The last part of the path is the object name.
    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.


  6. #6
    Join Date
    Apr 2009
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: DBus service name

    I know my object name, of course. But I don't know the service name at registration time. QDBusConnection::sessionBus().interface()->serviceRegistered( const QString& ) works for me anyway.

  7. #7
    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: DBus service name

    QDBusConnection::registerService() takes a string argument where you can pass the service name.
    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. DBus Registration problem
    By nrabara in forum Newbie
    Replies: 1
    Last Post: 30th April 2009, 10:34
  2. DBus on windows?
    By talk2amulya in forum Qt Programming
    Replies: 4
    Last Post: 30th March 2009, 11:11
  3. DBus over Network?
    By shensel in forum Qt Programming
    Replies: 5
    Last Post: 26th March 2009, 11:12
  4. How to check the current status of a service
    By Ankitha Varsha in forum Qt Programming
    Replies: 1
    Last Post: 21st October 2008, 12:55
  5. Creating QDS service
    By bowser in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 29th October 2007, 11:12

Tags for this Thread

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.