Skip to content

Commit 4bc4bff

Browse files
committed
Added add_and_activate_connection_profile method
Adds and activates the connection using the profile object.
1 parent 1608d62 commit 4bc4bff

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

sdbus_async/networkmanager/interfaces_other.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,3 +1378,33 @@ def device_added(self) -> str:
13781378
def device_removed(self) -> str:
13791379
"""Signal when device had been removed with path"""
13801380
raise NotImplementedError
1381+
1382+
async def add_and_activate_connection_profile(
1383+
self,
1384+
profile: ConnectionProfile,
1385+
device_path: str = '/',
1386+
specific_object: str = '/',
1387+
) -> Tuple[str, str]:
1388+
"""Adds new connection using the profile object as template.
1389+
1390+
:param ConnectionProfile profile: Connection profile to update
1391+
with.
1392+
1393+
:param str device_path: Object path of device to be activated
1394+
using the given connection
1395+
1396+
:param str specific_object: The path of a connection-type-specific
1397+
object this activation should use.
1398+
1399+
This parameter is currently ignored for wired and mobile broadband
1400+
connections, and the value of "/" should be used.
1401+
1402+
:return: Object path of new connection and path of active connection.
1403+
:rtype: Tuple[str, str]
1404+
"""
1405+
1406+
return await self.add_and_activate_connection(
1407+
profile.to_dbus(),
1408+
device_path,
1409+
specific_object,
1410+
)

sdbus_block/networkmanager/interfaces_other.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1271,3 +1271,33 @@ def connectivity_check_uri(self) -> str:
12711271
def global_dns_configuration(self) -> Dict[str, Tuple[str, Any]]:
12721272
"""Global DNS connection settings"""
12731273
raise NotImplementedError
1274+
1275+
def add_and_activate_connection_profile(
1276+
self,
1277+
profile: ConnectionProfile,
1278+
device_path: str = '/',
1279+
specific_object: str = '/',
1280+
) -> Tuple[str, str]:
1281+
"""Adds new connection using the profile object as template.
1282+
1283+
:param ConnectionProfile profile: Connection profile to update
1284+
with.
1285+
1286+
:param str device_path: Object path of device to be activated
1287+
using the given connection
1288+
1289+
:param str specific_object: The path of a connection-type-specific
1290+
object this activation should use.
1291+
1292+
This parameter is currently ignored for wired and mobile broadband
1293+
connections, and the value of "/" should be used.
1294+
1295+
:return: Object path of new connection and path of active connection.
1296+
:rtype: Tuple[str, str]
1297+
"""
1298+
1299+
return self.add_and_activate_connection(
1300+
profile.to_dbus(),
1301+
device_path,
1302+
specific_object,
1303+
)

0 commit comments

Comments
 (0)