From bfdf42806cd3320fed34e3b4335334ad5a6dbf58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20M=C3=BCller?= Date: Mon, 3 Jun 2019 16:38:38 +0200 Subject: [PATCH] Add NetworkManager.ActivateConnection --- NetworkManager.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/NetworkManager.go b/NetworkManager.go index 23ea055..b6da651 100644 --- a/NetworkManager.go +++ b/NetworkManager.go @@ -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())