Re: daierxin gmail com>



Thanks


On Sat, Feb 20, 2010 at 8:37 PM, kiran <kiranbhat2006 gmail com> wrote:
Thanks jklimes
             But what i found is that AddConnection Api is present in Network Manager 0.8 dbus interface  and not on Network Manager 0.7 Dbus interface, is that true or i am missing something.
             Even the dbus interface Documentation of NetworkManager says that.

regards
kiran






On Thu, Feb 11, 2010 at 7:28 PM, Jirka Klimes <jklimes redhat com> wrote:
On Thursday 11 of February 2010 12:45:33 kiran wrote:
> Hi
>
>                     How can i add new network Connection (cdma,gsm)  to the
> system-settings connection list through Dbus Api Interface exported by the
> "System settings"  Service.
>
>
> regards
> kiran
>

Hi kiran,

yes, it's possible. You would use AddConnection(connection) method of
org.freedesktop.NetworkManagerSettings interface.
You can use attached python example.

However, be sure that you use 'keyfile' plugin, otherwise you won't be able to
store the connection (just keyfile plugin supports it).

(/etc/NetworkManager/nm-system-settings.conf
should contain keyfile keyword:
[main]
plugins=ifcfg-rh, keyfile
)

Jirka


---- cut here ----
#!/usr/bin/python

import dbus

uuid = "f375c550-564a-4235-be1d-74a2c0c0bdd1"

s_con = { 'id':          'My GSM connection',
         'uuid':        uuid,
         'type':        'gsm',
         'autoconnect': False }

s_gsm = { 'username': 'user_name',
         'apn':      'epc.tmobile.com',
         'number':   '*99#' }

s_ip4 = { 'method': 'auto' }

s_ppp = { 'noauth': True }

s_serial = { 'baud': 115200 }


con = { 'connection': s_con,
       'gsm': s_gsm,
       'ppp': s_ppp,
       'serial': s_serial,
       'ipv4': s_ip4 }


sys_bus = dbus.SystemBus()
proxy = sys_bus.get_object("org.freedesktop.NetworkManagerSystemSettings",
"/org/freedesktop/NetworkManagerSettings")
iface = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings")

try:
   iface.AddConnection(con)
except Exception, e:
   print e
---- cut here ----




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