Documentation ¶
Index ¶
- Constants
- Variables
- func AddWifiNetwork(ssid, psk string) error
- func CheckIfNetworkExists(id string) (bool, error)
- func CheckState() error
- func ConnectWifiNetwork(ssid string) error
- func DisconnectWifiNetwork(ssid string, startHotspot bool) error
- func EnableHotspot(force bool) error
- func EnableWifi(force bool) error
- func GetStateChanges() (chan NetworkState, chan<- struct{}, error)
- func KeepHotspotOnFor(seconds int) error
- func ModifyNetworkConfig(id string, c map[string]string) error
- func ModifyWifiNetwork(ssid, psk string) error
- func RemoveWifiNetwork(ssid string, disconnect bool, startHotspot bool) error
- type InputError
- type NetworkState
- type WiFiNetwork
Constants ¶
View Source
const ( DbusInterface = "org.cacophony.RPiNetManager" DbusPath = "/org/cacophony/RPiNetManager" )
Variables ¶
View Source
var ( ErrNetworkAlreadyExists = InputError{Message: "a network with the given SSID already exists"} ErrPSKTooShort = InputError{Message: "the given PSK is too short, must be at least 8 characters long"} ErrBushnetNetwork = InputError{Message: "the given SSID is a Bushnet network so can't be modified"} )
Functions ¶
func AddWifiNetwork ¶
func CheckIfNetworkExists ¶ added in v0.5.1
func CheckState ¶ added in v0.1.2
func CheckState() error
func ConnectWifiNetwork ¶ added in v0.5.0
Connects to an existing network
func DisconnectWifiNetwork ¶ added in v0.5.0
func EnableHotspot ¶
EnableHotspot will enable the hotspot. If the hotspot is already enabled it will return unless force is true, then it will start up the hotspot again.
func EnableWifi ¶
EnableWifi will enable the wifi. The force parameter doesn't do anything at the moment.
func GetStateChanges ¶
func GetStateChanges() (chan NetworkState, chan<- struct{}, error)
GetStateChanges will start listening for state changes.
func KeepHotspotOnFor ¶
func ModifyNetworkConfig ¶ added in v0.5.1
ModifyNetworkConfig will check if a networks exists, create it if not, then set the given config values to it.
func ModifyWifiNetwork ¶ added in v0.5.0
Types ¶
type InputError ¶
type InputError struct {
Message string
}
func (InputError) Error ¶
func (e InputError) Error() string
type NetworkState ¶
type NetworkState string
const ( NS_INIT NetworkState = "Init" // Initial state, before any network state changes NS_WIFI_OFF NetworkState = "WIFI_OFF" // WIFI Radio is off. NS_WIFI_SETUP NetworkState = "WIFI_SETUP" // WIFI is being setup. NS_WIFI_SCANNING NetworkState = "WIFI_SCANNING" // WIFI is scanning for networks to connect to. NS_WIFI_CONNECTING NetworkState = "WIFI_CONNECTING" // WIFI is trying to connect to a network. NS_WIFI_CONNECTED NetworkState = "WIFI_CONNECTED" // WIFI has connected to a network. NS_HOTSPOT_STARTING NetworkState = "HOTSPOT_STARTING" // Hotspot is being setup. NS_HOTSPOT_RUNNING NetworkState = "HOTSPOT_RUNNING" // Hotspot is running. NS_ERROR NetworkState = "Error with network" )
func ReadState ¶
func ReadState() (NetworkState, error)
ReadState will read the current state of the network.
type WiFiNetwork ¶
type WiFiNetwork struct { SSID string Quality string ID string InUse bool AuthFailed bool LastConnectionTime time.Time }
func FindNetworkBySSID ¶ added in v0.5.0
func FindNetworkBySSID(ssid string) (WiFiNetwork, bool)
FindNetworkBySSID searches for a network by SSID in the list of WiFi networks
func ListSavedWifiNetworks ¶
func ListSavedWifiNetworks() ([]WiFiNetwork, error)
func ListUserSavedWifiNetworks ¶ added in v0.5.0
func ListUserSavedWifiNetworks() ([]WiFiNetwork, error)
func ScanWiFiNetworks ¶
func ScanWiFiNetworks() ([]WiFiNetwork, error)
Click to show internal directories.
Click to hide internal directories.