orion/openwrt/wifi_cell.go

32 lines
586 B
Go

package openwrt
import (
"fmt"
"strings"
)
// WifiCell reprensents wifi network Cell
type WifiCell struct {
// The SSID
Ssid string
// The cell mac adress
MacAdress string
}
// NewWifiCell returns a new WifiCell object
func NewWifiCell(ssid string, mac string) *WifiCell {
return &WifiCell{
Ssid: ssid,
MacAdress: mac,
}
}
// GetWifiCells retrieves all availabe wifi cells for a card !
func GetWifiCells(iface string) {
res := Run("iwinfo", iface, "scan")
for _, line := range strings.Split(strings.TrimSuffix(res.stdout, "\n"), "\n") {
fmt.Println(line)
}
}