NetworkManager.ActivateConnection and java-dbus

Matthew Johnson dbus at matthew.ath.cx
Mon Apr 29 05:23:28 PDT 2013


On Thu Apr 25 20:43, Vladimir Prus wrote:
> I am trying to use NetworkManager interfaces using java-dbus (as of version 2.7), and seem to
> be missing some design behind DBusInterface and Path classes. Running CreateInterface as follows:

Hmm, I can only vaguely remember what was going on there. I think DBusInterface
was to try and let you pass objects you've already bound and implicitly pull
the path from them. This is a bit hit and miss, so Path is there to allow you
to do it by hand (not String, to be semantically differentiated and because
otherwise I can't create the type strings implicitly).
>
>     public DBusInterface ActivateConnection(DBusInterface connection, DBusInterface device, DBusInterface specific_object);
>
> Documentation for that method say that the last parameter should be the object path of "/", at least when activating
> wired connection, and the only way I could do that is to is to change type of last parameter to Path, like so:
>
>     public DBusInterface ActivateConnection(DBusInterface connection, DBusInterface device, Path specific_object);

This should always be possible, yes

> This works to me now, but it seems that if in future, I need to pass DBusInterface for the last parameter, I will
> have a reserve problem. So:
>
>      - DBusInterface cannot be created for object path of "/"

Well, I don't think "/" is actually a valid path. I _think_
http://dbus.freedesktop.org/doc/dbus-specification.html#message-protocol-marshaling-object-path
implies that you must always have at least one element of at least one
character, but maybe I'm wrong.

>      - It does not appear I can convert DBusInterface to Path, unless I keep track of the original path used
>        to obtain each DBusInterface instance
>
> Am I missing something, and what's the right type to use for third parameter here?

I'd just use Path and keep track of what they should be when you need to call it. Sorry if that's less convenient.

Alternatively, you're welcome to contribute patches upstream.

Matt


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 835 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20130429/2129c393/attachment.pgp>


More information about the dbus mailing list