Re: daierxin gmail com>



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]