Creating a dbus connection

Naveen Verma ernaveenverma at gmail.com
Thu Jul 5 09:51:02 PDT 2007


Hi,

Hi,
>
> P. Durante wrote:
> >> And in my program I am doing like:
> >> DBus::Connection *pconn = DBus::Connection(bus_path);
> >> pconn->register_connection();
> >>
> >> After this it is working ok.
> >>
> >> So I have a question, is there any other way already exist to register
> the
> >> connection, or such function is missing and we need to add one as I did
> >> above?
> >
> > Yes, it's a bug, as per the doc:
> >
> > "If you open a bus connection with dbus_connection_open() or
> > dbus_connection_open_private() you will have to dbus_bus_register()
> > yourself, or make the appropriate registration method calls yourself."
> >
> > the constructor should call it and it doesn't, this hasn't come up
> > earlier because only the 'default' buses were being used.
> >
>
> I don't understand this - the docs you quoted indicate that
> connection_open() will not register with the bus, which is correct,
> because a DBusConnection does not have to be a connection to a bus.
> So having the C++ wrapper for connection_open register isn't right either.
>
> dbus_bus_get() does register with the bus, since it knows it's a bus.
> In C++ I'd expect that to be wrapped separately and as a static or
> factory method, rather than as a constructor.


   - I think you are correct. We can make a public method to register the
connection
     in the bus, and the user should call the register method after creating
the connection.
    As I tried in the above example.


Havoc


-Br
Naveen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freedesktop.org/archives/dbus/attachments/20070705/d25141ef/attachment.htm 


More information about the dbus mailing list