wifiConnections() added signal quality attribute
This commit is contained in:
parent
f9135308e7
commit
f9e9c6c199
@ -83,6 +83,7 @@ For major (breaking) changes - **version 4, 3 and 2** - see end of page.
|
||||
|
||||
| Version | Date | Comment |
|
||||
| ------- | ---------- | --------------------------------------------------------------------------------------------------- |
|
||||
| 5.22.0 | 2024-02-18 | `wifiConnections()` added signal quality attribute |
|
||||
| 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) |
|
||||
|
||||
@ -128,6 +128,7 @@ si.cpu()
|
||||
|
||||
(last 7 major and minor version releases)
|
||||
|
||||
- Version 5.22.0: `wifiConnections()` added signal quality
|
||||
- Version 5.21.0: `graphics()` added subVendor (linux)
|
||||
- Version 5.20.0: `mem()` added writeback and dirty (linux)
|
||||
- Version 5.19.0: `currentLoad()` added steal and guest time (linux)
|
||||
@ -658,15 +659,15 @@ Full function reference with examples can be found at [https://systeminformation
|
||||
| si.wifiConnections(cb) | [{...}] | X | | X | X | | array of active wifi connections |
|
||||
| | [0].id | X | | X | X | | ID |
|
||||
| | [0].iface | X | | X | X | | interface |
|
||||
| | [0].name | X | | X | X | | name |
|
||||
| | [0].mode | X | | X | X | | model |
|
||||
| | [0].model | X | | X | X | | model |
|
||||
| | [0].ssid | X | | X | X | | SSID |
|
||||
| | [0].bssid | X | | (X) | X | | BSSID (mac) - macOS only on older os versions |
|
||||
| | [0].mode | X | | | | | mode |
|
||||
| | [0].channel | X | | X | X | | channel |
|
||||
| | [0].frequency | X | | X | X | | frequency in MHz |
|
||||
| | [0].type | X | | X | X | | e.g. 802.11 |
|
||||
| | [0].security | X | | X | X | | array e.g. WPA, WPA-2 |
|
||||
| | [0].signalLevel | X | | X | X | | signal level in dB |
|
||||
| | [0].quality | X | | X | X | | quality in % |
|
||||
| | [0].security | X | | X | X | | array e.g. WPA, WPA-2 |
|
||||
| | [0].txRate | X | | X | X | | transfer rate MBit/s |
|
||||
|
||||
#### 15. Bluetooth
|
||||
|
||||
@ -57,6 +57,11 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th scope="row">5.22.0</th>
|
||||
<td>2024-02-18</td>
|
||||
<td><span class="code">wifiConnections()</span> added quality attribute</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">5.21.25</th>
|
||||
<td>2024-02-17</td>
|
||||
|
||||
@ -358,16 +358,6 @@ si.wifiInterfaces().then(data => console.log(data));</code></pre class="example"
|
||||
<td></td>
|
||||
<td>interface</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].name</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>name</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].model</td>
|
||||
@ -448,6 +438,16 @@ si.wifiInterfaces().then(data => console.log(data));</code></pre class="example"
|
||||
<td></td>
|
||||
<td>signal level in dB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].quality</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>X</td>
|
||||
<td>X</td>
|
||||
<td></td>
|
||||
<td>signal level quality in %</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>[0].txRate</td>
|
||||
|
||||
3
lib/index.d.ts
vendored
3
lib/index.d.ts
vendored
@ -576,10 +576,11 @@ export namespace Systeminformation {
|
||||
ssid: string;
|
||||
bssid: string;
|
||||
channel: number;
|
||||
frequency: number;
|
||||
type: string;
|
||||
security: string;
|
||||
frequency: number;
|
||||
signalLevel: number;
|
||||
quality: number;
|
||||
txRate: number;
|
||||
}
|
||||
|
||||
|
||||
18
lib/wifi.js
18
lib/wifi.js
@ -247,14 +247,15 @@ function getWifiNetworkListNmi() {
|
||||
const security = util.getValue(lines, 'SECURITY').replace('(', '').replace(')', '');
|
||||
const wpaFlags = util.getValue(lines, 'WPA-FLAGS').replace('(', '').replace(')', '');
|
||||
const rsnFlags = util.getValue(lines, 'RSN-FLAGS').replace('(', '').replace(')', '');
|
||||
const quality = util.getValue(lines, 'SIGNAL');
|
||||
result.push({
|
||||
ssid: util.getValue(lines, 'SSID'),
|
||||
bssid: util.getValue(lines, 'BSSID').toLowerCase(),
|
||||
mode: util.getValue(lines, 'MODE'),
|
||||
channel: channel ? parseInt(channel, 10) : null,
|
||||
frequency: frequency ? parseInt(frequency, 10) : null,
|
||||
signalLevel: wifiDBFromQuality(util.getValue(lines, 'SIGNAL')),
|
||||
quality: parseFloat(util.getValue(lines, 'SIGNAL')),
|
||||
signalLevel: wifiDBFromQuality(quality),
|
||||
quality: quality ? parseInt(quality, 10) : null,
|
||||
security: security && security !== 'none' ? security.split(' ') : [],
|
||||
wpaFlags: wpaFlags && wpaFlags !== 'none' ? wpaFlags.split(' ') : [],
|
||||
rsnFlags: rsnFlags && rsnFlags !== 'none' ? rsnFlags.split(' ') : []
|
||||
@ -575,6 +576,7 @@ function wifiConnections(callback) {
|
||||
const nmiConnection = nmiConnectionLinux(ssidSanitized);
|
||||
const channel = network && network.length && network[0].channel ? network[0].channel : (wpaDetails.channel ? wpaDetails.channel : null);
|
||||
const bssid = network && network.length && network[0].bssid ? network[0].bssid : (wpaDetails.bssid ? wpaDetails.bssid : null);
|
||||
const signalLevel = network && network.length && network[0].signalLevel ? network[0].signalLevel : null;
|
||||
if (ssid && bssid) {
|
||||
result.push({
|
||||
id: ifaceDetail.id,
|
||||
@ -586,7 +588,8 @@ function wifiConnections(callback) {
|
||||
frequency: channel ? wifiFrequencyFromChannel(channel) : null,
|
||||
type: nmiConnection.type ? nmiConnection.type : '802.11',
|
||||
security: nmiConnection.security ? nmiConnection.security : (wpaDetails.security ? wpaDetails.security : null),
|
||||
signalLevel: network && network.length && network[0].signalLevel ? network[0].signalLevel : null,
|
||||
signalLevel,
|
||||
quality: wifiQualityFromDB(signalLevel),
|
||||
txRate: null
|
||||
});
|
||||
}
|
||||
@ -614,8 +617,8 @@ function wifiConnections(callback) {
|
||||
const channel = util.getValue(lines2, 'channel', ':', true).split(',')[0];
|
||||
const type = '802.11';
|
||||
const rssi = util.toInt(util.getValue(lines2, 'agrCtlRSSI', ':', true));
|
||||
const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true));
|
||||
const signalLevel = rssi - noise;
|
||||
/// const noise = util.toInt(util.getValue(lines2, 'agrCtlNoise', ':', true));
|
||||
const signalLevel = rssi;
|
||||
if (ssid || bssid) {
|
||||
result.push({
|
||||
id: 'Wi-Fi',
|
||||
@ -628,6 +631,7 @@ function wifiConnections(callback) {
|
||||
type,
|
||||
security,
|
||||
signalLevel,
|
||||
quality: wifiQualityFromDB(signalLevel),
|
||||
txRate
|
||||
});
|
||||
}
|
||||
@ -661,7 +665,8 @@ 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 = wifiDBFromQuality(util.getValue(lines, 'Signal', ':', true));
|
||||
const quality = util.getValue(lines, 'Signal', ':', true);
|
||||
const signalLevel = wifiDBFromQuality(quality);
|
||||
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;
|
||||
@ -678,6 +683,7 @@ function wifiConnections(callback) {
|
||||
type,
|
||||
security,
|
||||
signalLevel,
|
||||
quality: quality ? parseInt(quality, 10) : null,
|
||||
txRate: util.toInt(txRate) || null
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user