RE: StateChanged device



On Mon, 2010-11-22 at 10:34 +0530, Jos Collin-ERS,HCLTech wrote:
> Hello Everyone,
> 
> Is it possible to get the name of the device when I receive a StateChanged signal? Is there any such parameter with in the StateChanged signal?

The StateChanged signal is an "global" signal that emits the core NM
state.  That state is a composite of the state of all device managed by
NM.  The best approach here is probably to just query NM for the device
you care about, and monitor the device's signals for state.  Or, you can
listed for the global StateChanged signal, then ask NM for each device
object and each device's state.  If you end goal is simply to figure out
whether a specific network interface is 'connected'  or not, I'd go for
the first option: listen for state on the device(s) you care about.  The
"global" bits are more for email/chat/web clients that just want to know
"am I online".

http://cgit.freedesktop.org/NetworkManager/NetworkManager/tree/examples/python

has some python examples, including 'nm-state.py' which explicitly
queries each device's state.  You'd basically do that when you get the
StateChanged signal.

Dan

> Please help.
> 
> Thanks,
> Jos Collin
> ________________________________________
> From: Jos Collin-ERS,HCLTech
> Sent: Friday, November 19, 2010 10:17 AM
> To: networkmanager-list gnome org
> Subject: StateChanged device
> 
> Hello,
> 
> I'm receiving NetworkManager.StateChanged signal when a network is connected or disconnected. Is it possible to get the name of the device or the identity of the network that is connected or disconnected inside the NetworkManager software, using the StateChanged Handler?
> 
> Thanks,
> Jos Collin
> 
> - Please ignore the disclaimer notice
> 
> ::DISCLAIMER::
> -----------------------------------------------------------------------------------------------------------------------
> 
> The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
> It shall not attach any liability on the originator or HCL or its affiliates. Any views or opinions presented in
> this email are solely those of the author and may not necessarily reflect the opinions of HCL or its affiliates.
> Any form of reproduction, dissemination, copying, disclosure, modification, distribution and / or publication of
> this message without the prior written consent of the author of this e-mail is strictly prohibited. If you have
> received this email in error please delete it and notify the sender immediately. Before opening any mail and
> attachments please check them for viruses and defect.
> 
> -----------------------------------------------------------------------------------------------------------------------
> 
> _______________________________________________
> networkmanager-list mailing list
> networkmanager-list gnome org
> http://mail.gnome.org/mailman/listinfo/networkmanager-list




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]