Add NetworkManager.ActivateConnection

This commit is contained in:
Christian Müller 2019-06-03 16:38:38 +02:00
parent 43dec4c754
commit bfdf42806c

View file

@ -72,6 +72,9 @@ type NetworkManager interface {
// GetActiveConnections returns the active connection of network devices.
GetActiveConnections() []ActiveConnection
// Activate a connection using the supplied device.
ActivateConnection(connection Connection, device Device) ActiveConnection
// ActivateWirelessConnection requests activating access point to network device
ActivateWirelessConnection(connection Connection, device Device, accessPoint AccessPoint) ActiveConnection
@ -157,6 +160,18 @@ func (n *networkManager) GetActiveConnections() []ActiveConnection {
return ac
}
func (n *networkManager) ActivateConnection(c Connection, d Device) ActiveConnection {
var opath dbus.ObjectPath
n.callWithReturnAndPanic(&opath, NetworkManagerActivateConnection, c.GetPath(), d.GetPath(), dbus.ObjectPath("/"))
activeConnection, err := NewActiveConnection(opath)
if err != nil {
panic(err)
}
return activeConnection
}
func (n *networkManager) ActivateWirelessConnection(c Connection, d Device, ap AccessPoint) ActiveConnection {
var opath dbus.ObjectPath
n.callWithReturnAndPanic(&opath, NetworkManagerActivateConnection, c.GetPath(), d.GetPath(), ap.GetPath())