From 7aedc25e3295b95a90eb710f443029d4ec920aa8 Mon Sep 17 00:00:00 2001 From: Michael Aaron Murphy Date: Thu, 29 Aug 2024 15:43:41 +0200 Subject: [PATCH] improv(network-manager): add NetworkManager::activate_connection_by_paths Useful when you have the paths, but not the zbus objects --- networkmanager/src/nm.rs | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/networkmanager/src/nm.rs b/networkmanager/src/nm.rs index 847d4b3..936fd4a 100644 --- a/networkmanager/src/nm.rs +++ b/networkmanager/src/nm.rs @@ -30,13 +30,23 @@ impl<'a> NetworkManager<'a> { NetworkManagerProxy::new(connection).await.map(Self) } + /// Activate a connection profile for the given device. pub async fn activate_connection( &self, - connection: &'a Connection<'a>, - device: &'a Device<'a>, + connection: &Connection<'_>, + device: &Device<'_>, ) -> Result> { let connection = connection.inner().path(); let device = device.inner().path(); + self.activate_connection_by_paths(connection, device).await + } + + /// Activate a connection profile for the given device by their object paths. + pub async fn activate_connection_by_paths( + &self, + connection: &ObjectPath<'_>, + device: &ObjectPath<'_>, + ) -> Result> { let specific_object = ObjectPath::from_static_str("/").unwrap(); let active_connection_path = self .0