2 from svc_settings
import UserSettings
5 class UserSettings_06(UserSettings
):
7 def __init__(self
, opath
, conmaps
):
8 dbus
.service
.Object
.__init
__(self
, bus
, opath
)
9 #print "CONMAPS:", conmaps
10 self
.conns
= map(self
.newCon
, conmaps
)
13 def newCon(self
, conmap
):
14 cpath
= "/MyConnection/%d" % self
.counter
15 self
.counter
= self
.counter
+ 1
16 c
= Connection_06(cpath
, conmap
)
17 #self.NewConnection(cpath) # announce it
20 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
21 in_signature
="i", out_signature
='as')
22 def getNetworks(self
, i
):
23 # FIXME bytearray to str WHERE?
24 #n = [ssid_str(c.Ssid()) for c in self.conns]
25 n
= [c
.ID() for c
in self
.conns
]
26 print "getNetworks:", n
29 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
30 in_signature
="", out_signature
='ao') # out??
31 def getVPNConnections(self
):
34 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
36 #out_signature='sibasi') #varies
37 def getNetworkProperties(self
, net
, type):
39 # type is 1, NETWORK_TYPE_ALLOWED
40 c
= self
.GetByNet(net
)
42 return c
.getNetworkProperties()
43 print "Oops, could not getNetworkProperties for " + net
46 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
48 #out_signature="isi") varies
49 def getKeyForNetwork(self
, dev
, net
, ssid
, attempt
, newkey
):
50 print "GKFN", dev
, net
, ssid
, attempt
, bool(newkey
)
52 m
= "Cannot ask for key"
54 raise dbus
.exceptions
.DBusException(m
)
56 snet
= opath_unescape(net
[net
.rfind("/")+1 : ]) # only stuff after /
57 c
= self
.GetByNet(snet
)
59 return c
.getKeyForNetwork()
60 print "Oops, could not getKeyForNetwork " + net
62 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
64 #in_signature="sbs isi", varies
65 def updateNetworkInfo(self
, ssid
, automatic
, bssid
, *security
):
66 print "Connected successfully"
70 print " automatic:", bool(automatic
)
71 print " bssid:", bssid
72 print " security:", security
75 def GetByNet(self
, net_name
):
76 "Returns connection, or None"