Re: How to connect to a specified wireless access point via network manager's dbus service?



Do you think this approach is feasible? If not, is there any other solution?

Regards
James Su

On Tue, Oct 21, 2008 at 11:40 PM, Zhe Su <james.su@gmail.com> wrote:
network-manager-applet has a piece of code to create a new default connection when connecting to a device which doesn't have connection yet.
See function applet_menu_item_activate_helper() in applet.c line 313.
I'm wondering if it's ok to export this piece of code through org.freedesktop.NetworkManagerUserSettings interface.
Maybe a new method: GetConnectionsForDevice(o: device), which returns existing connections for a specific device, or creates and returns a new default connection, if there is no connection for the device yet.

Regards
James Su


On Tue, Oct 21, 2008 at 9:29 PM, Dan Williams <dcbw redhat com> wrote:
On Tue, 2008-10-21 at 09:25 +0800, Zhe Su wrote:
> Thanks for your feedback.
>
> On Tue, Oct 21, 2008 at 1:28 AM, Dan Williams <dcbw redhat com> wrote:
>
>         On Sat, 2008-10-18 at 23:47 +0800, Zhe Su wrote:
>         > Hi,
>         >   I'm writing an application which needs to control network
>         manager
>         > via its dbus service, especially to connect the wifi to a
>         specified
>         > access point. I'm using openSUSE 11 with network manager
>         0.7. After
>         > reading the documentation and source code of network manager
>         applet, I
>         > found that a connection object must be created for the
>         access point
>         > before calling network manager to activate the ap. However
>         seems that
>         > it's only possible to create connection object by using
>         functions
>         > provided by libnm-{glib,utils}. There is no corresponding
>         methods
>         > exported through dbus. But I don't want to make my
>         application depend
>         > on libnm.
>         >   So I'm wondering if there is any way to achieve my goal
>         with nm's
>         > dbus service only?
>
>
>         Do you expect the applet to be running alongside your program?
> Yes.
>
>
>         _Something_ needs to provide the Connection details to
>         NetworkManager,
>         and right now that's the applet.  If you want to replace the
>         applet  and
>         provide your own org.freedesktop.NetworkManagerUserSettings
>         service,
>         that would work.
> I'm going to use existing settings service instead of providing a new
> one. The problem is, current org.freedesktop.NetworkManagerSettings
> interface doesn't have a method to create a new connection for a
> specific device and access point, which makes it impossible to
> activate the device in my application if there is no connection for
> that device yet. And it might be handy to have a method in
> org.freedesktop.NetworkManager to activate a specific device without
> specifying the connection (a temporary default connection shall be
> created and used by network manager), so that network manager can
> still work in many cases without settings service.

No, creating a temporary connection won't work because no settings
service provides that connection over dbus.  Thus, nothing (like the
applet or your application) can actually figure out the connection
details, and thus won't know what the connection's name is, what it's
uuid is, what it's IP settings are supposed to be etc.  NetworkManager
_consumes_ connections, it doesn't provide them.  Thus, something else
must provide them.

You could try writing out the connection you wish to use directly to
GConf, and then the applet will pick that connection up automatically
and you can tell NM to activate it.

Dan

> And when will nm 0.7 be released officially?
>
> Regards
> James Su
>
>
>
>
>         Once you have provided the connection object over D-Bus, NM
>         can find it,
>         and you can tell NM to activate that connection.  You can
>         BSS-lock that
>         connection to the particular AP you're interested in.
>
>         Dan
>
>
>
>
>





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]