1 from monitor_base
import MonitorBase
2 from manager
import cNM
3 from device07
import cDevice_07
5 class Monitor(MonitorBase
):
6 def __init__(self
, bus
):
7 MonitorBase
.__init
__(self
, bus
)
11 dbus_interface
="org.freedesktop.NetworkManager.Device.Wireless",
12 signal_name
="PropertiesChanged")
15 dbus_interface
="org.freedesktop.NetworkManager.AccessPoint",
16 signal_name
="PropertiesChanged")
18 self
.ignore("org.freedesktop.Hal.Device", "PropertyModified")
19 self
.ignore("fi.epitest.hostap.WPASupplicant.Interface", "ScanResultsAvailable")
20 self
.ignore("com.redhat.PrinterSpooler", "QueueChanged")
21 self
.ignore("org.freedesktop.NetworkManager", "StateChange") # deprecated
22 self
.watch(self
.nm_sc_h
, "org.freedesktop.NetworkManager", "StateChanged")
23 self
.watch(self
.wpas_isc_h
, "fi.epitest.hostap.WPASupplicant.Interface", "StateChange")
24 self
.watch(self
.nmd_sc_h
, "org.freedesktop.NetworkManager.Device", "StateChanged")
25 self
.watch(self
.bus_noc_h
, "org.freedesktop.DBus", "NameOwnerChanged")
27 def bus_noc_h(self
, *args
, **kwargs
):
28 (name
, old
, new
) = args
33 print "\tBUS NOC\t%s %s" % (name
, new
)
35 def wpas_isc_h(self
, *args
, **kwargs
):
36 opath
= kwargs
["path"]
38 print "\tWPAS %s\t(%s, was %s)" % (new
, opath
, old
.lower())
40 def nmd_sc_h(self
, *args
, **kwargs
):
41 opath
= kwargs
["path"]
42 (new
, old
, reason
) = args
43 news
= cDevice_07
.NM_DEVICE_STATE
[new
]
44 olds
= cDevice_07
.NM_DEVICE_STATE
[old
]
47 reasons
= "reason %d" % reason
48 print "\tDevice State %s\t(%s, was %s%s)" % (news
, opath
, olds
.lower(), reasons
)
50 def nm_sc_h(self
, *args
, **kwargs
):
53 print "\tNM State:", ss
55 def propc_h(self
, *args
, **kwargs
):
56 opath
= kwargs
["path"]
58 for k
, v
in props
.iteritems():
61 line
= "\tPROP\t%s\t%s\t(%s)" % (k
, v
, opath
)