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 self
.dump_props(["Udi", "Interface", "Driver",])
28 addr
= self
.get_property("Ip4Address")
29 print " Ip4Address:", self
.ip_str(addr
)
30 caps
= self
.get_property("Capabilities")
31 print " Capabilities:", bitmask_str(self
.NM_DEVICE_CAP
, caps
)
32 state
= self
.NM_DEVICE_STATE
[self
.get_property("State")]
33 print " Dev State:", state
34 if state
== "ACTIVATED":
35 self
.DumpIp4Config(self
.get_property("Ip4Config"))
37 dt
= self
.DeviceType()
38 print " Dev Type:", dt
41 class cDeviceEth_07(cDevice_07
, cDeviceEth
):
43 self
.dump_props(["HwAddress", "Speed", "Carrier"])
45 class cDeviceGSM_07(cDevice_07
):
49 class cDeviceWifi_07(cDevice_07
):
50 NM_802_11_DEVICE_CAP
= {1:"CIPHER_WEP40", 2:"CIPHER_WEP104",
51 4:"CIPHER_TKIP", 8:"CIPHER_CCMP",
55 self
.wdevi
= dbus
.Interface(self
.obj
, NMI
+ ".Device.Wireless")
56 aps
= self
.wdevi
.GetAccessPoints()
57 return map(cAP_07
, aps
)
60 print " Dev Mode:", self
.IW_MODE
[self
.get_property("Mode")]
61 wcaps
= self
.get_property("WirelessCapabilities")
62 print " Wifi Capabilities:", bitmask_str(self
.NM_802_11_DEVICE_CAP
, wcaps
)
63 self
.dump_props(["HwAddress", "Bitrate", "ActiveAccessPoint"])
64 #FIXME pass options otherwise
67 print " Access Points"