RE: StateChanged device
- From: "Jos Collin-ERS,HCLTech" <joscollin hcl com>
- To: Dan Williams <dcbw redhat com>
- Cc: "networkmanager-list gnome org" <networkmanager-list gnome org>
- Subject: RE: StateChanged device
- Date: Thu, 25 Nov 2010 13:27:44 +0530
Dan,
Thanks for the suggestion. I have decided to monitor the device's signals for state. I have found that there is a org.freedesktop.NetworkManager.Device.Statechanged signal and I have written a handler for it.
But there is a related issue. As you can see the Device.java is inside the package org.freedesktop.NetworkManager. When I include the stub in my code, Device.java shows an error "The package org.freedesktop.NetworkManager collides with a type". The reason is there is a NetworkManager.java in the same directory of org.thales.NetworkManager package.
If I change the package name or the class name then the signal reception won't work. I cannot even change the package name from NetworkManager to networkmanager. If I do that, I won't get the signals. So please suggest a solution.
Thanks,
Jos Collin
________________________________________
From: Dan Williams [dcbw redhat com]
Sent: Wednesday, November 24, 2010 9:32 AM
To: Jos Collin-ERS,HCLTech
Cc: networkmanager-list gnome org
Subject: 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]