friedrith / node-wifi

📶 NodeJS tool to manage wifi (connections, scans)
MIT License
395 stars 161 forks source link

macOS wifi.scan - quality calculation wrong #71

Open sebhildebrandt opened 5 years ago

sebhildebrandt commented 5 years ago

Hi,

in src/mac-scan.js I guess there is a small bug, quality calculation is maybe wrong:

In line 61 ff you have:

'signal_level' : lines[i].substr(colRssi, colChannel - colRssi).trim(),
'quality' : networkUtils.dBFromQuality(lines[i].substr(colRssi, colChannel - colRssi).trim()),

I guess it should be

'signal_level' : lines[i].substr(colRssi, colChannel - colRssi).trim(),
'quality' : networkUtils.QualityFromDB(lines[i].substr(colRssi, colChannel - colRssi).trim()),

The RSSI column returns the DB level and so you need to calculate the quality based on the given level.

Hope, that I am not completely wrong ;-) Regards