forked from xXAfoeXx/iwd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
station.go
42 lines (35 loc) · 959 Bytes
/
station.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package iwd
import (
"github.com/godbus/dbus/v5"
)
const (
objectStation = "net.connman.iwd.Station"
callStationScan = "net.connman.iwd.Station.Scan"
callStationDisconnect = "net.connman.iwd.Station.Disconnect"
callStationGetOrderedNetworks = "net.connman.iwd.Station.GetOrderedNetworks"
)
// Station refers to net.connman.iwd.Station
type Station struct {
Path dbus.ObjectPath
ConnectedNetwork dbus.ObjectPath
Scanning bool
State string
}
// Scan scans for wireless networks
func (s *Station) Scan(conn *dbus.Conn) error {
obj := conn.Object(objectIwd, s.Path)
call := obj.Call(callStationScan, 0)
if call.Err != nil {
return call.Err
}
return nil
}
// Disconnect station
func (s *Station) Disconnect(conn *dbus.Conn) error {
obj := conn.Object(objectIwd, s.Path)
call := obj.Call(callStationDisconnect, 0)
if call.Err != nil {
return call.Err
}
return nil
}