dbus Digest, Vol 158, Issue 9 - Multiple connections to dbus-daemon in single appication

dtdang ddt.fet.hut at gmail.com
Thu Oct 4 06:30:52 UTC 2018


On Wed, Sep 19, 2018 at 9:00 PM <dbus-request at lists.freedesktop.org> wrote:

>
> Message: 1
> Date: Wed, 19 Sep 2018 13:55:13 +1200
> From: Lawrence D'Oliveiro <ldo at geek-central.gen.nz>
> To: dbus at lists.freedesktop.org
> Subject: Re: Multiple connections to dbus-daemon in single appication
> Message-ID: <20180919135513.5fd678ae at theon.geek-central.gen.nz>
> Content-Type: text/plain; charset=UTF-8
>
> On Wed, 19 Sep 2018 10:45:36 +0900, dtdang wrote:
>
> > > On Tue, 18 Sep 2018 10:00:21 +0900, dtdang wrote:
> >>
> >> On Tue, 18 Sep 2018 13:22:51 +1200, Lawrence D'Oliveiro wrote:
> >>
> >>> I would like to register in three separated connections since
> >>> client will send command with option (like using dbus-send with
> >>> option --dest=com.app.bluetooth or --dest=com.ap.wifi or
> >>> --dest=com.ap.ap). So I want to open three separated connection
> >>> with specific name in three threads to listen from client.
> >>
> >> You can do all that on one connection.
> >>
> > Could you give any advises in detail ?
> > In worst case, there is three commands sending to three different
> > destination in parallel.
>
> It’s easy. You can request the registration of any number of names on a
> single bus connection
> <https://dbus.freedesktop.org/doc/api/html/group__DBusBus.html>. Then,
> when you receive a message, you call dbus_message_get_destination()
> <
> https://dbus.freedesktop.org/doc/api/html/group__DBusMessage.html#gaac65c926e6253e49aa689b4f032fad45
> >
> to determine the exact name it was addressed to, and dispatch your
> method-call handling on that.
>

It would be a good approach in my case I think. Could you give me example
of how to register multiple distinct name to application-bus-connection
when connecting to dbus-daemon ?
e.g I want to register "com.dasan.bluetooth" and "com.dasan.wifi" and
"com.dasan.ap" as name of bus-connection of my application.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/dbus/attachments/20181004/6495f067/attachment.html>


More information about the dbus mailing list