-
Notifications
You must be signed in to change notification settings - Fork 11
feat: view multiple access points per SSID #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
fab71c6
f73c200
d0e4ade
3c75d72
db09818
8c40286
b571258
caeb4c5
66700dd
3e8e727
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -102,23 +102,41 @@ func (b *Backend) BuildNetworkList(shouldScan bool) ([]wifi.Connection, error) { | |
|
|
||
| scannedNetworks := parseSystemProfilerOutput(string(out)) | ||
|
|
||
| var conns []wifi.Connection | ||
| // Aggregate networks by SSID | ||
| aggregatedConns := make(map[string]wifi.Connection) | ||
| processedSSIDs := make(map[string]bool) | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we get rid of
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are right, |
||
|
|
||
| for _, net := range scannedNetworks { | ||
| processedSSIDs[net.ssid] = true | ||
| isKnown := knownSSIDs[net.ssid] | ||
| isActive := net.isActive || net.ssid == currentSSID | ||
| conns = append(conns, wifi.Connection{ | ||
| SSID: net.ssid, | ||
| IsActive: isActive, | ||
| IsKnown: isKnown, | ||
| IsVisible: true, | ||
| Strength: rssiToStrength(net.rssi), | ||
| IsSecure: net.security != wifi.SecurityOpen, | ||
| Security: net.security, | ||
| AutoConnect: isKnown, | ||
| }) | ||
|
|
||
| ap := wifi.AccessPoint{Strength: rssiToStrength(net.rssi)} | ||
|
|
||
| if conn, exists := aggregatedConns[net.ssid]; exists { | ||
| conn.AccessPoints = append(conn.AccessPoints, ap) | ||
| // Merge flags if necessary (e.g. if one BSSID is active, the whole SSID is active) | ||
| if isActive { | ||
| conn.IsActive = true | ||
| } | ||
| aggregatedConns[net.ssid] = conn | ||
| } else { | ||
| aggregatedConns[net.ssid] = wifi.Connection{ | ||
| SSID: net.ssid, | ||
| IsActive: isActive, | ||
| IsKnown: isKnown, | ||
| IsVisible: true, | ||
| AccessPoints: []wifi.AccessPoint{ap}, | ||
| IsSecure: net.security != wifi.SecurityOpen, | ||
| Security: net.security, | ||
| AutoConnect: isKnown, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| var conns []wifi.Connection | ||
| for _, conn := range aggregatedConns { | ||
| conns = append(conns, conn) | ||
| } | ||
|
|
||
| // Add known networks that are not visible | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Document the units in a comment here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I added a comment to
Frequencyindicating it is in MHz.