This repository has been archived on 2025-03-19. You can view files and clone it, but cannot push or open issues or pull requests.
gonetworkmanager/WirelessDevice.go
2016-05-24 20:58:18 -04:00

47 lines
1 KiB
Go

package gonetworkmanager
import (
"github.com/godbus/dbus"
)
const (
WirelessDeviceInterface = DeviceInterface + ".Wireless"
WirelessDeviceGetAccessPoints = WirelessDeviceInterface + ".GetAccessPoints"
)
type WirelessDevice interface {
Device
// GetAccessPoints gets the list of access points visible to this device.
// Note that this list does not include access points which hide their SSID.
// To retrieve a list of all access points (including hidden ones) use the
// GetAllAccessPoints() method.
GetAccessPoints() []AccessPoint
}
func NewWirelessDevice(objectPath dbus.ObjectPath) (WirelessDevice, error) {
var d wirelessDevice
return &d, d.init(NetworkManagerInterface, objectPath)
}
type wirelessDevice struct {
device
}
func (d *wirelessDevice) GetAccessPoints() []AccessPoint {
var apPaths []dbus.ObjectPath
d.call(&apPaths, WirelessDeviceGetAccessPoints)
aps := make([]AccessPoint, len(apPaths))
var err error
for i, path := range apPaths {
aps[i], err = NewAccessPoint(path)
if err != nil {
panic(err)
}
}
return aps
}