Are there any cross-platform Rust APIs to check wireless network signal strength?


#1

I’d like to create a little Rust program that checks the current wifi network signal strength and informs the user about it.
How can I accomplish this with Rust? Is there any API to check the wifi signal strength?
Thanks a lot!


#2

It looks like rsnl will give you access to the netlink API to communicate with the Linux kernel and nl80211rs defines the constants to access the wireless subsystem.

However I’ve never used the netlink API or tried to communicate with the wireless subsystem, so I can’t say for sure.


#3

Unfortunately, I don’t know of any cross platform libraries for this task (Rust or otherwise). nl80211 is the newest Linux Wi-Fi Kernel <–> userspace protocol for Wi-Fi status and config but it isn’t the only one (wext is still in use, as well as vendor specific code in embedded devices - including Android) and it is Linux specific.

I’m pretty sure that the easiest way to get the information that you are looking for on Linux is to read /proc/net/wireless, but that only covers Linux.


#4

Thanks a lot for your help. Since for what I’ve read in the info provided
in the thread I’ve realized that going directly to the OS API’s might not
be most efficient way for getting this info. That’s why Im going to be
using OSX Airport utility, /proc/net/wireless or iw or iwconfig in linux
and for Windows I still need to find something.

I’d like to get SNR (Signal to Noise ratio) from all platforms, so any
information regarding that will be useful.
I’ve seen that Airport in OS X gives the Signal power and the Noise power,
so it’s easy enough to calculate the SNR.
But from Linux you dont get the Noise power so… I need to research
further.

Thanks!


#5

And when you get this all together hopefully you’ll have created the cross platform crate that you were looking for, so others can use it, too!


#6

Signal/noise ratio is an obviously helpful metric for the user. On Linux, nl80211.h defines a per channel NL80211_SURVEY_INFO_NOISE attribute. Unfortunately, as far as I can tell, very few drivers support the survey info attributes. If your driver supports it iw DEVICE_NAME survey dump should show you the survey information, as far as I know. I’ve never actually had access to a device that supports it.