aaa
aaa

Reputation: 499

How to get wifi signal strength using Qt?

So far I am able to scan all the available wifi using QNetworkConfigurationManager::allConfigurations(), but the QNetworkConfiguration data for each of them does not have the wifi signal strength. Can you point me into how to get this data? Thanks!

Upvotes: 10

Views: 4120

Answers (2)

gfernandes
gfernandes

Reputation: 1166

You could use QProcess and run command line commands to scan for wifi networks. Use regular expressions to parse the command line output which contains all details of the wifi network.

If you are using linux then the command is "iwlist scan"

Upvotes: 3

esavier
esavier

Reputation: 463

I am not sure you even can do this on normal desktop anyway(i mean just using Qt). Qt just dont have common interface with device to get such things. I am not sure what OS you are using, but the best hit for you is linking with OS and getting info from it or talking to device directly via driver. Both methods are difficult, especially because you need documentations, and moreover:

  • For the first method, linking via driver - this will work only for specific driver unless signal strenght is reported in way common to many drivers.
  • For the second method, linking via system - there may be slight difference between linux distros that can make you unable to make app portable between them. Same goes for Windows an linux, there is no guarantee(i would even say "way" but I am not sure so...) that both systems uses those same methods to report signal strength for user.

whatever you decide to do, you can use standard OS features to complete the goal. For example in windows you can use WlanGetAvailableNetworkList(). As far as I remember it will will provide something called IRSSI which is direct signal strength indicator :)

enjoy :)

Upvotes: 2

Related Questions