1 from device
import cDevice
, cDeviceEth
2 from manager
import NMI
3 from ap07
import cAP_07
7 class cDevice_07(cDevice
):
10 self
.dt
= self
.get_property("DeviceType")
12 self
.__class
__ = cDeviceEth_07
14 self
.__class
__ = cDeviceWifi_07
16 self
.__class
__ = cDeviceGSM_07
20 "UNKNOWN", "UNMANAGED", "UNAVAILABLE", "DISCONNECTED", "PREPARE",
21 "CONFIG", "NEED_AUTH", "IP_CONFIG", "ACTIVATED", "FAILED",]
26 # "Ip4Config", only for NM_DEVICE_STATE_ACTIVATED
27 for P
in ["Udi", "Interface", "Driver",]:
28 print " %s: %s" % (P
, self
.get_property(P
))
29 addr
= self
.get_property("Ip4Address")
30 print " Ip4Address:", self
.ip_str(addr
)
31 caps
= self
.get_property("Capabilities")
32 print " Capabilities:", bitmask_str(self
.NM_DEVICE_CAP
, caps
)
33 state
= self
.NM_DEVICE_STATE
[self
.get_property("State")]
34 print " Dev State:", state
35 if state
== "ACTIVATED":
36 self
.DumpIp4Config(self
.get_property("Ip4Config"))
38 dt
= self
.DeviceType()
39 print " Dev Type:", dt
42 class cDeviceEth_07(cDevice_07
, cDeviceEth
):
44 for P
in ["HwAddress", "Speed", "Carrier"]:
45 print " %s: %s" % (P
, self
.get_property(P
))
47 class cDeviceGSM_07(cDevice_07
):
50 print " %s: %s" % (P
, self
.get_property(P
))
52 class cDeviceWifi_07(cDevice_07
):
53 NM_802_11_DEVICE_CAP
= {1:"CIPHER_WEP40", 2:"CIPHER_WEP104",
54 4:"CIPHER_TKIP", 8:"CIPHER_CCMP",
58 self
.wdevi
= dbus
.Interface(self
.obj
, NMI
+ ".Device.Wireless")
59 aps
= self
.wdevi
.GetAccessPoints()
60 return map(cAP_07
, aps
)
63 print " Dev Mode:", self
.IW_MODE
[self
.get_property("Mode")]
64 wcaps
= self
.get_property("WirelessCapabilities")
65 print " Wifi Capabilities:", bitmask_str(self
.NM_802_11_DEVICE_CAP
, wcaps
)
66 for P
in ["HwAddress", "Bitrate", "ActiveAccessPoint"]:
67 print " %s: %s" % (P
, self
.get_property(P
))
68 #FIXME pass options otherwise
70 print " Access Points"