RE: How to get the ESSID of the active wifi network?



> But before that I need another command to get the correct Devices
> number, i.e. it's /Devices/0 in my case.

Yes, you have to find the device object path for your case. You can start with the following two options.
1. Use GetDevices, find the appropriate wireless device and then call ActiveAccessPoint on that device.

2. Get the ActiveConnections property. Get the devices that are part of this active connection (Devices property). You will get the wireless device object path. Then call ActiveAccessPoint on that device and get the Ssid property.

Please understand that Ssid is not a property of a network interface/device in your computer. It is not so complicated. Please find the python samples.

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


Regards,
Jos Collin


> and:
> dbus-send --system --print-reply --dest=org.freedesktop.NetworkManager
> /org/freedesktop/NetworkManager/AccessPoint/7
> org.freedesktop.DBus.Properties.Get string:org.freedesktop.NetworkManager
> string:ssid
>
> you'll get
> method return sender=:1.264 -> dest=:1.291 reply_serial=2
>    variant       array of bytes "THE_SSID"
>

And after that I have to convert the array of bytes into a simple
string.

Man, I didn't excpect it such complicated. :)

Maybe I should stick with nm-tool and a bit of grep.
(iwlist or iwgetid isn't working for me, that's why I thought d-bus
could be my hero)
Thanks anyway for all your help, this is a great community!

Jonathan

_______________________________________________
networkmanager-list mailing list
networkmanager-list gnome org
http://mail.gnome.org/mailman/listinfo/networkmanager-list

::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.

-----------------------------------------------------------------------------------------------------------------------


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