2 from svc_settings
import UserSettings
3 from svc_connection06
import Connection_06
6 class UserSettings_06(UserSettings
):
8 def __init__(self
, opath
, conmaps
):
10 dbus
.service
.Object
.__init
__(self
, bus
, opath
)
11 #print "CONMAPS:", conmaps
12 self
.conns
= map(self
.newCon
, conmaps
)
15 def newCon(self
, conmap
):
16 cpath
= "/MyConnection/%d" % self
.counter
17 self
.counter
= self
.counter
+ 1
18 c
= Connection_06(cpath
, conmap
)
19 #self.NewConnection(cpath) # announce it
22 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
23 in_signature
="i", out_signature
='as')
24 def getNetworks(self
, i
):
25 # FIXME bytearray to str WHERE?
26 #n = [ssid_str(c.Ssid()) for c in self.conns]
27 n
= [c
.ID() for c
in self
.conns
]
28 print "getNetworks:", n
31 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
32 in_signature
="", out_signature
='ao') # out??
33 def getVPNConnections(self
):
36 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
38 #out_signature='sibasi') #varies
39 def getNetworkProperties(self
, net
, type):
41 # type is 1, NETWORK_TYPE_ALLOWED
42 c
= self
.GetByNet(net
)
44 return c
.getNetworkProperties()
45 print "Oops, could not getNetworkProperties for " + net
48 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
50 #out_signature="isi") varies
51 def getKeyForNetwork(self
, dev
, net
, ssid
, attempt
, newkey
):
52 print "GKFN", dev
, net
, ssid
, attempt
, bool(newkey
)
54 m
= "Cannot ask for key"
56 raise dbus
.exceptions
.DBusException(m
)
58 snet
= opath_unescape(net
[net
.rfind("/")+1 : ]) # only stuff after /
59 c
= self
.GetByNet(snet
)
61 return c
.getKeyForNetwork()
62 print "Oops, could not getKeyForNetwork " + net
64 @dbus.service
.method(dbus_interface
="org.freedesktop.NetworkManagerInfo",
66 #in_signature="sbs isi", varies
67 def updateNetworkInfo(self
, ssid
, automatic
, bssid
, *security
):
68 print "Connected successfully"
72 print " automatic:", bool(automatic
)
73 print " bssid:", bssid
74 print " security:", security
77 def GetByNet(self
, net_name
):
78 "Returns connection, or None"