diff --git a/CHANGELOG.md b/CHANGELOG.md index 8da627a..6fd171e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page. | Version | Date | Comment | | ------- | ---------- | --------------------------------------------------------------------------------------------------- | +| 5.21.25 | 2024-02-17 | `wifiConnections()` fixed signal strength (windows) | | 5.21.24 | 2024-01-21 | `osInfo()` improved release version parsing (linux) | | 5.21.23 | 2024-01-20 | `cpu()` improved CPU speed parsing (linux) | | 5.21.22 | 2023-12-22 | `README.md` updated docs and HTML | diff --git a/docs/history.html b/docs/history.html index 340a570..c951b46 100644 --- a/docs/history.html +++ b/docs/history.html @@ -57,6 +57,11 @@ + + 5.21.25 + 2024-02-17 + wifiConnections() fixed signal strength (windows) + 5.21.24 2024-01-21 diff --git a/docs/index.html b/docs/index.html index 62f84ae..1483355 100644 --- a/docs/index.html +++ b/docs/index.html @@ -170,7 +170,7 @@
systeminformation
 
-
New Version: 5.21.24
+
New Version: 5.21.25
diff --git a/lib/wifi.js b/lib/wifi.js index 7bc3204..5fae47c 100644 --- a/lib/wifi.js +++ b/lib/wifi.js @@ -25,7 +25,10 @@ const _darwin = (_platform === 'darwin'); const _windows = (_platform === 'win32'); function wifiDBFromQuality(quality) { - return (parseFloat(quality) / 2 - 100); + const qual = parseFloat(quality); + if (qual < 0) { return 0; } + if (qual >= 100) { return -50; } + return (qual / 2 - 100); } function wifiQualityFromDB(db) { @@ -658,7 +661,7 @@ function wifiConnections(callback) { const id = lines[2].indexOf(':') >= 0 ? lines[2].split(':')[1].trim() : ''; const ssid = util.getValue(lines, 'SSID', ':', true); const bssid = util.getValue(lines, 'BSSID', ':', true); - const signalLevel = util.getValue(lines, 'Signal', ':', true); + const signalLevel = wifiDBFromQuality(util.getValue(lines, 'Signal', ':', true)); const type = util.getValue(lines, 'Radio type', ':', true) || util.getValue(lines, 'Type de radio', ':', true) || util.getValue(lines, 'Funktyp', ':', true) || null; const security = util.getValue(lines, 'authentication', ':', true) || util.getValue(lines, 'Authentification', ':', true) || util.getValue(lines, 'Authentifizierung', ':', true) || null; const channel = util.getValue(lines, 'Channel', ':', true) || util.getValue(lines, 'Canal', ':', true) || util.getValue(lines, 'Kanal', ':', true) || null;